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.esm.js 318KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972
  1. /*!
  2. * Vue.js v2.6.10
  3. * (c) 2014-2019 Evan You
  4. * Released under the MIT License.
  5. */
  6. /* */
  7. var emptyObject = Object.freeze({});
  8. // These helpers produce 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. function isPromise (val) {
  67. return (
  68. isDef(val) &&
  69. typeof val.then === 'function' &&
  70. typeof val.catch === 'function'
  71. )
  72. }
  73. /**
  74. * Convert a value to a string that is actually rendered.
  75. */
  76. function toString (val) {
  77. return val == null
  78. ? ''
  79. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  80. ? JSON.stringify(val, null, 2)
  81. : String(val)
  82. }
  83. /**
  84. * Convert an input value to a number for persistence.
  85. * If the conversion fails, return original string.
  86. */
  87. function toNumber (val) {
  88. var n = parseFloat(val);
  89. return isNaN(n) ? val : n
  90. }
  91. /**
  92. * Make a map and return a function for checking if a key
  93. * is in that map.
  94. */
  95. function makeMap (
  96. str,
  97. expectsLowerCase
  98. ) {
  99. var map = Object.create(null);
  100. var list = str.split(',');
  101. for (var i = 0; i < list.length; i++) {
  102. map[list[i]] = true;
  103. }
  104. return expectsLowerCase
  105. ? function (val) { return map[val.toLowerCase()]; }
  106. : function (val) { return map[val]; }
  107. }
  108. /**
  109. * Check if a tag is a built-in tag.
  110. */
  111. var isBuiltInTag = makeMap('slot,component', true);
  112. /**
  113. * Check if an attribute is a reserved attribute.
  114. */
  115. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  116. /**
  117. * Remove an item from an array.
  118. */
  119. function remove (arr, item) {
  120. if (arr.length) {
  121. var index = arr.indexOf(item);
  122. if (index > -1) {
  123. return arr.splice(index, 1)
  124. }
  125. }
  126. }
  127. /**
  128. * Check whether an object has the property.
  129. */
  130. var hasOwnProperty = Object.prototype.hasOwnProperty;
  131. function hasOwn (obj, key) {
  132. return hasOwnProperty.call(obj, key)
  133. }
  134. /**
  135. * Create a cached version of a pure function.
  136. */
  137. function cached (fn) {
  138. var cache = Object.create(null);
  139. return (function cachedFn (str) {
  140. var hit = cache[str];
  141. return hit || (cache[str] = fn(str))
  142. })
  143. }
  144. /**
  145. * Camelize a hyphen-delimited string.
  146. */
  147. var camelizeRE = /-(\w)/g;
  148. var camelize = cached(function (str) {
  149. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  150. });
  151. /**
  152. * Capitalize a string.
  153. */
  154. var capitalize = cached(function (str) {
  155. return str.charAt(0).toUpperCase() + str.slice(1)
  156. });
  157. /**
  158. * Hyphenate a camelCase string.
  159. */
  160. var hyphenateRE = /\B([A-Z])/g;
  161. var hyphenate = cached(function (str) {
  162. return str.replace(hyphenateRE, '-$1').toLowerCase()
  163. });
  164. /**
  165. * Simple bind polyfill for environments that do not support it,
  166. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  167. * since native bind is now performant enough in most browsers.
  168. * But removing it would mean breaking code that was able to run in
  169. * PhantomJS 1.x, so this must be kept for backward compatibility.
  170. */
  171. /* istanbul ignore next */
  172. function polyfillBind (fn, ctx) {
  173. function boundFn (a) {
  174. var l = arguments.length;
  175. return l
  176. ? l > 1
  177. ? fn.apply(ctx, arguments)
  178. : fn.call(ctx, a)
  179. : fn.call(ctx)
  180. }
  181. boundFn._length = fn.length;
  182. return boundFn
  183. }
  184. function nativeBind (fn, ctx) {
  185. return fn.bind(ctx)
  186. }
  187. var bind = Function.prototype.bind
  188. ? nativeBind
  189. : polyfillBind;
  190. /**
  191. * Convert an Array-like object to a real Array.
  192. */
  193. function toArray (list, start) {
  194. start = start || 0;
  195. var i = list.length - start;
  196. var ret = new Array(i);
  197. while (i--) {
  198. ret[i] = list[i + start];
  199. }
  200. return ret
  201. }
  202. /**
  203. * Mix properties into target object.
  204. */
  205. function extend (to, _from) {
  206. for (var key in _from) {
  207. to[key] = _from[key];
  208. }
  209. return to
  210. }
  211. /**
  212. * Merge an Array of Objects into a single Object.
  213. */
  214. function toObject (arr) {
  215. var res = {};
  216. for (var i = 0; i < arr.length; i++) {
  217. if (arr[i]) {
  218. extend(res, arr[i]);
  219. }
  220. }
  221. return res
  222. }
  223. /* eslint-disable no-unused-vars */
  224. /**
  225. * Perform no operation.
  226. * Stubbing args to make Flow happy without leaving useless transpiled code
  227. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  228. */
  229. function noop (a, b, c) {}
  230. /**
  231. * Always return false.
  232. */
  233. var no = function (a, b, c) { return false; };
  234. /* eslint-enable no-unused-vars */
  235. /**
  236. * Return the same value.
  237. */
  238. var identity = function (_) { return _; };
  239. /**
  240. * Generate a string containing static keys from compiler modules.
  241. */
  242. function genStaticKeys (modules) {
  243. return modules.reduce(function (keys, m) {
  244. return keys.concat(m.staticKeys || [])
  245. }, []).join(',')
  246. }
  247. /**
  248. * Check if two values are loosely equal - that is,
  249. * if they are plain objects, do they have the same shape?
  250. */
  251. function looseEqual (a, b) {
  252. if (a === b) { return true }
  253. var isObjectA = isObject(a);
  254. var isObjectB = isObject(b);
  255. if (isObjectA && isObjectB) {
  256. try {
  257. var isArrayA = Array.isArray(a);
  258. var isArrayB = Array.isArray(b);
  259. if (isArrayA && isArrayB) {
  260. return a.length === b.length && a.every(function (e, i) {
  261. return looseEqual(e, b[i])
  262. })
  263. } else if (a instanceof Date && b instanceof Date) {
  264. return a.getTime() === b.getTime()
  265. } else if (!isArrayA && !isArrayB) {
  266. var keysA = Object.keys(a);
  267. var keysB = Object.keys(b);
  268. return keysA.length === keysB.length && keysA.every(function (key) {
  269. return looseEqual(a[key], b[key])
  270. })
  271. } else {
  272. /* istanbul ignore next */
  273. return false
  274. }
  275. } catch (e) {
  276. /* istanbul ignore next */
  277. return false
  278. }
  279. } else if (!isObjectA && !isObjectB) {
  280. return String(a) === String(b)
  281. } else {
  282. return false
  283. }
  284. }
  285. /**
  286. * Return the first index at which a loosely equal value can be
  287. * found in the array (if value is a plain object, the array must
  288. * contain an object of the same shape), or -1 if it is not present.
  289. */
  290. function looseIndexOf (arr, val) {
  291. for (var i = 0; i < arr.length; i++) {
  292. if (looseEqual(arr[i], val)) { return i }
  293. }
  294. return -1
  295. }
  296. /**
  297. * Ensure a function is called only once.
  298. */
  299. function once (fn) {
  300. var called = false;
  301. return function () {
  302. if (!called) {
  303. called = true;
  304. fn.apply(this, arguments);
  305. }
  306. }
  307. }
  308. var SSR_ATTR = 'data-server-rendered';
  309. var ASSET_TYPES = [
  310. 'component',
  311. 'directive',
  312. 'filter'
  313. ];
  314. var LIFECYCLE_HOOKS = [
  315. 'beforeCreate',
  316. 'created',
  317. 'beforeMount',
  318. 'mounted',
  319. 'beforeUpdate',
  320. 'updated',
  321. 'beforeDestroy',
  322. 'destroyed',
  323. 'activated',
  324. 'deactivated',
  325. 'errorCaptured',
  326. 'serverPrefetch'
  327. ];
  328. /* */
  329. var config = ({
  330. /**
  331. * Option merge strategies (used in core/util/options)
  332. */
  333. // $flow-disable-line
  334. optionMergeStrategies: Object.create(null),
  335. /**
  336. * Whether to suppress warnings.
  337. */
  338. silent: false,
  339. /**
  340. * Show production mode tip message on boot?
  341. */
  342. productionTip: process.env.NODE_ENV !== 'production',
  343. /**
  344. * Whether to enable devtools
  345. */
  346. devtools: process.env.NODE_ENV !== 'production',
  347. /**
  348. * Whether to record perf
  349. */
  350. performance: false,
  351. /**
  352. * Error handler for watcher errors
  353. */
  354. errorHandler: null,
  355. /**
  356. * Warn handler for watcher warns
  357. */
  358. warnHandler: null,
  359. /**
  360. * Ignore certain custom elements
  361. */
  362. ignoredElements: [],
  363. /**
  364. * Custom user key aliases for v-on
  365. */
  366. // $flow-disable-line
  367. keyCodes: Object.create(null),
  368. /**
  369. * Check if a tag is reserved so that it cannot be registered as a
  370. * component. This is platform-dependent and may be overwritten.
  371. */
  372. isReservedTag: no,
  373. /**
  374. * Check if an attribute is reserved so that it cannot be used as a component
  375. * prop. This is platform-dependent and may be overwritten.
  376. */
  377. isReservedAttr: no,
  378. /**
  379. * Check if a tag is an unknown element.
  380. * Platform-dependent.
  381. */
  382. isUnknownElement: no,
  383. /**
  384. * Get the namespace of an element
  385. */
  386. getTagNamespace: noop,
  387. /**
  388. * Parse the real tag name for the specific platform.
  389. */
  390. parsePlatformTagName: identity,
  391. /**
  392. * Check if an attribute must be bound using property, e.g. value
  393. * Platform-dependent.
  394. */
  395. mustUseProp: no,
  396. /**
  397. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  398. * This will significantly reduce performance if set to false.
  399. */
  400. async: true,
  401. /**
  402. * Exposed for legacy reasons
  403. */
  404. _lifecycleHooks: LIFECYCLE_HOOKS
  405. });
  406. /* */
  407. /**
  408. * unicode letters used for parsing html tags, component names and property paths.
  409. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  410. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  411. */
  412. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  413. /**
  414. * Check if a string starts with $ or _
  415. */
  416. function isReserved (str) {
  417. var c = (str + '').charCodeAt(0);
  418. return c === 0x24 || c === 0x5F
  419. }
  420. /**
  421. * Define a property.
  422. */
  423. function def (obj, key, val, enumerable) {
  424. Object.defineProperty(obj, key, {
  425. value: val,
  426. enumerable: !!enumerable,
  427. writable: true,
  428. configurable: true
  429. });
  430. }
  431. /**
  432. * Parse simple path.
  433. */
  434. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  435. function parsePath (path) {
  436. if (bailRE.test(path)) {
  437. return
  438. }
  439. var segments = path.split('.');
  440. return function (obj) {
  441. for (var i = 0; i < segments.length; i++) {
  442. if (!obj) { return }
  443. obj = obj[segments[i]];
  444. }
  445. return obj
  446. }
  447. }
  448. /* */
  449. // can we use __proto__?
  450. var hasProto = '__proto__' in {};
  451. // Browser environment sniffing
  452. var inBrowser = typeof window !== 'undefined';
  453. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  454. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  455. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  456. var isIE = UA && /msie|trident/.test(UA);
  457. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  458. var isEdge = UA && UA.indexOf('edge/') > 0;
  459. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  460. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  461. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  462. var isPhantomJS = UA && /phantomjs/.test(UA);
  463. var isFF = UA && UA.match(/firefox\/(\d+)/);
  464. // Firefox has a "watch" function on Object.prototype...
  465. var nativeWatch = ({}).watch;
  466. var supportsPassive = false;
  467. if (inBrowser) {
  468. try {
  469. var opts = {};
  470. Object.defineProperty(opts, 'passive', ({
  471. get: function get () {
  472. /* istanbul ignore next */
  473. supportsPassive = true;
  474. }
  475. })); // https://github.com/facebook/flow/issues/285
  476. window.addEventListener('test-passive', null, opts);
  477. } catch (e) {}
  478. }
  479. // this needs to be lazy-evaled because vue may be required before
  480. // vue-server-renderer can set VUE_ENV
  481. var _isServer;
  482. var isServerRendering = function () {
  483. if (_isServer === undefined) {
  484. /* istanbul ignore if */
  485. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  486. // detect presence of vue-server-renderer and avoid
  487. // Webpack shimming the process
  488. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  489. } else {
  490. _isServer = false;
  491. }
  492. }
  493. return _isServer
  494. };
  495. // detect devtools
  496. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  497. /* istanbul ignore next */
  498. function isNative (Ctor) {
  499. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  500. }
  501. var hasSymbol =
  502. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  503. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  504. var _Set;
  505. /* istanbul ignore if */ // $flow-disable-line
  506. if (typeof Set !== 'undefined' && isNative(Set)) {
  507. // use native Set when available.
  508. _Set = Set;
  509. } else {
  510. // a non-standard Set polyfill that only works with primitive keys.
  511. _Set = /*@__PURE__*/(function () {
  512. function Set () {
  513. this.set = Object.create(null);
  514. }
  515. Set.prototype.has = function has (key) {
  516. return this.set[key] === true
  517. };
  518. Set.prototype.add = function add (key) {
  519. this.set[key] = true;
  520. };
  521. Set.prototype.clear = function clear () {
  522. this.set = Object.create(null);
  523. };
  524. return Set;
  525. }());
  526. }
  527. /* */
  528. var warn = noop;
  529. var tip = noop;
  530. var generateComponentTrace = (noop); // work around flow check
  531. var formatComponentName = (noop);
  532. if (process.env.NODE_ENV !== 'production') {
  533. var hasConsole = typeof console !== 'undefined';
  534. var classifyRE = /(?:^|[-_])(\w)/g;
  535. var classify = function (str) { return str
  536. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  537. .replace(/[-_]/g, ''); };
  538. warn = function (msg, vm) {
  539. var trace = vm ? generateComponentTrace(vm) : '';
  540. if (config.warnHandler) {
  541. config.warnHandler.call(null, msg, vm, trace);
  542. } else if (hasConsole && (!config.silent)) {
  543. console.error(("[Vue warn]: " + msg + trace));
  544. }
  545. };
  546. tip = function (msg, vm) {
  547. if (hasConsole && (!config.silent)) {
  548. console.warn("[Vue tip]: " + msg + (
  549. vm ? generateComponentTrace(vm) : ''
  550. ));
  551. }
  552. };
  553. formatComponentName = function (vm, includeFile) {
  554. if (vm.$root === vm) {
  555. return '<Root>'
  556. }
  557. var options = typeof vm === 'function' && vm.cid != null
  558. ? vm.options
  559. : vm._isVue
  560. ? vm.$options || vm.constructor.options
  561. : vm;
  562. var name = options.name || options._componentTag;
  563. var file = options.__file;
  564. if (!name && file) {
  565. var match = file.match(/([^/\\]+)\.vue$/);
  566. name = match && match[1];
  567. }
  568. return (
  569. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  570. (file && includeFile !== false ? (" at " + file) : '')
  571. )
  572. };
  573. var repeat = function (str, n) {
  574. var res = '';
  575. while (n) {
  576. if (n % 2 === 1) { res += str; }
  577. if (n > 1) { str += str; }
  578. n >>= 1;
  579. }
  580. return res
  581. };
  582. generateComponentTrace = function (vm) {
  583. if (vm._isVue && vm.$parent) {
  584. var tree = [];
  585. var currentRecursiveSequence = 0;
  586. while (vm) {
  587. if (tree.length > 0) {
  588. var last = tree[tree.length - 1];
  589. if (last.constructor === vm.constructor) {
  590. currentRecursiveSequence++;
  591. vm = vm.$parent;
  592. continue
  593. } else if (currentRecursiveSequence > 0) {
  594. tree[tree.length - 1] = [last, currentRecursiveSequence];
  595. currentRecursiveSequence = 0;
  596. }
  597. }
  598. tree.push(vm);
  599. vm = vm.$parent;
  600. }
  601. return '\n\nfound in\n\n' + tree
  602. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  603. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  604. : formatComponentName(vm))); })
  605. .join('\n')
  606. } else {
  607. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  608. }
  609. };
  610. }
  611. /* */
  612. var uid = 0;
  613. /**
  614. * A dep is an observable that can have multiple
  615. * directives subscribing to it.
  616. */
  617. var Dep = function Dep () {
  618. this.id = uid++;
  619. this.subs = [];
  620. };
  621. Dep.prototype.addSub = function addSub (sub) {
  622. this.subs.push(sub);
  623. };
  624. Dep.prototype.removeSub = function removeSub (sub) {
  625. remove(this.subs, sub);
  626. };
  627. Dep.prototype.depend = function depend () {
  628. if (Dep.target) {
  629. Dep.target.addDep(this);
  630. }
  631. };
  632. Dep.prototype.notify = function notify () {
  633. // stabilize the subscriber list first
  634. var subs = this.subs.slice();
  635. if (process.env.NODE_ENV !== 'production' && !config.async) {
  636. // subs aren't sorted in scheduler if not running async
  637. // we need to sort them now to make sure they fire in correct
  638. // order
  639. subs.sort(function (a, b) { return a.id - b.id; });
  640. }
  641. for (var i = 0, l = subs.length; i < l; i++) {
  642. subs[i].update();
  643. }
  644. };
  645. // The current target watcher being evaluated.
  646. // This is globally unique because only one watcher
  647. // can be evaluated at a time.
  648. Dep.target = null;
  649. var targetStack = [];
  650. function pushTarget (target) {
  651. targetStack.push(target);
  652. Dep.target = target;
  653. }
  654. function popTarget () {
  655. targetStack.pop();
  656. Dep.target = targetStack[targetStack.length - 1];
  657. }
  658. /* */
  659. var VNode = function VNode (
  660. tag,
  661. data,
  662. children,
  663. text,
  664. elm,
  665. context,
  666. componentOptions,
  667. asyncFactory
  668. ) {
  669. this.tag = tag;
  670. this.data = data;
  671. this.children = children;
  672. this.text = text;
  673. this.elm = elm;
  674. this.ns = undefined;
  675. this.context = context;
  676. this.fnContext = undefined;
  677. this.fnOptions = undefined;
  678. this.fnScopeId = undefined;
  679. this.key = data && data.key;
  680. this.componentOptions = componentOptions;
  681. this.componentInstance = undefined;
  682. this.parent = undefined;
  683. this.raw = false;
  684. this.isStatic = false;
  685. this.isRootInsert = true;
  686. this.isComment = false;
  687. this.isCloned = false;
  688. this.isOnce = false;
  689. this.asyncFactory = asyncFactory;
  690. this.asyncMeta = undefined;
  691. this.isAsyncPlaceholder = false;
  692. };
  693. var prototypeAccessors = { child: { configurable: true } };
  694. // DEPRECATED: alias for componentInstance for backwards compat.
  695. /* istanbul ignore next */
  696. prototypeAccessors.child.get = function () {
  697. return this.componentInstance
  698. };
  699. Object.defineProperties( VNode.prototype, prototypeAccessors );
  700. var createEmptyVNode = function (text) {
  701. if ( text === void 0 ) text = '';
  702. var node = new VNode();
  703. node.text = text;
  704. node.isComment = true;
  705. return node
  706. };
  707. function createTextVNode (val) {
  708. return new VNode(undefined, undefined, undefined, String(val))
  709. }
  710. // optimized shallow clone
  711. // used for static nodes and slot nodes because they may be reused across
  712. // multiple renders, cloning them avoids errors when DOM manipulations rely
  713. // on their elm reference.
  714. function cloneVNode (vnode) {
  715. var cloned = new VNode(
  716. vnode.tag,
  717. vnode.data,
  718. // #7975
  719. // clone children array to avoid mutating original in case of cloning
  720. // a child.
  721. vnode.children && vnode.children.slice(),
  722. vnode.text,
  723. vnode.elm,
  724. vnode.context,
  725. vnode.componentOptions,
  726. vnode.asyncFactory
  727. );
  728. cloned.ns = vnode.ns;
  729. cloned.isStatic = vnode.isStatic;
  730. cloned.key = vnode.key;
  731. cloned.isComment = vnode.isComment;
  732. cloned.fnContext = vnode.fnContext;
  733. cloned.fnOptions = vnode.fnOptions;
  734. cloned.fnScopeId = vnode.fnScopeId;
  735. cloned.asyncMeta = vnode.asyncMeta;
  736. cloned.isCloned = true;
  737. return cloned
  738. }
  739. /*
  740. * not type checking this file because flow doesn't play well with
  741. * dynamically accessing methods on Array prototype
  742. */
  743. var arrayProto = Array.prototype;
  744. var arrayMethods = Object.create(arrayProto);
  745. var methodsToPatch = [
  746. 'push',
  747. 'pop',
  748. 'shift',
  749. 'unshift',
  750. 'splice',
  751. 'sort',
  752. 'reverse'
  753. ];
  754. /**
  755. * Intercept mutating methods and emit events
  756. */
  757. methodsToPatch.forEach(function (method) {
  758. // cache original method
  759. var original = arrayProto[method];
  760. def(arrayMethods, method, function mutator () {
  761. var args = [], len = arguments.length;
  762. while ( len-- ) args[ len ] = arguments[ len ];
  763. var result = original.apply(this, args);
  764. var ob = this.__ob__;
  765. var inserted;
  766. switch (method) {
  767. case 'push':
  768. case 'unshift':
  769. inserted = args;
  770. break
  771. case 'splice':
  772. inserted = args.slice(2);
  773. break
  774. }
  775. if (inserted) { ob.observeArray(inserted); }
  776. // notify change
  777. ob.dep.notify();
  778. return result
  779. });
  780. });
  781. /* */
  782. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  783. /**
  784. * In some cases we may want to disable observation inside a component's
  785. * update computation.
  786. */
  787. var shouldObserve = true;
  788. function toggleObserving (value) {
  789. shouldObserve = value;
  790. }
  791. /**
  792. * Observer class that is attached to each observed
  793. * object. Once attached, the observer converts the target
  794. * object's property keys into getter/setters that
  795. * collect dependencies and dispatch updates.
  796. */
  797. var Observer = function Observer (value) {
  798. this.value = value;
  799. this.dep = new Dep();
  800. this.vmCount = 0;
  801. def(value, '__ob__', this);
  802. if (Array.isArray(value)) {
  803. if (hasProto) {
  804. protoAugment(value, arrayMethods);
  805. } else {
  806. copyAugment(value, arrayMethods, arrayKeys);
  807. }
  808. this.observeArray(value);
  809. } else {
  810. this.walk(value);
  811. }
  812. };
  813. /**
  814. * Walk through all properties and convert them into
  815. * getter/setters. This method should only be called when
  816. * value type is Object.
  817. */
  818. Observer.prototype.walk = function walk (obj) {
  819. var keys = Object.keys(obj);
  820. for (var i = 0; i < keys.length; i++) {
  821. defineReactive$$1(obj, keys[i]);
  822. }
  823. };
  824. /**
  825. * Observe a list of Array items.
  826. */
  827. Observer.prototype.observeArray = function observeArray (items) {
  828. for (var i = 0, l = items.length; i < l; i++) {
  829. observe(items[i]);
  830. }
  831. };
  832. // helpers
  833. /**
  834. * Augment a target Object or Array by intercepting
  835. * the prototype chain using __proto__
  836. */
  837. function protoAugment (target, src) {
  838. /* eslint-disable no-proto */
  839. target.__proto__ = src;
  840. /* eslint-enable no-proto */
  841. }
  842. /**
  843. * Augment a target Object or Array by defining
  844. * hidden properties.
  845. */
  846. /* istanbul ignore next */
  847. function copyAugment (target, src, keys) {
  848. for (var i = 0, l = keys.length; i < l; i++) {
  849. var key = keys[i];
  850. def(target, key, src[key]);
  851. }
  852. }
  853. /**
  854. * Attempt to create an observer instance for a value,
  855. * returns the new observer if successfully observed,
  856. * or the existing observer if the value already has one.
  857. */
  858. function observe (value, asRootData) {
  859. if (!isObject(value) || value instanceof VNode) {
  860. return
  861. }
  862. var ob;
  863. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  864. ob = value.__ob__;
  865. } else if (
  866. shouldObserve &&
  867. !isServerRendering() &&
  868. (Array.isArray(value) || isPlainObject(value)) &&
  869. Object.isExtensible(value) &&
  870. !value._isVue
  871. ) {
  872. ob = new Observer(value);
  873. }
  874. if (asRootData && ob) {
  875. ob.vmCount++;
  876. }
  877. return ob
  878. }
  879. /**
  880. * Define a reactive property on an Object.
  881. */
  882. function defineReactive$$1 (
  883. obj,
  884. key,
  885. val,
  886. customSetter,
  887. shallow
  888. ) {
  889. var dep = new Dep();
  890. var property = Object.getOwnPropertyDescriptor(obj, key);
  891. if (property && property.configurable === false) {
  892. return
  893. }
  894. // cater for pre-defined getter/setters
  895. var getter = property && property.get;
  896. var setter = property && property.set;
  897. if ((!getter || setter) && arguments.length === 2) {
  898. val = obj[key];
  899. }
  900. var childOb = !shallow && observe(val);
  901. Object.defineProperty(obj, key, {
  902. enumerable: true,
  903. configurable: true,
  904. get: function reactiveGetter () {
  905. var value = getter ? getter.call(obj) : val;
  906. if (Dep.target) {
  907. dep.depend();
  908. if (childOb) {
  909. childOb.dep.depend();
  910. if (Array.isArray(value)) {
  911. dependArray(value);
  912. }
  913. }
  914. }
  915. return value
  916. },
  917. set: function reactiveSetter (newVal) {
  918. var value = getter ? getter.call(obj) : val;
  919. /* eslint-disable no-self-compare */
  920. if (newVal === value || (newVal !== newVal && value !== value)) {
  921. return
  922. }
  923. /* eslint-enable no-self-compare */
  924. if (process.env.NODE_ENV !== 'production' && customSetter) {
  925. customSetter();
  926. }
  927. // #7981: for accessor properties without setter
  928. if (getter && !setter) { return }
  929. if (setter) {
  930. setter.call(obj, newVal);
  931. } else {
  932. val = newVal;
  933. }
  934. childOb = !shallow && observe(newVal);
  935. dep.notify();
  936. }
  937. });
  938. }
  939. /**
  940. * Set a property on an object. Adds the new property and
  941. * triggers change notification if the property doesn't
  942. * already exist.
  943. */
  944. function set (target, key, val) {
  945. if (process.env.NODE_ENV !== 'production' &&
  946. (isUndef(target) || isPrimitive(target))
  947. ) {
  948. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  949. }
  950. if (Array.isArray(target) && isValidArrayIndex(key)) {
  951. target.length = Math.max(target.length, key);
  952. target.splice(key, 1, val);
  953. return val
  954. }
  955. if (key in target && !(key in Object.prototype)) {
  956. target[key] = val;
  957. return val
  958. }
  959. var ob = (target).__ob__;
  960. if (target._isVue || (ob && ob.vmCount)) {
  961. process.env.NODE_ENV !== 'production' && warn(
  962. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  963. 'at runtime - declare it upfront in the data option.'
  964. );
  965. return val
  966. }
  967. if (!ob) {
  968. target[key] = val;
  969. return val
  970. }
  971. defineReactive$$1(ob.value, key, val);
  972. ob.dep.notify();
  973. return val
  974. }
  975. /**
  976. * Delete a property and trigger change if necessary.
  977. */
  978. function del (target, key) {
  979. if (process.env.NODE_ENV !== 'production' &&
  980. (isUndef(target) || isPrimitive(target))
  981. ) {
  982. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  983. }
  984. if (Array.isArray(target) && isValidArrayIndex(key)) {
  985. target.splice(key, 1);
  986. return
  987. }
  988. var ob = (target).__ob__;
  989. if (target._isVue || (ob && ob.vmCount)) {
  990. process.env.NODE_ENV !== 'production' && warn(
  991. 'Avoid deleting properties on a Vue instance or its root $data ' +
  992. '- just set it to null.'
  993. );
  994. return
  995. }
  996. if (!hasOwn(target, key)) {
  997. return
  998. }
  999. delete target[key];
  1000. if (!ob) {
  1001. return
  1002. }
  1003. ob.dep.notify();
  1004. }
  1005. /**
  1006. * Collect dependencies on array elements when the array is touched, since
  1007. * we cannot intercept array element access like property getters.
  1008. */
  1009. function dependArray (value) {
  1010. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1011. e = value[i];
  1012. e && e.__ob__ && e.__ob__.dep.depend();
  1013. if (Array.isArray(e)) {
  1014. dependArray(e);
  1015. }
  1016. }
  1017. }
  1018. /* */
  1019. /**
  1020. * Option overwriting strategies are functions that handle
  1021. * how to merge a parent option value and a child option
  1022. * value into the final value.
  1023. */
  1024. var strats = config.optionMergeStrategies;
  1025. /**
  1026. * Options with restrictions
  1027. */
  1028. if (process.env.NODE_ENV !== 'production') {
  1029. strats.el = strats.propsData = function (parent, child, vm, key) {
  1030. if (!vm) {
  1031. warn(
  1032. "option \"" + key + "\" can only be used during instance " +
  1033. 'creation with the `new` keyword.'
  1034. );
  1035. }
  1036. return defaultStrat(parent, child)
  1037. };
  1038. }
  1039. /**
  1040. * Helper that recursively merges two data objects together.
  1041. */
  1042. function mergeData (to, from) {
  1043. if (!from) { return to }
  1044. var key, toVal, fromVal;
  1045. var keys = hasSymbol
  1046. ? Reflect.ownKeys(from)
  1047. : Object.keys(from);
  1048. for (var i = 0; i < keys.length; i++) {
  1049. key = keys[i];
  1050. // in case the object is already observed...
  1051. if (key === '__ob__') { continue }
  1052. toVal = to[key];
  1053. fromVal = from[key];
  1054. if (!hasOwn(to, key)) {
  1055. set(to, key, fromVal);
  1056. } else if (
  1057. toVal !== fromVal &&
  1058. isPlainObject(toVal) &&
  1059. isPlainObject(fromVal)
  1060. ) {
  1061. mergeData(toVal, fromVal);
  1062. }
  1063. }
  1064. return to
  1065. }
  1066. /**
  1067. * Data
  1068. */
  1069. function mergeDataOrFn (
  1070. parentVal,
  1071. childVal,
  1072. vm
  1073. ) {
  1074. if (!vm) {
  1075. // in a Vue.extend merge, both should be functions
  1076. if (!childVal) {
  1077. return parentVal
  1078. }
  1079. if (!parentVal) {
  1080. return childVal
  1081. }
  1082. // when parentVal & childVal are both present,
  1083. // we need to return a function that returns the
  1084. // merged result of both functions... no need to
  1085. // check if parentVal is a function here because
  1086. // it has to be a function to pass previous merges.
  1087. return function mergedDataFn () {
  1088. return mergeData(
  1089. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1090. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1091. )
  1092. }
  1093. } else {
  1094. return function mergedInstanceDataFn () {
  1095. // instance merge
  1096. var instanceData = typeof childVal === 'function'
  1097. ? childVal.call(vm, vm)
  1098. : childVal;
  1099. var defaultData = typeof parentVal === 'function'
  1100. ? parentVal.call(vm, vm)
  1101. : parentVal;
  1102. if (instanceData) {
  1103. return mergeData(instanceData, defaultData)
  1104. } else {
  1105. return defaultData
  1106. }
  1107. }
  1108. }
  1109. }
  1110. strats.data = function (
  1111. parentVal,
  1112. childVal,
  1113. vm
  1114. ) {
  1115. if (!vm) {
  1116. if (childVal && typeof childVal !== 'function') {
  1117. process.env.NODE_ENV !== 'production' && warn(
  1118. 'The "data" option should be a function ' +
  1119. 'that returns a per-instance value in component ' +
  1120. 'definitions.',
  1121. vm
  1122. );
  1123. return parentVal
  1124. }
  1125. return mergeDataOrFn(parentVal, childVal)
  1126. }
  1127. return mergeDataOrFn(parentVal, childVal, vm)
  1128. };
  1129. /**
  1130. * Hooks and props are merged as arrays.
  1131. */
  1132. function mergeHook (
  1133. parentVal,
  1134. childVal
  1135. ) {
  1136. var res = childVal
  1137. ? parentVal
  1138. ? parentVal.concat(childVal)
  1139. : Array.isArray(childVal)
  1140. ? childVal
  1141. : [childVal]
  1142. : parentVal;
  1143. return res
  1144. ? dedupeHooks(res)
  1145. : res
  1146. }
  1147. function dedupeHooks (hooks) {
  1148. var res = [];
  1149. for (var i = 0; i < hooks.length; i++) {
  1150. if (res.indexOf(hooks[i]) === -1) {
  1151. res.push(hooks[i]);
  1152. }
  1153. }
  1154. return res
  1155. }
  1156. LIFECYCLE_HOOKS.forEach(function (hook) {
  1157. strats[hook] = mergeHook;
  1158. });
  1159. /**
  1160. * Assets
  1161. *
  1162. * When a vm is present (instance creation), we need to do
  1163. * a three-way merge between constructor options, instance
  1164. * options and parent options.
  1165. */
  1166. function mergeAssets (
  1167. parentVal,
  1168. childVal,
  1169. vm,
  1170. key
  1171. ) {
  1172. var res = Object.create(parentVal || null);
  1173. if (childVal) {
  1174. process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
  1175. return extend(res, childVal)
  1176. } else {
  1177. return res
  1178. }
  1179. }
  1180. ASSET_TYPES.forEach(function (type) {
  1181. strats[type + 's'] = mergeAssets;
  1182. });
  1183. /**
  1184. * Watchers.
  1185. *
  1186. * Watchers hashes should not overwrite one
  1187. * another, so we merge them as arrays.
  1188. */
  1189. strats.watch = function (
  1190. parentVal,
  1191. childVal,
  1192. vm,
  1193. key
  1194. ) {
  1195. // work around Firefox's Object.prototype.watch...
  1196. if (parentVal === nativeWatch) { parentVal = undefined; }
  1197. if (childVal === nativeWatch) { childVal = undefined; }
  1198. /* istanbul ignore if */
  1199. if (!childVal) { return Object.create(parentVal || null) }
  1200. if (process.env.NODE_ENV !== 'production') {
  1201. assertObjectType(key, childVal, vm);
  1202. }
  1203. if (!parentVal) { return childVal }
  1204. var ret = {};
  1205. extend(ret, parentVal);
  1206. for (var key$1 in childVal) {
  1207. var parent = ret[key$1];
  1208. var child = childVal[key$1];
  1209. if (parent && !Array.isArray(parent)) {
  1210. parent = [parent];
  1211. }
  1212. ret[key$1] = parent
  1213. ? parent.concat(child)
  1214. : Array.isArray(child) ? child : [child];
  1215. }
  1216. return ret
  1217. };
  1218. /**
  1219. * Other object hashes.
  1220. */
  1221. strats.props =
  1222. strats.methods =
  1223. strats.inject =
  1224. strats.computed = function (
  1225. parentVal,
  1226. childVal,
  1227. vm,
  1228. key
  1229. ) {
  1230. if (childVal && process.env.NODE_ENV !== 'production') {
  1231. assertObjectType(key, childVal, vm);
  1232. }
  1233. if (!parentVal) { return childVal }
  1234. var ret = Object.create(null);
  1235. extend(ret, parentVal);
  1236. if (childVal) { extend(ret, childVal); }
  1237. return ret
  1238. };
  1239. strats.provide = mergeDataOrFn;
  1240. /**
  1241. * Default strategy.
  1242. */
  1243. var defaultStrat = function (parentVal, childVal) {
  1244. return childVal === undefined
  1245. ? parentVal
  1246. : childVal
  1247. };
  1248. /**
  1249. * Validate component names
  1250. */
  1251. function checkComponents (options) {
  1252. for (var key in options.components) {
  1253. validateComponentName(key);
  1254. }
  1255. }
  1256. function validateComponentName (name) {
  1257. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1258. warn(
  1259. 'Invalid component name: "' + name + '". Component names ' +
  1260. 'should conform to valid custom element name in html5 specification.'
  1261. );
  1262. }
  1263. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1264. warn(
  1265. 'Do not use built-in or reserved HTML elements as component ' +
  1266. 'id: ' + name
  1267. );
  1268. }
  1269. }
  1270. /**
  1271. * Ensure all props option syntax are normalized into the
  1272. * Object-based format.
  1273. */
  1274. function normalizeProps (options, vm) {
  1275. var props = options.props;
  1276. if (!props) { return }
  1277. var res = {};
  1278. var i, val, name;
  1279. if (Array.isArray(props)) {
  1280. i = props.length;
  1281. while (i--) {
  1282. val = props[i];
  1283. if (typeof val === 'string') {
  1284. name = camelize(val);
  1285. res[name] = { type: null };
  1286. } else if (process.env.NODE_ENV !== 'production') {
  1287. warn('props must be strings when using array syntax.');
  1288. }
  1289. }
  1290. } else if (isPlainObject(props)) {
  1291. for (var key in props) {
  1292. val = props[key];
  1293. name = camelize(key);
  1294. res[name] = isPlainObject(val)
  1295. ? val
  1296. : { type: val };
  1297. }
  1298. } else if (process.env.NODE_ENV !== 'production') {
  1299. warn(
  1300. "Invalid value for option \"props\": expected an Array or an Object, " +
  1301. "but got " + (toRawType(props)) + ".",
  1302. vm
  1303. );
  1304. }
  1305. options.props = res;
  1306. }
  1307. /**
  1308. * Normalize all injections into Object-based format
  1309. */
  1310. function normalizeInject (options, vm) {
  1311. var inject = options.inject;
  1312. if (!inject) { return }
  1313. var normalized = options.inject = {};
  1314. if (Array.isArray(inject)) {
  1315. for (var i = 0; i < inject.length; i++) {
  1316. normalized[inject[i]] = { from: inject[i] };
  1317. }
  1318. } else if (isPlainObject(inject)) {
  1319. for (var key in inject) {
  1320. var val = inject[key];
  1321. normalized[key] = isPlainObject(val)
  1322. ? extend({ from: key }, val)
  1323. : { from: val };
  1324. }
  1325. } else if (process.env.NODE_ENV !== 'production') {
  1326. warn(
  1327. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1328. "but got " + (toRawType(inject)) + ".",
  1329. vm
  1330. );
  1331. }
  1332. }
  1333. /**
  1334. * Normalize raw function directives into object format.
  1335. */
  1336. function normalizeDirectives (options) {
  1337. var dirs = options.directives;
  1338. if (dirs) {
  1339. for (var key in dirs) {
  1340. var def$$1 = dirs[key];
  1341. if (typeof def$$1 === 'function') {
  1342. dirs[key] = { bind: def$$1, update: def$$1 };
  1343. }
  1344. }
  1345. }
  1346. }
  1347. function assertObjectType (name, value, vm) {
  1348. if (!isPlainObject(value)) {
  1349. warn(
  1350. "Invalid value for option \"" + name + "\": expected an Object, " +
  1351. "but got " + (toRawType(value)) + ".",
  1352. vm
  1353. );
  1354. }
  1355. }
  1356. /**
  1357. * Merge two option objects into a new one.
  1358. * Core utility used in both instantiation and inheritance.
  1359. */
  1360. function mergeOptions (
  1361. parent,
  1362. child,
  1363. vm
  1364. ) {
  1365. if (process.env.NODE_ENV !== 'production') {
  1366. checkComponents(child);
  1367. }
  1368. if (typeof child === 'function') {
  1369. child = child.options;
  1370. }
  1371. normalizeProps(child, vm);
  1372. normalizeInject(child, vm);
  1373. normalizeDirectives(child);
  1374. // Apply extends and mixins on the child options,
  1375. // but only if it is a raw options object that isn't
  1376. // the result of another mergeOptions call.
  1377. // Only merged options has the _base property.
  1378. if (!child._base) {
  1379. if (child.extends) {
  1380. parent = mergeOptions(parent, child.extends, vm);
  1381. }
  1382. if (child.mixins) {
  1383. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1384. parent = mergeOptions(parent, child.mixins[i], vm);
  1385. }
  1386. }
  1387. }
  1388. var options = {};
  1389. var key;
  1390. for (key in parent) {
  1391. mergeField(key);
  1392. }
  1393. for (key in child) {
  1394. if (!hasOwn(parent, key)) {
  1395. mergeField(key);
  1396. }
  1397. }
  1398. function mergeField (key) {
  1399. var strat = strats[key] || defaultStrat;
  1400. options[key] = strat(parent[key], child[key], vm, key);
  1401. }
  1402. return options
  1403. }
  1404. /**
  1405. * Resolve an asset.
  1406. * This function is used because child instances need access
  1407. * to assets defined in its ancestor chain.
  1408. */
  1409. function resolveAsset (
  1410. options,
  1411. type,
  1412. id,
  1413. warnMissing
  1414. ) {
  1415. /* istanbul ignore if */
  1416. if (typeof id !== 'string') {
  1417. return
  1418. }
  1419. var assets = options[type];
  1420. // check local registration variations first
  1421. if (hasOwn(assets, id)) { return assets[id] }
  1422. var camelizedId = camelize(id);
  1423. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1424. var PascalCaseId = capitalize(camelizedId);
  1425. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1426. // fallback to prototype chain
  1427. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1428. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  1429. warn(
  1430. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1431. options
  1432. );
  1433. }
  1434. return res
  1435. }
  1436. /* */
  1437. function validateProp (
  1438. key,
  1439. propOptions,
  1440. propsData,
  1441. vm
  1442. ) {
  1443. var prop = propOptions[key];
  1444. var absent = !hasOwn(propsData, key);
  1445. var value = propsData[key];
  1446. // boolean casting
  1447. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1448. if (booleanIndex > -1) {
  1449. if (absent && !hasOwn(prop, 'default')) {
  1450. value = false;
  1451. } else if (value === '' || value === hyphenate(key)) {
  1452. // only cast empty string / same name to boolean if
  1453. // boolean has higher priority
  1454. var stringIndex = getTypeIndex(String, prop.type);
  1455. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1456. value = true;
  1457. }
  1458. }
  1459. }
  1460. // check default value
  1461. if (value === undefined) {
  1462. value = getPropDefaultValue(vm, prop, key);
  1463. // since the default value is a fresh copy,
  1464. // make sure to observe it.
  1465. var prevShouldObserve = shouldObserve;
  1466. toggleObserving(true);
  1467. observe(value);
  1468. toggleObserving(prevShouldObserve);
  1469. }
  1470. if (
  1471. process.env.NODE_ENV !== 'production' &&
  1472. // skip validation for weex recycle-list child component props
  1473. !(false)
  1474. ) {
  1475. assertProp(prop, key, value, vm, absent);
  1476. }
  1477. return value
  1478. }
  1479. /**
  1480. * Get the default value of a prop.
  1481. */
  1482. function getPropDefaultValue (vm, prop, key) {
  1483. // no default, return undefined
  1484. if (!hasOwn(prop, 'default')) {
  1485. return undefined
  1486. }
  1487. var def = prop.default;
  1488. // warn against non-factory defaults for Object & Array
  1489. if (process.env.NODE_ENV !== 'production' && isObject(def)) {
  1490. warn(
  1491. 'Invalid default value for prop "' + key + '": ' +
  1492. 'Props with type Object/Array must use a factory function ' +
  1493. 'to return the default value.',
  1494. vm
  1495. );
  1496. }
  1497. // the raw prop value was also undefined from previous render,
  1498. // return previous default value to avoid unnecessary watcher trigger
  1499. if (vm && vm.$options.propsData &&
  1500. vm.$options.propsData[key] === undefined &&
  1501. vm._props[key] !== undefined
  1502. ) {
  1503. return vm._props[key]
  1504. }
  1505. // call factory function for non-Function types
  1506. // a value is Function if its prototype is function even across different execution context
  1507. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1508. ? def.call(vm)
  1509. : def
  1510. }
  1511. /**
  1512. * Assert whether a prop is valid.
  1513. */
  1514. function assertProp (
  1515. prop,
  1516. name,
  1517. value,
  1518. vm,
  1519. absent
  1520. ) {
  1521. if (prop.required && absent) {
  1522. warn(
  1523. 'Missing required prop: "' + name + '"',
  1524. vm
  1525. );
  1526. return
  1527. }
  1528. if (value == null && !prop.required) {
  1529. return
  1530. }
  1531. var type = prop.type;
  1532. var valid = !type || type === true;
  1533. var expectedTypes = [];
  1534. if (type) {
  1535. if (!Array.isArray(type)) {
  1536. type = [type];
  1537. }
  1538. for (var i = 0; i < type.length && !valid; i++) {
  1539. var assertedType = assertType(value, type[i]);
  1540. expectedTypes.push(assertedType.expectedType || '');
  1541. valid = assertedType.valid;
  1542. }
  1543. }
  1544. if (!valid) {
  1545. warn(
  1546. getInvalidTypeMessage(name, value, expectedTypes),
  1547. vm
  1548. );
  1549. return
  1550. }
  1551. var validator = prop.validator;
  1552. if (validator) {
  1553. if (!validator(value)) {
  1554. warn(
  1555. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1556. vm
  1557. );
  1558. }
  1559. }
  1560. }
  1561. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1562. function assertType (value, type) {
  1563. var valid;
  1564. var expectedType = getType(type);
  1565. if (simpleCheckRE.test(expectedType)) {
  1566. var t = typeof value;
  1567. valid = t === expectedType.toLowerCase();
  1568. // for primitive wrapper objects
  1569. if (!valid && t === 'object') {
  1570. valid = value instanceof type;
  1571. }
  1572. } else if (expectedType === 'Object') {
  1573. valid = isPlainObject(value);
  1574. } else if (expectedType === 'Array') {
  1575. valid = Array.isArray(value);
  1576. } else {
  1577. valid = value instanceof type;
  1578. }
  1579. return {
  1580. valid: valid,
  1581. expectedType: expectedType
  1582. }
  1583. }
  1584. /**
  1585. * Use function string name to check built-in types,
  1586. * because a simple equality check will fail when running
  1587. * across different vms / iframes.
  1588. */
  1589. function getType (fn) {
  1590. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1591. return match ? match[1] : ''
  1592. }
  1593. function isSameType (a, b) {
  1594. return getType(a) === getType(b)
  1595. }
  1596. function getTypeIndex (type, expectedTypes) {
  1597. if (!Array.isArray(expectedTypes)) {
  1598. return isSameType(expectedTypes, type) ? 0 : -1
  1599. }
  1600. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1601. if (isSameType(expectedTypes[i], type)) {
  1602. return i
  1603. }
  1604. }
  1605. return -1
  1606. }
  1607. function getInvalidTypeMessage (name, value, expectedTypes) {
  1608. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1609. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1610. var expectedType = expectedTypes[0];
  1611. var receivedType = toRawType(value);
  1612. var expectedValue = styleValue(value, expectedType);
  1613. var receivedValue = styleValue(value, receivedType);
  1614. // check if we need to specify expected value
  1615. if (expectedTypes.length === 1 &&
  1616. isExplicable(expectedType) &&
  1617. !isBoolean(expectedType, receivedType)) {
  1618. message += " with value " + expectedValue;
  1619. }
  1620. message += ", got " + receivedType + " ";
  1621. // check if we need to specify received value
  1622. if (isExplicable(receivedType)) {
  1623. message += "with value " + receivedValue + ".";
  1624. }
  1625. return message
  1626. }
  1627. function styleValue (value, type) {
  1628. if (type === 'String') {
  1629. return ("\"" + value + "\"")
  1630. } else if (type === 'Number') {
  1631. return ("" + (Number(value)))
  1632. } else {
  1633. return ("" + value)
  1634. }
  1635. }
  1636. function isExplicable (value) {
  1637. var explicitTypes = ['string', 'number', 'boolean'];
  1638. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1639. }
  1640. function isBoolean () {
  1641. var args = [], len = arguments.length;
  1642. while ( len-- ) args[ len ] = arguments[ len ];
  1643. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1644. }
  1645. /* */
  1646. function handleError (err, vm, info) {
  1647. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1648. // See: https://github.com/vuejs/vuex/issues/1505
  1649. pushTarget();
  1650. try {
  1651. if (vm) {
  1652. var cur = vm;
  1653. while ((cur = cur.$parent)) {
  1654. var hooks = cur.$options.errorCaptured;
  1655. if (hooks) {
  1656. for (var i = 0; i < hooks.length; i++) {
  1657. try {
  1658. var capture = hooks[i].call(cur, err, vm, info) === false;
  1659. if (capture) { return }
  1660. } catch (e) {
  1661. globalHandleError(e, cur, 'errorCaptured hook');
  1662. }
  1663. }
  1664. }
  1665. }
  1666. }
  1667. globalHandleError(err, vm, info);
  1668. } finally {
  1669. popTarget();
  1670. }
  1671. }
  1672. function invokeWithErrorHandling (
  1673. handler,
  1674. context,
  1675. args,
  1676. vm,
  1677. info
  1678. ) {
  1679. var res;
  1680. try {
  1681. res = args ? handler.apply(context, args) : handler.call(context);
  1682. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1683. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1684. // issue #9511
  1685. // avoid catch triggering multiple times when nested calls
  1686. res._handled = true;
  1687. }
  1688. } catch (e) {
  1689. handleError(e, vm, info);
  1690. }
  1691. return res
  1692. }
  1693. function globalHandleError (err, vm, info) {
  1694. if (config.errorHandler) {
  1695. try {
  1696. return config.errorHandler.call(null, err, vm, info)
  1697. } catch (e) {
  1698. // if the user intentionally throws the original error in the handler,
  1699. // do not log it twice
  1700. if (e !== err) {
  1701. logError(e, null, 'config.errorHandler');
  1702. }
  1703. }
  1704. }
  1705. logError(err, vm, info);
  1706. }
  1707. function logError (err, vm, info) {
  1708. if (process.env.NODE_ENV !== 'production') {
  1709. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1710. }
  1711. /* istanbul ignore else */
  1712. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1713. console.error(err);
  1714. } else {
  1715. throw err
  1716. }
  1717. }
  1718. /* */
  1719. var isUsingMicroTask = false;
  1720. var callbacks = [];
  1721. var pending = false;
  1722. function flushCallbacks () {
  1723. pending = false;
  1724. var copies = callbacks.slice(0);
  1725. callbacks.length = 0;
  1726. for (var i = 0; i < copies.length; i++) {
  1727. copies[i]();
  1728. }
  1729. }
  1730. // Here we have async deferring wrappers using microtasks.
  1731. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1732. // However, it has subtle problems when state is changed right before repaint
  1733. // (e.g. #6813, out-in transitions).
  1734. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1735. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1736. // So we now use microtasks everywhere, again.
  1737. // A major drawback of this tradeoff is that there are some scenarios
  1738. // where microtasks have too high a priority and fire in between supposedly
  1739. // sequential events (e.g. #4521, #6690, which have workarounds)
  1740. // or even between bubbling of the same event (#6566).
  1741. var timerFunc;
  1742. // The nextTick behavior leverages the microtask queue, which can be accessed
  1743. // via either native Promise.then or MutationObserver.
  1744. // MutationObserver has wider support, however it is seriously bugged in
  1745. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1746. // completely stops working after triggering a few times... so, if native
  1747. // Promise is available, we will use it:
  1748. /* istanbul ignore next, $flow-disable-line */
  1749. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1750. var p = Promise.resolve();
  1751. timerFunc = function () {
  1752. p.then(flushCallbacks);
  1753. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1754. // it can get stuck in a weird state where callbacks are pushed into the
  1755. // microtask queue but the queue isn't being flushed, until the browser
  1756. // needs to do some other work, e.g. handle a timer. Therefore we can
  1757. // "force" the microtask queue to be flushed by adding an empty timer.
  1758. if (isIOS) { setTimeout(noop); }
  1759. };
  1760. isUsingMicroTask = true;
  1761. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1762. isNative(MutationObserver) ||
  1763. // PhantomJS and iOS 7.x
  1764. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1765. )) {
  1766. // Use MutationObserver where native Promise is not available,
  1767. // e.g. PhantomJS, iOS7, Android 4.4
  1768. // (#6466 MutationObserver is unreliable in IE11)
  1769. var counter = 1;
  1770. var observer = new MutationObserver(flushCallbacks);
  1771. var textNode = document.createTextNode(String(counter));
  1772. observer.observe(textNode, {
  1773. characterData: true
  1774. });
  1775. timerFunc = function () {
  1776. counter = (counter + 1) % 2;
  1777. textNode.data = String(counter);
  1778. };
  1779. isUsingMicroTask = true;
  1780. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1781. // Fallback to setImmediate.
  1782. // Techinically it leverages the (macro) task queue,
  1783. // but it is still a better choice than setTimeout.
  1784. timerFunc = function () {
  1785. setImmediate(flushCallbacks);
  1786. };
  1787. } else {
  1788. // Fallback to setTimeout.
  1789. timerFunc = function () {
  1790. setTimeout(flushCallbacks, 0);
  1791. };
  1792. }
  1793. function nextTick (cb, ctx) {
  1794. var _resolve;
  1795. callbacks.push(function () {
  1796. if (cb) {
  1797. try {
  1798. cb.call(ctx);
  1799. } catch (e) {
  1800. handleError(e, ctx, 'nextTick');
  1801. }
  1802. } else if (_resolve) {
  1803. _resolve(ctx);
  1804. }
  1805. });
  1806. if (!pending) {
  1807. pending = true;
  1808. timerFunc();
  1809. }
  1810. // $flow-disable-line
  1811. if (!cb && typeof Promise !== 'undefined') {
  1812. return new Promise(function (resolve) {
  1813. _resolve = resolve;
  1814. })
  1815. }
  1816. }
  1817. /* */
  1818. var mark;
  1819. var measure;
  1820. if (process.env.NODE_ENV !== 'production') {
  1821. var perf = inBrowser && window.performance;
  1822. /* istanbul ignore if */
  1823. if (
  1824. perf &&
  1825. perf.mark &&
  1826. perf.measure &&
  1827. perf.clearMarks &&
  1828. perf.clearMeasures
  1829. ) {
  1830. mark = function (tag) { return perf.mark(tag); };
  1831. measure = function (name, startTag, endTag) {
  1832. perf.measure(name, startTag, endTag);
  1833. perf.clearMarks(startTag);
  1834. perf.clearMarks(endTag);
  1835. // perf.clearMeasures(name)
  1836. };
  1837. }
  1838. }
  1839. /* not type checking this file because flow doesn't play well with Proxy */
  1840. var initProxy;
  1841. if (process.env.NODE_ENV !== 'production') {
  1842. var allowedGlobals = makeMap(
  1843. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1844. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1845. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1846. 'require' // for Webpack/Browserify
  1847. );
  1848. var warnNonPresent = function (target, key) {
  1849. warn(
  1850. "Property or method \"" + key + "\" is not defined on the instance but " +
  1851. 'referenced during render. Make sure that this property is reactive, ' +
  1852. 'either in the data option, or for class-based components, by ' +
  1853. 'initializing the property. ' +
  1854. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1855. target
  1856. );
  1857. };
  1858. var warnReservedPrefix = function (target, key) {
  1859. warn(
  1860. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1861. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1862. 'prevent conflicts with Vue internals' +
  1863. 'See: https://vuejs.org/v2/api/#data',
  1864. target
  1865. );
  1866. };
  1867. var hasProxy =
  1868. typeof Proxy !== 'undefined' && isNative(Proxy);
  1869. if (hasProxy) {
  1870. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1871. config.keyCodes = new Proxy(config.keyCodes, {
  1872. set: function set (target, key, value) {
  1873. if (isBuiltInModifier(key)) {
  1874. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1875. return false
  1876. } else {
  1877. target[key] = value;
  1878. return true
  1879. }
  1880. }
  1881. });
  1882. }
  1883. var hasHandler = {
  1884. has: function has (target, key) {
  1885. var has = key in target;
  1886. var isAllowed = allowedGlobals(key) ||
  1887. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1888. if (!has && !isAllowed) {
  1889. if (key in target.$data) { warnReservedPrefix(target, key); }
  1890. else { warnNonPresent(target, key); }
  1891. }
  1892. return has || !isAllowed
  1893. }
  1894. };
  1895. var getHandler = {
  1896. get: function get (target, key) {
  1897. if (typeof key === 'string' && !(key in target)) {
  1898. if (key in target.$data) { warnReservedPrefix(target, key); }
  1899. else { warnNonPresent(target, key); }
  1900. }
  1901. return target[key]
  1902. }
  1903. };
  1904. initProxy = function initProxy (vm) {
  1905. if (hasProxy) {
  1906. // determine which proxy handler to use
  1907. var options = vm.$options;
  1908. var handlers = options.render && options.render._withStripped
  1909. ? getHandler
  1910. : hasHandler;
  1911. vm._renderProxy = new Proxy(vm, handlers);
  1912. } else {
  1913. vm._renderProxy = vm;
  1914. }
  1915. };
  1916. }
  1917. /* */
  1918. var seenObjects = new _Set();
  1919. /**
  1920. * Recursively traverse an object to evoke all converted
  1921. * getters, so that every nested property inside the object
  1922. * is collected as a "deep" dependency.
  1923. */
  1924. function traverse (val) {
  1925. _traverse(val, seenObjects);
  1926. seenObjects.clear();
  1927. }
  1928. function _traverse (val, seen) {
  1929. var i, keys;
  1930. var isA = Array.isArray(val);
  1931. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1932. return
  1933. }
  1934. if (val.__ob__) {
  1935. var depId = val.__ob__.dep.id;
  1936. if (seen.has(depId)) {
  1937. return
  1938. }
  1939. seen.add(depId);
  1940. }
  1941. if (isA) {
  1942. i = val.length;
  1943. while (i--) { _traverse(val[i], seen); }
  1944. } else {
  1945. keys = Object.keys(val);
  1946. i = keys.length;
  1947. while (i--) { _traverse(val[keys[i]], seen); }
  1948. }
  1949. }
  1950. /* */
  1951. var normalizeEvent = cached(function (name) {
  1952. var passive = name.charAt(0) === '&';
  1953. name = passive ? name.slice(1) : name;
  1954. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1955. name = once$$1 ? name.slice(1) : name;
  1956. var capture = name.charAt(0) === '!';
  1957. name = capture ? name.slice(1) : name;
  1958. return {
  1959. name: name,
  1960. once: once$$1,
  1961. capture: capture,
  1962. passive: passive
  1963. }
  1964. });
  1965. function createFnInvoker (fns, vm) {
  1966. function invoker () {
  1967. var arguments$1 = arguments;
  1968. var fns = invoker.fns;
  1969. if (Array.isArray(fns)) {
  1970. var cloned = fns.slice();
  1971. for (var i = 0; i < cloned.length; i++) {
  1972. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1973. }
  1974. } else {
  1975. // return handler return value for single handlers
  1976. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1977. }
  1978. }
  1979. invoker.fns = fns;
  1980. return invoker
  1981. }
  1982. function updateListeners (
  1983. on,
  1984. oldOn,
  1985. add,
  1986. remove$$1,
  1987. createOnceHandler,
  1988. vm
  1989. ) {
  1990. var name, def$$1, cur, old, event;
  1991. for (name in on) {
  1992. def$$1 = cur = on[name];
  1993. old = oldOn[name];
  1994. event = normalizeEvent(name);
  1995. if (isUndef(cur)) {
  1996. process.env.NODE_ENV !== 'production' && warn(
  1997. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1998. vm
  1999. );
  2000. } else if (isUndef(old)) {
  2001. if (isUndef(cur.fns)) {
  2002. cur = on[name] = createFnInvoker(cur, vm);
  2003. }
  2004. if (isTrue(event.once)) {
  2005. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  2006. }
  2007. add(event.name, cur, event.capture, event.passive, event.params);
  2008. } else if (cur !== old) {
  2009. old.fns = cur;
  2010. on[name] = old;
  2011. }
  2012. }
  2013. for (name in oldOn) {
  2014. if (isUndef(on[name])) {
  2015. event = normalizeEvent(name);
  2016. remove$$1(event.name, oldOn[name], event.capture);
  2017. }
  2018. }
  2019. }
  2020. /* */
  2021. function mergeVNodeHook (def, hookKey, hook) {
  2022. if (def instanceof VNode) {
  2023. def = def.data.hook || (def.data.hook = {});
  2024. }
  2025. var invoker;
  2026. var oldHook = def[hookKey];
  2027. function wrappedHook () {
  2028. hook.apply(this, arguments);
  2029. // important: remove merged hook to ensure it's called only once
  2030. // and prevent memory leak
  2031. remove(invoker.fns, wrappedHook);
  2032. }
  2033. if (isUndef(oldHook)) {
  2034. // no existing hook
  2035. invoker = createFnInvoker([wrappedHook]);
  2036. } else {
  2037. /* istanbul ignore if */
  2038. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2039. // already a merged invoker
  2040. invoker = oldHook;
  2041. invoker.fns.push(wrappedHook);
  2042. } else {
  2043. // existing plain hook
  2044. invoker = createFnInvoker([oldHook, wrappedHook]);
  2045. }
  2046. }
  2047. invoker.merged = true;
  2048. def[hookKey] = invoker;
  2049. }
  2050. /* */
  2051. function extractPropsFromVNodeData (
  2052. data,
  2053. Ctor,
  2054. tag
  2055. ) {
  2056. // we are only extracting raw values here.
  2057. // validation and default values are handled in the child
  2058. // component itself.
  2059. var propOptions = Ctor.options.props;
  2060. if (isUndef(propOptions)) {
  2061. return
  2062. }
  2063. var res = {};
  2064. var attrs = data.attrs;
  2065. var props = data.props;
  2066. if (isDef(attrs) || isDef(props)) {
  2067. for (var key in propOptions) {
  2068. var altKey = hyphenate(key);
  2069. if (process.env.NODE_ENV !== 'production') {
  2070. var keyInLowerCase = key.toLowerCase();
  2071. if (
  2072. key !== keyInLowerCase &&
  2073. attrs && hasOwn(attrs, keyInLowerCase)
  2074. ) {
  2075. tip(
  2076. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2077. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2078. " \"" + key + "\". " +
  2079. "Note that HTML attributes are case-insensitive and camelCased " +
  2080. "props need to use their kebab-case equivalents when using in-DOM " +
  2081. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2082. );
  2083. }
  2084. }
  2085. checkProp(res, props, key, altKey, true) ||
  2086. checkProp(res, attrs, key, altKey, false);
  2087. }
  2088. }
  2089. return res
  2090. }
  2091. function checkProp (
  2092. res,
  2093. hash,
  2094. key,
  2095. altKey,
  2096. preserve
  2097. ) {
  2098. if (isDef(hash)) {
  2099. if (hasOwn(hash, key)) {
  2100. res[key] = hash[key];
  2101. if (!preserve) {
  2102. delete hash[key];
  2103. }
  2104. return true
  2105. } else if (hasOwn(hash, altKey)) {
  2106. res[key] = hash[altKey];
  2107. if (!preserve) {
  2108. delete hash[altKey];
  2109. }
  2110. return true
  2111. }
  2112. }
  2113. return false
  2114. }
  2115. /* */
  2116. // The template compiler attempts to minimize the need for normalization by
  2117. // statically analyzing the template at compile time.
  2118. //
  2119. // For plain HTML markup, normalization can be completely skipped because the
  2120. // generated render function is guaranteed to return Array<VNode>. There are
  2121. // two cases where extra normalization is needed:
  2122. // 1. When the children contains components - because a functional component
  2123. // may return an Array instead of a single root. In this case, just a simple
  2124. // normalization is needed - if any child is an Array, we flatten the whole
  2125. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2126. // because functional components already normalize their own children.
  2127. function simpleNormalizeChildren (children) {
  2128. for (var i = 0; i < children.length; i++) {
  2129. if (Array.isArray(children[i])) {
  2130. return Array.prototype.concat.apply([], children)
  2131. }
  2132. }
  2133. return children
  2134. }
  2135. // 2. When the children contains constructs that always generated nested Arrays,
  2136. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2137. // with hand-written render functions / JSX. In such cases a full normalization
  2138. // is needed to cater to all possible types of children values.
  2139. function normalizeChildren (children) {
  2140. return isPrimitive(children)
  2141. ? [createTextVNode(children)]
  2142. : Array.isArray(children)
  2143. ? normalizeArrayChildren(children)
  2144. : undefined
  2145. }
  2146. function isTextNode (node) {
  2147. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2148. }
  2149. function normalizeArrayChildren (children, nestedIndex) {
  2150. var res = [];
  2151. var i, c, lastIndex, last;
  2152. for (i = 0; i < children.length; i++) {
  2153. c = children[i];
  2154. if (isUndef(c) || typeof c === 'boolean') { continue }
  2155. lastIndex = res.length - 1;
  2156. last = res[lastIndex];
  2157. // nested
  2158. if (Array.isArray(c)) {
  2159. if (c.length > 0) {
  2160. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2161. // merge adjacent text nodes
  2162. if (isTextNode(c[0]) && isTextNode(last)) {
  2163. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2164. c.shift();
  2165. }
  2166. res.push.apply(res, c);
  2167. }
  2168. } else if (isPrimitive(c)) {
  2169. if (isTextNode(last)) {
  2170. // merge adjacent text nodes
  2171. // this is necessary for SSR hydration because text nodes are
  2172. // essentially merged when rendered to HTML strings
  2173. res[lastIndex] = createTextVNode(last.text + c);
  2174. } else if (c !== '') {
  2175. // convert primitive to vnode
  2176. res.push(createTextVNode(c));
  2177. }
  2178. } else {
  2179. if (isTextNode(c) && isTextNode(last)) {
  2180. // merge adjacent text nodes
  2181. res[lastIndex] = createTextVNode(last.text + c.text);
  2182. } else {
  2183. // default key for nested array children (likely generated by v-for)
  2184. if (isTrue(children._isVList) &&
  2185. isDef(c.tag) &&
  2186. isUndef(c.key) &&
  2187. isDef(nestedIndex)) {
  2188. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2189. }
  2190. res.push(c);
  2191. }
  2192. }
  2193. }
  2194. return res
  2195. }
  2196. /* */
  2197. function initProvide (vm) {
  2198. var provide = vm.$options.provide;
  2199. if (provide) {
  2200. vm._provided = typeof provide === 'function'
  2201. ? provide.call(vm)
  2202. : provide;
  2203. }
  2204. }
  2205. function initInjections (vm) {
  2206. var result = resolveInject(vm.$options.inject, vm);
  2207. if (result) {
  2208. toggleObserving(false);
  2209. Object.keys(result).forEach(function (key) {
  2210. /* istanbul ignore else */
  2211. if (process.env.NODE_ENV !== 'production') {
  2212. defineReactive$$1(vm, key, result[key], function () {
  2213. warn(
  2214. "Avoid mutating an injected value directly since the changes will be " +
  2215. "overwritten whenever the provided component re-renders. " +
  2216. "injection being mutated: \"" + key + "\"",
  2217. vm
  2218. );
  2219. });
  2220. } else {
  2221. defineReactive$$1(vm, key, result[key]);
  2222. }
  2223. });
  2224. toggleObserving(true);
  2225. }
  2226. }
  2227. function resolveInject (inject, vm) {
  2228. if (inject) {
  2229. // inject is :any because flow is not smart enough to figure out cached
  2230. var result = Object.create(null);
  2231. var keys = hasSymbol
  2232. ? Reflect.ownKeys(inject)
  2233. : Object.keys(inject);
  2234. for (var i = 0; i < keys.length; i++) {
  2235. var key = keys[i];
  2236. // #6574 in case the inject object is observed...
  2237. if (key === '__ob__') { continue }
  2238. var provideKey = inject[key].from;
  2239. var source = vm;
  2240. while (source) {
  2241. if (source._provided && hasOwn(source._provided, provideKey)) {
  2242. result[key] = source._provided[provideKey];
  2243. break
  2244. }
  2245. source = source.$parent;
  2246. }
  2247. if (!source) {
  2248. if ('default' in inject[key]) {
  2249. var provideDefault = inject[key].default;
  2250. result[key] = typeof provideDefault === 'function'
  2251. ? provideDefault.call(vm)
  2252. : provideDefault;
  2253. } else if (process.env.NODE_ENV !== 'production') {
  2254. warn(("Injection \"" + key + "\" not found"), vm);
  2255. }
  2256. }
  2257. }
  2258. return result
  2259. }
  2260. }
  2261. /* */
  2262. /**
  2263. * Runtime helper for resolving raw children VNodes into a slot object.
  2264. */
  2265. function resolveSlots (
  2266. children,
  2267. context
  2268. ) {
  2269. if (!children || !children.length) {
  2270. return {}
  2271. }
  2272. var slots = {};
  2273. for (var i = 0, l = children.length; i < l; i++) {
  2274. var child = children[i];
  2275. var data = child.data;
  2276. // remove slot attribute if the node is resolved as a Vue slot node
  2277. if (data && data.attrs && data.attrs.slot) {
  2278. delete data.attrs.slot;
  2279. }
  2280. // named slots should only be respected if the vnode was rendered in the
  2281. // same context.
  2282. if ((child.context === context || child.fnContext === context) &&
  2283. data && data.slot != null
  2284. ) {
  2285. var name = data.slot;
  2286. var slot = (slots[name] || (slots[name] = []));
  2287. if (child.tag === 'template') {
  2288. slot.push.apply(slot, child.children || []);
  2289. } else {
  2290. slot.push(child);
  2291. }
  2292. } else {
  2293. (slots.default || (slots.default = [])).push(child);
  2294. }
  2295. }
  2296. // ignore slots that contains only whitespace
  2297. for (var name$1 in slots) {
  2298. if (slots[name$1].every(isWhitespace)) {
  2299. delete slots[name$1];
  2300. }
  2301. }
  2302. return slots
  2303. }
  2304. function isWhitespace (node) {
  2305. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2306. }
  2307. /* */
  2308. function normalizeScopedSlots (
  2309. slots,
  2310. normalSlots,
  2311. prevSlots
  2312. ) {
  2313. var res;
  2314. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2315. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2316. var key = slots && slots.$key;
  2317. if (!slots) {
  2318. res = {};
  2319. } else if (slots._normalized) {
  2320. // fast path 1: child component re-render only, parent did not change
  2321. return slots._normalized
  2322. } else if (
  2323. isStable &&
  2324. prevSlots &&
  2325. prevSlots !== emptyObject &&
  2326. key === prevSlots.$key &&
  2327. !hasNormalSlots &&
  2328. !prevSlots.$hasNormal
  2329. ) {
  2330. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2331. // only need to normalize once
  2332. return prevSlots
  2333. } else {
  2334. res = {};
  2335. for (var key$1 in slots) {
  2336. if (slots[key$1] && key$1[0] !== '$') {
  2337. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2338. }
  2339. }
  2340. }
  2341. // expose normal slots on scopedSlots
  2342. for (var key$2 in normalSlots) {
  2343. if (!(key$2 in res)) {
  2344. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2345. }
  2346. }
  2347. // avoriaz seems to mock a non-extensible $scopedSlots object
  2348. // and when that is passed down this would cause an error
  2349. if (slots && Object.isExtensible(slots)) {
  2350. (slots)._normalized = res;
  2351. }
  2352. def(res, '$stable', isStable);
  2353. def(res, '$key', key);
  2354. def(res, '$hasNormal', hasNormalSlots);
  2355. return res
  2356. }
  2357. function normalizeScopedSlot(normalSlots, key, fn) {
  2358. var normalized = function () {
  2359. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2360. res = res && typeof res === 'object' && !Array.isArray(res)
  2361. ? [res] // single vnode
  2362. : normalizeChildren(res);
  2363. return res && (
  2364. res.length === 0 ||
  2365. (res.length === 1 && res[0].isComment) // #9658
  2366. ) ? undefined
  2367. : res
  2368. };
  2369. // this is a slot using the new v-slot syntax without scope. although it is
  2370. // compiled as a scoped slot, render fn users would expect it to be present
  2371. // on this.$slots because the usage is semantically a normal slot.
  2372. if (fn.proxy) {
  2373. Object.defineProperty(normalSlots, key, {
  2374. get: normalized,
  2375. enumerable: true,
  2376. configurable: true
  2377. });
  2378. }
  2379. return normalized
  2380. }
  2381. function proxyNormalSlot(slots, key) {
  2382. return function () { return slots[key]; }
  2383. }
  2384. /* */
  2385. /**
  2386. * Runtime helper for rendering v-for lists.
  2387. */
  2388. function renderList (
  2389. val,
  2390. render
  2391. ) {
  2392. var ret, i, l, keys, key;
  2393. if (Array.isArray(val) || typeof val === 'string') {
  2394. ret = new Array(val.length);
  2395. for (i = 0, l = val.length; i < l; i++) {
  2396. ret[i] = render(val[i], i);
  2397. }
  2398. } else if (typeof val === 'number') {
  2399. ret = new Array(val);
  2400. for (i = 0; i < val; i++) {
  2401. ret[i] = render(i + 1, i);
  2402. }
  2403. } else if (isObject(val)) {
  2404. if (hasSymbol && val[Symbol.iterator]) {
  2405. ret = [];
  2406. var iterator = val[Symbol.iterator]();
  2407. var result = iterator.next();
  2408. while (!result.done) {
  2409. ret.push(render(result.value, ret.length));
  2410. result = iterator.next();
  2411. }
  2412. } else {
  2413. keys = Object.keys(val);
  2414. ret = new Array(keys.length);
  2415. for (i = 0, l = keys.length; i < l; i++) {
  2416. key = keys[i];
  2417. ret[i] = render(val[key], key, i);
  2418. }
  2419. }
  2420. }
  2421. if (!isDef(ret)) {
  2422. ret = [];
  2423. }
  2424. (ret)._isVList = true;
  2425. return ret
  2426. }
  2427. /* */
  2428. /**
  2429. * Runtime helper for rendering <slot>
  2430. */
  2431. function renderSlot (
  2432. name,
  2433. fallback,
  2434. props,
  2435. bindObject
  2436. ) {
  2437. var scopedSlotFn = this.$scopedSlots[name];
  2438. var nodes;
  2439. if (scopedSlotFn) { // scoped slot
  2440. props = props || {};
  2441. if (bindObject) {
  2442. if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
  2443. warn(
  2444. 'slot v-bind without argument expects an Object',
  2445. this
  2446. );
  2447. }
  2448. props = extend(extend({}, bindObject), props);
  2449. }
  2450. nodes = scopedSlotFn(props) || fallback;
  2451. } else {
  2452. nodes = this.$slots[name] || fallback;
  2453. }
  2454. var target = props && props.slot;
  2455. if (target) {
  2456. return this.$createElement('template', { slot: target }, nodes)
  2457. } else {
  2458. return nodes
  2459. }
  2460. }
  2461. /* */
  2462. /**
  2463. * Runtime helper for resolving filters
  2464. */
  2465. function resolveFilter (id) {
  2466. return resolveAsset(this.$options, 'filters', id, true) || identity
  2467. }
  2468. /* */
  2469. function isKeyNotMatch (expect, actual) {
  2470. if (Array.isArray(expect)) {
  2471. return expect.indexOf(actual) === -1
  2472. } else {
  2473. return expect !== actual
  2474. }
  2475. }
  2476. /**
  2477. * Runtime helper for checking keyCodes from config.
  2478. * exposed as Vue.prototype._k
  2479. * passing in eventKeyName as last argument separately for backwards compat
  2480. */
  2481. function checkKeyCodes (
  2482. eventKeyCode,
  2483. key,
  2484. builtInKeyCode,
  2485. eventKeyName,
  2486. builtInKeyName
  2487. ) {
  2488. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2489. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2490. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2491. } else if (mappedKeyCode) {
  2492. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2493. } else if (eventKeyName) {
  2494. return hyphenate(eventKeyName) !== key
  2495. }
  2496. }
  2497. /* */
  2498. /**
  2499. * Runtime helper for merging v-bind="object" into a VNode's data.
  2500. */
  2501. function bindObjectProps (
  2502. data,
  2503. tag,
  2504. value,
  2505. asProp,
  2506. isSync
  2507. ) {
  2508. if (value) {
  2509. if (!isObject(value)) {
  2510. process.env.NODE_ENV !== 'production' && warn(
  2511. 'v-bind without argument expects an Object or Array value',
  2512. this
  2513. );
  2514. } else {
  2515. if (Array.isArray(value)) {
  2516. value = toObject(value);
  2517. }
  2518. var hash;
  2519. var loop = function ( key ) {
  2520. if (
  2521. key === 'class' ||
  2522. key === 'style' ||
  2523. isReservedAttribute(key)
  2524. ) {
  2525. hash = data;
  2526. } else {
  2527. var type = data.attrs && data.attrs.type;
  2528. hash = asProp || config.mustUseProp(tag, type, key)
  2529. ? data.domProps || (data.domProps = {})
  2530. : data.attrs || (data.attrs = {});
  2531. }
  2532. var camelizedKey = camelize(key);
  2533. var hyphenatedKey = hyphenate(key);
  2534. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2535. hash[key] = value[key];
  2536. if (isSync) {
  2537. var on = data.on || (data.on = {});
  2538. on[("update:" + key)] = function ($event) {
  2539. value[key] = $event;
  2540. };
  2541. }
  2542. }
  2543. };
  2544. for (var key in value) loop( key );
  2545. }
  2546. }
  2547. return data
  2548. }
  2549. /* */
  2550. /**
  2551. * Runtime helper for rendering static trees.
  2552. */
  2553. function renderStatic (
  2554. index,
  2555. isInFor
  2556. ) {
  2557. var cached = this._staticTrees || (this._staticTrees = []);
  2558. var tree = cached[index];
  2559. // if has already-rendered static tree and not inside v-for,
  2560. // we can reuse the same tree.
  2561. if (tree && !isInFor) {
  2562. return tree
  2563. }
  2564. // otherwise, render a fresh tree.
  2565. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2566. this._renderProxy,
  2567. null,
  2568. this // for render fns generated for functional component templates
  2569. );
  2570. markStatic(tree, ("__static__" + index), false);
  2571. return tree
  2572. }
  2573. /**
  2574. * Runtime helper for v-once.
  2575. * Effectively it means marking the node as static with a unique key.
  2576. */
  2577. function markOnce (
  2578. tree,
  2579. index,
  2580. key
  2581. ) {
  2582. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2583. return tree
  2584. }
  2585. function markStatic (
  2586. tree,
  2587. key,
  2588. isOnce
  2589. ) {
  2590. if (Array.isArray(tree)) {
  2591. for (var i = 0; i < tree.length; i++) {
  2592. if (tree[i] && typeof tree[i] !== 'string') {
  2593. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2594. }
  2595. }
  2596. } else {
  2597. markStaticNode(tree, key, isOnce);
  2598. }
  2599. }
  2600. function markStaticNode (node, key, isOnce) {
  2601. node.isStatic = true;
  2602. node.key = key;
  2603. node.isOnce = isOnce;
  2604. }
  2605. /* */
  2606. function bindObjectListeners (data, value) {
  2607. if (value) {
  2608. if (!isPlainObject(value)) {
  2609. process.env.NODE_ENV !== 'production' && warn(
  2610. 'v-on without argument expects an Object value',
  2611. this
  2612. );
  2613. } else {
  2614. var on = data.on = data.on ? extend({}, data.on) : {};
  2615. for (var key in value) {
  2616. var existing = on[key];
  2617. var ours = value[key];
  2618. on[key] = existing ? [].concat(existing, ours) : ours;
  2619. }
  2620. }
  2621. }
  2622. return data
  2623. }
  2624. /* */
  2625. function resolveScopedSlots (
  2626. fns, // see flow/vnode
  2627. res,
  2628. // the following are added in 2.6
  2629. hasDynamicKeys,
  2630. contentHashKey
  2631. ) {
  2632. res = res || { $stable: !hasDynamicKeys };
  2633. for (var i = 0; i < fns.length; i++) {
  2634. var slot = fns[i];
  2635. if (Array.isArray(slot)) {
  2636. resolveScopedSlots(slot, res, hasDynamicKeys);
  2637. } else if (slot) {
  2638. // marker for reverse proxying v-slot without scope on this.$slots
  2639. if (slot.proxy) {
  2640. slot.fn.proxy = true;
  2641. }
  2642. res[slot.key] = slot.fn;
  2643. }
  2644. }
  2645. if (contentHashKey) {
  2646. (res).$key = contentHashKey;
  2647. }
  2648. return res
  2649. }
  2650. /* */
  2651. function bindDynamicKeys (baseObj, values) {
  2652. for (var i = 0; i < values.length; i += 2) {
  2653. var key = values[i];
  2654. if (typeof key === 'string' && key) {
  2655. baseObj[values[i]] = values[i + 1];
  2656. } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
  2657. // null is a speical value for explicitly removing a binding
  2658. warn(
  2659. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2660. this
  2661. );
  2662. }
  2663. }
  2664. return baseObj
  2665. }
  2666. // helper to dynamically append modifier runtime markers to event names.
  2667. // ensure only append when value is already string, otherwise it will be cast
  2668. // to string and cause the type check to miss.
  2669. function prependModifier (value, symbol) {
  2670. return typeof value === 'string' ? symbol + value : value
  2671. }
  2672. /* */
  2673. function installRenderHelpers (target) {
  2674. target._o = markOnce;
  2675. target._n = toNumber;
  2676. target._s = toString;
  2677. target._l = renderList;
  2678. target._t = renderSlot;
  2679. target._q = looseEqual;
  2680. target._i = looseIndexOf;
  2681. target._m = renderStatic;
  2682. target._f = resolveFilter;
  2683. target._k = checkKeyCodes;
  2684. target._b = bindObjectProps;
  2685. target._v = createTextVNode;
  2686. target._e = createEmptyVNode;
  2687. target._u = resolveScopedSlots;
  2688. target._g = bindObjectListeners;
  2689. target._d = bindDynamicKeys;
  2690. target._p = prependModifier;
  2691. }
  2692. /* */
  2693. function FunctionalRenderContext (
  2694. data,
  2695. props,
  2696. children,
  2697. parent,
  2698. Ctor
  2699. ) {
  2700. var this$1 = this;
  2701. var options = Ctor.options;
  2702. // ensure the createElement function in functional components
  2703. // gets a unique context - this is necessary for correct named slot check
  2704. var contextVm;
  2705. if (hasOwn(parent, '_uid')) {
  2706. contextVm = Object.create(parent);
  2707. // $flow-disable-line
  2708. contextVm._original = parent;
  2709. } else {
  2710. // the context vm passed in is a functional context as well.
  2711. // in this case we want to make sure we are able to get a hold to the
  2712. // real context instance.
  2713. contextVm = parent;
  2714. // $flow-disable-line
  2715. parent = parent._original;
  2716. }
  2717. var isCompiled = isTrue(options._compiled);
  2718. var needNormalization = !isCompiled;
  2719. this.data = data;
  2720. this.props = props;
  2721. this.children = children;
  2722. this.parent = parent;
  2723. this.listeners = data.on || emptyObject;
  2724. this.injections = resolveInject(options.inject, parent);
  2725. this.slots = function () {
  2726. if (!this$1.$slots) {
  2727. normalizeScopedSlots(
  2728. data.scopedSlots,
  2729. this$1.$slots = resolveSlots(children, parent)
  2730. );
  2731. }
  2732. return this$1.$slots
  2733. };
  2734. Object.defineProperty(this, 'scopedSlots', ({
  2735. enumerable: true,
  2736. get: function get () {
  2737. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2738. }
  2739. }));
  2740. // support for compiled functional template
  2741. if (isCompiled) {
  2742. // exposing $options for renderStatic()
  2743. this.$options = options;
  2744. // pre-resolve slots for renderSlot()
  2745. this.$slots = this.slots();
  2746. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2747. }
  2748. if (options._scopeId) {
  2749. this._c = function (a, b, c, d) {
  2750. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2751. if (vnode && !Array.isArray(vnode)) {
  2752. vnode.fnScopeId = options._scopeId;
  2753. vnode.fnContext = parent;
  2754. }
  2755. return vnode
  2756. };
  2757. } else {
  2758. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2759. }
  2760. }
  2761. installRenderHelpers(FunctionalRenderContext.prototype);
  2762. function createFunctionalComponent (
  2763. Ctor,
  2764. propsData,
  2765. data,
  2766. contextVm,
  2767. children
  2768. ) {
  2769. var options = Ctor.options;
  2770. var props = {};
  2771. var propOptions = options.props;
  2772. if (isDef(propOptions)) {
  2773. for (var key in propOptions) {
  2774. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2775. }
  2776. } else {
  2777. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2778. if (isDef(data.props)) { mergeProps(props, data.props); }
  2779. }
  2780. var renderContext = new FunctionalRenderContext(
  2781. data,
  2782. props,
  2783. children,
  2784. contextVm,
  2785. Ctor
  2786. );
  2787. var vnode = options.render.call(null, renderContext._c, renderContext);
  2788. if (vnode instanceof VNode) {
  2789. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2790. } else if (Array.isArray(vnode)) {
  2791. var vnodes = normalizeChildren(vnode) || [];
  2792. var res = new Array(vnodes.length);
  2793. for (var i = 0; i < vnodes.length; i++) {
  2794. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2795. }
  2796. return res
  2797. }
  2798. }
  2799. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2800. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2801. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2802. // that should not be matched to match.
  2803. var clone = cloneVNode(vnode);
  2804. clone.fnContext = contextVm;
  2805. clone.fnOptions = options;
  2806. if (process.env.NODE_ENV !== 'production') {
  2807. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2808. }
  2809. if (data.slot) {
  2810. (clone.data || (clone.data = {})).slot = data.slot;
  2811. }
  2812. return clone
  2813. }
  2814. function mergeProps (to, from) {
  2815. for (var key in from) {
  2816. to[camelize(key)] = from[key];
  2817. }
  2818. }
  2819. /* */
  2820. /* */
  2821. /* */
  2822. /* */
  2823. // inline hooks to be invoked on component VNodes during patch
  2824. var componentVNodeHooks = {
  2825. init: function init (vnode, hydrating) {
  2826. if (
  2827. vnode.componentInstance &&
  2828. !vnode.componentInstance._isDestroyed &&
  2829. vnode.data.keepAlive
  2830. ) {
  2831. // kept-alive components, treat as a patch
  2832. var mountedNode = vnode; // work around flow
  2833. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2834. } else {
  2835. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2836. vnode,
  2837. activeInstance
  2838. );
  2839. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2840. }
  2841. },
  2842. prepatch: function prepatch (oldVnode, vnode) {
  2843. var options = vnode.componentOptions;
  2844. var child = vnode.componentInstance = oldVnode.componentInstance;
  2845. updateChildComponent(
  2846. child,
  2847. options.propsData, // updated props
  2848. options.listeners, // updated listeners
  2849. vnode, // new parent vnode
  2850. options.children // new children
  2851. );
  2852. },
  2853. insert: function insert (vnode) {
  2854. var context = vnode.context;
  2855. var componentInstance = vnode.componentInstance;
  2856. if (!componentInstance._isMounted) {
  2857. componentInstance._isMounted = true;
  2858. callHook(componentInstance, 'mounted');
  2859. }
  2860. if (vnode.data.keepAlive) {
  2861. if (context._isMounted) {
  2862. // vue-router#1212
  2863. // During updates, a kept-alive component's child components may
  2864. // change, so directly walking the tree here may call activated hooks
  2865. // on incorrect children. Instead we push them into a queue which will
  2866. // be processed after the whole patch process ended.
  2867. queueActivatedComponent(componentInstance);
  2868. } else {
  2869. activateChildComponent(componentInstance, true /* direct */);
  2870. }
  2871. }
  2872. },
  2873. destroy: function destroy (vnode) {
  2874. var componentInstance = vnode.componentInstance;
  2875. if (!componentInstance._isDestroyed) {
  2876. if (!vnode.data.keepAlive) {
  2877. componentInstance.$destroy();
  2878. } else {
  2879. deactivateChildComponent(componentInstance, true /* direct */);
  2880. }
  2881. }
  2882. }
  2883. };
  2884. var hooksToMerge = Object.keys(componentVNodeHooks);
  2885. function createComponent (
  2886. Ctor,
  2887. data,
  2888. context,
  2889. children,
  2890. tag
  2891. ) {
  2892. if (isUndef(Ctor)) {
  2893. return
  2894. }
  2895. var baseCtor = context.$options._base;
  2896. // plain options object: turn it into a constructor
  2897. if (isObject(Ctor)) {
  2898. Ctor = baseCtor.extend(Ctor);
  2899. }
  2900. // if at this stage it's not a constructor or an async component factory,
  2901. // reject.
  2902. if (typeof Ctor !== 'function') {
  2903. if (process.env.NODE_ENV !== 'production') {
  2904. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2905. }
  2906. return
  2907. }
  2908. // async component
  2909. var asyncFactory;
  2910. if (isUndef(Ctor.cid)) {
  2911. asyncFactory = Ctor;
  2912. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2913. if (Ctor === undefined) {
  2914. // return a placeholder node for async component, which is rendered
  2915. // as a comment node but preserves all the raw information for the node.
  2916. // the information will be used for async server-rendering and hydration.
  2917. return createAsyncPlaceholder(
  2918. asyncFactory,
  2919. data,
  2920. context,
  2921. children,
  2922. tag
  2923. )
  2924. }
  2925. }
  2926. data = data || {};
  2927. // resolve constructor options in case global mixins are applied after
  2928. // component constructor creation
  2929. resolveConstructorOptions(Ctor);
  2930. // transform component v-model data into props & events
  2931. if (isDef(data.model)) {
  2932. transformModel(Ctor.options, data);
  2933. }
  2934. // extract props
  2935. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  2936. // functional component
  2937. if (isTrue(Ctor.options.functional)) {
  2938. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2939. }
  2940. // extract listeners, since these needs to be treated as
  2941. // child component listeners instead of DOM listeners
  2942. var listeners = data.on;
  2943. // replace with listeners with .native modifier
  2944. // so it gets processed during parent component patch.
  2945. data.on = data.nativeOn;
  2946. if (isTrue(Ctor.options.abstract)) {
  2947. // abstract components do not keep anything
  2948. // other than props & listeners & slot
  2949. // work around flow
  2950. var slot = data.slot;
  2951. data = {};
  2952. if (slot) {
  2953. data.slot = slot;
  2954. }
  2955. }
  2956. // install component management hooks onto the placeholder node
  2957. installComponentHooks(data);
  2958. // return a placeholder vnode
  2959. var name = Ctor.options.name || tag;
  2960. var vnode = new VNode(
  2961. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2962. data, undefined, undefined, undefined, context,
  2963. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2964. asyncFactory
  2965. );
  2966. return vnode
  2967. }
  2968. function createComponentInstanceForVnode (
  2969. vnode, // we know it's MountedComponentVNode but flow doesn't
  2970. parent // activeInstance in lifecycle state
  2971. ) {
  2972. var options = {
  2973. _isComponent: true,
  2974. _parentVnode: vnode,
  2975. parent: parent
  2976. };
  2977. // check inline-template render functions
  2978. var inlineTemplate = vnode.data.inlineTemplate;
  2979. if (isDef(inlineTemplate)) {
  2980. options.render = inlineTemplate.render;
  2981. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2982. }
  2983. return new vnode.componentOptions.Ctor(options)
  2984. }
  2985. function installComponentHooks (data) {
  2986. var hooks = data.hook || (data.hook = {});
  2987. for (var i = 0; i < hooksToMerge.length; i++) {
  2988. var key = hooksToMerge[i];
  2989. var existing = hooks[key];
  2990. var toMerge = componentVNodeHooks[key];
  2991. if (existing !== toMerge && !(existing && existing._merged)) {
  2992. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  2993. }
  2994. }
  2995. }
  2996. function mergeHook$1 (f1, f2) {
  2997. var merged = function (a, b) {
  2998. // flow complains about extra args which is why we use any
  2999. f1(a, b);
  3000. f2(a, b);
  3001. };
  3002. merged._merged = true;
  3003. return merged
  3004. }
  3005. // transform component v-model info (value and callback) into
  3006. // prop and event handler respectively.
  3007. function transformModel (options, data) {
  3008. var prop = (options.model && options.model.prop) || 'value';
  3009. var event = (options.model && options.model.event) || 'input'
  3010. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3011. var on = data.on || (data.on = {});
  3012. var existing = on[event];
  3013. var callback = data.model.callback;
  3014. if (isDef(existing)) {
  3015. if (
  3016. Array.isArray(existing)
  3017. ? existing.indexOf(callback) === -1
  3018. : existing !== callback
  3019. ) {
  3020. on[event] = [callback].concat(existing);
  3021. }
  3022. } else {
  3023. on[event] = callback;
  3024. }
  3025. }
  3026. /* */
  3027. var SIMPLE_NORMALIZE = 1;
  3028. var ALWAYS_NORMALIZE = 2;
  3029. // wrapper function for providing a more flexible interface
  3030. // without getting yelled at by flow
  3031. function createElement (
  3032. context,
  3033. tag,
  3034. data,
  3035. children,
  3036. normalizationType,
  3037. alwaysNormalize
  3038. ) {
  3039. if (Array.isArray(data) || isPrimitive(data)) {
  3040. normalizationType = children;
  3041. children = data;
  3042. data = undefined;
  3043. }
  3044. if (isTrue(alwaysNormalize)) {
  3045. normalizationType = ALWAYS_NORMALIZE;
  3046. }
  3047. return _createElement(context, tag, data, children, normalizationType)
  3048. }
  3049. function _createElement (
  3050. context,
  3051. tag,
  3052. data,
  3053. children,
  3054. normalizationType
  3055. ) {
  3056. if (isDef(data) && isDef((data).__ob__)) {
  3057. process.env.NODE_ENV !== 'production' && warn(
  3058. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3059. 'Always create fresh vnode data objects in each render!',
  3060. context
  3061. );
  3062. return createEmptyVNode()
  3063. }
  3064. // object syntax in v-bind
  3065. if (isDef(data) && isDef(data.is)) {
  3066. tag = data.is;
  3067. }
  3068. if (!tag) {
  3069. // in case of component :is set to falsy value
  3070. return createEmptyVNode()
  3071. }
  3072. // warn against non-primitive key
  3073. if (process.env.NODE_ENV !== 'production' &&
  3074. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3075. ) {
  3076. {
  3077. warn(
  3078. 'Avoid using non-primitive value as key, ' +
  3079. 'use string/number value instead.',
  3080. context
  3081. );
  3082. }
  3083. }
  3084. // support single function children as default scoped slot
  3085. if (Array.isArray(children) &&
  3086. typeof children[0] === 'function'
  3087. ) {
  3088. data = data || {};
  3089. data.scopedSlots = { default: children[0] };
  3090. children.length = 0;
  3091. }
  3092. if (normalizationType === ALWAYS_NORMALIZE) {
  3093. children = normalizeChildren(children);
  3094. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3095. children = simpleNormalizeChildren(children);
  3096. }
  3097. var vnode, ns;
  3098. if (typeof tag === 'string') {
  3099. var Ctor;
  3100. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3101. if (config.isReservedTag(tag)) {
  3102. // platform built-in elements
  3103. vnode = new VNode(
  3104. config.parsePlatformTagName(tag), data, children,
  3105. undefined, undefined, context
  3106. );
  3107. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3108. // component
  3109. vnode = createComponent(Ctor, data, context, children, tag);
  3110. } else {
  3111. // unknown or unlisted namespaced elements
  3112. // check at runtime because it may get assigned a namespace when its
  3113. // parent normalizes children
  3114. vnode = new VNode(
  3115. tag, data, children,
  3116. undefined, undefined, context
  3117. );
  3118. }
  3119. } else {
  3120. // direct component options / constructor
  3121. vnode = createComponent(tag, data, context, children);
  3122. }
  3123. if (Array.isArray(vnode)) {
  3124. return vnode
  3125. } else if (isDef(vnode)) {
  3126. if (isDef(ns)) { applyNS(vnode, ns); }
  3127. if (isDef(data)) { registerDeepBindings(data); }
  3128. return vnode
  3129. } else {
  3130. return createEmptyVNode()
  3131. }
  3132. }
  3133. function applyNS (vnode, ns, force) {
  3134. vnode.ns = ns;
  3135. if (vnode.tag === 'foreignObject') {
  3136. // use default namespace inside foreignObject
  3137. ns = undefined;
  3138. force = true;
  3139. }
  3140. if (isDef(vnode.children)) {
  3141. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3142. var child = vnode.children[i];
  3143. if (isDef(child.tag) && (
  3144. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3145. applyNS(child, ns, force);
  3146. }
  3147. }
  3148. }
  3149. }
  3150. // ref #5318
  3151. // necessary to ensure parent re-render when deep bindings like :style and
  3152. // :class are used on slot nodes
  3153. function registerDeepBindings (data) {
  3154. if (isObject(data.style)) {
  3155. traverse(data.style);
  3156. }
  3157. if (isObject(data.class)) {
  3158. traverse(data.class);
  3159. }
  3160. }
  3161. /* */
  3162. function initRender (vm) {
  3163. vm._vnode = null; // the root of the child tree
  3164. vm._staticTrees = null; // v-once cached trees
  3165. var options = vm.$options;
  3166. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3167. var renderContext = parentVnode && parentVnode.context;
  3168. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3169. vm.$scopedSlots = emptyObject;
  3170. // bind the createElement fn to this instance
  3171. // so that we get proper render context inside it.
  3172. // args order: tag, data, children, normalizationType, alwaysNormalize
  3173. // internal version is used by render functions compiled from templates
  3174. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3175. // normalization is always applied for the public version, used in
  3176. // user-written render functions.
  3177. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3178. // $attrs & $listeners are exposed for easier HOC creation.
  3179. // they need to be reactive so that HOCs using them are always updated
  3180. var parentData = parentVnode && parentVnode.data;
  3181. /* istanbul ignore else */
  3182. if (process.env.NODE_ENV !== 'production') {
  3183. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3184. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3185. }, true);
  3186. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3187. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3188. }, true);
  3189. } else {
  3190. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
  3191. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
  3192. }
  3193. }
  3194. var currentRenderingInstance = null;
  3195. function renderMixin (Vue) {
  3196. // install runtime convenience helpers
  3197. installRenderHelpers(Vue.prototype);
  3198. Vue.prototype.$nextTick = function (fn) {
  3199. return nextTick(fn, this)
  3200. };
  3201. Vue.prototype._render = function () {
  3202. var vm = this;
  3203. var ref = vm.$options;
  3204. var render = ref.render;
  3205. var _parentVnode = ref._parentVnode;
  3206. if (_parentVnode) {
  3207. vm.$scopedSlots = normalizeScopedSlots(
  3208. _parentVnode.data.scopedSlots,
  3209. vm.$slots,
  3210. vm.$scopedSlots
  3211. );
  3212. }
  3213. // set parent vnode. this allows render functions to have access
  3214. // to the data on the placeholder node.
  3215. vm.$vnode = _parentVnode;
  3216. // render self
  3217. var vnode;
  3218. try {
  3219. // There's no need to maintain a stack becaues all render fns are called
  3220. // separately from one another. Nested component's render fns are called
  3221. // when parent component is patched.
  3222. currentRenderingInstance = vm;
  3223. vnode = render.call(vm._renderProxy, vm.$createElement);
  3224. } catch (e) {
  3225. handleError(e, vm, "render");
  3226. // return error render result,
  3227. // or previous vnode to prevent render error causing blank component
  3228. /* istanbul ignore else */
  3229. if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {
  3230. try {
  3231. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3232. } catch (e) {
  3233. handleError(e, vm, "renderError");
  3234. vnode = vm._vnode;
  3235. }
  3236. } else {
  3237. vnode = vm._vnode;
  3238. }
  3239. } finally {
  3240. currentRenderingInstance = null;
  3241. }
  3242. // if the returned array contains only a single node, allow it
  3243. if (Array.isArray(vnode) && vnode.length === 1) {
  3244. vnode = vnode[0];
  3245. }
  3246. // return empty vnode in case the render function errored out
  3247. if (!(vnode instanceof VNode)) {
  3248. if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
  3249. warn(
  3250. 'Multiple root nodes returned from render function. Render function ' +
  3251. 'should return a single root node.',
  3252. vm
  3253. );
  3254. }
  3255. vnode = createEmptyVNode();
  3256. }
  3257. // set parent
  3258. vnode.parent = _parentVnode;
  3259. return vnode
  3260. };
  3261. }
  3262. /* */
  3263. function ensureCtor (comp, base) {
  3264. if (
  3265. comp.__esModule ||
  3266. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3267. ) {
  3268. comp = comp.default;
  3269. }
  3270. return isObject(comp)
  3271. ? base.extend(comp)
  3272. : comp
  3273. }
  3274. function createAsyncPlaceholder (
  3275. factory,
  3276. data,
  3277. context,
  3278. children,
  3279. tag
  3280. ) {
  3281. var node = createEmptyVNode();
  3282. node.asyncFactory = factory;
  3283. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3284. return node
  3285. }
  3286. function resolveAsyncComponent (
  3287. factory,
  3288. baseCtor
  3289. ) {
  3290. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3291. return factory.errorComp
  3292. }
  3293. if (isDef(factory.resolved)) {
  3294. return factory.resolved
  3295. }
  3296. var owner = currentRenderingInstance;
  3297. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3298. // already pending
  3299. factory.owners.push(owner);
  3300. }
  3301. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3302. return factory.loadingComp
  3303. }
  3304. if (owner && !isDef(factory.owners)) {
  3305. var owners = factory.owners = [owner];
  3306. var sync = true;
  3307. var timerLoading = null;
  3308. var timerTimeout = null
  3309. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3310. var forceRender = function (renderCompleted) {
  3311. for (var i = 0, l = owners.length; i < l; i++) {
  3312. (owners[i]).$forceUpdate();
  3313. }
  3314. if (renderCompleted) {
  3315. owners.length = 0;
  3316. if (timerLoading !== null) {
  3317. clearTimeout(timerLoading);
  3318. timerLoading = null;
  3319. }
  3320. if (timerTimeout !== null) {
  3321. clearTimeout(timerTimeout);
  3322. timerTimeout = null;
  3323. }
  3324. }
  3325. };
  3326. var resolve = once(function (res) {
  3327. // cache resolved
  3328. factory.resolved = ensureCtor(res, baseCtor);
  3329. // invoke callbacks only if this is not a synchronous resolve
  3330. // (async resolves are shimmed as synchronous during SSR)
  3331. if (!sync) {
  3332. forceRender(true);
  3333. } else {
  3334. owners.length = 0;
  3335. }
  3336. });
  3337. var reject = once(function (reason) {
  3338. process.env.NODE_ENV !== 'production' && warn(
  3339. "Failed to resolve async component: " + (String(factory)) +
  3340. (reason ? ("\nReason: " + reason) : '')
  3341. );
  3342. if (isDef(factory.errorComp)) {
  3343. factory.error = true;
  3344. forceRender(true);
  3345. }
  3346. });
  3347. var res = factory(resolve, reject);
  3348. if (isObject(res)) {
  3349. if (isPromise(res)) {
  3350. // () => Promise
  3351. if (isUndef(factory.resolved)) {
  3352. res.then(resolve, reject);
  3353. }
  3354. } else if (isPromise(res.component)) {
  3355. res.component.then(resolve, reject);
  3356. if (isDef(res.error)) {
  3357. factory.errorComp = ensureCtor(res.error, baseCtor);
  3358. }
  3359. if (isDef(res.loading)) {
  3360. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3361. if (res.delay === 0) {
  3362. factory.loading = true;
  3363. } else {
  3364. timerLoading = setTimeout(function () {
  3365. timerLoading = null;
  3366. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3367. factory.loading = true;
  3368. forceRender(false);
  3369. }
  3370. }, res.delay || 200);
  3371. }
  3372. }
  3373. if (isDef(res.timeout)) {
  3374. timerTimeout = setTimeout(function () {
  3375. timerTimeout = null;
  3376. if (isUndef(factory.resolved)) {
  3377. reject(
  3378. process.env.NODE_ENV !== 'production'
  3379. ? ("timeout (" + (res.timeout) + "ms)")
  3380. : null
  3381. );
  3382. }
  3383. }, res.timeout);
  3384. }
  3385. }
  3386. }
  3387. sync = false;
  3388. // return in case resolved synchronously
  3389. return factory.loading
  3390. ? factory.loadingComp
  3391. : factory.resolved
  3392. }
  3393. }
  3394. /* */
  3395. function isAsyncPlaceholder (node) {
  3396. return node.isComment && node.asyncFactory
  3397. }
  3398. /* */
  3399. function getFirstComponentChild (children) {
  3400. if (Array.isArray(children)) {
  3401. for (var i = 0; i < children.length; i++) {
  3402. var c = children[i];
  3403. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3404. return c
  3405. }
  3406. }
  3407. }
  3408. }
  3409. /* */
  3410. /* */
  3411. function initEvents (vm) {
  3412. vm._events = Object.create(null);
  3413. vm._hasHookEvent = false;
  3414. // init parent attached events
  3415. var listeners = vm.$options._parentListeners;
  3416. if (listeners) {
  3417. updateComponentListeners(vm, listeners);
  3418. }
  3419. }
  3420. var target;
  3421. function add (event, fn) {
  3422. target.$on(event, fn);
  3423. }
  3424. function remove$1 (event, fn) {
  3425. target.$off(event, fn);
  3426. }
  3427. function createOnceHandler (event, fn) {
  3428. var _target = target;
  3429. return function onceHandler () {
  3430. var res = fn.apply(null, arguments);
  3431. if (res !== null) {
  3432. _target.$off(event, onceHandler);
  3433. }
  3434. }
  3435. }
  3436. function updateComponentListeners (
  3437. vm,
  3438. listeners,
  3439. oldListeners
  3440. ) {
  3441. target = vm;
  3442. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3443. target = undefined;
  3444. }
  3445. function eventsMixin (Vue) {
  3446. var hookRE = /^hook:/;
  3447. Vue.prototype.$on = function (event, fn) {
  3448. var vm = this;
  3449. if (Array.isArray(event)) {
  3450. for (var i = 0, l = event.length; i < l; i++) {
  3451. vm.$on(event[i], fn);
  3452. }
  3453. } else {
  3454. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3455. // optimize hook:event cost by using a boolean flag marked at registration
  3456. // instead of a hash lookup
  3457. if (hookRE.test(event)) {
  3458. vm._hasHookEvent = true;
  3459. }
  3460. }
  3461. return vm
  3462. };
  3463. Vue.prototype.$once = function (event, fn) {
  3464. var vm = this;
  3465. function on () {
  3466. vm.$off(event, on);
  3467. fn.apply(vm, arguments);
  3468. }
  3469. on.fn = fn;
  3470. vm.$on(event, on);
  3471. return vm
  3472. };
  3473. Vue.prototype.$off = function (event, fn) {
  3474. var vm = this;
  3475. // all
  3476. if (!arguments.length) {
  3477. vm._events = Object.create(null);
  3478. return vm
  3479. }
  3480. // array of events
  3481. if (Array.isArray(event)) {
  3482. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3483. vm.$off(event[i$1], fn);
  3484. }
  3485. return vm
  3486. }
  3487. // specific event
  3488. var cbs = vm._events[event];
  3489. if (!cbs) {
  3490. return vm
  3491. }
  3492. if (!fn) {
  3493. vm._events[event] = null;
  3494. return vm
  3495. }
  3496. // specific handler
  3497. var cb;
  3498. var i = cbs.length;
  3499. while (i--) {
  3500. cb = cbs[i];
  3501. if (cb === fn || cb.fn === fn) {
  3502. cbs.splice(i, 1);
  3503. break
  3504. }
  3505. }
  3506. return vm
  3507. };
  3508. Vue.prototype.$emit = function (event) {
  3509. var vm = this;
  3510. if (process.env.NODE_ENV !== 'production') {
  3511. var lowerCaseEvent = event.toLowerCase();
  3512. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3513. tip(
  3514. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3515. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3516. "Note that HTML attributes are case-insensitive and you cannot use " +
  3517. "v-on to listen to camelCase events when using in-DOM templates. " +
  3518. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3519. );
  3520. }
  3521. }
  3522. var cbs = vm._events[event];
  3523. if (cbs) {
  3524. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3525. var args = toArray(arguments, 1);
  3526. var info = "event handler for \"" + event + "\"";
  3527. for (var i = 0, l = cbs.length; i < l; i++) {
  3528. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3529. }
  3530. }
  3531. return vm
  3532. };
  3533. }
  3534. /* */
  3535. var activeInstance = null;
  3536. var isUpdatingChildComponent = false;
  3537. function setActiveInstance(vm) {
  3538. var prevActiveInstance = activeInstance;
  3539. activeInstance = vm;
  3540. return function () {
  3541. activeInstance = prevActiveInstance;
  3542. }
  3543. }
  3544. function initLifecycle (vm) {
  3545. var options = vm.$options;
  3546. // locate first non-abstract parent
  3547. var parent = options.parent;
  3548. if (parent && !options.abstract) {
  3549. while (parent.$options.abstract && parent.$parent) {
  3550. parent = parent.$parent;
  3551. }
  3552. parent.$children.push(vm);
  3553. }
  3554. vm.$parent = parent;
  3555. vm.$root = parent ? parent.$root : vm;
  3556. vm.$children = [];
  3557. vm.$refs = {};
  3558. vm._watcher = null;
  3559. vm._inactive = null;
  3560. vm._directInactive = false;
  3561. vm._isMounted = false;
  3562. vm._isDestroyed = false;
  3563. vm._isBeingDestroyed = false;
  3564. }
  3565. function lifecycleMixin (Vue) {
  3566. Vue.prototype._update = function (vnode, hydrating) {
  3567. var vm = this;
  3568. var prevEl = vm.$el;
  3569. var prevVnode = vm._vnode;
  3570. var restoreActiveInstance = setActiveInstance(vm);
  3571. vm._vnode = vnode;
  3572. // Vue.prototype.__patch__ is injected in entry points
  3573. // based on the rendering backend used.
  3574. if (!prevVnode) {
  3575. // initial render
  3576. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3577. } else {
  3578. // updates
  3579. vm.$el = vm.__patch__(prevVnode, vnode);
  3580. }
  3581. restoreActiveInstance();
  3582. // update __vue__ reference
  3583. if (prevEl) {
  3584. prevEl.__vue__ = null;
  3585. }
  3586. if (vm.$el) {
  3587. vm.$el.__vue__ = vm;
  3588. }
  3589. // if parent is an HOC, update its $el as well
  3590. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3591. vm.$parent.$el = vm.$el;
  3592. }
  3593. // updated hook is called by the scheduler to ensure that children are
  3594. // updated in a parent's updated hook.
  3595. };
  3596. Vue.prototype.$forceUpdate = function () {
  3597. var vm = this;
  3598. if (vm._watcher) {
  3599. vm._watcher.update();
  3600. }
  3601. };
  3602. Vue.prototype.$destroy = function () {
  3603. var vm = this;
  3604. if (vm._isBeingDestroyed) {
  3605. return
  3606. }
  3607. callHook(vm, 'beforeDestroy');
  3608. vm._isBeingDestroyed = true;
  3609. // remove self from parent
  3610. var parent = vm.$parent;
  3611. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3612. remove(parent.$children, vm);
  3613. }
  3614. // teardown watchers
  3615. if (vm._watcher) {
  3616. vm._watcher.teardown();
  3617. }
  3618. var i = vm._watchers.length;
  3619. while (i--) {
  3620. vm._watchers[i].teardown();
  3621. }
  3622. // remove reference from data ob
  3623. // frozen object may not have observer.
  3624. if (vm._data.__ob__) {
  3625. vm._data.__ob__.vmCount--;
  3626. }
  3627. // call the last hook...
  3628. vm._isDestroyed = true;
  3629. // invoke destroy hooks on current rendered tree
  3630. vm.__patch__(vm._vnode, null);
  3631. // fire destroyed hook
  3632. callHook(vm, 'destroyed');
  3633. // turn off all instance listeners.
  3634. vm.$off();
  3635. // remove __vue__ reference
  3636. if (vm.$el) {
  3637. vm.$el.__vue__ = null;
  3638. }
  3639. // release circular reference (#6759)
  3640. if (vm.$vnode) {
  3641. vm.$vnode.parent = null;
  3642. }
  3643. };
  3644. }
  3645. function mountComponent (
  3646. vm,
  3647. el,
  3648. hydrating
  3649. ) {
  3650. vm.$el = el;
  3651. if (!vm.$options.render) {
  3652. vm.$options.render = createEmptyVNode;
  3653. if (process.env.NODE_ENV !== 'production') {
  3654. /* istanbul ignore if */
  3655. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3656. vm.$options.el || el) {
  3657. warn(
  3658. 'You are using the runtime-only build of Vue where the template ' +
  3659. 'compiler is not available. Either pre-compile the templates into ' +
  3660. 'render functions, or use the compiler-included build.',
  3661. vm
  3662. );
  3663. } else {
  3664. warn(
  3665. 'Failed to mount component: template or render function not defined.',
  3666. vm
  3667. );
  3668. }
  3669. }
  3670. }
  3671. callHook(vm, 'beforeMount');
  3672. var updateComponent;
  3673. /* istanbul ignore if */
  3674. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  3675. updateComponent = function () {
  3676. var name = vm._name;
  3677. var id = vm._uid;
  3678. var startTag = "vue-perf-start:" + id;
  3679. var endTag = "vue-perf-end:" + id;
  3680. mark(startTag);
  3681. var vnode = vm._render();
  3682. mark(endTag);
  3683. measure(("vue " + name + " render"), startTag, endTag);
  3684. mark(startTag);
  3685. vm._update(vnode, hydrating);
  3686. mark(endTag);
  3687. measure(("vue " + name + " patch"), startTag, endTag);
  3688. };
  3689. } else {
  3690. updateComponent = function () {
  3691. vm._update(vm._render(), hydrating);
  3692. };
  3693. }
  3694. // we set this to vm._watcher inside the watcher's constructor
  3695. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3696. // component's mounted hook), which relies on vm._watcher being already defined
  3697. new Watcher(vm, updateComponent, noop, {
  3698. before: function before () {
  3699. if (vm._isMounted && !vm._isDestroyed) {
  3700. callHook(vm, 'beforeUpdate');
  3701. }
  3702. }
  3703. }, true /* isRenderWatcher */);
  3704. hydrating = false;
  3705. // manually mounted instance, call mounted on self
  3706. // mounted is called for render-created child components in its inserted hook
  3707. if (vm.$vnode == null) {
  3708. vm._isMounted = true;
  3709. callHook(vm, 'mounted');
  3710. }
  3711. return vm
  3712. }
  3713. function updateChildComponent (
  3714. vm,
  3715. propsData,
  3716. listeners,
  3717. parentVnode,
  3718. renderChildren
  3719. ) {
  3720. if (process.env.NODE_ENV !== 'production') {
  3721. isUpdatingChildComponent = true;
  3722. }
  3723. // determine whether component has slot children
  3724. // we need to do this before overwriting $options._renderChildren.
  3725. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3726. // dynamic slot names). Static scoped slots compiled from template has the
  3727. // "$stable" marker.
  3728. var newScopedSlots = parentVnode.data.scopedSlots;
  3729. var oldScopedSlots = vm.$scopedSlots;
  3730. var hasDynamicScopedSlot = !!(
  3731. (newScopedSlots && !newScopedSlots.$stable) ||
  3732. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3733. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3734. );
  3735. // Any static slot children from the parent may have changed during parent's
  3736. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3737. // update is necessary to ensure correctness.
  3738. var needsForceUpdate = !!(
  3739. renderChildren || // has new static slots
  3740. vm.$options._renderChildren || // has old static slots
  3741. hasDynamicScopedSlot
  3742. );
  3743. vm.$options._parentVnode = parentVnode;
  3744. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3745. if (vm._vnode) { // update child tree's parent
  3746. vm._vnode.parent = parentVnode;
  3747. }
  3748. vm.$options._renderChildren = renderChildren;
  3749. // update $attrs and $listeners hash
  3750. // these are also reactive so they may trigger child update if the child
  3751. // used them during render
  3752. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3753. vm.$listeners = listeners || emptyObject;
  3754. // update props
  3755. if (propsData && vm.$options.props) {
  3756. toggleObserving(false);
  3757. var props = vm._props;
  3758. var propKeys = vm.$options._propKeys || [];
  3759. for (var i = 0; i < propKeys.length; i++) {
  3760. var key = propKeys[i];
  3761. var propOptions = vm.$options.props; // wtf flow?
  3762. props[key] = validateProp(key, propOptions, propsData, vm);
  3763. }
  3764. toggleObserving(true);
  3765. // keep a copy of raw propsData
  3766. vm.$options.propsData = propsData;
  3767. }
  3768. // update listeners
  3769. listeners = listeners || emptyObject;
  3770. var oldListeners = vm.$options._parentListeners;
  3771. vm.$options._parentListeners = listeners;
  3772. updateComponentListeners(vm, listeners, oldListeners);
  3773. // resolve slots + force update if has children
  3774. if (needsForceUpdate) {
  3775. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3776. vm.$forceUpdate();
  3777. }
  3778. if (process.env.NODE_ENV !== 'production') {
  3779. isUpdatingChildComponent = false;
  3780. }
  3781. }
  3782. function isInInactiveTree (vm) {
  3783. while (vm && (vm = vm.$parent)) {
  3784. if (vm._inactive) { return true }
  3785. }
  3786. return false
  3787. }
  3788. function activateChildComponent (vm, direct) {
  3789. if (direct) {
  3790. vm._directInactive = false;
  3791. if (isInInactiveTree(vm)) {
  3792. return
  3793. }
  3794. } else if (vm._directInactive) {
  3795. return
  3796. }
  3797. if (vm._inactive || vm._inactive === null) {
  3798. vm._inactive = false;
  3799. for (var i = 0; i < vm.$children.length; i++) {
  3800. activateChildComponent(vm.$children[i]);
  3801. }
  3802. callHook(vm, 'activated');
  3803. }
  3804. }
  3805. function deactivateChildComponent (vm, direct) {
  3806. if (direct) {
  3807. vm._directInactive = true;
  3808. if (isInInactiveTree(vm)) {
  3809. return
  3810. }
  3811. }
  3812. if (!vm._inactive) {
  3813. vm._inactive = true;
  3814. for (var i = 0; i < vm.$children.length; i++) {
  3815. deactivateChildComponent(vm.$children[i]);
  3816. }
  3817. callHook(vm, 'deactivated');
  3818. }
  3819. }
  3820. function callHook (vm, hook) {
  3821. // #7573 disable dep collection when invoking lifecycle hooks
  3822. pushTarget();
  3823. var handlers = vm.$options[hook];
  3824. var info = hook + " hook";
  3825. if (handlers) {
  3826. for (var i = 0, j = handlers.length; i < j; i++) {
  3827. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3828. }
  3829. }
  3830. if (vm._hasHookEvent) {
  3831. vm.$emit('hook:' + hook);
  3832. }
  3833. popTarget();
  3834. }
  3835. /* */
  3836. var MAX_UPDATE_COUNT = 100;
  3837. var queue = [];
  3838. var activatedChildren = [];
  3839. var has = {};
  3840. var circular = {};
  3841. var waiting = false;
  3842. var flushing = false;
  3843. var index = 0;
  3844. /**
  3845. * Reset the scheduler's state.
  3846. */
  3847. function resetSchedulerState () {
  3848. index = queue.length = activatedChildren.length = 0;
  3849. has = {};
  3850. if (process.env.NODE_ENV !== 'production') {
  3851. circular = {};
  3852. }
  3853. waiting = flushing = false;
  3854. }
  3855. // Async edge case #6566 requires saving the timestamp when event listeners are
  3856. // attached. However, calling performance.now() has a perf overhead especially
  3857. // if the page has thousands of event listeners. Instead, we take a timestamp
  3858. // every time the scheduler flushes and use that for all event listeners
  3859. // attached during that flush.
  3860. var currentFlushTimestamp = 0;
  3861. // Async edge case fix requires storing an event listener's attach timestamp.
  3862. var getNow = Date.now;
  3863. // Determine what event timestamp the browser is using. Annoyingly, the
  3864. // timestamp can either be hi-res (relative to page load) or low-res
  3865. // (relative to UNIX epoch), so in order to compare time we have to use the
  3866. // same timestamp type when saving the flush timestamp.
  3867. // All IE versions use low-res event timestamps, and have problematic clock
  3868. // implementations (#9632)
  3869. if (inBrowser && !isIE) {
  3870. var performance = window.performance;
  3871. if (
  3872. performance &&
  3873. typeof performance.now === 'function' &&
  3874. getNow() > document.createEvent('Event').timeStamp
  3875. ) {
  3876. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3877. // smaller than it, it means the event is using a hi-res timestamp,
  3878. // and we need to use the hi-res version for event listener timestamps as
  3879. // well.
  3880. getNow = function () { return performance.now(); };
  3881. }
  3882. }
  3883. /**
  3884. * Flush both queues and run the watchers.
  3885. */
  3886. function flushSchedulerQueue () {
  3887. currentFlushTimestamp = getNow();
  3888. flushing = true;
  3889. var watcher, id;
  3890. // Sort queue before flush.
  3891. // This ensures that:
  3892. // 1. Components are updated from parent to child. (because parent is always
  3893. // created before the child)
  3894. // 2. A component's user watchers are run before its render watcher (because
  3895. // user watchers are created before the render watcher)
  3896. // 3. If a component is destroyed during a parent component's watcher run,
  3897. // its watchers can be skipped.
  3898. queue.sort(function (a, b) { return a.id - b.id; });
  3899. // do not cache length because more watchers might be pushed
  3900. // as we run existing watchers
  3901. for (index = 0; index < queue.length; index++) {
  3902. watcher = queue[index];
  3903. if (watcher.before) {
  3904. watcher.before();
  3905. }
  3906. id = watcher.id;
  3907. has[id] = null;
  3908. watcher.run();
  3909. // in dev build, check and stop circular updates.
  3910. if (process.env.NODE_ENV !== 'production' && has[id] != null) {
  3911. circular[id] = (circular[id] || 0) + 1;
  3912. if (circular[id] > MAX_UPDATE_COUNT) {
  3913. warn(
  3914. 'You may have an infinite update loop ' + (
  3915. watcher.user
  3916. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3917. : "in a component render function."
  3918. ),
  3919. watcher.vm
  3920. );
  3921. break
  3922. }
  3923. }
  3924. }
  3925. // keep copies of post queues before resetting state
  3926. var activatedQueue = activatedChildren.slice();
  3927. var updatedQueue = queue.slice();
  3928. resetSchedulerState();
  3929. // call component updated and activated hooks
  3930. callActivatedHooks(activatedQueue);
  3931. callUpdatedHooks(updatedQueue);
  3932. // devtool hook
  3933. /* istanbul ignore if */
  3934. if (devtools && config.devtools) {
  3935. devtools.emit('flush');
  3936. }
  3937. }
  3938. function callUpdatedHooks (queue) {
  3939. var i = queue.length;
  3940. while (i--) {
  3941. var watcher = queue[i];
  3942. var vm = watcher.vm;
  3943. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3944. callHook(vm, 'updated');
  3945. }
  3946. }
  3947. }
  3948. /**
  3949. * Queue a kept-alive component that was activated during patch.
  3950. * The queue will be processed after the entire tree has been patched.
  3951. */
  3952. function queueActivatedComponent (vm) {
  3953. // setting _inactive to false here so that a render function can
  3954. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3955. vm._inactive = false;
  3956. activatedChildren.push(vm);
  3957. }
  3958. function callActivatedHooks (queue) {
  3959. for (var i = 0; i < queue.length; i++) {
  3960. queue[i]._inactive = true;
  3961. activateChildComponent(queue[i], true /* true */);
  3962. }
  3963. }
  3964. /**
  3965. * Push a watcher into the watcher queue.
  3966. * Jobs with duplicate IDs will be skipped unless it's
  3967. * pushed when the queue is being flushed.
  3968. */
  3969. function queueWatcher (watcher) {
  3970. var id = watcher.id;
  3971. if (has[id] == null) {
  3972. has[id] = true;
  3973. if (!flushing) {
  3974. queue.push(watcher);
  3975. } else {
  3976. // if already flushing, splice the watcher based on its id
  3977. // if already past its id, it will be run next immediately.
  3978. var i = queue.length - 1;
  3979. while (i > index && queue[i].id > watcher.id) {
  3980. i--;
  3981. }
  3982. queue.splice(i + 1, 0, watcher);
  3983. }
  3984. // queue the flush
  3985. if (!waiting) {
  3986. waiting = true;
  3987. if (process.env.NODE_ENV !== 'production' && !config.async) {
  3988. flushSchedulerQueue();
  3989. return
  3990. }
  3991. nextTick(flushSchedulerQueue);
  3992. }
  3993. }
  3994. }
  3995. /* */
  3996. var uid$2 = 0;
  3997. /**
  3998. * A watcher parses an expression, collects dependencies,
  3999. * and fires callback when the expression value changes.
  4000. * This is used for both the $watch() api and directives.
  4001. */
  4002. var Watcher = function Watcher (
  4003. vm,
  4004. expOrFn,
  4005. cb,
  4006. options,
  4007. isRenderWatcher
  4008. ) {
  4009. this.vm = vm;
  4010. if (isRenderWatcher) {
  4011. vm._watcher = this;
  4012. }
  4013. vm._watchers.push(this);
  4014. // options
  4015. if (options) {
  4016. this.deep = !!options.deep;
  4017. this.user = !!options.user;
  4018. this.lazy = !!options.lazy;
  4019. this.sync = !!options.sync;
  4020. this.before = options.before;
  4021. } else {
  4022. this.deep = this.user = this.lazy = this.sync = false;
  4023. }
  4024. this.cb = cb;
  4025. this.id = ++uid$2; // uid for batching
  4026. this.active = true;
  4027. this.dirty = this.lazy; // for lazy watchers
  4028. this.deps = [];
  4029. this.newDeps = [];
  4030. this.depIds = new _Set();
  4031. this.newDepIds = new _Set();
  4032. this.expression = process.env.NODE_ENV !== 'production'
  4033. ? expOrFn.toString()
  4034. : '';
  4035. // parse expression for getter
  4036. if (typeof expOrFn === 'function') {
  4037. this.getter = expOrFn;
  4038. } else {
  4039. this.getter = parsePath(expOrFn);
  4040. if (!this.getter) {
  4041. this.getter = noop;
  4042. process.env.NODE_ENV !== 'production' && warn(
  4043. "Failed watching path: \"" + expOrFn + "\" " +
  4044. 'Watcher only accepts simple dot-delimited paths. ' +
  4045. 'For full control, use a function instead.',
  4046. vm
  4047. );
  4048. }
  4049. }
  4050. this.value = this.lazy
  4051. ? undefined
  4052. : this.get();
  4053. };
  4054. /**
  4055. * Evaluate the getter, and re-collect dependencies.
  4056. */
  4057. Watcher.prototype.get = function get () {
  4058. pushTarget(this);
  4059. var value;
  4060. var vm = this.vm;
  4061. try {
  4062. value = this.getter.call(vm, vm);
  4063. } catch (e) {
  4064. if (this.user) {
  4065. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4066. } else {
  4067. throw e
  4068. }
  4069. } finally {
  4070. // "touch" every property so they are all tracked as
  4071. // dependencies for deep watching
  4072. if (this.deep) {
  4073. traverse(value);
  4074. }
  4075. popTarget();
  4076. this.cleanupDeps();
  4077. }
  4078. return value
  4079. };
  4080. /**
  4081. * Add a dependency to this directive.
  4082. */
  4083. Watcher.prototype.addDep = function addDep (dep) {
  4084. var id = dep.id;
  4085. if (!this.newDepIds.has(id)) {
  4086. this.newDepIds.add(id);
  4087. this.newDeps.push(dep);
  4088. if (!this.depIds.has(id)) {
  4089. dep.addSub(this);
  4090. }
  4091. }
  4092. };
  4093. /**
  4094. * Clean up for dependency collection.
  4095. */
  4096. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4097. var i = this.deps.length;
  4098. while (i--) {
  4099. var dep = this.deps[i];
  4100. if (!this.newDepIds.has(dep.id)) {
  4101. dep.removeSub(this);
  4102. }
  4103. }
  4104. var tmp = this.depIds;
  4105. this.depIds = this.newDepIds;
  4106. this.newDepIds = tmp;
  4107. this.newDepIds.clear();
  4108. tmp = this.deps;
  4109. this.deps = this.newDeps;
  4110. this.newDeps = tmp;
  4111. this.newDeps.length = 0;
  4112. };
  4113. /**
  4114. * Subscriber interface.
  4115. * Will be called when a dependency changes.
  4116. */
  4117. Watcher.prototype.update = function update () {
  4118. /* istanbul ignore else */
  4119. if (this.lazy) {
  4120. this.dirty = true;
  4121. } else if (this.sync) {
  4122. this.run();
  4123. } else {
  4124. queueWatcher(this);
  4125. }
  4126. };
  4127. /**
  4128. * Scheduler job interface.
  4129. * Will be called by the scheduler.
  4130. */
  4131. Watcher.prototype.run = function run () {
  4132. if (this.active) {
  4133. var value = this.get();
  4134. if (
  4135. value !== this.value ||
  4136. // Deep watchers and watchers on Object/Arrays should fire even
  4137. // when the value is the same, because the value may
  4138. // have mutated.
  4139. isObject(value) ||
  4140. this.deep
  4141. ) {
  4142. // set new value
  4143. var oldValue = this.value;
  4144. this.value = value;
  4145. if (this.user) {
  4146. try {
  4147. this.cb.call(this.vm, value, oldValue);
  4148. } catch (e) {
  4149. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4150. }
  4151. } else {
  4152. this.cb.call(this.vm, value, oldValue);
  4153. }
  4154. }
  4155. }
  4156. };
  4157. /**
  4158. * Evaluate the value of the watcher.
  4159. * This only gets called for lazy watchers.
  4160. */
  4161. Watcher.prototype.evaluate = function evaluate () {
  4162. this.value = this.get();
  4163. this.dirty = false;
  4164. };
  4165. /**
  4166. * Depend on all deps collected by this watcher.
  4167. */
  4168. Watcher.prototype.depend = function depend () {
  4169. var i = this.deps.length;
  4170. while (i--) {
  4171. this.deps[i].depend();
  4172. }
  4173. };
  4174. /**
  4175. * Remove self from all dependencies' subscriber list.
  4176. */
  4177. Watcher.prototype.teardown = function teardown () {
  4178. if (this.active) {
  4179. // remove self from vm's watcher list
  4180. // this is a somewhat expensive operation so we skip it
  4181. // if the vm is being destroyed.
  4182. if (!this.vm._isBeingDestroyed) {
  4183. remove(this.vm._watchers, this);
  4184. }
  4185. var i = this.deps.length;
  4186. while (i--) {
  4187. this.deps[i].removeSub(this);
  4188. }
  4189. this.active = false;
  4190. }
  4191. };
  4192. /* */
  4193. var sharedPropertyDefinition = {
  4194. enumerable: true,
  4195. configurable: true,
  4196. get: noop,
  4197. set: noop
  4198. };
  4199. function proxy (target, sourceKey, key) {
  4200. sharedPropertyDefinition.get = function proxyGetter () {
  4201. return this[sourceKey][key]
  4202. };
  4203. sharedPropertyDefinition.set = function proxySetter (val) {
  4204. this[sourceKey][key] = val;
  4205. };
  4206. Object.defineProperty(target, key, sharedPropertyDefinition);
  4207. }
  4208. function initState (vm) {
  4209. vm._watchers = [];
  4210. var opts = vm.$options;
  4211. if (opts.props) { initProps(vm, opts.props); }
  4212. if (opts.methods) { initMethods(vm, opts.methods); }
  4213. if (opts.data) {
  4214. initData(vm);
  4215. } else {
  4216. observe(vm._data = {}, true /* asRootData */);
  4217. }
  4218. if (opts.computed) { initComputed(vm, opts.computed); }
  4219. if (opts.watch && opts.watch !== nativeWatch) {
  4220. initWatch(vm, opts.watch);
  4221. }
  4222. }
  4223. function initProps (vm, propsOptions) {
  4224. var propsData = vm.$options.propsData || {};
  4225. var props = vm._props = {};
  4226. // cache prop keys so that future props updates can iterate using Array
  4227. // instead of dynamic object key enumeration.
  4228. var keys = vm.$options._propKeys = [];
  4229. var isRoot = !vm.$parent;
  4230. // root instance props should be converted
  4231. if (!isRoot) {
  4232. toggleObserving(false);
  4233. }
  4234. var loop = function ( key ) {
  4235. keys.push(key);
  4236. var value = validateProp(key, propsOptions, propsData, vm);
  4237. /* istanbul ignore else */
  4238. if (process.env.NODE_ENV !== 'production') {
  4239. var hyphenatedKey = hyphenate(key);
  4240. if (isReservedAttribute(hyphenatedKey) ||
  4241. config.isReservedAttr(hyphenatedKey)) {
  4242. warn(
  4243. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4244. vm
  4245. );
  4246. }
  4247. defineReactive$$1(props, key, value, function () {
  4248. if (!isRoot && !isUpdatingChildComponent) {
  4249. warn(
  4250. "Avoid mutating a prop directly since the value will be " +
  4251. "overwritten whenever the parent component re-renders. " +
  4252. "Instead, use a data or computed property based on the prop's " +
  4253. "value. Prop being mutated: \"" + key + "\"",
  4254. vm
  4255. );
  4256. }
  4257. });
  4258. } else {
  4259. defineReactive$$1(props, key, value);
  4260. }
  4261. // static props are already proxied on the component's prototype
  4262. // during Vue.extend(). We only need to proxy props defined at
  4263. // instantiation here.
  4264. if (!(key in vm)) {
  4265. proxy(vm, "_props", key);
  4266. }
  4267. };
  4268. for (var key in propsOptions) loop( key );
  4269. toggleObserving(true);
  4270. }
  4271. function initData (vm) {
  4272. var data = vm.$options.data;
  4273. data = vm._data = typeof data === 'function'
  4274. ? getData(data, vm)
  4275. : data || {};
  4276. if (!isPlainObject(data)) {
  4277. data = {};
  4278. process.env.NODE_ENV !== 'production' && warn(
  4279. 'data functions should return an object:\n' +
  4280. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4281. vm
  4282. );
  4283. }
  4284. // proxy data on instance
  4285. var keys = Object.keys(data);
  4286. var props = vm.$options.props;
  4287. var methods = vm.$options.methods;
  4288. var i = keys.length;
  4289. while (i--) {
  4290. var key = keys[i];
  4291. if (process.env.NODE_ENV !== 'production') {
  4292. if (methods && hasOwn(methods, key)) {
  4293. warn(
  4294. ("Method \"" + key + "\" has already been defined as a data property."),
  4295. vm
  4296. );
  4297. }
  4298. }
  4299. if (props && hasOwn(props, key)) {
  4300. process.env.NODE_ENV !== 'production' && warn(
  4301. "The data property \"" + key + "\" is already declared as a prop. " +
  4302. "Use prop default value instead.",
  4303. vm
  4304. );
  4305. } else if (!isReserved(key)) {
  4306. proxy(vm, "_data", key);
  4307. }
  4308. }
  4309. // observe data
  4310. observe(data, true /* asRootData */);
  4311. }
  4312. function getData (data, vm) {
  4313. // #7573 disable dep collection when invoking data getters
  4314. pushTarget();
  4315. try {
  4316. return data.call(vm, vm)
  4317. } catch (e) {
  4318. handleError(e, vm, "data()");
  4319. return {}
  4320. } finally {
  4321. popTarget();
  4322. }
  4323. }
  4324. var computedWatcherOptions = { lazy: true };
  4325. function initComputed (vm, computed) {
  4326. // $flow-disable-line
  4327. var watchers = vm._computedWatchers = Object.create(null);
  4328. // computed properties are just getters during SSR
  4329. var isSSR = isServerRendering();
  4330. for (var key in computed) {
  4331. var userDef = computed[key];
  4332. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4333. if (process.env.NODE_ENV !== 'production' && getter == null) {
  4334. warn(
  4335. ("Getter is missing for computed property \"" + key + "\"."),
  4336. vm
  4337. );
  4338. }
  4339. if (!isSSR) {
  4340. // create internal watcher for the computed property.
  4341. watchers[key] = new Watcher(
  4342. vm,
  4343. getter || noop,
  4344. noop,
  4345. computedWatcherOptions
  4346. );
  4347. }
  4348. // component-defined computed properties are already defined on the
  4349. // component prototype. We only need to define computed properties defined
  4350. // at instantiation here.
  4351. if (!(key in vm)) {
  4352. defineComputed(vm, key, userDef);
  4353. } else if (process.env.NODE_ENV !== 'production') {
  4354. if (key in vm.$data) {
  4355. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4356. } else if (vm.$options.props && key in vm.$options.props) {
  4357. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4358. }
  4359. }
  4360. }
  4361. }
  4362. function defineComputed (
  4363. target,
  4364. key,
  4365. userDef
  4366. ) {
  4367. var shouldCache = !isServerRendering();
  4368. if (typeof userDef === 'function') {
  4369. sharedPropertyDefinition.get = shouldCache
  4370. ? createComputedGetter(key)
  4371. : createGetterInvoker(userDef);
  4372. sharedPropertyDefinition.set = noop;
  4373. } else {
  4374. sharedPropertyDefinition.get = userDef.get
  4375. ? shouldCache && userDef.cache !== false
  4376. ? createComputedGetter(key)
  4377. : createGetterInvoker(userDef.get)
  4378. : noop;
  4379. sharedPropertyDefinition.set = userDef.set || noop;
  4380. }
  4381. if (process.env.NODE_ENV !== 'production' &&
  4382. sharedPropertyDefinition.set === noop) {
  4383. sharedPropertyDefinition.set = function () {
  4384. warn(
  4385. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4386. this
  4387. );
  4388. };
  4389. }
  4390. Object.defineProperty(target, key, sharedPropertyDefinition);
  4391. }
  4392. function createComputedGetter (key) {
  4393. return function computedGetter () {
  4394. var watcher = this._computedWatchers && this._computedWatchers[key];
  4395. if (watcher) {
  4396. if (watcher.dirty) {
  4397. watcher.evaluate();
  4398. }
  4399. if (Dep.target) {
  4400. watcher.depend();
  4401. }
  4402. return watcher.value
  4403. }
  4404. }
  4405. }
  4406. function createGetterInvoker(fn) {
  4407. return function computedGetter () {
  4408. return fn.call(this, this)
  4409. }
  4410. }
  4411. function initMethods (vm, methods) {
  4412. var props = vm.$options.props;
  4413. for (var key in methods) {
  4414. if (process.env.NODE_ENV !== 'production') {
  4415. if (typeof methods[key] !== 'function') {
  4416. warn(
  4417. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4418. "Did you reference the function correctly?",
  4419. vm
  4420. );
  4421. }
  4422. if (props && hasOwn(props, key)) {
  4423. warn(
  4424. ("Method \"" + key + "\" has already been defined as a prop."),
  4425. vm
  4426. );
  4427. }
  4428. if ((key in vm) && isReserved(key)) {
  4429. warn(
  4430. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4431. "Avoid defining component methods that start with _ or $."
  4432. );
  4433. }
  4434. }
  4435. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4436. }
  4437. }
  4438. function initWatch (vm, watch) {
  4439. for (var key in watch) {
  4440. var handler = watch[key];
  4441. if (Array.isArray(handler)) {
  4442. for (var i = 0; i < handler.length; i++) {
  4443. createWatcher(vm, key, handler[i]);
  4444. }
  4445. } else {
  4446. createWatcher(vm, key, handler);
  4447. }
  4448. }
  4449. }
  4450. function createWatcher (
  4451. vm,
  4452. expOrFn,
  4453. handler,
  4454. options
  4455. ) {
  4456. if (isPlainObject(handler)) {
  4457. options = handler;
  4458. handler = handler.handler;
  4459. }
  4460. if (typeof handler === 'string') {
  4461. handler = vm[handler];
  4462. }
  4463. return vm.$watch(expOrFn, handler, options)
  4464. }
  4465. function stateMixin (Vue) {
  4466. // flow somehow has problems with directly declared definition object
  4467. // when using Object.defineProperty, so we have to procedurally build up
  4468. // the object here.
  4469. var dataDef = {};
  4470. dataDef.get = function () { return this._data };
  4471. var propsDef = {};
  4472. propsDef.get = function () { return this._props };
  4473. if (process.env.NODE_ENV !== 'production') {
  4474. dataDef.set = function () {
  4475. warn(
  4476. 'Avoid replacing instance root $data. ' +
  4477. 'Use nested data properties instead.',
  4478. this
  4479. );
  4480. };
  4481. propsDef.set = function () {
  4482. warn("$props is readonly.", this);
  4483. };
  4484. }
  4485. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4486. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4487. Vue.prototype.$set = set;
  4488. Vue.prototype.$delete = del;
  4489. Vue.prototype.$watch = function (
  4490. expOrFn,
  4491. cb,
  4492. options
  4493. ) {
  4494. var vm = this;
  4495. if (isPlainObject(cb)) {
  4496. return createWatcher(vm, expOrFn, cb, options)
  4497. }
  4498. options = options || {};
  4499. options.user = true;
  4500. var watcher = new Watcher(vm, expOrFn, cb, options);
  4501. if (options.immediate) {
  4502. try {
  4503. cb.call(vm, watcher.value);
  4504. } catch (error) {
  4505. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4506. }
  4507. }
  4508. return function unwatchFn () {
  4509. watcher.teardown();
  4510. }
  4511. };
  4512. }
  4513. /* */
  4514. var uid$3 = 0;
  4515. function initMixin (Vue) {
  4516. Vue.prototype._init = function (options) {
  4517. var vm = this;
  4518. // a uid
  4519. vm._uid = uid$3++;
  4520. var startTag, endTag;
  4521. /* istanbul ignore if */
  4522. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4523. startTag = "vue-perf-start:" + (vm._uid);
  4524. endTag = "vue-perf-end:" + (vm._uid);
  4525. mark(startTag);
  4526. }
  4527. // a flag to avoid this being observed
  4528. vm._isVue = true;
  4529. // merge options
  4530. if (options && options._isComponent) {
  4531. // optimize internal component instantiation
  4532. // since dynamic options merging is pretty slow, and none of the
  4533. // internal component options needs special treatment.
  4534. initInternalComponent(vm, options);
  4535. } else {
  4536. vm.$options = mergeOptions(
  4537. resolveConstructorOptions(vm.constructor),
  4538. options || {},
  4539. vm
  4540. );
  4541. }
  4542. /* istanbul ignore else */
  4543. if (process.env.NODE_ENV !== 'production') {
  4544. initProxy(vm);
  4545. } else {
  4546. vm._renderProxy = vm;
  4547. }
  4548. // expose real self
  4549. vm._self = vm;
  4550. initLifecycle(vm);
  4551. initEvents(vm);
  4552. initRender(vm);
  4553. callHook(vm, 'beforeCreate');
  4554. initInjections(vm); // resolve injections before data/props
  4555. initState(vm);
  4556. initProvide(vm); // resolve provide after data/props
  4557. callHook(vm, 'created');
  4558. /* istanbul ignore if */
  4559. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  4560. vm._name = formatComponentName(vm, false);
  4561. mark(endTag);
  4562. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4563. }
  4564. if (vm.$options.el) {
  4565. vm.$mount(vm.$options.el);
  4566. }
  4567. };
  4568. }
  4569. function initInternalComponent (vm, options) {
  4570. var opts = vm.$options = Object.create(vm.constructor.options);
  4571. // doing this because it's faster than dynamic enumeration.
  4572. var parentVnode = options._parentVnode;
  4573. opts.parent = options.parent;
  4574. opts._parentVnode = parentVnode;
  4575. var vnodeComponentOptions = parentVnode.componentOptions;
  4576. opts.propsData = vnodeComponentOptions.propsData;
  4577. opts._parentListeners = vnodeComponentOptions.listeners;
  4578. opts._renderChildren = vnodeComponentOptions.children;
  4579. opts._componentTag = vnodeComponentOptions.tag;
  4580. if (options.render) {
  4581. opts.render = options.render;
  4582. opts.staticRenderFns = options.staticRenderFns;
  4583. }
  4584. }
  4585. function resolveConstructorOptions (Ctor) {
  4586. var options = Ctor.options;
  4587. if (Ctor.super) {
  4588. var superOptions = resolveConstructorOptions(Ctor.super);
  4589. var cachedSuperOptions = Ctor.superOptions;
  4590. if (superOptions !== cachedSuperOptions) {
  4591. // super option changed,
  4592. // need to resolve new options.
  4593. Ctor.superOptions = superOptions;
  4594. // check if there are any late-modified/attached options (#4976)
  4595. var modifiedOptions = resolveModifiedOptions(Ctor);
  4596. // update base extend options
  4597. if (modifiedOptions) {
  4598. extend(Ctor.extendOptions, modifiedOptions);
  4599. }
  4600. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4601. if (options.name) {
  4602. options.components[options.name] = Ctor;
  4603. }
  4604. }
  4605. }
  4606. return options
  4607. }
  4608. function resolveModifiedOptions (Ctor) {
  4609. var modified;
  4610. var latest = Ctor.options;
  4611. var sealed = Ctor.sealedOptions;
  4612. for (var key in latest) {
  4613. if (latest[key] !== sealed[key]) {
  4614. if (!modified) { modified = {}; }
  4615. modified[key] = latest[key];
  4616. }
  4617. }
  4618. return modified
  4619. }
  4620. function Vue (options) {
  4621. if (process.env.NODE_ENV !== 'production' &&
  4622. !(this instanceof Vue)
  4623. ) {
  4624. warn('Vue is a constructor and should be called with the `new` keyword');
  4625. }
  4626. this._init(options);
  4627. }
  4628. initMixin(Vue);
  4629. stateMixin(Vue);
  4630. eventsMixin(Vue);
  4631. lifecycleMixin(Vue);
  4632. renderMixin(Vue);
  4633. /* */
  4634. function initUse (Vue) {
  4635. Vue.use = function (plugin) {
  4636. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4637. if (installedPlugins.indexOf(plugin) > -1) {
  4638. return this
  4639. }
  4640. // additional parameters
  4641. var args = toArray(arguments, 1);
  4642. args.unshift(this);
  4643. if (typeof plugin.install === 'function') {
  4644. plugin.install.apply(plugin, args);
  4645. } else if (typeof plugin === 'function') {
  4646. plugin.apply(null, args);
  4647. }
  4648. installedPlugins.push(plugin);
  4649. return this
  4650. };
  4651. }
  4652. /* */
  4653. function initMixin$1 (Vue) {
  4654. Vue.mixin = function (mixin) {
  4655. this.options = mergeOptions(this.options, mixin);
  4656. return this
  4657. };
  4658. }
  4659. /* */
  4660. function initExtend (Vue) {
  4661. /**
  4662. * Each instance constructor, including Vue, has a unique
  4663. * cid. This enables us to create wrapped "child
  4664. * constructors" for prototypal inheritance and cache them.
  4665. */
  4666. Vue.cid = 0;
  4667. var cid = 1;
  4668. /**
  4669. * Class inheritance
  4670. */
  4671. Vue.extend = function (extendOptions) {
  4672. extendOptions = extendOptions || {};
  4673. var Super = this;
  4674. var SuperId = Super.cid;
  4675. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4676. if (cachedCtors[SuperId]) {
  4677. return cachedCtors[SuperId]
  4678. }
  4679. var name = extendOptions.name || Super.options.name;
  4680. if (process.env.NODE_ENV !== 'production' && name) {
  4681. validateComponentName(name);
  4682. }
  4683. var Sub = function VueComponent (options) {
  4684. this._init(options);
  4685. };
  4686. Sub.prototype = Object.create(Super.prototype);
  4687. Sub.prototype.constructor = Sub;
  4688. Sub.cid = cid++;
  4689. Sub.options = mergeOptions(
  4690. Super.options,
  4691. extendOptions
  4692. );
  4693. Sub['super'] = Super;
  4694. // For props and computed properties, we define the proxy getters on
  4695. // the Vue instances at extension time, on the extended prototype. This
  4696. // avoids Object.defineProperty calls for each instance created.
  4697. if (Sub.options.props) {
  4698. initProps$1(Sub);
  4699. }
  4700. if (Sub.options.computed) {
  4701. initComputed$1(Sub);
  4702. }
  4703. // allow further extension/mixin/plugin usage
  4704. Sub.extend = Super.extend;
  4705. Sub.mixin = Super.mixin;
  4706. Sub.use = Super.use;
  4707. // create asset registers, so extended classes
  4708. // can have their private assets too.
  4709. ASSET_TYPES.forEach(function (type) {
  4710. Sub[type] = Super[type];
  4711. });
  4712. // enable recursive self-lookup
  4713. if (name) {
  4714. Sub.options.components[name] = Sub;
  4715. }
  4716. // keep a reference to the super options at extension time.
  4717. // later at instantiation we can check if Super's options have
  4718. // been updated.
  4719. Sub.superOptions = Super.options;
  4720. Sub.extendOptions = extendOptions;
  4721. Sub.sealedOptions = extend({}, Sub.options);
  4722. // cache constructor
  4723. cachedCtors[SuperId] = Sub;
  4724. return Sub
  4725. };
  4726. }
  4727. function initProps$1 (Comp) {
  4728. var props = Comp.options.props;
  4729. for (var key in props) {
  4730. proxy(Comp.prototype, "_props", key);
  4731. }
  4732. }
  4733. function initComputed$1 (Comp) {
  4734. var computed = Comp.options.computed;
  4735. for (var key in computed) {
  4736. defineComputed(Comp.prototype, key, computed[key]);
  4737. }
  4738. }
  4739. /* */
  4740. function initAssetRegisters (Vue) {
  4741. /**
  4742. * Create asset registration methods.
  4743. */
  4744. ASSET_TYPES.forEach(function (type) {
  4745. Vue[type] = function (
  4746. id,
  4747. definition
  4748. ) {
  4749. if (!definition) {
  4750. return this.options[type + 's'][id]
  4751. } else {
  4752. /* istanbul ignore if */
  4753. if (process.env.NODE_ENV !== 'production' && type === 'component') {
  4754. validateComponentName(id);
  4755. }
  4756. if (type === 'component' && isPlainObject(definition)) {
  4757. definition.name = definition.name || id;
  4758. definition = this.options._base.extend(definition);
  4759. }
  4760. if (type === 'directive' && typeof definition === 'function') {
  4761. definition = { bind: definition, update: definition };
  4762. }
  4763. this.options[type + 's'][id] = definition;
  4764. return definition
  4765. }
  4766. };
  4767. });
  4768. }
  4769. /* */
  4770. function getComponentName (opts) {
  4771. return opts && (opts.Ctor.options.name || opts.tag)
  4772. }
  4773. function matches (pattern, name) {
  4774. if (Array.isArray(pattern)) {
  4775. return pattern.indexOf(name) > -1
  4776. } else if (typeof pattern === 'string') {
  4777. return pattern.split(',').indexOf(name) > -1
  4778. } else if (isRegExp(pattern)) {
  4779. return pattern.test(name)
  4780. }
  4781. /* istanbul ignore next */
  4782. return false
  4783. }
  4784. function pruneCache (keepAliveInstance, filter) {
  4785. var cache = keepAliveInstance.cache;
  4786. var keys = keepAliveInstance.keys;
  4787. var _vnode = keepAliveInstance._vnode;
  4788. for (var key in cache) {
  4789. var cachedNode = cache[key];
  4790. if (cachedNode) {
  4791. var name = getComponentName(cachedNode.componentOptions);
  4792. if (name && !filter(name)) {
  4793. pruneCacheEntry(cache, key, keys, _vnode);
  4794. }
  4795. }
  4796. }
  4797. }
  4798. function pruneCacheEntry (
  4799. cache,
  4800. key,
  4801. keys,
  4802. current
  4803. ) {
  4804. var cached$$1 = cache[key];
  4805. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4806. cached$$1.componentInstance.$destroy();
  4807. }
  4808. cache[key] = null;
  4809. remove(keys, key);
  4810. }
  4811. var patternTypes = [String, RegExp, Array];
  4812. var KeepAlive = {
  4813. name: 'keep-alive',
  4814. abstract: true,
  4815. props: {
  4816. include: patternTypes,
  4817. exclude: patternTypes,
  4818. max: [String, Number]
  4819. },
  4820. created: function created () {
  4821. this.cache = Object.create(null);
  4822. this.keys = [];
  4823. },
  4824. destroyed: function destroyed () {
  4825. for (var key in this.cache) {
  4826. pruneCacheEntry(this.cache, key, this.keys);
  4827. }
  4828. },
  4829. mounted: function mounted () {
  4830. var this$1 = this;
  4831. this.$watch('include', function (val) {
  4832. pruneCache(this$1, function (name) { return matches(val, name); });
  4833. });
  4834. this.$watch('exclude', function (val) {
  4835. pruneCache(this$1, function (name) { return !matches(val, name); });
  4836. });
  4837. },
  4838. render: function render () {
  4839. var slot = this.$slots.default;
  4840. var vnode = getFirstComponentChild(slot);
  4841. var componentOptions = vnode && vnode.componentOptions;
  4842. if (componentOptions) {
  4843. // check pattern
  4844. var name = getComponentName(componentOptions);
  4845. var ref = this;
  4846. var include = ref.include;
  4847. var exclude = ref.exclude;
  4848. if (
  4849. // not included
  4850. (include && (!name || !matches(include, name))) ||
  4851. // excluded
  4852. (exclude && name && matches(exclude, name))
  4853. ) {
  4854. return vnode
  4855. }
  4856. var ref$1 = this;
  4857. var cache = ref$1.cache;
  4858. var keys = ref$1.keys;
  4859. var key = vnode.key == null
  4860. // same constructor may get registered as different local components
  4861. // so cid alone is not enough (#3269)
  4862. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4863. : vnode.key;
  4864. if (cache[key]) {
  4865. vnode.componentInstance = cache[key].componentInstance;
  4866. // make current key freshest
  4867. remove(keys, key);
  4868. keys.push(key);
  4869. } else {
  4870. cache[key] = vnode;
  4871. keys.push(key);
  4872. // prune oldest entry
  4873. if (this.max && keys.length > parseInt(this.max)) {
  4874. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4875. }
  4876. }
  4877. vnode.data.keepAlive = true;
  4878. }
  4879. return vnode || (slot && slot[0])
  4880. }
  4881. };
  4882. var builtInComponents = {
  4883. KeepAlive: KeepAlive
  4884. };
  4885. /* */
  4886. function initGlobalAPI (Vue) {
  4887. // config
  4888. var configDef = {};
  4889. configDef.get = function () { return config; };
  4890. if (process.env.NODE_ENV !== 'production') {
  4891. configDef.set = function () {
  4892. warn(
  4893. 'Do not replace the Vue.config object, set individual fields instead.'
  4894. );
  4895. };
  4896. }
  4897. Object.defineProperty(Vue, 'config', configDef);
  4898. // exposed util methods.
  4899. // NOTE: these are not considered part of the public API - avoid relying on
  4900. // them unless you are aware of the risk.
  4901. Vue.util = {
  4902. warn: warn,
  4903. extend: extend,
  4904. mergeOptions: mergeOptions,
  4905. defineReactive: defineReactive$$1
  4906. };
  4907. Vue.set = set;
  4908. Vue.delete = del;
  4909. Vue.nextTick = nextTick;
  4910. // 2.6 explicit observable API
  4911. Vue.observable = function (obj) {
  4912. observe(obj);
  4913. return obj
  4914. };
  4915. Vue.options = Object.create(null);
  4916. ASSET_TYPES.forEach(function (type) {
  4917. Vue.options[type + 's'] = Object.create(null);
  4918. });
  4919. // this is used to identify the "base" constructor to extend all plain-object
  4920. // components with in Weex's multi-instance scenarios.
  4921. Vue.options._base = Vue;
  4922. extend(Vue.options.components, builtInComponents);
  4923. initUse(Vue);
  4924. initMixin$1(Vue);
  4925. initExtend(Vue);
  4926. initAssetRegisters(Vue);
  4927. }
  4928. initGlobalAPI(Vue);
  4929. Object.defineProperty(Vue.prototype, '$isServer', {
  4930. get: isServerRendering
  4931. });
  4932. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4933. get: function get () {
  4934. /* istanbul ignore next */
  4935. return this.$vnode && this.$vnode.ssrContext
  4936. }
  4937. });
  4938. // expose FunctionalRenderContext for ssr runtime helper installation
  4939. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4940. value: FunctionalRenderContext
  4941. });
  4942. Vue.version = '2.6.10';
  4943. /* */
  4944. // these are reserved for web because they are directly compiled away
  4945. // during template compilation
  4946. var isReservedAttr = makeMap('style,class');
  4947. // attributes that should be using props for binding
  4948. var acceptValue = makeMap('input,textarea,option,select,progress');
  4949. var mustUseProp = function (tag, type, attr) {
  4950. return (
  4951. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4952. (attr === 'selected' && tag === 'option') ||
  4953. (attr === 'checked' && tag === 'input') ||
  4954. (attr === 'muted' && tag === 'video')
  4955. )
  4956. };
  4957. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4958. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4959. var convertEnumeratedValue = function (key, value) {
  4960. return isFalsyAttrValue(value) || value === 'false'
  4961. ? 'false'
  4962. // allow arbitrary string value for contenteditable
  4963. : key === 'contenteditable' && isValidContentEditableValue(value)
  4964. ? value
  4965. : 'true'
  4966. };
  4967. var isBooleanAttr = makeMap(
  4968. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4969. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4970. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4971. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4972. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4973. 'truespeed,typemustmatch,visible'
  4974. );
  4975. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4976. var isXlink = function (name) {
  4977. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4978. };
  4979. var getXlinkProp = function (name) {
  4980. return isXlink(name) ? name.slice(6, name.length) : ''
  4981. };
  4982. var isFalsyAttrValue = function (val) {
  4983. return val == null || val === false
  4984. };
  4985. /* */
  4986. function genClassForVnode (vnode) {
  4987. var data = vnode.data;
  4988. var parentNode = vnode;
  4989. var childNode = vnode;
  4990. while (isDef(childNode.componentInstance)) {
  4991. childNode = childNode.componentInstance._vnode;
  4992. if (childNode && childNode.data) {
  4993. data = mergeClassData(childNode.data, data);
  4994. }
  4995. }
  4996. while (isDef(parentNode = parentNode.parent)) {
  4997. if (parentNode && parentNode.data) {
  4998. data = mergeClassData(data, parentNode.data);
  4999. }
  5000. }
  5001. return renderClass(data.staticClass, data.class)
  5002. }
  5003. function mergeClassData (child, parent) {
  5004. return {
  5005. staticClass: concat(child.staticClass, parent.staticClass),
  5006. class: isDef(child.class)
  5007. ? [child.class, parent.class]
  5008. : parent.class
  5009. }
  5010. }
  5011. function renderClass (
  5012. staticClass,
  5013. dynamicClass
  5014. ) {
  5015. if (isDef(staticClass) || isDef(dynamicClass)) {
  5016. return concat(staticClass, stringifyClass(dynamicClass))
  5017. }
  5018. /* istanbul ignore next */
  5019. return ''
  5020. }
  5021. function concat (a, b) {
  5022. return a ? b ? (a + ' ' + b) : a : (b || '')
  5023. }
  5024. function stringifyClass (value) {
  5025. if (Array.isArray(value)) {
  5026. return stringifyArray(value)
  5027. }
  5028. if (isObject(value)) {
  5029. return stringifyObject(value)
  5030. }
  5031. if (typeof value === 'string') {
  5032. return value
  5033. }
  5034. /* istanbul ignore next */
  5035. return ''
  5036. }
  5037. function stringifyArray (value) {
  5038. var res = '';
  5039. var stringified;
  5040. for (var i = 0, l = value.length; i < l; i++) {
  5041. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5042. if (res) { res += ' '; }
  5043. res += stringified;
  5044. }
  5045. }
  5046. return res
  5047. }
  5048. function stringifyObject (value) {
  5049. var res = '';
  5050. for (var key in value) {
  5051. if (value[key]) {
  5052. if (res) { res += ' '; }
  5053. res += key;
  5054. }
  5055. }
  5056. return res
  5057. }
  5058. /* */
  5059. var namespaceMap = {
  5060. svg: 'http://www.w3.org/2000/svg',
  5061. math: 'http://www.w3.org/1998/Math/MathML'
  5062. };
  5063. var isHTMLTag = makeMap(
  5064. 'html,body,base,head,link,meta,style,title,' +
  5065. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5066. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5067. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5068. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5069. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5070. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5071. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5072. 'output,progress,select,textarea,' +
  5073. 'details,dialog,menu,menuitem,summary,' +
  5074. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5075. );
  5076. // this map is intentionally selective, only covering SVG elements that may
  5077. // contain child elements.
  5078. var isSVG = makeMap(
  5079. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5080. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5081. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5082. true
  5083. );
  5084. var isPreTag = function (tag) { return tag === 'pre'; };
  5085. var isReservedTag = function (tag) {
  5086. return isHTMLTag(tag) || isSVG(tag)
  5087. };
  5088. function getTagNamespace (tag) {
  5089. if (isSVG(tag)) {
  5090. return 'svg'
  5091. }
  5092. // basic support for MathML
  5093. // note it doesn't support other MathML elements being component roots
  5094. if (tag === 'math') {
  5095. return 'math'
  5096. }
  5097. }
  5098. var unknownElementCache = Object.create(null);
  5099. function isUnknownElement (tag) {
  5100. /* istanbul ignore if */
  5101. if (!inBrowser) {
  5102. return true
  5103. }
  5104. if (isReservedTag(tag)) {
  5105. return false
  5106. }
  5107. tag = tag.toLowerCase();
  5108. /* istanbul ignore if */
  5109. if (unknownElementCache[tag] != null) {
  5110. return unknownElementCache[tag]
  5111. }
  5112. var el = document.createElement(tag);
  5113. if (tag.indexOf('-') > -1) {
  5114. // http://stackoverflow.com/a/28210364/1070244
  5115. return (unknownElementCache[tag] = (
  5116. el.constructor === window.HTMLUnknownElement ||
  5117. el.constructor === window.HTMLElement
  5118. ))
  5119. } else {
  5120. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5121. }
  5122. }
  5123. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5124. /* */
  5125. /**
  5126. * Query an element selector if it's not an element already.
  5127. */
  5128. function query (el) {
  5129. if (typeof el === 'string') {
  5130. var selected = document.querySelector(el);
  5131. if (!selected) {
  5132. process.env.NODE_ENV !== 'production' && warn(
  5133. 'Cannot find element: ' + el
  5134. );
  5135. return document.createElement('div')
  5136. }
  5137. return selected
  5138. } else {
  5139. return el
  5140. }
  5141. }
  5142. /* */
  5143. function createElement$1 (tagName, vnode) {
  5144. var elm = document.createElement(tagName);
  5145. if (tagName !== 'select') {
  5146. return elm
  5147. }
  5148. // false or null will remove the attribute but undefined will not
  5149. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5150. elm.setAttribute('multiple', 'multiple');
  5151. }
  5152. return elm
  5153. }
  5154. function createElementNS (namespace, tagName) {
  5155. return document.createElementNS(namespaceMap[namespace], tagName)
  5156. }
  5157. function createTextNode (text) {
  5158. return document.createTextNode(text)
  5159. }
  5160. function createComment (text) {
  5161. return document.createComment(text)
  5162. }
  5163. function insertBefore (parentNode, newNode, referenceNode) {
  5164. parentNode.insertBefore(newNode, referenceNode);
  5165. }
  5166. function removeChild (node, child) {
  5167. node.removeChild(child);
  5168. }
  5169. function appendChild (node, child) {
  5170. node.appendChild(child);
  5171. }
  5172. function parentNode (node) {
  5173. return node.parentNode
  5174. }
  5175. function nextSibling (node) {
  5176. return node.nextSibling
  5177. }
  5178. function tagName (node) {
  5179. return node.tagName
  5180. }
  5181. function setTextContent (node, text) {
  5182. node.textContent = text;
  5183. }
  5184. function setStyleScope (node, scopeId) {
  5185. node.setAttribute(scopeId, '');
  5186. }
  5187. var nodeOps = /*#__PURE__*/Object.freeze({
  5188. createElement: createElement$1,
  5189. createElementNS: createElementNS,
  5190. createTextNode: createTextNode,
  5191. createComment: createComment,
  5192. insertBefore: insertBefore,
  5193. removeChild: removeChild,
  5194. appendChild: appendChild,
  5195. parentNode: parentNode,
  5196. nextSibling: nextSibling,
  5197. tagName: tagName,
  5198. setTextContent: setTextContent,
  5199. setStyleScope: setStyleScope
  5200. });
  5201. /* */
  5202. var ref = {
  5203. create: function create (_, vnode) {
  5204. registerRef(vnode);
  5205. },
  5206. update: function update (oldVnode, vnode) {
  5207. if (oldVnode.data.ref !== vnode.data.ref) {
  5208. registerRef(oldVnode, true);
  5209. registerRef(vnode);
  5210. }
  5211. },
  5212. destroy: function destroy (vnode) {
  5213. registerRef(vnode, true);
  5214. }
  5215. };
  5216. function registerRef (vnode, isRemoval) {
  5217. var key = vnode.data.ref;
  5218. if (!isDef(key)) { return }
  5219. var vm = vnode.context;
  5220. var ref = vnode.componentInstance || vnode.elm;
  5221. var refs = vm.$refs;
  5222. if (isRemoval) {
  5223. if (Array.isArray(refs[key])) {
  5224. remove(refs[key], ref);
  5225. } else if (refs[key] === ref) {
  5226. refs[key] = undefined;
  5227. }
  5228. } else {
  5229. if (vnode.data.refInFor) {
  5230. if (!Array.isArray(refs[key])) {
  5231. refs[key] = [ref];
  5232. } else if (refs[key].indexOf(ref) < 0) {
  5233. // $flow-disable-line
  5234. refs[key].push(ref);
  5235. }
  5236. } else {
  5237. refs[key] = ref;
  5238. }
  5239. }
  5240. }
  5241. /**
  5242. * Virtual DOM patching algorithm based on Snabbdom by
  5243. * Simon Friis Vindum (@paldepind)
  5244. * Licensed under the MIT License
  5245. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5246. *
  5247. * modified by Evan You (@yyx990803)
  5248. *
  5249. * Not type-checking this because this file is perf-critical and the cost
  5250. * of making flow understand it is not worth it.
  5251. */
  5252. var emptyNode = new VNode('', {}, []);
  5253. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5254. function sameVnode (a, b) {
  5255. return (
  5256. a.key === b.key && (
  5257. (
  5258. a.tag === b.tag &&
  5259. a.isComment === b.isComment &&
  5260. isDef(a.data) === isDef(b.data) &&
  5261. sameInputType(a, b)
  5262. ) || (
  5263. isTrue(a.isAsyncPlaceholder) &&
  5264. a.asyncFactory === b.asyncFactory &&
  5265. isUndef(b.asyncFactory.error)
  5266. )
  5267. )
  5268. )
  5269. }
  5270. function sameInputType (a, b) {
  5271. if (a.tag !== 'input') { return true }
  5272. var i;
  5273. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5274. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5275. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5276. }
  5277. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5278. var i, key;
  5279. var map = {};
  5280. for (i = beginIdx; i <= endIdx; ++i) {
  5281. key = children[i].key;
  5282. if (isDef(key)) { map[key] = i; }
  5283. }
  5284. return map
  5285. }
  5286. function createPatchFunction (backend) {
  5287. var i, j;
  5288. var cbs = {};
  5289. var modules = backend.modules;
  5290. var nodeOps = backend.nodeOps;
  5291. for (i = 0; i < hooks.length; ++i) {
  5292. cbs[hooks[i]] = [];
  5293. for (j = 0; j < modules.length; ++j) {
  5294. if (isDef(modules[j][hooks[i]])) {
  5295. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5296. }
  5297. }
  5298. }
  5299. function emptyNodeAt (elm) {
  5300. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5301. }
  5302. function createRmCb (childElm, listeners) {
  5303. function remove$$1 () {
  5304. if (--remove$$1.listeners === 0) {
  5305. removeNode(childElm);
  5306. }
  5307. }
  5308. remove$$1.listeners = listeners;
  5309. return remove$$1
  5310. }
  5311. function removeNode (el) {
  5312. var parent = nodeOps.parentNode(el);
  5313. // element may have already been removed due to v-html / v-text
  5314. if (isDef(parent)) {
  5315. nodeOps.removeChild(parent, el);
  5316. }
  5317. }
  5318. function isUnknownElement$$1 (vnode, inVPre) {
  5319. return (
  5320. !inVPre &&
  5321. !vnode.ns &&
  5322. !(
  5323. config.ignoredElements.length &&
  5324. config.ignoredElements.some(function (ignore) {
  5325. return isRegExp(ignore)
  5326. ? ignore.test(vnode.tag)
  5327. : ignore === vnode.tag
  5328. })
  5329. ) &&
  5330. config.isUnknownElement(vnode.tag)
  5331. )
  5332. }
  5333. var creatingElmInVPre = 0;
  5334. function createElm (
  5335. vnode,
  5336. insertedVnodeQueue,
  5337. parentElm,
  5338. refElm,
  5339. nested,
  5340. ownerArray,
  5341. index
  5342. ) {
  5343. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5344. // This vnode was used in a previous render!
  5345. // now it's used as a new node, overwriting its elm would cause
  5346. // potential patch errors down the road when it's used as an insertion
  5347. // reference node. Instead, we clone the node on-demand before creating
  5348. // associated DOM element for it.
  5349. vnode = ownerArray[index] = cloneVNode(vnode);
  5350. }
  5351. vnode.isRootInsert = !nested; // for transition enter check
  5352. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5353. return
  5354. }
  5355. var data = vnode.data;
  5356. var children = vnode.children;
  5357. var tag = vnode.tag;
  5358. if (isDef(tag)) {
  5359. if (process.env.NODE_ENV !== 'production') {
  5360. if (data && data.pre) {
  5361. creatingElmInVPre++;
  5362. }
  5363. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5364. warn(
  5365. 'Unknown custom element: <' + tag + '> - did you ' +
  5366. 'register the component correctly? For recursive components, ' +
  5367. 'make sure to provide the "name" option.',
  5368. vnode.context
  5369. );
  5370. }
  5371. }
  5372. vnode.elm = vnode.ns
  5373. ? nodeOps.createElementNS(vnode.ns, tag)
  5374. : nodeOps.createElement(tag, vnode);
  5375. setScope(vnode);
  5376. /* istanbul ignore if */
  5377. {
  5378. createChildren(vnode, children, insertedVnodeQueue);
  5379. if (isDef(data)) {
  5380. invokeCreateHooks(vnode, insertedVnodeQueue);
  5381. }
  5382. insert(parentElm, vnode.elm, refElm);
  5383. }
  5384. if (process.env.NODE_ENV !== 'production' && data && data.pre) {
  5385. creatingElmInVPre--;
  5386. }
  5387. } else if (isTrue(vnode.isComment)) {
  5388. vnode.elm = nodeOps.createComment(vnode.text);
  5389. insert(parentElm, vnode.elm, refElm);
  5390. } else {
  5391. vnode.elm = nodeOps.createTextNode(vnode.text);
  5392. insert(parentElm, vnode.elm, refElm);
  5393. }
  5394. }
  5395. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5396. var i = vnode.data;
  5397. if (isDef(i)) {
  5398. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5399. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5400. i(vnode, false /* hydrating */);
  5401. }
  5402. // after calling the init hook, if the vnode is a child component
  5403. // it should've created a child instance and mounted it. the child
  5404. // component also has set the placeholder vnode's elm.
  5405. // in that case we can just return the element and be done.
  5406. if (isDef(vnode.componentInstance)) {
  5407. initComponent(vnode, insertedVnodeQueue);
  5408. insert(parentElm, vnode.elm, refElm);
  5409. if (isTrue(isReactivated)) {
  5410. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5411. }
  5412. return true
  5413. }
  5414. }
  5415. }
  5416. function initComponent (vnode, insertedVnodeQueue) {
  5417. if (isDef(vnode.data.pendingInsert)) {
  5418. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5419. vnode.data.pendingInsert = null;
  5420. }
  5421. vnode.elm = vnode.componentInstance.$el;
  5422. if (isPatchable(vnode)) {
  5423. invokeCreateHooks(vnode, insertedVnodeQueue);
  5424. setScope(vnode);
  5425. } else {
  5426. // empty component root.
  5427. // skip all element-related modules except for ref (#3455)
  5428. registerRef(vnode);
  5429. // make sure to invoke the insert hook
  5430. insertedVnodeQueue.push(vnode);
  5431. }
  5432. }
  5433. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5434. var i;
  5435. // hack for #4339: a reactivated component with inner transition
  5436. // does not trigger because the inner node's created hooks are not called
  5437. // again. It's not ideal to involve module-specific logic in here but
  5438. // there doesn't seem to be a better way to do it.
  5439. var innerNode = vnode;
  5440. while (innerNode.componentInstance) {
  5441. innerNode = innerNode.componentInstance._vnode;
  5442. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5443. for (i = 0; i < cbs.activate.length; ++i) {
  5444. cbs.activate[i](emptyNode, innerNode);
  5445. }
  5446. insertedVnodeQueue.push(innerNode);
  5447. break
  5448. }
  5449. }
  5450. // unlike a newly created component,
  5451. // a reactivated keep-alive component doesn't insert itself
  5452. insert(parentElm, vnode.elm, refElm);
  5453. }
  5454. function insert (parent, elm, ref$$1) {
  5455. if (isDef(parent)) {
  5456. if (isDef(ref$$1)) {
  5457. if (nodeOps.parentNode(ref$$1) === parent) {
  5458. nodeOps.insertBefore(parent, elm, ref$$1);
  5459. }
  5460. } else {
  5461. nodeOps.appendChild(parent, elm);
  5462. }
  5463. }
  5464. }
  5465. function createChildren (vnode, children, insertedVnodeQueue) {
  5466. if (Array.isArray(children)) {
  5467. if (process.env.NODE_ENV !== 'production') {
  5468. checkDuplicateKeys(children);
  5469. }
  5470. for (var i = 0; i < children.length; ++i) {
  5471. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5472. }
  5473. } else if (isPrimitive(vnode.text)) {
  5474. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5475. }
  5476. }
  5477. function isPatchable (vnode) {
  5478. while (vnode.componentInstance) {
  5479. vnode = vnode.componentInstance._vnode;
  5480. }
  5481. return isDef(vnode.tag)
  5482. }
  5483. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5484. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5485. cbs.create[i$1](emptyNode, vnode);
  5486. }
  5487. i = vnode.data.hook; // Reuse variable
  5488. if (isDef(i)) {
  5489. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5490. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5491. }
  5492. }
  5493. // set scope id attribute for scoped CSS.
  5494. // this is implemented as a special case to avoid the overhead
  5495. // of going through the normal attribute patching process.
  5496. function setScope (vnode) {
  5497. var i;
  5498. if (isDef(i = vnode.fnScopeId)) {
  5499. nodeOps.setStyleScope(vnode.elm, i);
  5500. } else {
  5501. var ancestor = vnode;
  5502. while (ancestor) {
  5503. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5504. nodeOps.setStyleScope(vnode.elm, i);
  5505. }
  5506. ancestor = ancestor.parent;
  5507. }
  5508. }
  5509. // for slot content they should also get the scopeId from the host instance.
  5510. if (isDef(i = activeInstance) &&
  5511. i !== vnode.context &&
  5512. i !== vnode.fnContext &&
  5513. isDef(i = i.$options._scopeId)
  5514. ) {
  5515. nodeOps.setStyleScope(vnode.elm, i);
  5516. }
  5517. }
  5518. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5519. for (; startIdx <= endIdx; ++startIdx) {
  5520. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5521. }
  5522. }
  5523. function invokeDestroyHook (vnode) {
  5524. var i, j;
  5525. var data = vnode.data;
  5526. if (isDef(data)) {
  5527. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5528. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5529. }
  5530. if (isDef(i = vnode.children)) {
  5531. for (j = 0; j < vnode.children.length; ++j) {
  5532. invokeDestroyHook(vnode.children[j]);
  5533. }
  5534. }
  5535. }
  5536. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5537. for (; startIdx <= endIdx; ++startIdx) {
  5538. var ch = vnodes[startIdx];
  5539. if (isDef(ch)) {
  5540. if (isDef(ch.tag)) {
  5541. removeAndInvokeRemoveHook(ch);
  5542. invokeDestroyHook(ch);
  5543. } else { // Text node
  5544. removeNode(ch.elm);
  5545. }
  5546. }
  5547. }
  5548. }
  5549. function removeAndInvokeRemoveHook (vnode, rm) {
  5550. if (isDef(rm) || isDef(vnode.data)) {
  5551. var i;
  5552. var listeners = cbs.remove.length + 1;
  5553. if (isDef(rm)) {
  5554. // we have a recursively passed down rm callback
  5555. // increase the listeners count
  5556. rm.listeners += listeners;
  5557. } else {
  5558. // directly removing
  5559. rm = createRmCb(vnode.elm, listeners);
  5560. }
  5561. // recursively invoke hooks on child component root node
  5562. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5563. removeAndInvokeRemoveHook(i, rm);
  5564. }
  5565. for (i = 0; i < cbs.remove.length; ++i) {
  5566. cbs.remove[i](vnode, rm);
  5567. }
  5568. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5569. i(vnode, rm);
  5570. } else {
  5571. rm();
  5572. }
  5573. } else {
  5574. removeNode(vnode.elm);
  5575. }
  5576. }
  5577. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5578. var oldStartIdx = 0;
  5579. var newStartIdx = 0;
  5580. var oldEndIdx = oldCh.length - 1;
  5581. var oldStartVnode = oldCh[0];
  5582. var oldEndVnode = oldCh[oldEndIdx];
  5583. var newEndIdx = newCh.length - 1;
  5584. var newStartVnode = newCh[0];
  5585. var newEndVnode = newCh[newEndIdx];
  5586. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5587. // removeOnly is a special flag used only by <transition-group>
  5588. // to ensure removed elements stay in correct relative positions
  5589. // during leaving transitions
  5590. var canMove = !removeOnly;
  5591. if (process.env.NODE_ENV !== 'production') {
  5592. checkDuplicateKeys(newCh);
  5593. }
  5594. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5595. if (isUndef(oldStartVnode)) {
  5596. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5597. } else if (isUndef(oldEndVnode)) {
  5598. oldEndVnode = oldCh[--oldEndIdx];
  5599. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5600. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5601. oldStartVnode = oldCh[++oldStartIdx];
  5602. newStartVnode = newCh[++newStartIdx];
  5603. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5604. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5605. oldEndVnode = oldCh[--oldEndIdx];
  5606. newEndVnode = newCh[--newEndIdx];
  5607. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5608. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5609. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5610. oldStartVnode = oldCh[++oldStartIdx];
  5611. newEndVnode = newCh[--newEndIdx];
  5612. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5613. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5614. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5615. oldEndVnode = oldCh[--oldEndIdx];
  5616. newStartVnode = newCh[++newStartIdx];
  5617. } else {
  5618. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5619. idxInOld = isDef(newStartVnode.key)
  5620. ? oldKeyToIdx[newStartVnode.key]
  5621. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5622. if (isUndef(idxInOld)) { // New element
  5623. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5624. } else {
  5625. vnodeToMove = oldCh[idxInOld];
  5626. if (sameVnode(vnodeToMove, newStartVnode)) {
  5627. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5628. oldCh[idxInOld] = undefined;
  5629. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5630. } else {
  5631. // same key but different element. treat as new element
  5632. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5633. }
  5634. }
  5635. newStartVnode = newCh[++newStartIdx];
  5636. }
  5637. }
  5638. if (oldStartIdx > oldEndIdx) {
  5639. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5640. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5641. } else if (newStartIdx > newEndIdx) {
  5642. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5643. }
  5644. }
  5645. function checkDuplicateKeys (children) {
  5646. var seenKeys = {};
  5647. for (var i = 0; i < children.length; i++) {
  5648. var vnode = children[i];
  5649. var key = vnode.key;
  5650. if (isDef(key)) {
  5651. if (seenKeys[key]) {
  5652. warn(
  5653. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5654. vnode.context
  5655. );
  5656. } else {
  5657. seenKeys[key] = true;
  5658. }
  5659. }
  5660. }
  5661. }
  5662. function findIdxInOld (node, oldCh, start, end) {
  5663. for (var i = start; i < end; i++) {
  5664. var c = oldCh[i];
  5665. if (isDef(c) && sameVnode(node, c)) { return i }
  5666. }
  5667. }
  5668. function patchVnode (
  5669. oldVnode,
  5670. vnode,
  5671. insertedVnodeQueue,
  5672. ownerArray,
  5673. index,
  5674. removeOnly
  5675. ) {
  5676. if (oldVnode === vnode) {
  5677. return
  5678. }
  5679. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5680. // clone reused vnode
  5681. vnode = ownerArray[index] = cloneVNode(vnode);
  5682. }
  5683. var elm = vnode.elm = oldVnode.elm;
  5684. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5685. if (isDef(vnode.asyncFactory.resolved)) {
  5686. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5687. } else {
  5688. vnode.isAsyncPlaceholder = true;
  5689. }
  5690. return
  5691. }
  5692. // reuse element for static trees.
  5693. // note we only do this if the vnode is cloned -
  5694. // if the new node is not cloned it means the render functions have been
  5695. // reset by the hot-reload-api and we need to do a proper re-render.
  5696. if (isTrue(vnode.isStatic) &&
  5697. isTrue(oldVnode.isStatic) &&
  5698. vnode.key === oldVnode.key &&
  5699. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5700. ) {
  5701. vnode.componentInstance = oldVnode.componentInstance;
  5702. return
  5703. }
  5704. var i;
  5705. var data = vnode.data;
  5706. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5707. i(oldVnode, vnode);
  5708. }
  5709. var oldCh = oldVnode.children;
  5710. var ch = vnode.children;
  5711. if (isDef(data) && isPatchable(vnode)) {
  5712. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5713. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5714. }
  5715. if (isUndef(vnode.text)) {
  5716. if (isDef(oldCh) && isDef(ch)) {
  5717. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5718. } else if (isDef(ch)) {
  5719. if (process.env.NODE_ENV !== 'production') {
  5720. checkDuplicateKeys(ch);
  5721. }
  5722. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5723. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5724. } else if (isDef(oldCh)) {
  5725. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5726. } else if (isDef(oldVnode.text)) {
  5727. nodeOps.setTextContent(elm, '');
  5728. }
  5729. } else if (oldVnode.text !== vnode.text) {
  5730. nodeOps.setTextContent(elm, vnode.text);
  5731. }
  5732. if (isDef(data)) {
  5733. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5734. }
  5735. }
  5736. function invokeInsertHook (vnode, queue, initial) {
  5737. // delay insert hooks for component root nodes, invoke them after the
  5738. // element is really inserted
  5739. if (isTrue(initial) && isDef(vnode.parent)) {
  5740. vnode.parent.data.pendingInsert = queue;
  5741. } else {
  5742. for (var i = 0; i < queue.length; ++i) {
  5743. queue[i].data.hook.insert(queue[i]);
  5744. }
  5745. }
  5746. }
  5747. var hydrationBailed = false;
  5748. // list of modules that can skip create hook during hydration because they
  5749. // are already rendered on the client or has no need for initialization
  5750. // Note: style is excluded because it relies on initial clone for future
  5751. // deep updates (#7063).
  5752. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5753. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5754. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5755. var i;
  5756. var tag = vnode.tag;
  5757. var data = vnode.data;
  5758. var children = vnode.children;
  5759. inVPre = inVPre || (data && data.pre);
  5760. vnode.elm = elm;
  5761. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5762. vnode.isAsyncPlaceholder = true;
  5763. return true
  5764. }
  5765. // assert node match
  5766. if (process.env.NODE_ENV !== 'production') {
  5767. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5768. return false
  5769. }
  5770. }
  5771. if (isDef(data)) {
  5772. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5773. if (isDef(i = vnode.componentInstance)) {
  5774. // child component. it should have hydrated its own tree.
  5775. initComponent(vnode, insertedVnodeQueue);
  5776. return true
  5777. }
  5778. }
  5779. if (isDef(tag)) {
  5780. if (isDef(children)) {
  5781. // empty element, allow client to pick up and populate children
  5782. if (!elm.hasChildNodes()) {
  5783. createChildren(vnode, children, insertedVnodeQueue);
  5784. } else {
  5785. // v-html and domProps: innerHTML
  5786. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5787. if (i !== elm.innerHTML) {
  5788. /* istanbul ignore if */
  5789. if (process.env.NODE_ENV !== 'production' &&
  5790. typeof console !== 'undefined' &&
  5791. !hydrationBailed
  5792. ) {
  5793. hydrationBailed = true;
  5794. console.warn('Parent: ', elm);
  5795. console.warn('server innerHTML: ', i);
  5796. console.warn('client innerHTML: ', elm.innerHTML);
  5797. }
  5798. return false
  5799. }
  5800. } else {
  5801. // iterate and compare children lists
  5802. var childrenMatch = true;
  5803. var childNode = elm.firstChild;
  5804. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5805. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5806. childrenMatch = false;
  5807. break
  5808. }
  5809. childNode = childNode.nextSibling;
  5810. }
  5811. // if childNode is not null, it means the actual childNodes list is
  5812. // longer than the virtual children list.
  5813. if (!childrenMatch || childNode) {
  5814. /* istanbul ignore if */
  5815. if (process.env.NODE_ENV !== 'production' &&
  5816. typeof console !== 'undefined' &&
  5817. !hydrationBailed
  5818. ) {
  5819. hydrationBailed = true;
  5820. console.warn('Parent: ', elm);
  5821. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5822. }
  5823. return false
  5824. }
  5825. }
  5826. }
  5827. }
  5828. if (isDef(data)) {
  5829. var fullInvoke = false;
  5830. for (var key in data) {
  5831. if (!isRenderedModule(key)) {
  5832. fullInvoke = true;
  5833. invokeCreateHooks(vnode, insertedVnodeQueue);
  5834. break
  5835. }
  5836. }
  5837. if (!fullInvoke && data['class']) {
  5838. // ensure collecting deps for deep class bindings for future updates
  5839. traverse(data['class']);
  5840. }
  5841. }
  5842. } else if (elm.data !== vnode.text) {
  5843. elm.data = vnode.text;
  5844. }
  5845. return true
  5846. }
  5847. function assertNodeMatch (node, vnode, inVPre) {
  5848. if (isDef(vnode.tag)) {
  5849. return vnode.tag.indexOf('vue-component') === 0 || (
  5850. !isUnknownElement$$1(vnode, inVPre) &&
  5851. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5852. )
  5853. } else {
  5854. return node.nodeType === (vnode.isComment ? 8 : 3)
  5855. }
  5856. }
  5857. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5858. if (isUndef(vnode)) {
  5859. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5860. return
  5861. }
  5862. var isInitialPatch = false;
  5863. var insertedVnodeQueue = [];
  5864. if (isUndef(oldVnode)) {
  5865. // empty mount (likely as component), create new root element
  5866. isInitialPatch = true;
  5867. createElm(vnode, insertedVnodeQueue);
  5868. } else {
  5869. var isRealElement = isDef(oldVnode.nodeType);
  5870. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5871. // patch existing root node
  5872. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5873. } else {
  5874. if (isRealElement) {
  5875. // mounting to a real element
  5876. // check if this is server-rendered content and if we can perform
  5877. // a successful hydration.
  5878. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5879. oldVnode.removeAttribute(SSR_ATTR);
  5880. hydrating = true;
  5881. }
  5882. if (isTrue(hydrating)) {
  5883. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5884. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5885. return oldVnode
  5886. } else if (process.env.NODE_ENV !== 'production') {
  5887. warn(
  5888. 'The client-side rendered virtual DOM tree is not matching ' +
  5889. 'server-rendered content. This is likely caused by incorrect ' +
  5890. 'HTML markup, for example nesting block-level elements inside ' +
  5891. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5892. 'full client-side render.'
  5893. );
  5894. }
  5895. }
  5896. // either not server-rendered, or hydration failed.
  5897. // create an empty node and replace it
  5898. oldVnode = emptyNodeAt(oldVnode);
  5899. }
  5900. // replacing existing element
  5901. var oldElm = oldVnode.elm;
  5902. var parentElm = nodeOps.parentNode(oldElm);
  5903. // create new node
  5904. createElm(
  5905. vnode,
  5906. insertedVnodeQueue,
  5907. // extremely rare edge case: do not insert if old element is in a
  5908. // leaving transition. Only happens when combining transition +
  5909. // keep-alive + HOCs. (#4590)
  5910. oldElm._leaveCb ? null : parentElm,
  5911. nodeOps.nextSibling(oldElm)
  5912. );
  5913. // update parent placeholder node element, recursively
  5914. if (isDef(vnode.parent)) {
  5915. var ancestor = vnode.parent;
  5916. var patchable = isPatchable(vnode);
  5917. while (ancestor) {
  5918. for (var i = 0; i < cbs.destroy.length; ++i) {
  5919. cbs.destroy[i](ancestor);
  5920. }
  5921. ancestor.elm = vnode.elm;
  5922. if (patchable) {
  5923. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5924. cbs.create[i$1](emptyNode, ancestor);
  5925. }
  5926. // #6513
  5927. // invoke insert hooks that may have been merged by create hooks.
  5928. // e.g. for directives that uses the "inserted" hook.
  5929. var insert = ancestor.data.hook.insert;
  5930. if (insert.merged) {
  5931. // start at index 1 to avoid re-invoking component mounted hook
  5932. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5933. insert.fns[i$2]();
  5934. }
  5935. }
  5936. } else {
  5937. registerRef(ancestor);
  5938. }
  5939. ancestor = ancestor.parent;
  5940. }
  5941. }
  5942. // destroy old node
  5943. if (isDef(parentElm)) {
  5944. removeVnodes(parentElm, [oldVnode], 0, 0);
  5945. } else if (isDef(oldVnode.tag)) {
  5946. invokeDestroyHook(oldVnode);
  5947. }
  5948. }
  5949. }
  5950. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5951. return vnode.elm
  5952. }
  5953. }
  5954. /* */
  5955. var directives = {
  5956. create: updateDirectives,
  5957. update: updateDirectives,
  5958. destroy: function unbindDirectives (vnode) {
  5959. updateDirectives(vnode, emptyNode);
  5960. }
  5961. };
  5962. function updateDirectives (oldVnode, vnode) {
  5963. if (oldVnode.data.directives || vnode.data.directives) {
  5964. _update(oldVnode, vnode);
  5965. }
  5966. }
  5967. function _update (oldVnode, vnode) {
  5968. var isCreate = oldVnode === emptyNode;
  5969. var isDestroy = vnode === emptyNode;
  5970. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5971. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5972. var dirsWithInsert = [];
  5973. var dirsWithPostpatch = [];
  5974. var key, oldDir, dir;
  5975. for (key in newDirs) {
  5976. oldDir = oldDirs[key];
  5977. dir = newDirs[key];
  5978. if (!oldDir) {
  5979. // new directive, bind
  5980. callHook$1(dir, 'bind', vnode, oldVnode);
  5981. if (dir.def && dir.def.inserted) {
  5982. dirsWithInsert.push(dir);
  5983. }
  5984. } else {
  5985. // existing directive, update
  5986. dir.oldValue = oldDir.value;
  5987. dir.oldArg = oldDir.arg;
  5988. callHook$1(dir, 'update', vnode, oldVnode);
  5989. if (dir.def && dir.def.componentUpdated) {
  5990. dirsWithPostpatch.push(dir);
  5991. }
  5992. }
  5993. }
  5994. if (dirsWithInsert.length) {
  5995. var callInsert = function () {
  5996. for (var i = 0; i < dirsWithInsert.length; i++) {
  5997. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5998. }
  5999. };
  6000. if (isCreate) {
  6001. mergeVNodeHook(vnode, 'insert', callInsert);
  6002. } else {
  6003. callInsert();
  6004. }
  6005. }
  6006. if (dirsWithPostpatch.length) {
  6007. mergeVNodeHook(vnode, 'postpatch', function () {
  6008. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  6009. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  6010. }
  6011. });
  6012. }
  6013. if (!isCreate) {
  6014. for (key in oldDirs) {
  6015. if (!newDirs[key]) {
  6016. // no longer present, unbind
  6017. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6018. }
  6019. }
  6020. }
  6021. }
  6022. var emptyModifiers = Object.create(null);
  6023. function normalizeDirectives$1 (
  6024. dirs,
  6025. vm
  6026. ) {
  6027. var res = Object.create(null);
  6028. if (!dirs) {
  6029. // $flow-disable-line
  6030. return res
  6031. }
  6032. var i, dir;
  6033. for (i = 0; i < dirs.length; i++) {
  6034. dir = dirs[i];
  6035. if (!dir.modifiers) {
  6036. // $flow-disable-line
  6037. dir.modifiers = emptyModifiers;
  6038. }
  6039. res[getRawDirName(dir)] = dir;
  6040. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6041. }
  6042. // $flow-disable-line
  6043. return res
  6044. }
  6045. function getRawDirName (dir) {
  6046. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6047. }
  6048. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6049. var fn = dir.def && dir.def[hook];
  6050. if (fn) {
  6051. try {
  6052. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6053. } catch (e) {
  6054. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6055. }
  6056. }
  6057. }
  6058. var baseModules = [
  6059. ref,
  6060. directives
  6061. ];
  6062. /* */
  6063. function updateAttrs (oldVnode, vnode) {
  6064. var opts = vnode.componentOptions;
  6065. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6066. return
  6067. }
  6068. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6069. return
  6070. }
  6071. var key, cur, old;
  6072. var elm = vnode.elm;
  6073. var oldAttrs = oldVnode.data.attrs || {};
  6074. var attrs = vnode.data.attrs || {};
  6075. // clone observed objects, as the user probably wants to mutate it
  6076. if (isDef(attrs.__ob__)) {
  6077. attrs = vnode.data.attrs = extend({}, attrs);
  6078. }
  6079. for (key in attrs) {
  6080. cur = attrs[key];
  6081. old = oldAttrs[key];
  6082. if (old !== cur) {
  6083. setAttr(elm, key, cur);
  6084. }
  6085. }
  6086. // #4391: in IE9, setting type can reset value for input[type=radio]
  6087. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6088. /* istanbul ignore if */
  6089. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6090. setAttr(elm, 'value', attrs.value);
  6091. }
  6092. for (key in oldAttrs) {
  6093. if (isUndef(attrs[key])) {
  6094. if (isXlink(key)) {
  6095. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6096. } else if (!isEnumeratedAttr(key)) {
  6097. elm.removeAttribute(key);
  6098. }
  6099. }
  6100. }
  6101. }
  6102. function setAttr (el, key, value) {
  6103. if (el.tagName.indexOf('-') > -1) {
  6104. baseSetAttr(el, key, value);
  6105. } else if (isBooleanAttr(key)) {
  6106. // set attribute for blank value
  6107. // e.g. <option disabled>Select one</option>
  6108. if (isFalsyAttrValue(value)) {
  6109. el.removeAttribute(key);
  6110. } else {
  6111. // technically allowfullscreen is a boolean attribute for <iframe>,
  6112. // but Flash expects a value of "true" when used on <embed> tag
  6113. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6114. ? 'true'
  6115. : key;
  6116. el.setAttribute(key, value);
  6117. }
  6118. } else if (isEnumeratedAttr(key)) {
  6119. el.setAttribute(key, convertEnumeratedValue(key, value));
  6120. } else if (isXlink(key)) {
  6121. if (isFalsyAttrValue(value)) {
  6122. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6123. } else {
  6124. el.setAttributeNS(xlinkNS, key, value);
  6125. }
  6126. } else {
  6127. baseSetAttr(el, key, value);
  6128. }
  6129. }
  6130. function baseSetAttr (el, key, value) {
  6131. if (isFalsyAttrValue(value)) {
  6132. el.removeAttribute(key);
  6133. } else {
  6134. // #7138: IE10 & 11 fires input event when setting placeholder on
  6135. // <textarea>... block the first input event and remove the blocker
  6136. // immediately.
  6137. /* istanbul ignore if */
  6138. if (
  6139. isIE && !isIE9 &&
  6140. el.tagName === 'TEXTAREA' &&
  6141. key === 'placeholder' && value !== '' && !el.__ieph
  6142. ) {
  6143. var blocker = function (e) {
  6144. e.stopImmediatePropagation();
  6145. el.removeEventListener('input', blocker);
  6146. };
  6147. el.addEventListener('input', blocker);
  6148. // $flow-disable-line
  6149. el.__ieph = true; /* IE placeholder patched */
  6150. }
  6151. el.setAttribute(key, value);
  6152. }
  6153. }
  6154. var attrs = {
  6155. create: updateAttrs,
  6156. update: updateAttrs
  6157. };
  6158. /* */
  6159. function updateClass (oldVnode, vnode) {
  6160. var el = vnode.elm;
  6161. var data = vnode.data;
  6162. var oldData = oldVnode.data;
  6163. if (
  6164. isUndef(data.staticClass) &&
  6165. isUndef(data.class) && (
  6166. isUndef(oldData) || (
  6167. isUndef(oldData.staticClass) &&
  6168. isUndef(oldData.class)
  6169. )
  6170. )
  6171. ) {
  6172. return
  6173. }
  6174. var cls = genClassForVnode(vnode);
  6175. // handle transition classes
  6176. var transitionClass = el._transitionClasses;
  6177. if (isDef(transitionClass)) {
  6178. cls = concat(cls, stringifyClass(transitionClass));
  6179. }
  6180. // set the class
  6181. if (cls !== el._prevClass) {
  6182. el.setAttribute('class', cls);
  6183. el._prevClass = cls;
  6184. }
  6185. }
  6186. var klass = {
  6187. create: updateClass,
  6188. update: updateClass
  6189. };
  6190. /* */
  6191. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6192. function parseFilters (exp) {
  6193. var inSingle = false;
  6194. var inDouble = false;
  6195. var inTemplateString = false;
  6196. var inRegex = false;
  6197. var curly = 0;
  6198. var square = 0;
  6199. var paren = 0;
  6200. var lastFilterIndex = 0;
  6201. var c, prev, i, expression, filters;
  6202. for (i = 0; i < exp.length; i++) {
  6203. prev = c;
  6204. c = exp.charCodeAt(i);
  6205. if (inSingle) {
  6206. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  6207. } else if (inDouble) {
  6208. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  6209. } else if (inTemplateString) {
  6210. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  6211. } else if (inRegex) {
  6212. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  6213. } else if (
  6214. c === 0x7C && // pipe
  6215. exp.charCodeAt(i + 1) !== 0x7C &&
  6216. exp.charCodeAt(i - 1) !== 0x7C &&
  6217. !curly && !square && !paren
  6218. ) {
  6219. if (expression === undefined) {
  6220. // first filter, end of expression
  6221. lastFilterIndex = i + 1;
  6222. expression = exp.slice(0, i).trim();
  6223. } else {
  6224. pushFilter();
  6225. }
  6226. } else {
  6227. switch (c) {
  6228. case 0x22: inDouble = true; break // "
  6229. case 0x27: inSingle = true; break // '
  6230. case 0x60: inTemplateString = true; break // `
  6231. case 0x28: paren++; break // (
  6232. case 0x29: paren--; break // )
  6233. case 0x5B: square++; break // [
  6234. case 0x5D: square--; break // ]
  6235. case 0x7B: curly++; break // {
  6236. case 0x7D: curly--; break // }
  6237. }
  6238. if (c === 0x2f) { // /
  6239. var j = i - 1;
  6240. var p = (void 0);
  6241. // find first non-whitespace prev char
  6242. for (; j >= 0; j--) {
  6243. p = exp.charAt(j);
  6244. if (p !== ' ') { break }
  6245. }
  6246. if (!p || !validDivisionCharRE.test(p)) {
  6247. inRegex = true;
  6248. }
  6249. }
  6250. }
  6251. }
  6252. if (expression === undefined) {
  6253. expression = exp.slice(0, i).trim();
  6254. } else if (lastFilterIndex !== 0) {
  6255. pushFilter();
  6256. }
  6257. function pushFilter () {
  6258. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6259. lastFilterIndex = i + 1;
  6260. }
  6261. if (filters) {
  6262. for (i = 0; i < filters.length; i++) {
  6263. expression = wrapFilter(expression, filters[i]);
  6264. }
  6265. }
  6266. return expression
  6267. }
  6268. function wrapFilter (exp, filter) {
  6269. var i = filter.indexOf('(');
  6270. if (i < 0) {
  6271. // _f: resolveFilter
  6272. return ("_f(\"" + filter + "\")(" + exp + ")")
  6273. } else {
  6274. var name = filter.slice(0, i);
  6275. var args = filter.slice(i + 1);
  6276. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6277. }
  6278. }
  6279. /* */
  6280. /* eslint-disable no-unused-vars */
  6281. function baseWarn (msg, range) {
  6282. console.error(("[Vue compiler]: " + msg));
  6283. }
  6284. /* eslint-enable no-unused-vars */
  6285. function pluckModuleFunction (
  6286. modules,
  6287. key
  6288. ) {
  6289. return modules
  6290. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6291. : []
  6292. }
  6293. function addProp (el, name, value, range, dynamic) {
  6294. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6295. el.plain = false;
  6296. }
  6297. function addAttr (el, name, value, range, dynamic) {
  6298. var attrs = dynamic
  6299. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  6300. : (el.attrs || (el.attrs = []));
  6301. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6302. el.plain = false;
  6303. }
  6304. // add a raw attr (use this in preTransforms)
  6305. function addRawAttr (el, name, value, range) {
  6306. el.attrsMap[name] = value;
  6307. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  6308. }
  6309. function addDirective (
  6310. el,
  6311. name,
  6312. rawName,
  6313. value,
  6314. arg,
  6315. isDynamicArg,
  6316. modifiers,
  6317. range
  6318. ) {
  6319. (el.directives || (el.directives = [])).push(rangeSetItem({
  6320. name: name,
  6321. rawName: rawName,
  6322. value: value,
  6323. arg: arg,
  6324. isDynamicArg: isDynamicArg,
  6325. modifiers: modifiers
  6326. }, range));
  6327. el.plain = false;
  6328. }
  6329. function prependModifierMarker (symbol, name, dynamic) {
  6330. return dynamic
  6331. ? ("_p(" + name + ",\"" + symbol + "\")")
  6332. : symbol + name // mark the event as captured
  6333. }
  6334. function addHandler (
  6335. el,
  6336. name,
  6337. value,
  6338. modifiers,
  6339. important,
  6340. warn,
  6341. range,
  6342. dynamic
  6343. ) {
  6344. modifiers = modifiers || emptyObject;
  6345. // warn prevent and passive modifier
  6346. /* istanbul ignore if */
  6347. if (
  6348. process.env.NODE_ENV !== 'production' && warn &&
  6349. modifiers.prevent && modifiers.passive
  6350. ) {
  6351. warn(
  6352. 'passive and prevent can\'t be used together. ' +
  6353. 'Passive handler can\'t prevent default event.',
  6354. range
  6355. );
  6356. }
  6357. // normalize click.right and click.middle since they don't actually fire
  6358. // this is technically browser-specific, but at least for now browsers are
  6359. // the only target envs that have right/middle clicks.
  6360. if (modifiers.right) {
  6361. if (dynamic) {
  6362. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  6363. } else if (name === 'click') {
  6364. name = 'contextmenu';
  6365. delete modifiers.right;
  6366. }
  6367. } else if (modifiers.middle) {
  6368. if (dynamic) {
  6369. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  6370. } else if (name === 'click') {
  6371. name = 'mouseup';
  6372. }
  6373. }
  6374. // check capture modifier
  6375. if (modifiers.capture) {
  6376. delete modifiers.capture;
  6377. name = prependModifierMarker('!', name, dynamic);
  6378. }
  6379. if (modifiers.once) {
  6380. delete modifiers.once;
  6381. name = prependModifierMarker('~', name, dynamic);
  6382. }
  6383. /* istanbul ignore if */
  6384. if (modifiers.passive) {
  6385. delete modifiers.passive;
  6386. name = prependModifierMarker('&', name, dynamic);
  6387. }
  6388. var events;
  6389. if (modifiers.native) {
  6390. delete modifiers.native;
  6391. events = el.nativeEvents || (el.nativeEvents = {});
  6392. } else {
  6393. events = el.events || (el.events = {});
  6394. }
  6395. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  6396. if (modifiers !== emptyObject) {
  6397. newHandler.modifiers = modifiers;
  6398. }
  6399. var handlers = events[name];
  6400. /* istanbul ignore if */
  6401. if (Array.isArray(handlers)) {
  6402. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6403. } else if (handlers) {
  6404. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6405. } else {
  6406. events[name] = newHandler;
  6407. }
  6408. el.plain = false;
  6409. }
  6410. function getRawBindingAttr (
  6411. el,
  6412. name
  6413. ) {
  6414. return el.rawAttrsMap[':' + name] ||
  6415. el.rawAttrsMap['v-bind:' + name] ||
  6416. el.rawAttrsMap[name]
  6417. }
  6418. function getBindingAttr (
  6419. el,
  6420. name,
  6421. getStatic
  6422. ) {
  6423. var dynamicValue =
  6424. getAndRemoveAttr(el, ':' + name) ||
  6425. getAndRemoveAttr(el, 'v-bind:' + name);
  6426. if (dynamicValue != null) {
  6427. return parseFilters(dynamicValue)
  6428. } else if (getStatic !== false) {
  6429. var staticValue = getAndRemoveAttr(el, name);
  6430. if (staticValue != null) {
  6431. return JSON.stringify(staticValue)
  6432. }
  6433. }
  6434. }
  6435. // note: this only removes the attr from the Array (attrsList) so that it
  6436. // doesn't get processed by processAttrs.
  6437. // By default it does NOT remove it from the map (attrsMap) because the map is
  6438. // needed during codegen.
  6439. function getAndRemoveAttr (
  6440. el,
  6441. name,
  6442. removeFromMap
  6443. ) {
  6444. var val;
  6445. if ((val = el.attrsMap[name]) != null) {
  6446. var list = el.attrsList;
  6447. for (var i = 0, l = list.length; i < l; i++) {
  6448. if (list[i].name === name) {
  6449. list.splice(i, 1);
  6450. break
  6451. }
  6452. }
  6453. }
  6454. if (removeFromMap) {
  6455. delete el.attrsMap[name];
  6456. }
  6457. return val
  6458. }
  6459. function getAndRemoveAttrByRegex (
  6460. el,
  6461. name
  6462. ) {
  6463. var list = el.attrsList;
  6464. for (var i = 0, l = list.length; i < l; i++) {
  6465. var attr = list[i];
  6466. if (name.test(attr.name)) {
  6467. list.splice(i, 1);
  6468. return attr
  6469. }
  6470. }
  6471. }
  6472. function rangeSetItem (
  6473. item,
  6474. range
  6475. ) {
  6476. if (range) {
  6477. if (range.start != null) {
  6478. item.start = range.start;
  6479. }
  6480. if (range.end != null) {
  6481. item.end = range.end;
  6482. }
  6483. }
  6484. return item
  6485. }
  6486. /* */
  6487. /**
  6488. * Cross-platform code generation for component v-model
  6489. */
  6490. function genComponentModel (
  6491. el,
  6492. value,
  6493. modifiers
  6494. ) {
  6495. var ref = modifiers || {};
  6496. var number = ref.number;
  6497. var trim = ref.trim;
  6498. var baseValueExpression = '$$v';
  6499. var valueExpression = baseValueExpression;
  6500. if (trim) {
  6501. valueExpression =
  6502. "(typeof " + baseValueExpression + " === 'string'" +
  6503. "? " + baseValueExpression + ".trim()" +
  6504. ": " + baseValueExpression + ")";
  6505. }
  6506. if (number) {
  6507. valueExpression = "_n(" + valueExpression + ")";
  6508. }
  6509. var assignment = genAssignmentCode(value, valueExpression);
  6510. el.model = {
  6511. value: ("(" + value + ")"),
  6512. expression: JSON.stringify(value),
  6513. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6514. };
  6515. }
  6516. /**
  6517. * Cross-platform codegen helper for generating v-model value assignment code.
  6518. */
  6519. function genAssignmentCode (
  6520. value,
  6521. assignment
  6522. ) {
  6523. var res = parseModel(value);
  6524. if (res.key === null) {
  6525. return (value + "=" + assignment)
  6526. } else {
  6527. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6528. }
  6529. }
  6530. /**
  6531. * Parse a v-model expression into a base path and a final key segment.
  6532. * Handles both dot-path and possible square brackets.
  6533. *
  6534. * Possible cases:
  6535. *
  6536. * - test
  6537. * - test[key]
  6538. * - test[test1[key]]
  6539. * - test["a"][key]
  6540. * - xxx.test[a[a].test1[key]]
  6541. * - test.xxx.a["asa"][test1[key]]
  6542. *
  6543. */
  6544. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6545. function parseModel (val) {
  6546. // Fix https://github.com/vuejs/vue/pull/7730
  6547. // allow v-model="obj.val " (trailing whitespace)
  6548. val = val.trim();
  6549. len = val.length;
  6550. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6551. index$1 = val.lastIndexOf('.');
  6552. if (index$1 > -1) {
  6553. return {
  6554. exp: val.slice(0, index$1),
  6555. key: '"' + val.slice(index$1 + 1) + '"'
  6556. }
  6557. } else {
  6558. return {
  6559. exp: val,
  6560. key: null
  6561. }
  6562. }
  6563. }
  6564. str = val;
  6565. index$1 = expressionPos = expressionEndPos = 0;
  6566. while (!eof()) {
  6567. chr = next();
  6568. /* istanbul ignore if */
  6569. if (isStringStart(chr)) {
  6570. parseString(chr);
  6571. } else if (chr === 0x5B) {
  6572. parseBracket(chr);
  6573. }
  6574. }
  6575. return {
  6576. exp: val.slice(0, expressionPos),
  6577. key: val.slice(expressionPos + 1, expressionEndPos)
  6578. }
  6579. }
  6580. function next () {
  6581. return str.charCodeAt(++index$1)
  6582. }
  6583. function eof () {
  6584. return index$1 >= len
  6585. }
  6586. function isStringStart (chr) {
  6587. return chr === 0x22 || chr === 0x27
  6588. }
  6589. function parseBracket (chr) {
  6590. var inBracket = 1;
  6591. expressionPos = index$1;
  6592. while (!eof()) {
  6593. chr = next();
  6594. if (isStringStart(chr)) {
  6595. parseString(chr);
  6596. continue
  6597. }
  6598. if (chr === 0x5B) { inBracket++; }
  6599. if (chr === 0x5D) { inBracket--; }
  6600. if (inBracket === 0) {
  6601. expressionEndPos = index$1;
  6602. break
  6603. }
  6604. }
  6605. }
  6606. function parseString (chr) {
  6607. var stringQuote = chr;
  6608. while (!eof()) {
  6609. chr = next();
  6610. if (chr === stringQuote) {
  6611. break
  6612. }
  6613. }
  6614. }
  6615. /* */
  6616. var warn$1;
  6617. // in some cases, the event used has to be determined at runtime
  6618. // so we used some reserved tokens during compile.
  6619. var RANGE_TOKEN = '__r';
  6620. var CHECKBOX_RADIO_TOKEN = '__c';
  6621. function model (
  6622. el,
  6623. dir,
  6624. _warn
  6625. ) {
  6626. warn$1 = _warn;
  6627. var value = dir.value;
  6628. var modifiers = dir.modifiers;
  6629. var tag = el.tag;
  6630. var type = el.attrsMap.type;
  6631. if (process.env.NODE_ENV !== 'production') {
  6632. // inputs with type="file" are read only and setting the input's
  6633. // value will throw an error.
  6634. if (tag === 'input' && type === 'file') {
  6635. warn$1(
  6636. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6637. "File inputs are read only. Use a v-on:change listener instead.",
  6638. el.rawAttrsMap['v-model']
  6639. );
  6640. }
  6641. }
  6642. if (el.component) {
  6643. genComponentModel(el, value, modifiers);
  6644. // component v-model doesn't need extra runtime
  6645. return false
  6646. } else if (tag === 'select') {
  6647. genSelect(el, value, modifiers);
  6648. } else if (tag === 'input' && type === 'checkbox') {
  6649. genCheckboxModel(el, value, modifiers);
  6650. } else if (tag === 'input' && type === 'radio') {
  6651. genRadioModel(el, value, modifiers);
  6652. } else if (tag === 'input' || tag === 'textarea') {
  6653. genDefaultModel(el, value, modifiers);
  6654. } else if (!config.isReservedTag(tag)) {
  6655. genComponentModel(el, value, modifiers);
  6656. // component v-model doesn't need extra runtime
  6657. return false
  6658. } else if (process.env.NODE_ENV !== 'production') {
  6659. warn$1(
  6660. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6661. "v-model is not supported on this element type. " +
  6662. 'If you are working with contenteditable, it\'s recommended to ' +
  6663. 'wrap a library dedicated for that purpose inside a custom component.',
  6664. el.rawAttrsMap['v-model']
  6665. );
  6666. }
  6667. // ensure runtime directive metadata
  6668. return true
  6669. }
  6670. function genCheckboxModel (
  6671. el,
  6672. value,
  6673. modifiers
  6674. ) {
  6675. var number = modifiers && modifiers.number;
  6676. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6677. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6678. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6679. addProp(el, 'checked',
  6680. "Array.isArray(" + value + ")" +
  6681. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6682. trueValueBinding === 'true'
  6683. ? (":(" + value + ")")
  6684. : (":_q(" + value + "," + trueValueBinding + ")")
  6685. )
  6686. );
  6687. addHandler(el, 'change',
  6688. "var $$a=" + value + "," +
  6689. '$$el=$event.target,' +
  6690. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6691. 'if(Array.isArray($$a)){' +
  6692. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6693. '$$i=_i($$a,$$v);' +
  6694. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6695. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6696. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6697. null, true
  6698. );
  6699. }
  6700. function genRadioModel (
  6701. el,
  6702. value,
  6703. modifiers
  6704. ) {
  6705. var number = modifiers && modifiers.number;
  6706. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6707. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6708. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6709. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6710. }
  6711. function genSelect (
  6712. el,
  6713. value,
  6714. modifiers
  6715. ) {
  6716. var number = modifiers && modifiers.number;
  6717. var selectedVal = "Array.prototype.filter" +
  6718. ".call($event.target.options,function(o){return o.selected})" +
  6719. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6720. "return " + (number ? '_n(val)' : 'val') + "})";
  6721. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6722. var code = "var $$selectedVal = " + selectedVal + ";";
  6723. code = code + " " + (genAssignmentCode(value, assignment));
  6724. addHandler(el, 'change', code, null, true);
  6725. }
  6726. function genDefaultModel (
  6727. el,
  6728. value,
  6729. modifiers
  6730. ) {
  6731. var type = el.attrsMap.type;
  6732. // warn if v-bind:value conflicts with v-model
  6733. // except for inputs with v-bind:type
  6734. if (process.env.NODE_ENV !== 'production') {
  6735. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6736. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6737. if (value$1 && !typeBinding) {
  6738. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6739. warn$1(
  6740. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6741. 'because the latter already expands to a value binding internally',
  6742. el.rawAttrsMap[binding]
  6743. );
  6744. }
  6745. }
  6746. var ref = modifiers || {};
  6747. var lazy = ref.lazy;
  6748. var number = ref.number;
  6749. var trim = ref.trim;
  6750. var needCompositionGuard = !lazy && type !== 'range';
  6751. var event = lazy
  6752. ? 'change'
  6753. : type === 'range'
  6754. ? RANGE_TOKEN
  6755. : 'input';
  6756. var valueExpression = '$event.target.value';
  6757. if (trim) {
  6758. valueExpression = "$event.target.value.trim()";
  6759. }
  6760. if (number) {
  6761. valueExpression = "_n(" + valueExpression + ")";
  6762. }
  6763. var code = genAssignmentCode(value, valueExpression);
  6764. if (needCompositionGuard) {
  6765. code = "if($event.target.composing)return;" + code;
  6766. }
  6767. addProp(el, 'value', ("(" + value + ")"));
  6768. addHandler(el, event, code, null, true);
  6769. if (trim || number) {
  6770. addHandler(el, 'blur', '$forceUpdate()');
  6771. }
  6772. }
  6773. /* */
  6774. // normalize v-model event tokens that can only be determined at runtime.
  6775. // it's important to place the event as the first in the array because
  6776. // the whole point is ensuring the v-model callback gets called before
  6777. // user-attached handlers.
  6778. function normalizeEvents (on) {
  6779. /* istanbul ignore if */
  6780. if (isDef(on[RANGE_TOKEN])) {
  6781. // IE input[type=range] only supports `change` event
  6782. var event = isIE ? 'change' : 'input';
  6783. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6784. delete on[RANGE_TOKEN];
  6785. }
  6786. // This was originally intended to fix #4521 but no longer necessary
  6787. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6788. /* istanbul ignore if */
  6789. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6790. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6791. delete on[CHECKBOX_RADIO_TOKEN];
  6792. }
  6793. }
  6794. var target$1;
  6795. function createOnceHandler$1 (event, handler, capture) {
  6796. var _target = target$1; // save current target element in closure
  6797. return function onceHandler () {
  6798. var res = handler.apply(null, arguments);
  6799. if (res !== null) {
  6800. remove$2(event, onceHandler, capture, _target);
  6801. }
  6802. }
  6803. }
  6804. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6805. // implementation and does not fire microtasks in between event propagation, so
  6806. // safe to exclude.
  6807. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6808. function add$1 (
  6809. name,
  6810. handler,
  6811. capture,
  6812. passive
  6813. ) {
  6814. // async edge case #6566: inner click event triggers patch, event handler
  6815. // attached to outer element during patch, and triggered again. This
  6816. // happens because browsers fire microtask ticks between event propagation.
  6817. // the solution is simple: we save the timestamp when a handler is attached,
  6818. // and the handler would only fire if the event passed to it was fired
  6819. // AFTER it was attached.
  6820. if (useMicrotaskFix) {
  6821. var attachedTimestamp = currentFlushTimestamp;
  6822. var original = handler;
  6823. handler = original._wrapper = function (e) {
  6824. if (
  6825. // no bubbling, should always fire.
  6826. // this is just a safety net in case event.timeStamp is unreliable in
  6827. // certain weird environments...
  6828. e.target === e.currentTarget ||
  6829. // event is fired after handler attachment
  6830. e.timeStamp >= attachedTimestamp ||
  6831. // bail for environments that have buggy event.timeStamp implementations
  6832. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  6833. // #9681 QtWebEngine event.timeStamp is negative value
  6834. e.timeStamp <= 0 ||
  6835. // #9448 bail if event is fired in another document in a multi-page
  6836. // electron/nw.js app, since event.timeStamp will be using a different
  6837. // starting reference
  6838. e.target.ownerDocument !== document
  6839. ) {
  6840. return original.apply(this, arguments)
  6841. }
  6842. };
  6843. }
  6844. target$1.addEventListener(
  6845. name,
  6846. handler,
  6847. supportsPassive
  6848. ? { capture: capture, passive: passive }
  6849. : capture
  6850. );
  6851. }
  6852. function remove$2 (
  6853. name,
  6854. handler,
  6855. capture,
  6856. _target
  6857. ) {
  6858. (_target || target$1).removeEventListener(
  6859. name,
  6860. handler._wrapper || handler,
  6861. capture
  6862. );
  6863. }
  6864. function updateDOMListeners (oldVnode, vnode) {
  6865. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6866. return
  6867. }
  6868. var on = vnode.data.on || {};
  6869. var oldOn = oldVnode.data.on || {};
  6870. target$1 = vnode.elm;
  6871. normalizeEvents(on);
  6872. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6873. target$1 = undefined;
  6874. }
  6875. var events = {
  6876. create: updateDOMListeners,
  6877. update: updateDOMListeners
  6878. };
  6879. /* */
  6880. var svgContainer;
  6881. function updateDOMProps (oldVnode, vnode) {
  6882. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6883. return
  6884. }
  6885. var key, cur;
  6886. var elm = vnode.elm;
  6887. var oldProps = oldVnode.data.domProps || {};
  6888. var props = vnode.data.domProps || {};
  6889. // clone observed objects, as the user probably wants to mutate it
  6890. if (isDef(props.__ob__)) {
  6891. props = vnode.data.domProps = extend({}, props);
  6892. }
  6893. for (key in oldProps) {
  6894. if (!(key in props)) {
  6895. elm[key] = '';
  6896. }
  6897. }
  6898. for (key in props) {
  6899. cur = props[key];
  6900. // ignore children if the node has textContent or innerHTML,
  6901. // as these will throw away existing DOM nodes and cause removal errors
  6902. // on subsequent patches (#3360)
  6903. if (key === 'textContent' || key === 'innerHTML') {
  6904. if (vnode.children) { vnode.children.length = 0; }
  6905. if (cur === oldProps[key]) { continue }
  6906. // #6601 work around Chrome version <= 55 bug where single textNode
  6907. // replaced by innerHTML/textContent retains its parentNode property
  6908. if (elm.childNodes.length === 1) {
  6909. elm.removeChild(elm.childNodes[0]);
  6910. }
  6911. }
  6912. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6913. // store value as _value as well since
  6914. // non-string values will be stringified
  6915. elm._value = cur;
  6916. // avoid resetting cursor position when value is the same
  6917. var strCur = isUndef(cur) ? '' : String(cur);
  6918. if (shouldUpdateValue(elm, strCur)) {
  6919. elm.value = strCur;
  6920. }
  6921. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6922. // IE doesn't support innerHTML for SVG elements
  6923. svgContainer = svgContainer || document.createElement('div');
  6924. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6925. var svg = svgContainer.firstChild;
  6926. while (elm.firstChild) {
  6927. elm.removeChild(elm.firstChild);
  6928. }
  6929. while (svg.firstChild) {
  6930. elm.appendChild(svg.firstChild);
  6931. }
  6932. } else if (
  6933. // skip the update if old and new VDOM state is the same.
  6934. // `value` is handled separately because the DOM value may be temporarily
  6935. // out of sync with VDOM state due to focus, composition and modifiers.
  6936. // This #4521 by skipping the unnecesarry `checked` update.
  6937. cur !== oldProps[key]
  6938. ) {
  6939. // some property updates can throw
  6940. // e.g. `value` on <progress> w/ non-finite value
  6941. try {
  6942. elm[key] = cur;
  6943. } catch (e) {}
  6944. }
  6945. }
  6946. }
  6947. // check platforms/web/util/attrs.js acceptValue
  6948. function shouldUpdateValue (elm, checkVal) {
  6949. return (!elm.composing && (
  6950. elm.tagName === 'OPTION' ||
  6951. isNotInFocusAndDirty(elm, checkVal) ||
  6952. isDirtyWithModifiers(elm, checkVal)
  6953. ))
  6954. }
  6955. function isNotInFocusAndDirty (elm, checkVal) {
  6956. // return true when textbox (.number and .trim) loses focus and its value is
  6957. // not equal to the updated value
  6958. var notInFocus = true;
  6959. // #6157
  6960. // work around IE bug when accessing document.activeElement in an iframe
  6961. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6962. return notInFocus && elm.value !== checkVal
  6963. }
  6964. function isDirtyWithModifiers (elm, newVal) {
  6965. var value = elm.value;
  6966. var modifiers = elm._vModifiers; // injected by v-model runtime
  6967. if (isDef(modifiers)) {
  6968. if (modifiers.number) {
  6969. return toNumber(value) !== toNumber(newVal)
  6970. }
  6971. if (modifiers.trim) {
  6972. return value.trim() !== newVal.trim()
  6973. }
  6974. }
  6975. return value !== newVal
  6976. }
  6977. var domProps = {
  6978. create: updateDOMProps,
  6979. update: updateDOMProps
  6980. };
  6981. /* */
  6982. var parseStyleText = cached(function (cssText) {
  6983. var res = {};
  6984. var listDelimiter = /;(?![^(]*\))/g;
  6985. var propertyDelimiter = /:(.+)/;
  6986. cssText.split(listDelimiter).forEach(function (item) {
  6987. if (item) {
  6988. var tmp = item.split(propertyDelimiter);
  6989. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6990. }
  6991. });
  6992. return res
  6993. });
  6994. // merge static and dynamic style data on the same vnode
  6995. function normalizeStyleData (data) {
  6996. var style = normalizeStyleBinding(data.style);
  6997. // static style is pre-processed into an object during compilation
  6998. // and is always a fresh object, so it's safe to merge into it
  6999. return data.staticStyle
  7000. ? extend(data.staticStyle, style)
  7001. : style
  7002. }
  7003. // normalize possible array / string values into Object
  7004. function normalizeStyleBinding (bindingStyle) {
  7005. if (Array.isArray(bindingStyle)) {
  7006. return toObject(bindingStyle)
  7007. }
  7008. if (typeof bindingStyle === 'string') {
  7009. return parseStyleText(bindingStyle)
  7010. }
  7011. return bindingStyle
  7012. }
  7013. /**
  7014. * parent component style should be after child's
  7015. * so that parent component's style could override it
  7016. */
  7017. function getStyle (vnode, checkChild) {
  7018. var res = {};
  7019. var styleData;
  7020. if (checkChild) {
  7021. var childNode = vnode;
  7022. while (childNode.componentInstance) {
  7023. childNode = childNode.componentInstance._vnode;
  7024. if (
  7025. childNode && childNode.data &&
  7026. (styleData = normalizeStyleData(childNode.data))
  7027. ) {
  7028. extend(res, styleData);
  7029. }
  7030. }
  7031. }
  7032. if ((styleData = normalizeStyleData(vnode.data))) {
  7033. extend(res, styleData);
  7034. }
  7035. var parentNode = vnode;
  7036. while ((parentNode = parentNode.parent)) {
  7037. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  7038. extend(res, styleData);
  7039. }
  7040. }
  7041. return res
  7042. }
  7043. /* */
  7044. var cssVarRE = /^--/;
  7045. var importantRE = /\s*!important$/;
  7046. var setProp = function (el, name, val) {
  7047. /* istanbul ignore if */
  7048. if (cssVarRE.test(name)) {
  7049. el.style.setProperty(name, val);
  7050. } else if (importantRE.test(val)) {
  7051. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  7052. } else {
  7053. var normalizedName = normalize(name);
  7054. if (Array.isArray(val)) {
  7055. // Support values array created by autoprefixer, e.g.
  7056. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  7057. // Set them one by one, and the browser will only set those it can recognize
  7058. for (var i = 0, len = val.length; i < len; i++) {
  7059. el.style[normalizedName] = val[i];
  7060. }
  7061. } else {
  7062. el.style[normalizedName] = val;
  7063. }
  7064. }
  7065. };
  7066. var vendorNames = ['Webkit', 'Moz', 'ms'];
  7067. var emptyStyle;
  7068. var normalize = cached(function (prop) {
  7069. emptyStyle = emptyStyle || document.createElement('div').style;
  7070. prop = camelize(prop);
  7071. if (prop !== 'filter' && (prop in emptyStyle)) {
  7072. return prop
  7073. }
  7074. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  7075. for (var i = 0; i < vendorNames.length; i++) {
  7076. var name = vendorNames[i] + capName;
  7077. if (name in emptyStyle) {
  7078. return name
  7079. }
  7080. }
  7081. });
  7082. function updateStyle (oldVnode, vnode) {
  7083. var data = vnode.data;
  7084. var oldData = oldVnode.data;
  7085. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7086. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7087. ) {
  7088. return
  7089. }
  7090. var cur, name;
  7091. var el = vnode.elm;
  7092. var oldStaticStyle = oldData.staticStyle;
  7093. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7094. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7095. var oldStyle = oldStaticStyle || oldStyleBinding;
  7096. var style = normalizeStyleBinding(vnode.data.style) || {};
  7097. // store normalized style under a different key for next diff
  7098. // make sure to clone it if it's reactive, since the user likely wants
  7099. // to mutate it.
  7100. vnode.data.normalizedStyle = isDef(style.__ob__)
  7101. ? extend({}, style)
  7102. : style;
  7103. var newStyle = getStyle(vnode, true);
  7104. for (name in oldStyle) {
  7105. if (isUndef(newStyle[name])) {
  7106. setProp(el, name, '');
  7107. }
  7108. }
  7109. for (name in newStyle) {
  7110. cur = newStyle[name];
  7111. if (cur !== oldStyle[name]) {
  7112. // ie9 setting to null has no effect, must use empty string
  7113. setProp(el, name, cur == null ? '' : cur);
  7114. }
  7115. }
  7116. }
  7117. var style = {
  7118. create: updateStyle,
  7119. update: updateStyle
  7120. };
  7121. /* */
  7122. var whitespaceRE = /\s+/;
  7123. /**
  7124. * Add class with compatibility for SVG since classList is not supported on
  7125. * SVG elements in IE
  7126. */
  7127. function addClass (el, cls) {
  7128. /* istanbul ignore if */
  7129. if (!cls || !(cls = cls.trim())) {
  7130. return
  7131. }
  7132. /* istanbul ignore else */
  7133. if (el.classList) {
  7134. if (cls.indexOf(' ') > -1) {
  7135. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  7136. } else {
  7137. el.classList.add(cls);
  7138. }
  7139. } else {
  7140. var cur = " " + (el.getAttribute('class') || '') + " ";
  7141. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7142. el.setAttribute('class', (cur + cls).trim());
  7143. }
  7144. }
  7145. }
  7146. /**
  7147. * Remove class with compatibility for SVG since classList is not supported on
  7148. * SVG elements in IE
  7149. */
  7150. function removeClass (el, cls) {
  7151. /* istanbul ignore if */
  7152. if (!cls || !(cls = cls.trim())) {
  7153. return
  7154. }
  7155. /* istanbul ignore else */
  7156. if (el.classList) {
  7157. if (cls.indexOf(' ') > -1) {
  7158. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  7159. } else {
  7160. el.classList.remove(cls);
  7161. }
  7162. if (!el.classList.length) {
  7163. el.removeAttribute('class');
  7164. }
  7165. } else {
  7166. var cur = " " + (el.getAttribute('class') || '') + " ";
  7167. var tar = ' ' + cls + ' ';
  7168. while (cur.indexOf(tar) >= 0) {
  7169. cur = cur.replace(tar, ' ');
  7170. }
  7171. cur = cur.trim();
  7172. if (cur) {
  7173. el.setAttribute('class', cur);
  7174. } else {
  7175. el.removeAttribute('class');
  7176. }
  7177. }
  7178. }
  7179. /* */
  7180. function resolveTransition (def$$1) {
  7181. if (!def$$1) {
  7182. return
  7183. }
  7184. /* istanbul ignore else */
  7185. if (typeof def$$1 === 'object') {
  7186. var res = {};
  7187. if (def$$1.css !== false) {
  7188. extend(res, autoCssTransition(def$$1.name || 'v'));
  7189. }
  7190. extend(res, def$$1);
  7191. return res
  7192. } else if (typeof def$$1 === 'string') {
  7193. return autoCssTransition(def$$1)
  7194. }
  7195. }
  7196. var autoCssTransition = cached(function (name) {
  7197. return {
  7198. enterClass: (name + "-enter"),
  7199. enterToClass: (name + "-enter-to"),
  7200. enterActiveClass: (name + "-enter-active"),
  7201. leaveClass: (name + "-leave"),
  7202. leaveToClass: (name + "-leave-to"),
  7203. leaveActiveClass: (name + "-leave-active")
  7204. }
  7205. });
  7206. var hasTransition = inBrowser && !isIE9;
  7207. var TRANSITION = 'transition';
  7208. var ANIMATION = 'animation';
  7209. // Transition property/event sniffing
  7210. var transitionProp = 'transition';
  7211. var transitionEndEvent = 'transitionend';
  7212. var animationProp = 'animation';
  7213. var animationEndEvent = 'animationend';
  7214. if (hasTransition) {
  7215. /* istanbul ignore if */
  7216. if (window.ontransitionend === undefined &&
  7217. window.onwebkittransitionend !== undefined
  7218. ) {
  7219. transitionProp = 'WebkitTransition';
  7220. transitionEndEvent = 'webkitTransitionEnd';
  7221. }
  7222. if (window.onanimationend === undefined &&
  7223. window.onwebkitanimationend !== undefined
  7224. ) {
  7225. animationProp = 'WebkitAnimation';
  7226. animationEndEvent = 'webkitAnimationEnd';
  7227. }
  7228. }
  7229. // binding to window is necessary to make hot reload work in IE in strict mode
  7230. var raf = inBrowser
  7231. ? window.requestAnimationFrame
  7232. ? window.requestAnimationFrame.bind(window)
  7233. : setTimeout
  7234. : /* istanbul ignore next */ function (fn) { return fn(); };
  7235. function nextFrame (fn) {
  7236. raf(function () {
  7237. raf(fn);
  7238. });
  7239. }
  7240. function addTransitionClass (el, cls) {
  7241. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7242. if (transitionClasses.indexOf(cls) < 0) {
  7243. transitionClasses.push(cls);
  7244. addClass(el, cls);
  7245. }
  7246. }
  7247. function removeTransitionClass (el, cls) {
  7248. if (el._transitionClasses) {
  7249. remove(el._transitionClasses, cls);
  7250. }
  7251. removeClass(el, cls);
  7252. }
  7253. function whenTransitionEnds (
  7254. el,
  7255. expectedType,
  7256. cb
  7257. ) {
  7258. var ref = getTransitionInfo(el, expectedType);
  7259. var type = ref.type;
  7260. var timeout = ref.timeout;
  7261. var propCount = ref.propCount;
  7262. if (!type) { return cb() }
  7263. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  7264. var ended = 0;
  7265. var end = function () {
  7266. el.removeEventListener(event, onEnd);
  7267. cb();
  7268. };
  7269. var onEnd = function (e) {
  7270. if (e.target === el) {
  7271. if (++ended >= propCount) {
  7272. end();
  7273. }
  7274. }
  7275. };
  7276. setTimeout(function () {
  7277. if (ended < propCount) {
  7278. end();
  7279. }
  7280. }, timeout + 1);
  7281. el.addEventListener(event, onEnd);
  7282. }
  7283. var transformRE = /\b(transform|all)(,|$)/;
  7284. function getTransitionInfo (el, expectedType) {
  7285. var styles = window.getComputedStyle(el);
  7286. // JSDOM may return undefined for transition properties
  7287. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  7288. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  7289. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  7290. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  7291. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  7292. var animationTimeout = getTimeout(animationDelays, animationDurations);
  7293. var type;
  7294. var timeout = 0;
  7295. var propCount = 0;
  7296. /* istanbul ignore if */
  7297. if (expectedType === TRANSITION) {
  7298. if (transitionTimeout > 0) {
  7299. type = TRANSITION;
  7300. timeout = transitionTimeout;
  7301. propCount = transitionDurations.length;
  7302. }
  7303. } else if (expectedType === ANIMATION) {
  7304. if (animationTimeout > 0) {
  7305. type = ANIMATION;
  7306. timeout = animationTimeout;
  7307. propCount = animationDurations.length;
  7308. }
  7309. } else {
  7310. timeout = Math.max(transitionTimeout, animationTimeout);
  7311. type = timeout > 0
  7312. ? transitionTimeout > animationTimeout
  7313. ? TRANSITION
  7314. : ANIMATION
  7315. : null;
  7316. propCount = type
  7317. ? type === TRANSITION
  7318. ? transitionDurations.length
  7319. : animationDurations.length
  7320. : 0;
  7321. }
  7322. var hasTransform =
  7323. type === TRANSITION &&
  7324. transformRE.test(styles[transitionProp + 'Property']);
  7325. return {
  7326. type: type,
  7327. timeout: timeout,
  7328. propCount: propCount,
  7329. hasTransform: hasTransform
  7330. }
  7331. }
  7332. function getTimeout (delays, durations) {
  7333. /* istanbul ignore next */
  7334. while (delays.length < durations.length) {
  7335. delays = delays.concat(delays);
  7336. }
  7337. return Math.max.apply(null, durations.map(function (d, i) {
  7338. return toMs(d) + toMs(delays[i])
  7339. }))
  7340. }
  7341. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  7342. // in a locale-dependent way, using a comma instead of a dot.
  7343. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  7344. // as a floor function) causing unexpected behaviors
  7345. function toMs (s) {
  7346. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  7347. }
  7348. /* */
  7349. function enter (vnode, toggleDisplay) {
  7350. var el = vnode.elm;
  7351. // call leave callback now
  7352. if (isDef(el._leaveCb)) {
  7353. el._leaveCb.cancelled = true;
  7354. el._leaveCb();
  7355. }
  7356. var data = resolveTransition(vnode.data.transition);
  7357. if (isUndef(data)) {
  7358. return
  7359. }
  7360. /* istanbul ignore if */
  7361. if (isDef(el._enterCb) || el.nodeType !== 1) {
  7362. return
  7363. }
  7364. var css = data.css;
  7365. var type = data.type;
  7366. var enterClass = data.enterClass;
  7367. var enterToClass = data.enterToClass;
  7368. var enterActiveClass = data.enterActiveClass;
  7369. var appearClass = data.appearClass;
  7370. var appearToClass = data.appearToClass;
  7371. var appearActiveClass = data.appearActiveClass;
  7372. var beforeEnter = data.beforeEnter;
  7373. var enter = data.enter;
  7374. var afterEnter = data.afterEnter;
  7375. var enterCancelled = data.enterCancelled;
  7376. var beforeAppear = data.beforeAppear;
  7377. var appear = data.appear;
  7378. var afterAppear = data.afterAppear;
  7379. var appearCancelled = data.appearCancelled;
  7380. var duration = data.duration;
  7381. // activeInstance will always be the <transition> component managing this
  7382. // transition. One edge case to check is when the <transition> is placed
  7383. // as the root node of a child component. In that case we need to check
  7384. // <transition>'s parent for appear check.
  7385. var context = activeInstance;
  7386. var transitionNode = activeInstance.$vnode;
  7387. while (transitionNode && transitionNode.parent) {
  7388. context = transitionNode.context;
  7389. transitionNode = transitionNode.parent;
  7390. }
  7391. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7392. if (isAppear && !appear && appear !== '') {
  7393. return
  7394. }
  7395. var startClass = isAppear && appearClass
  7396. ? appearClass
  7397. : enterClass;
  7398. var activeClass = isAppear && appearActiveClass
  7399. ? appearActiveClass
  7400. : enterActiveClass;
  7401. var toClass = isAppear && appearToClass
  7402. ? appearToClass
  7403. : enterToClass;
  7404. var beforeEnterHook = isAppear
  7405. ? (beforeAppear || beforeEnter)
  7406. : beforeEnter;
  7407. var enterHook = isAppear
  7408. ? (typeof appear === 'function' ? appear : enter)
  7409. : enter;
  7410. var afterEnterHook = isAppear
  7411. ? (afterAppear || afterEnter)
  7412. : afterEnter;
  7413. var enterCancelledHook = isAppear
  7414. ? (appearCancelled || enterCancelled)
  7415. : enterCancelled;
  7416. var explicitEnterDuration = toNumber(
  7417. isObject(duration)
  7418. ? duration.enter
  7419. : duration
  7420. );
  7421. if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
  7422. checkDuration(explicitEnterDuration, 'enter', vnode);
  7423. }
  7424. var expectsCSS = css !== false && !isIE9;
  7425. var userWantsControl = getHookArgumentsLength(enterHook);
  7426. var cb = el._enterCb = once(function () {
  7427. if (expectsCSS) {
  7428. removeTransitionClass(el, toClass);
  7429. removeTransitionClass(el, activeClass);
  7430. }
  7431. if (cb.cancelled) {
  7432. if (expectsCSS) {
  7433. removeTransitionClass(el, startClass);
  7434. }
  7435. enterCancelledHook && enterCancelledHook(el);
  7436. } else {
  7437. afterEnterHook && afterEnterHook(el);
  7438. }
  7439. el._enterCb = null;
  7440. });
  7441. if (!vnode.data.show) {
  7442. // remove pending leave element on enter by injecting an insert hook
  7443. mergeVNodeHook(vnode, 'insert', function () {
  7444. var parent = el.parentNode;
  7445. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7446. if (pendingNode &&
  7447. pendingNode.tag === vnode.tag &&
  7448. pendingNode.elm._leaveCb
  7449. ) {
  7450. pendingNode.elm._leaveCb();
  7451. }
  7452. enterHook && enterHook(el, cb);
  7453. });
  7454. }
  7455. // start enter transition
  7456. beforeEnterHook && beforeEnterHook(el);
  7457. if (expectsCSS) {
  7458. addTransitionClass(el, startClass);
  7459. addTransitionClass(el, activeClass);
  7460. nextFrame(function () {
  7461. removeTransitionClass(el, startClass);
  7462. if (!cb.cancelled) {
  7463. addTransitionClass(el, toClass);
  7464. if (!userWantsControl) {
  7465. if (isValidDuration(explicitEnterDuration)) {
  7466. setTimeout(cb, explicitEnterDuration);
  7467. } else {
  7468. whenTransitionEnds(el, type, cb);
  7469. }
  7470. }
  7471. }
  7472. });
  7473. }
  7474. if (vnode.data.show) {
  7475. toggleDisplay && toggleDisplay();
  7476. enterHook && enterHook(el, cb);
  7477. }
  7478. if (!expectsCSS && !userWantsControl) {
  7479. cb();
  7480. }
  7481. }
  7482. function leave (vnode, rm) {
  7483. var el = vnode.elm;
  7484. // call enter callback now
  7485. if (isDef(el._enterCb)) {
  7486. el._enterCb.cancelled = true;
  7487. el._enterCb();
  7488. }
  7489. var data = resolveTransition(vnode.data.transition);
  7490. if (isUndef(data) || el.nodeType !== 1) {
  7491. return rm()
  7492. }
  7493. /* istanbul ignore if */
  7494. if (isDef(el._leaveCb)) {
  7495. return
  7496. }
  7497. var css = data.css;
  7498. var type = data.type;
  7499. var leaveClass = data.leaveClass;
  7500. var leaveToClass = data.leaveToClass;
  7501. var leaveActiveClass = data.leaveActiveClass;
  7502. var beforeLeave = data.beforeLeave;
  7503. var leave = data.leave;
  7504. var afterLeave = data.afterLeave;
  7505. var leaveCancelled = data.leaveCancelled;
  7506. var delayLeave = data.delayLeave;
  7507. var duration = data.duration;
  7508. var expectsCSS = css !== false && !isIE9;
  7509. var userWantsControl = getHookArgumentsLength(leave);
  7510. var explicitLeaveDuration = toNumber(
  7511. isObject(duration)
  7512. ? duration.leave
  7513. : duration
  7514. );
  7515. if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
  7516. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7517. }
  7518. var cb = el._leaveCb = once(function () {
  7519. if (el.parentNode && el.parentNode._pending) {
  7520. el.parentNode._pending[vnode.key] = null;
  7521. }
  7522. if (expectsCSS) {
  7523. removeTransitionClass(el, leaveToClass);
  7524. removeTransitionClass(el, leaveActiveClass);
  7525. }
  7526. if (cb.cancelled) {
  7527. if (expectsCSS) {
  7528. removeTransitionClass(el, leaveClass);
  7529. }
  7530. leaveCancelled && leaveCancelled(el);
  7531. } else {
  7532. rm();
  7533. afterLeave && afterLeave(el);
  7534. }
  7535. el._leaveCb = null;
  7536. });
  7537. if (delayLeave) {
  7538. delayLeave(performLeave);
  7539. } else {
  7540. performLeave();
  7541. }
  7542. function performLeave () {
  7543. // the delayed leave may have already been cancelled
  7544. if (cb.cancelled) {
  7545. return
  7546. }
  7547. // record leaving element
  7548. if (!vnode.data.show && el.parentNode) {
  7549. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7550. }
  7551. beforeLeave && beforeLeave(el);
  7552. if (expectsCSS) {
  7553. addTransitionClass(el, leaveClass);
  7554. addTransitionClass(el, leaveActiveClass);
  7555. nextFrame(function () {
  7556. removeTransitionClass(el, leaveClass);
  7557. if (!cb.cancelled) {
  7558. addTransitionClass(el, leaveToClass);
  7559. if (!userWantsControl) {
  7560. if (isValidDuration(explicitLeaveDuration)) {
  7561. setTimeout(cb, explicitLeaveDuration);
  7562. } else {
  7563. whenTransitionEnds(el, type, cb);
  7564. }
  7565. }
  7566. }
  7567. });
  7568. }
  7569. leave && leave(el, cb);
  7570. if (!expectsCSS && !userWantsControl) {
  7571. cb();
  7572. }
  7573. }
  7574. }
  7575. // only used in dev mode
  7576. function checkDuration (val, name, vnode) {
  7577. if (typeof val !== 'number') {
  7578. warn(
  7579. "<transition> explicit " + name + " duration is not a valid number - " +
  7580. "got " + (JSON.stringify(val)) + ".",
  7581. vnode.context
  7582. );
  7583. } else if (isNaN(val)) {
  7584. warn(
  7585. "<transition> explicit " + name + " duration is NaN - " +
  7586. 'the duration expression might be incorrect.',
  7587. vnode.context
  7588. );
  7589. }
  7590. }
  7591. function isValidDuration (val) {
  7592. return typeof val === 'number' && !isNaN(val)
  7593. }
  7594. /**
  7595. * Normalize a transition hook's argument length. The hook may be:
  7596. * - a merged hook (invoker) with the original in .fns
  7597. * - a wrapped component method (check ._length)
  7598. * - a plain function (.length)
  7599. */
  7600. function getHookArgumentsLength (fn) {
  7601. if (isUndef(fn)) {
  7602. return false
  7603. }
  7604. var invokerFns = fn.fns;
  7605. if (isDef(invokerFns)) {
  7606. // invoker
  7607. return getHookArgumentsLength(
  7608. Array.isArray(invokerFns)
  7609. ? invokerFns[0]
  7610. : invokerFns
  7611. )
  7612. } else {
  7613. return (fn._length || fn.length) > 1
  7614. }
  7615. }
  7616. function _enter (_, vnode) {
  7617. if (vnode.data.show !== true) {
  7618. enter(vnode);
  7619. }
  7620. }
  7621. var transition = inBrowser ? {
  7622. create: _enter,
  7623. activate: _enter,
  7624. remove: function remove$$1 (vnode, rm) {
  7625. /* istanbul ignore else */
  7626. if (vnode.data.show !== true) {
  7627. leave(vnode, rm);
  7628. } else {
  7629. rm();
  7630. }
  7631. }
  7632. } : {};
  7633. var platformModules = [
  7634. attrs,
  7635. klass,
  7636. events,
  7637. domProps,
  7638. style,
  7639. transition
  7640. ];
  7641. /* */
  7642. // the directive module should be applied last, after all
  7643. // built-in modules have been applied.
  7644. var modules = platformModules.concat(baseModules);
  7645. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7646. /**
  7647. * Not type checking this file because flow doesn't like attaching
  7648. * properties to Elements.
  7649. */
  7650. /* istanbul ignore if */
  7651. if (isIE9) {
  7652. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7653. document.addEventListener('selectionchange', function () {
  7654. var el = document.activeElement;
  7655. if (el && el.vmodel) {
  7656. trigger(el, 'input');
  7657. }
  7658. });
  7659. }
  7660. var directive = {
  7661. inserted: function inserted (el, binding, vnode, oldVnode) {
  7662. if (vnode.tag === 'select') {
  7663. // #6903
  7664. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7665. mergeVNodeHook(vnode, 'postpatch', function () {
  7666. directive.componentUpdated(el, binding, vnode);
  7667. });
  7668. } else {
  7669. setSelected(el, binding, vnode.context);
  7670. }
  7671. el._vOptions = [].map.call(el.options, getValue);
  7672. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7673. el._vModifiers = binding.modifiers;
  7674. if (!binding.modifiers.lazy) {
  7675. el.addEventListener('compositionstart', onCompositionStart);
  7676. el.addEventListener('compositionend', onCompositionEnd);
  7677. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7678. // switching focus before confirming composition choice
  7679. // this also fixes the issue where some browsers e.g. iOS Chrome
  7680. // fires "change" instead of "input" on autocomplete.
  7681. el.addEventListener('change', onCompositionEnd);
  7682. /* istanbul ignore if */
  7683. if (isIE9) {
  7684. el.vmodel = true;
  7685. }
  7686. }
  7687. }
  7688. },
  7689. componentUpdated: function componentUpdated (el, binding, vnode) {
  7690. if (vnode.tag === 'select') {
  7691. setSelected(el, binding, vnode.context);
  7692. // in case the options rendered by v-for have changed,
  7693. // it's possible that the value is out-of-sync with the rendered options.
  7694. // detect such cases and filter out values that no longer has a matching
  7695. // option in the DOM.
  7696. var prevOptions = el._vOptions;
  7697. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7698. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7699. // trigger change event if
  7700. // no matching option found for at least one value
  7701. var needReset = el.multiple
  7702. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7703. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7704. if (needReset) {
  7705. trigger(el, 'change');
  7706. }
  7707. }
  7708. }
  7709. }
  7710. };
  7711. function setSelected (el, binding, vm) {
  7712. actuallySetSelected(el, binding, vm);
  7713. /* istanbul ignore if */
  7714. if (isIE || isEdge) {
  7715. setTimeout(function () {
  7716. actuallySetSelected(el, binding, vm);
  7717. }, 0);
  7718. }
  7719. }
  7720. function actuallySetSelected (el, binding, vm) {
  7721. var value = binding.value;
  7722. var isMultiple = el.multiple;
  7723. if (isMultiple && !Array.isArray(value)) {
  7724. process.env.NODE_ENV !== 'production' && warn(
  7725. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7726. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7727. vm
  7728. );
  7729. return
  7730. }
  7731. var selected, option;
  7732. for (var i = 0, l = el.options.length; i < l; i++) {
  7733. option = el.options[i];
  7734. if (isMultiple) {
  7735. selected = looseIndexOf(value, getValue(option)) > -1;
  7736. if (option.selected !== selected) {
  7737. option.selected = selected;
  7738. }
  7739. } else {
  7740. if (looseEqual(getValue(option), value)) {
  7741. if (el.selectedIndex !== i) {
  7742. el.selectedIndex = i;
  7743. }
  7744. return
  7745. }
  7746. }
  7747. }
  7748. if (!isMultiple) {
  7749. el.selectedIndex = -1;
  7750. }
  7751. }
  7752. function hasNoMatchingOption (value, options) {
  7753. return options.every(function (o) { return !looseEqual(o, value); })
  7754. }
  7755. function getValue (option) {
  7756. return '_value' in option
  7757. ? option._value
  7758. : option.value
  7759. }
  7760. function onCompositionStart (e) {
  7761. e.target.composing = true;
  7762. }
  7763. function onCompositionEnd (e) {
  7764. // prevent triggering an input event for no reason
  7765. if (!e.target.composing) { return }
  7766. e.target.composing = false;
  7767. trigger(e.target, 'input');
  7768. }
  7769. function trigger (el, type) {
  7770. var e = document.createEvent('HTMLEvents');
  7771. e.initEvent(type, true, true);
  7772. el.dispatchEvent(e);
  7773. }
  7774. /* */
  7775. // recursively search for possible transition defined inside the component root
  7776. function locateNode (vnode) {
  7777. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7778. ? locateNode(vnode.componentInstance._vnode)
  7779. : vnode
  7780. }
  7781. var show = {
  7782. bind: function bind (el, ref, vnode) {
  7783. var value = ref.value;
  7784. vnode = locateNode(vnode);
  7785. var transition$$1 = vnode.data && vnode.data.transition;
  7786. var originalDisplay = el.__vOriginalDisplay =
  7787. el.style.display === 'none' ? '' : el.style.display;
  7788. if (value && transition$$1) {
  7789. vnode.data.show = true;
  7790. enter(vnode, function () {
  7791. el.style.display = originalDisplay;
  7792. });
  7793. } else {
  7794. el.style.display = value ? originalDisplay : 'none';
  7795. }
  7796. },
  7797. update: function update (el, ref, vnode) {
  7798. var value = ref.value;
  7799. var oldValue = ref.oldValue;
  7800. /* istanbul ignore if */
  7801. if (!value === !oldValue) { return }
  7802. vnode = locateNode(vnode);
  7803. var transition$$1 = vnode.data && vnode.data.transition;
  7804. if (transition$$1) {
  7805. vnode.data.show = true;
  7806. if (value) {
  7807. enter(vnode, function () {
  7808. el.style.display = el.__vOriginalDisplay;
  7809. });
  7810. } else {
  7811. leave(vnode, function () {
  7812. el.style.display = 'none';
  7813. });
  7814. }
  7815. } else {
  7816. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7817. }
  7818. },
  7819. unbind: function unbind (
  7820. el,
  7821. binding,
  7822. vnode,
  7823. oldVnode,
  7824. isDestroy
  7825. ) {
  7826. if (!isDestroy) {
  7827. el.style.display = el.__vOriginalDisplay;
  7828. }
  7829. }
  7830. };
  7831. var platformDirectives = {
  7832. model: directive,
  7833. show: show
  7834. };
  7835. /* */
  7836. var transitionProps = {
  7837. name: String,
  7838. appear: Boolean,
  7839. css: Boolean,
  7840. mode: String,
  7841. type: String,
  7842. enterClass: String,
  7843. leaveClass: String,
  7844. enterToClass: String,
  7845. leaveToClass: String,
  7846. enterActiveClass: String,
  7847. leaveActiveClass: String,
  7848. appearClass: String,
  7849. appearActiveClass: String,
  7850. appearToClass: String,
  7851. duration: [Number, String, Object]
  7852. };
  7853. // in case the child is also an abstract component, e.g. <keep-alive>
  7854. // we want to recursively retrieve the real component to be rendered
  7855. function getRealChild (vnode) {
  7856. var compOptions = vnode && vnode.componentOptions;
  7857. if (compOptions && compOptions.Ctor.options.abstract) {
  7858. return getRealChild(getFirstComponentChild(compOptions.children))
  7859. } else {
  7860. return vnode
  7861. }
  7862. }
  7863. function extractTransitionData (comp) {
  7864. var data = {};
  7865. var options = comp.$options;
  7866. // props
  7867. for (var key in options.propsData) {
  7868. data[key] = comp[key];
  7869. }
  7870. // events.
  7871. // extract listeners and pass them directly to the transition methods
  7872. var listeners = options._parentListeners;
  7873. for (var key$1 in listeners) {
  7874. data[camelize(key$1)] = listeners[key$1];
  7875. }
  7876. return data
  7877. }
  7878. function placeholder (h, rawChild) {
  7879. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7880. return h('keep-alive', {
  7881. props: rawChild.componentOptions.propsData
  7882. })
  7883. }
  7884. }
  7885. function hasParentTransition (vnode) {
  7886. while ((vnode = vnode.parent)) {
  7887. if (vnode.data.transition) {
  7888. return true
  7889. }
  7890. }
  7891. }
  7892. function isSameChild (child, oldChild) {
  7893. return oldChild.key === child.key && oldChild.tag === child.tag
  7894. }
  7895. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7896. var isVShowDirective = function (d) { return d.name === 'show'; };
  7897. var Transition = {
  7898. name: 'transition',
  7899. props: transitionProps,
  7900. abstract: true,
  7901. render: function render (h) {
  7902. var this$1 = this;
  7903. var children = this.$slots.default;
  7904. if (!children) {
  7905. return
  7906. }
  7907. // filter out text nodes (possible whitespaces)
  7908. children = children.filter(isNotTextNode);
  7909. /* istanbul ignore if */
  7910. if (!children.length) {
  7911. return
  7912. }
  7913. // warn multiple elements
  7914. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  7915. warn(
  7916. '<transition> can only be used on a single element. Use ' +
  7917. '<transition-group> for lists.',
  7918. this.$parent
  7919. );
  7920. }
  7921. var mode = this.mode;
  7922. // warn invalid mode
  7923. if (process.env.NODE_ENV !== 'production' &&
  7924. mode && mode !== 'in-out' && mode !== 'out-in'
  7925. ) {
  7926. warn(
  7927. 'invalid <transition> mode: ' + mode,
  7928. this.$parent
  7929. );
  7930. }
  7931. var rawChild = children[0];
  7932. // if this is a component root node and the component's
  7933. // parent container node also has transition, skip.
  7934. if (hasParentTransition(this.$vnode)) {
  7935. return rawChild
  7936. }
  7937. // apply transition data to child
  7938. // use getRealChild() to ignore abstract components e.g. keep-alive
  7939. var child = getRealChild(rawChild);
  7940. /* istanbul ignore if */
  7941. if (!child) {
  7942. return rawChild
  7943. }
  7944. if (this._leaving) {
  7945. return placeholder(h, rawChild)
  7946. }
  7947. // ensure a key that is unique to the vnode type and to this transition
  7948. // component instance. This key will be used to remove pending leaving nodes
  7949. // during entering.
  7950. var id = "__transition-" + (this._uid) + "-";
  7951. child.key = child.key == null
  7952. ? child.isComment
  7953. ? id + 'comment'
  7954. : id + child.tag
  7955. : isPrimitive(child.key)
  7956. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7957. : child.key;
  7958. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7959. var oldRawChild = this._vnode;
  7960. var oldChild = getRealChild(oldRawChild);
  7961. // mark v-show
  7962. // so that the transition module can hand over the control to the directive
  7963. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7964. child.data.show = true;
  7965. }
  7966. if (
  7967. oldChild &&
  7968. oldChild.data &&
  7969. !isSameChild(child, oldChild) &&
  7970. !isAsyncPlaceholder(oldChild) &&
  7971. // #6687 component root is a comment node
  7972. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7973. ) {
  7974. // replace old child transition data with fresh one
  7975. // important for dynamic transitions!
  7976. var oldData = oldChild.data.transition = extend({}, data);
  7977. // handle transition mode
  7978. if (mode === 'out-in') {
  7979. // return placeholder node and queue update when leave finishes
  7980. this._leaving = true;
  7981. mergeVNodeHook(oldData, 'afterLeave', function () {
  7982. this$1._leaving = false;
  7983. this$1.$forceUpdate();
  7984. });
  7985. return placeholder(h, rawChild)
  7986. } else if (mode === 'in-out') {
  7987. if (isAsyncPlaceholder(child)) {
  7988. return oldRawChild
  7989. }
  7990. var delayedLeave;
  7991. var performLeave = function () { delayedLeave(); };
  7992. mergeVNodeHook(data, 'afterEnter', performLeave);
  7993. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7994. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7995. }
  7996. }
  7997. return rawChild
  7998. }
  7999. };
  8000. /* */
  8001. var props = extend({
  8002. tag: String,
  8003. moveClass: String
  8004. }, transitionProps);
  8005. delete props.mode;
  8006. var TransitionGroup = {
  8007. props: props,
  8008. beforeMount: function beforeMount () {
  8009. var this$1 = this;
  8010. var update = this._update;
  8011. this._update = function (vnode, hydrating) {
  8012. var restoreActiveInstance = setActiveInstance(this$1);
  8013. // force removing pass
  8014. this$1.__patch__(
  8015. this$1._vnode,
  8016. this$1.kept,
  8017. false, // hydrating
  8018. true // removeOnly (!important, avoids unnecessary moves)
  8019. );
  8020. this$1._vnode = this$1.kept;
  8021. restoreActiveInstance();
  8022. update.call(this$1, vnode, hydrating);
  8023. };
  8024. },
  8025. render: function render (h) {
  8026. var tag = this.tag || this.$vnode.data.tag || 'span';
  8027. var map = Object.create(null);
  8028. var prevChildren = this.prevChildren = this.children;
  8029. var rawChildren = this.$slots.default || [];
  8030. var children = this.children = [];
  8031. var transitionData = extractTransitionData(this);
  8032. for (var i = 0; i < rawChildren.length; i++) {
  8033. var c = rawChildren[i];
  8034. if (c.tag) {
  8035. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  8036. children.push(c);
  8037. map[c.key] = c
  8038. ;(c.data || (c.data = {})).transition = transitionData;
  8039. } else if (process.env.NODE_ENV !== 'production') {
  8040. var opts = c.componentOptions;
  8041. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  8042. warn(("<transition-group> children must be keyed: <" + name + ">"));
  8043. }
  8044. }
  8045. }
  8046. if (prevChildren) {
  8047. var kept = [];
  8048. var removed = [];
  8049. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  8050. var c$1 = prevChildren[i$1];
  8051. c$1.data.transition = transitionData;
  8052. c$1.data.pos = c$1.elm.getBoundingClientRect();
  8053. if (map[c$1.key]) {
  8054. kept.push(c$1);
  8055. } else {
  8056. removed.push(c$1);
  8057. }
  8058. }
  8059. this.kept = h(tag, null, kept);
  8060. this.removed = removed;
  8061. }
  8062. return h(tag, null, children)
  8063. },
  8064. updated: function updated () {
  8065. var children = this.prevChildren;
  8066. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  8067. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  8068. return
  8069. }
  8070. // we divide the work into three loops to avoid mixing DOM reads and writes
  8071. // in each iteration - which helps prevent layout thrashing.
  8072. children.forEach(callPendingCbs);
  8073. children.forEach(recordPosition);
  8074. children.forEach(applyTranslation);
  8075. // force reflow to put everything in position
  8076. // assign to this to avoid being removed in tree-shaking
  8077. // $flow-disable-line
  8078. this._reflow = document.body.offsetHeight;
  8079. children.forEach(function (c) {
  8080. if (c.data.moved) {
  8081. var el = c.elm;
  8082. var s = el.style;
  8083. addTransitionClass(el, moveClass);
  8084. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8085. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  8086. if (e && e.target !== el) {
  8087. return
  8088. }
  8089. if (!e || /transform$/.test(e.propertyName)) {
  8090. el.removeEventListener(transitionEndEvent, cb);
  8091. el._moveCb = null;
  8092. removeTransitionClass(el, moveClass);
  8093. }
  8094. });
  8095. }
  8096. });
  8097. },
  8098. methods: {
  8099. hasMove: function hasMove (el, moveClass) {
  8100. /* istanbul ignore if */
  8101. if (!hasTransition) {
  8102. return false
  8103. }
  8104. /* istanbul ignore if */
  8105. if (this._hasMove) {
  8106. return this._hasMove
  8107. }
  8108. // Detect whether an element with the move class applied has
  8109. // CSS transitions. Since the element may be inside an entering
  8110. // transition at this very moment, we make a clone of it and remove
  8111. // all other transition classes applied to ensure only the move class
  8112. // is applied.
  8113. var clone = el.cloneNode();
  8114. if (el._transitionClasses) {
  8115. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  8116. }
  8117. addClass(clone, moveClass);
  8118. clone.style.display = 'none';
  8119. this.$el.appendChild(clone);
  8120. var info = getTransitionInfo(clone);
  8121. this.$el.removeChild(clone);
  8122. return (this._hasMove = info.hasTransform)
  8123. }
  8124. }
  8125. };
  8126. function callPendingCbs (c) {
  8127. /* istanbul ignore if */
  8128. if (c.elm._moveCb) {
  8129. c.elm._moveCb();
  8130. }
  8131. /* istanbul ignore if */
  8132. if (c.elm._enterCb) {
  8133. c.elm._enterCb();
  8134. }
  8135. }
  8136. function recordPosition (c) {
  8137. c.data.newPos = c.elm.getBoundingClientRect();
  8138. }
  8139. function applyTranslation (c) {
  8140. var oldPos = c.data.pos;
  8141. var newPos = c.data.newPos;
  8142. var dx = oldPos.left - newPos.left;
  8143. var dy = oldPos.top - newPos.top;
  8144. if (dx || dy) {
  8145. c.data.moved = true;
  8146. var s = c.elm.style;
  8147. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  8148. s.transitionDuration = '0s';
  8149. }
  8150. }
  8151. var platformComponents = {
  8152. Transition: Transition,
  8153. TransitionGroup: TransitionGroup
  8154. };
  8155. /* */
  8156. // install platform specific utils
  8157. Vue.config.mustUseProp = mustUseProp;
  8158. Vue.config.isReservedTag = isReservedTag;
  8159. Vue.config.isReservedAttr = isReservedAttr;
  8160. Vue.config.getTagNamespace = getTagNamespace;
  8161. Vue.config.isUnknownElement = isUnknownElement;
  8162. // install platform runtime directives & components
  8163. extend(Vue.options.directives, platformDirectives);
  8164. extend(Vue.options.components, platformComponents);
  8165. // install platform patch function
  8166. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  8167. // public mount method
  8168. Vue.prototype.$mount = function (
  8169. el,
  8170. hydrating
  8171. ) {
  8172. el = el && inBrowser ? query(el) : undefined;
  8173. return mountComponent(this, el, hydrating)
  8174. };
  8175. // devtools global hook
  8176. /* istanbul ignore next */
  8177. if (inBrowser) {
  8178. setTimeout(function () {
  8179. if (config.devtools) {
  8180. if (devtools) {
  8181. devtools.emit('init', Vue);
  8182. } else if (
  8183. process.env.NODE_ENV !== 'production' &&
  8184. process.env.NODE_ENV !== 'test'
  8185. ) {
  8186. console[console.info ? 'info' : 'log'](
  8187. 'Download the Vue Devtools extension for a better development experience:\n' +
  8188. 'https://github.com/vuejs/vue-devtools'
  8189. );
  8190. }
  8191. }
  8192. if (process.env.NODE_ENV !== 'production' &&
  8193. process.env.NODE_ENV !== 'test' &&
  8194. config.productionTip !== false &&
  8195. typeof console !== 'undefined'
  8196. ) {
  8197. console[console.info ? 'info' : 'log'](
  8198. "You are running Vue in development mode.\n" +
  8199. "Make sure to turn on production mode when deploying for production.\n" +
  8200. "See more tips at https://vuejs.org/guide/deployment.html"
  8201. );
  8202. }
  8203. }, 0);
  8204. }
  8205. /* */
  8206. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  8207. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  8208. var buildRegex = cached(function (delimiters) {
  8209. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  8210. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  8211. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  8212. });
  8213. function parseText (
  8214. text,
  8215. delimiters
  8216. ) {
  8217. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  8218. if (!tagRE.test(text)) {
  8219. return
  8220. }
  8221. var tokens = [];
  8222. var rawTokens = [];
  8223. var lastIndex = tagRE.lastIndex = 0;
  8224. var match, index, tokenValue;
  8225. while ((match = tagRE.exec(text))) {
  8226. index = match.index;
  8227. // push text token
  8228. if (index > lastIndex) {
  8229. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  8230. tokens.push(JSON.stringify(tokenValue));
  8231. }
  8232. // tag token
  8233. var exp = parseFilters(match[1].trim());
  8234. tokens.push(("_s(" + exp + ")"));
  8235. rawTokens.push({ '@binding': exp });
  8236. lastIndex = index + match[0].length;
  8237. }
  8238. if (lastIndex < text.length) {
  8239. rawTokens.push(tokenValue = text.slice(lastIndex));
  8240. tokens.push(JSON.stringify(tokenValue));
  8241. }
  8242. return {
  8243. expression: tokens.join('+'),
  8244. tokens: rawTokens
  8245. }
  8246. }
  8247. /* */
  8248. function transformNode (el, options) {
  8249. var warn = options.warn || baseWarn;
  8250. var staticClass = getAndRemoveAttr(el, 'class');
  8251. if (process.env.NODE_ENV !== 'production' && staticClass) {
  8252. var res = parseText(staticClass, options.delimiters);
  8253. if (res) {
  8254. warn(
  8255. "class=\"" + staticClass + "\": " +
  8256. 'Interpolation inside attributes has been removed. ' +
  8257. 'Use v-bind or the colon shorthand instead. For example, ' +
  8258. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  8259. el.rawAttrsMap['class']
  8260. );
  8261. }
  8262. }
  8263. if (staticClass) {
  8264. el.staticClass = JSON.stringify(staticClass);
  8265. }
  8266. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  8267. if (classBinding) {
  8268. el.classBinding = classBinding;
  8269. }
  8270. }
  8271. function genData (el) {
  8272. var data = '';
  8273. if (el.staticClass) {
  8274. data += "staticClass:" + (el.staticClass) + ",";
  8275. }
  8276. if (el.classBinding) {
  8277. data += "class:" + (el.classBinding) + ",";
  8278. }
  8279. return data
  8280. }
  8281. var klass$1 = {
  8282. staticKeys: ['staticClass'],
  8283. transformNode: transformNode,
  8284. genData: genData
  8285. };
  8286. /* */
  8287. function transformNode$1 (el, options) {
  8288. var warn = options.warn || baseWarn;
  8289. var staticStyle = getAndRemoveAttr(el, 'style');
  8290. if (staticStyle) {
  8291. /* istanbul ignore if */
  8292. if (process.env.NODE_ENV !== 'production') {
  8293. var res = parseText(staticStyle, options.delimiters);
  8294. if (res) {
  8295. warn(
  8296. "style=\"" + staticStyle + "\": " +
  8297. 'Interpolation inside attributes has been removed. ' +
  8298. 'Use v-bind or the colon shorthand instead. For example, ' +
  8299. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  8300. el.rawAttrsMap['style']
  8301. );
  8302. }
  8303. }
  8304. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  8305. }
  8306. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  8307. if (styleBinding) {
  8308. el.styleBinding = styleBinding;
  8309. }
  8310. }
  8311. function genData$1 (el) {
  8312. var data = '';
  8313. if (el.staticStyle) {
  8314. data += "staticStyle:" + (el.staticStyle) + ",";
  8315. }
  8316. if (el.styleBinding) {
  8317. data += "style:(" + (el.styleBinding) + "),";
  8318. }
  8319. return data
  8320. }
  8321. var style$1 = {
  8322. staticKeys: ['staticStyle'],
  8323. transformNode: transformNode$1,
  8324. genData: genData$1
  8325. };
  8326. /* */
  8327. var decoder;
  8328. var he = {
  8329. decode: function decode (html) {
  8330. decoder = decoder || document.createElement('div');
  8331. decoder.innerHTML = html;
  8332. return decoder.textContent
  8333. }
  8334. };
  8335. /* */
  8336. var isUnaryTag = makeMap(
  8337. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  8338. 'link,meta,param,source,track,wbr'
  8339. );
  8340. // Elements that you can, intentionally, leave open
  8341. // (and which close themselves)
  8342. var canBeLeftOpenTag = makeMap(
  8343. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  8344. );
  8345. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  8346. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  8347. var isNonPhrasingTag = makeMap(
  8348. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  8349. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  8350. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  8351. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  8352. 'title,tr,track'
  8353. );
  8354. /**
  8355. * Not type-checking this file because it's mostly vendor code.
  8356. */
  8357. // Regular Expressions for parsing tags and attributes
  8358. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8359. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8360. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  8361. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  8362. var startTagOpen = new RegExp(("^<" + qnameCapture));
  8363. var startTagClose = /^\s*(\/?)>/;
  8364. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  8365. var doctype = /^<!DOCTYPE [^>]+>/i;
  8366. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  8367. var comment = /^<!\--/;
  8368. var conditionalComment = /^<!\[/;
  8369. // Special Elements (can contain anything)
  8370. var isPlainTextElement = makeMap('script,style,textarea', true);
  8371. var reCache = {};
  8372. var decodingMap = {
  8373. '&lt;': '<',
  8374. '&gt;': '>',
  8375. '&quot;': '"',
  8376. '&amp;': '&',
  8377. '&#10;': '\n',
  8378. '&#9;': '\t',
  8379. '&#39;': "'"
  8380. };
  8381. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  8382. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  8383. // #5992
  8384. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8385. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  8386. function decodeAttr (value, shouldDecodeNewlines) {
  8387. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8388. return value.replace(re, function (match) { return decodingMap[match]; })
  8389. }
  8390. function parseHTML (html, options) {
  8391. var stack = [];
  8392. var expectHTML = options.expectHTML;
  8393. var isUnaryTag$$1 = options.isUnaryTag || no;
  8394. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8395. var index = 0;
  8396. var last, lastTag;
  8397. while (html) {
  8398. last = html;
  8399. // Make sure we're not in a plaintext content element like script/style
  8400. if (!lastTag || !isPlainTextElement(lastTag)) {
  8401. var textEnd = html.indexOf('<');
  8402. if (textEnd === 0) {
  8403. // Comment:
  8404. if (comment.test(html)) {
  8405. var commentEnd = html.indexOf('-->');
  8406. if (commentEnd >= 0) {
  8407. if (options.shouldKeepComment) {
  8408. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  8409. }
  8410. advance(commentEnd + 3);
  8411. continue
  8412. }
  8413. }
  8414. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8415. if (conditionalComment.test(html)) {
  8416. var conditionalEnd = html.indexOf(']>');
  8417. if (conditionalEnd >= 0) {
  8418. advance(conditionalEnd + 2);
  8419. continue
  8420. }
  8421. }
  8422. // Doctype:
  8423. var doctypeMatch = html.match(doctype);
  8424. if (doctypeMatch) {
  8425. advance(doctypeMatch[0].length);
  8426. continue
  8427. }
  8428. // End tag:
  8429. var endTagMatch = html.match(endTag);
  8430. if (endTagMatch) {
  8431. var curIndex = index;
  8432. advance(endTagMatch[0].length);
  8433. parseEndTag(endTagMatch[1], curIndex, index);
  8434. continue
  8435. }
  8436. // Start tag:
  8437. var startTagMatch = parseStartTag();
  8438. if (startTagMatch) {
  8439. handleStartTag(startTagMatch);
  8440. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8441. advance(1);
  8442. }
  8443. continue
  8444. }
  8445. }
  8446. var text = (void 0), rest = (void 0), next = (void 0);
  8447. if (textEnd >= 0) {
  8448. rest = html.slice(textEnd);
  8449. while (
  8450. !endTag.test(rest) &&
  8451. !startTagOpen.test(rest) &&
  8452. !comment.test(rest) &&
  8453. !conditionalComment.test(rest)
  8454. ) {
  8455. // < in plain text, be forgiving and treat it as text
  8456. next = rest.indexOf('<', 1);
  8457. if (next < 0) { break }
  8458. textEnd += next;
  8459. rest = html.slice(textEnd);
  8460. }
  8461. text = html.substring(0, textEnd);
  8462. }
  8463. if (textEnd < 0) {
  8464. text = html;
  8465. }
  8466. if (text) {
  8467. advance(text.length);
  8468. }
  8469. if (options.chars && text) {
  8470. options.chars(text, index - text.length, index);
  8471. }
  8472. } else {
  8473. var endTagLength = 0;
  8474. var stackedTag = lastTag.toLowerCase();
  8475. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8476. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8477. endTagLength = endTag.length;
  8478. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8479. text = text
  8480. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8481. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8482. }
  8483. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8484. text = text.slice(1);
  8485. }
  8486. if (options.chars) {
  8487. options.chars(text);
  8488. }
  8489. return ''
  8490. });
  8491. index += html.length - rest$1.length;
  8492. html = rest$1;
  8493. parseEndTag(stackedTag, index - endTagLength, index);
  8494. }
  8495. if (html === last) {
  8496. options.chars && options.chars(html);
  8497. if (process.env.NODE_ENV !== 'production' && !stack.length && options.warn) {
  8498. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  8499. }
  8500. break
  8501. }
  8502. }
  8503. // Clean up any remaining tags
  8504. parseEndTag();
  8505. function advance (n) {
  8506. index += n;
  8507. html = html.substring(n);
  8508. }
  8509. function parseStartTag () {
  8510. var start = html.match(startTagOpen);
  8511. if (start) {
  8512. var match = {
  8513. tagName: start[1],
  8514. attrs: [],
  8515. start: index
  8516. };
  8517. advance(start[0].length);
  8518. var end, attr;
  8519. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  8520. attr.start = index;
  8521. advance(attr[0].length);
  8522. attr.end = index;
  8523. match.attrs.push(attr);
  8524. }
  8525. if (end) {
  8526. match.unarySlash = end[1];
  8527. advance(end[0].length);
  8528. match.end = index;
  8529. return match
  8530. }
  8531. }
  8532. }
  8533. function handleStartTag (match) {
  8534. var tagName = match.tagName;
  8535. var unarySlash = match.unarySlash;
  8536. if (expectHTML) {
  8537. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8538. parseEndTag(lastTag);
  8539. }
  8540. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8541. parseEndTag(tagName);
  8542. }
  8543. }
  8544. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8545. var l = match.attrs.length;
  8546. var attrs = new Array(l);
  8547. for (var i = 0; i < l; i++) {
  8548. var args = match.attrs[i];
  8549. var value = args[3] || args[4] || args[5] || '';
  8550. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8551. ? options.shouldDecodeNewlinesForHref
  8552. : options.shouldDecodeNewlines;
  8553. attrs[i] = {
  8554. name: args[1],
  8555. value: decodeAttr(value, shouldDecodeNewlines)
  8556. };
  8557. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  8558. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  8559. attrs[i].end = args.end;
  8560. }
  8561. }
  8562. if (!unary) {
  8563. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  8564. lastTag = tagName;
  8565. }
  8566. if (options.start) {
  8567. options.start(tagName, attrs, unary, match.start, match.end);
  8568. }
  8569. }
  8570. function parseEndTag (tagName, start, end) {
  8571. var pos, lowerCasedTagName;
  8572. if (start == null) { start = index; }
  8573. if (end == null) { end = index; }
  8574. // Find the closest opened tag of the same type
  8575. if (tagName) {
  8576. lowerCasedTagName = tagName.toLowerCase();
  8577. for (pos = stack.length - 1; pos >= 0; pos--) {
  8578. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8579. break
  8580. }
  8581. }
  8582. } else {
  8583. // If no tag name is provided, clean shop
  8584. pos = 0;
  8585. }
  8586. if (pos >= 0) {
  8587. // Close all the open elements, up the stack
  8588. for (var i = stack.length - 1; i >= pos; i--) {
  8589. if (process.env.NODE_ENV !== 'production' &&
  8590. (i > pos || !tagName) &&
  8591. options.warn
  8592. ) {
  8593. options.warn(
  8594. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  8595. { start: stack[i].start, end: stack[i].end }
  8596. );
  8597. }
  8598. if (options.end) {
  8599. options.end(stack[i].tag, start, end);
  8600. }
  8601. }
  8602. // Remove the open elements from the stack
  8603. stack.length = pos;
  8604. lastTag = pos && stack[pos - 1].tag;
  8605. } else if (lowerCasedTagName === 'br') {
  8606. if (options.start) {
  8607. options.start(tagName, [], true, start, end);
  8608. }
  8609. } else if (lowerCasedTagName === 'p') {
  8610. if (options.start) {
  8611. options.start(tagName, [], false, start, end);
  8612. }
  8613. if (options.end) {
  8614. options.end(tagName, start, end);
  8615. }
  8616. }
  8617. }
  8618. }
  8619. /* */
  8620. var onRE = /^@|^v-on:/;
  8621. var dirRE = /^v-|^@|^:/;
  8622. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8623. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8624. var stripParensRE = /^\(|\)$/g;
  8625. var dynamicArgRE = /^\[.*\]$/;
  8626. var argRE = /:(.*)$/;
  8627. var bindRE = /^:|^\.|^v-bind:/;
  8628. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  8629. var slotRE = /^v-slot(:|$)|^#/;
  8630. var lineBreakRE = /[\r\n]/;
  8631. var whitespaceRE$1 = /\s+/g;
  8632. var invalidAttributeRE = /[\s"'<>\/=]/;
  8633. var decodeHTMLCached = cached(he.decode);
  8634. var emptySlotScopeToken = "_empty_";
  8635. // configurable state
  8636. var warn$2;
  8637. var delimiters;
  8638. var transforms;
  8639. var preTransforms;
  8640. var postTransforms;
  8641. var platformIsPreTag;
  8642. var platformMustUseProp;
  8643. var platformGetTagNamespace;
  8644. var maybeComponent;
  8645. function createASTElement (
  8646. tag,
  8647. attrs,
  8648. parent
  8649. ) {
  8650. return {
  8651. type: 1,
  8652. tag: tag,
  8653. attrsList: attrs,
  8654. attrsMap: makeAttrsMap(attrs),
  8655. rawAttrsMap: {},
  8656. parent: parent,
  8657. children: []
  8658. }
  8659. }
  8660. /**
  8661. * Convert HTML string to AST.
  8662. */
  8663. function parse (
  8664. template,
  8665. options
  8666. ) {
  8667. warn$2 = options.warn || baseWarn;
  8668. platformIsPreTag = options.isPreTag || no;
  8669. platformMustUseProp = options.mustUseProp || no;
  8670. platformGetTagNamespace = options.getTagNamespace || no;
  8671. var isReservedTag = options.isReservedTag || no;
  8672. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  8673. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8674. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8675. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8676. delimiters = options.delimiters;
  8677. var stack = [];
  8678. var preserveWhitespace = options.preserveWhitespace !== false;
  8679. var whitespaceOption = options.whitespace;
  8680. var root;
  8681. var currentParent;
  8682. var inVPre = false;
  8683. var inPre = false;
  8684. var warned = false;
  8685. function warnOnce (msg, range) {
  8686. if (!warned) {
  8687. warned = true;
  8688. warn$2(msg, range);
  8689. }
  8690. }
  8691. function closeElement (element) {
  8692. trimEndingWhitespace(element);
  8693. if (!inVPre && !element.processed) {
  8694. element = processElement(element, options);
  8695. }
  8696. // tree management
  8697. if (!stack.length && element !== root) {
  8698. // allow root elements with v-if, v-else-if and v-else
  8699. if (root.if && (element.elseif || element.else)) {
  8700. if (process.env.NODE_ENV !== 'production') {
  8701. checkRootConstraints(element);
  8702. }
  8703. addIfCondition(root, {
  8704. exp: element.elseif,
  8705. block: element
  8706. });
  8707. } else if (process.env.NODE_ENV !== 'production') {
  8708. warnOnce(
  8709. "Component template should contain exactly one root element. " +
  8710. "If you are using v-if on multiple elements, " +
  8711. "use v-else-if to chain them instead.",
  8712. { start: element.start }
  8713. );
  8714. }
  8715. }
  8716. if (currentParent && !element.forbidden) {
  8717. if (element.elseif || element.else) {
  8718. processIfConditions(element, currentParent);
  8719. } else {
  8720. if (element.slotScope) {
  8721. // scoped slot
  8722. // keep it in the children list so that v-else(-if) conditions can
  8723. // find it as the prev node.
  8724. var name = element.slotTarget || '"default"'
  8725. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8726. }
  8727. currentParent.children.push(element);
  8728. element.parent = currentParent;
  8729. }
  8730. }
  8731. // final children cleanup
  8732. // filter out scoped slots
  8733. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  8734. // remove trailing whitespace node again
  8735. trimEndingWhitespace(element);
  8736. // check pre state
  8737. if (element.pre) {
  8738. inVPre = false;
  8739. }
  8740. if (platformIsPreTag(element.tag)) {
  8741. inPre = false;
  8742. }
  8743. // apply post-transforms
  8744. for (var i = 0; i < postTransforms.length; i++) {
  8745. postTransforms[i](element, options);
  8746. }
  8747. }
  8748. function trimEndingWhitespace (el) {
  8749. // remove trailing whitespace node
  8750. if (!inPre) {
  8751. var lastNode;
  8752. while (
  8753. (lastNode = el.children[el.children.length - 1]) &&
  8754. lastNode.type === 3 &&
  8755. lastNode.text === ' '
  8756. ) {
  8757. el.children.pop();
  8758. }
  8759. }
  8760. }
  8761. function checkRootConstraints (el) {
  8762. if (el.tag === 'slot' || el.tag === 'template') {
  8763. warnOnce(
  8764. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8765. 'contain multiple nodes.',
  8766. { start: el.start }
  8767. );
  8768. }
  8769. if (el.attrsMap.hasOwnProperty('v-for')) {
  8770. warnOnce(
  8771. 'Cannot use v-for on stateful component root element because ' +
  8772. 'it renders multiple elements.',
  8773. el.rawAttrsMap['v-for']
  8774. );
  8775. }
  8776. }
  8777. parseHTML(template, {
  8778. warn: warn$2,
  8779. expectHTML: options.expectHTML,
  8780. isUnaryTag: options.isUnaryTag,
  8781. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8782. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8783. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8784. shouldKeepComment: options.comments,
  8785. outputSourceRange: options.outputSourceRange,
  8786. start: function start (tag, attrs, unary, start$1, end) {
  8787. // check namespace.
  8788. // inherit parent ns if there is one
  8789. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8790. // handle IE svg bug
  8791. /* istanbul ignore if */
  8792. if (isIE && ns === 'svg') {
  8793. attrs = guardIESVGBug(attrs);
  8794. }
  8795. var element = createASTElement(tag, attrs, currentParent);
  8796. if (ns) {
  8797. element.ns = ns;
  8798. }
  8799. if (process.env.NODE_ENV !== 'production') {
  8800. if (options.outputSourceRange) {
  8801. element.start = start$1;
  8802. element.end = end;
  8803. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  8804. cumulated[attr.name] = attr;
  8805. return cumulated
  8806. }, {});
  8807. }
  8808. attrs.forEach(function (attr) {
  8809. if (invalidAttributeRE.test(attr.name)) {
  8810. warn$2(
  8811. "Invalid dynamic argument expression: attribute names cannot contain " +
  8812. "spaces, quotes, <, >, / or =.",
  8813. {
  8814. start: attr.start + attr.name.indexOf("["),
  8815. end: attr.start + attr.name.length
  8816. }
  8817. );
  8818. }
  8819. });
  8820. }
  8821. if (isForbiddenTag(element) && !isServerRendering()) {
  8822. element.forbidden = true;
  8823. process.env.NODE_ENV !== 'production' && warn$2(
  8824. 'Templates should only be responsible for mapping the state to the ' +
  8825. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8826. "<" + tag + ">" + ', as they will not be parsed.',
  8827. { start: element.start }
  8828. );
  8829. }
  8830. // apply pre-transforms
  8831. for (var i = 0; i < preTransforms.length; i++) {
  8832. element = preTransforms[i](element, options) || element;
  8833. }
  8834. if (!inVPre) {
  8835. processPre(element);
  8836. if (element.pre) {
  8837. inVPre = true;
  8838. }
  8839. }
  8840. if (platformIsPreTag(element.tag)) {
  8841. inPre = true;
  8842. }
  8843. if (inVPre) {
  8844. processRawAttrs(element);
  8845. } else if (!element.processed) {
  8846. // structural directives
  8847. processFor(element);
  8848. processIf(element);
  8849. processOnce(element);
  8850. }
  8851. if (!root) {
  8852. root = element;
  8853. if (process.env.NODE_ENV !== 'production') {
  8854. checkRootConstraints(root);
  8855. }
  8856. }
  8857. if (!unary) {
  8858. currentParent = element;
  8859. stack.push(element);
  8860. } else {
  8861. closeElement(element);
  8862. }
  8863. },
  8864. end: function end (tag, start, end$1) {
  8865. var element = stack[stack.length - 1];
  8866. // pop stack
  8867. stack.length -= 1;
  8868. currentParent = stack[stack.length - 1];
  8869. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  8870. element.end = end$1;
  8871. }
  8872. closeElement(element);
  8873. },
  8874. chars: function chars (text, start, end) {
  8875. if (!currentParent) {
  8876. if (process.env.NODE_ENV !== 'production') {
  8877. if (text === template) {
  8878. warnOnce(
  8879. 'Component template requires a root element, rather than just text.',
  8880. { start: start }
  8881. );
  8882. } else if ((text = text.trim())) {
  8883. warnOnce(
  8884. ("text \"" + text + "\" outside root element will be ignored."),
  8885. { start: start }
  8886. );
  8887. }
  8888. }
  8889. return
  8890. }
  8891. // IE textarea placeholder bug
  8892. /* istanbul ignore if */
  8893. if (isIE &&
  8894. currentParent.tag === 'textarea' &&
  8895. currentParent.attrsMap.placeholder === text
  8896. ) {
  8897. return
  8898. }
  8899. var children = currentParent.children;
  8900. if (inPre || text.trim()) {
  8901. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  8902. } else if (!children.length) {
  8903. // remove the whitespace-only node right after an opening tag
  8904. text = '';
  8905. } else if (whitespaceOption) {
  8906. if (whitespaceOption === 'condense') {
  8907. // in condense mode, remove the whitespace node if it contains
  8908. // line break, otherwise condense to a single space
  8909. text = lineBreakRE.test(text) ? '' : ' ';
  8910. } else {
  8911. text = ' ';
  8912. }
  8913. } else {
  8914. text = preserveWhitespace ? ' ' : '';
  8915. }
  8916. if (text) {
  8917. if (!inPre && whitespaceOption === 'condense') {
  8918. // condense consecutive whitespaces into single space
  8919. text = text.replace(whitespaceRE$1, ' ');
  8920. }
  8921. var res;
  8922. var child;
  8923. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8924. child = {
  8925. type: 2,
  8926. expression: res.expression,
  8927. tokens: res.tokens,
  8928. text: text
  8929. };
  8930. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8931. child = {
  8932. type: 3,
  8933. text: text
  8934. };
  8935. }
  8936. if (child) {
  8937. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  8938. child.start = start;
  8939. child.end = end;
  8940. }
  8941. children.push(child);
  8942. }
  8943. }
  8944. },
  8945. comment: function comment (text, start, end) {
  8946. // adding anyting as a sibling to the root node is forbidden
  8947. // comments should still be allowed, but ignored
  8948. if (currentParent) {
  8949. var child = {
  8950. type: 3,
  8951. text: text,
  8952. isComment: true
  8953. };
  8954. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  8955. child.start = start;
  8956. child.end = end;
  8957. }
  8958. currentParent.children.push(child);
  8959. }
  8960. }
  8961. });
  8962. return root
  8963. }
  8964. function processPre (el) {
  8965. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8966. el.pre = true;
  8967. }
  8968. }
  8969. function processRawAttrs (el) {
  8970. var list = el.attrsList;
  8971. var len = list.length;
  8972. if (len) {
  8973. var attrs = el.attrs = new Array(len);
  8974. for (var i = 0; i < len; i++) {
  8975. attrs[i] = {
  8976. name: list[i].name,
  8977. value: JSON.stringify(list[i].value)
  8978. };
  8979. if (list[i].start != null) {
  8980. attrs[i].start = list[i].start;
  8981. attrs[i].end = list[i].end;
  8982. }
  8983. }
  8984. } else if (!el.pre) {
  8985. // non root node in pre blocks with no attributes
  8986. el.plain = true;
  8987. }
  8988. }
  8989. function processElement (
  8990. element,
  8991. options
  8992. ) {
  8993. processKey(element);
  8994. // determine whether this is a plain element after
  8995. // removing structural attributes
  8996. element.plain = (
  8997. !element.key &&
  8998. !element.scopedSlots &&
  8999. !element.attrsList.length
  9000. );
  9001. processRef(element);
  9002. processSlotContent(element);
  9003. processSlotOutlet(element);
  9004. processComponent(element);
  9005. for (var i = 0; i < transforms.length; i++) {
  9006. element = transforms[i](element, options) || element;
  9007. }
  9008. processAttrs(element);
  9009. return element
  9010. }
  9011. function processKey (el) {
  9012. var exp = getBindingAttr(el, 'key');
  9013. if (exp) {
  9014. if (process.env.NODE_ENV !== 'production') {
  9015. if (el.tag === 'template') {
  9016. warn$2(
  9017. "<template> cannot be keyed. Place the key on real elements instead.",
  9018. getRawBindingAttr(el, 'key')
  9019. );
  9020. }
  9021. if (el.for) {
  9022. var iterator = el.iterator2 || el.iterator1;
  9023. var parent = el.parent;
  9024. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  9025. warn$2(
  9026. "Do not use v-for index as key on <transition-group> children, " +
  9027. "this is the same as not using keys.",
  9028. getRawBindingAttr(el, 'key'),
  9029. true /* tip */
  9030. );
  9031. }
  9032. }
  9033. }
  9034. el.key = exp;
  9035. }
  9036. }
  9037. function processRef (el) {
  9038. var ref = getBindingAttr(el, 'ref');
  9039. if (ref) {
  9040. el.ref = ref;
  9041. el.refInFor = checkInFor(el);
  9042. }
  9043. }
  9044. function processFor (el) {
  9045. var exp;
  9046. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  9047. var res = parseFor(exp);
  9048. if (res) {
  9049. extend(el, res);
  9050. } else if (process.env.NODE_ENV !== 'production') {
  9051. warn$2(
  9052. ("Invalid v-for expression: " + exp),
  9053. el.rawAttrsMap['v-for']
  9054. );
  9055. }
  9056. }
  9057. }
  9058. function parseFor (exp) {
  9059. var inMatch = exp.match(forAliasRE);
  9060. if (!inMatch) { return }
  9061. var res = {};
  9062. res.for = inMatch[2].trim();
  9063. var alias = inMatch[1].trim().replace(stripParensRE, '');
  9064. var iteratorMatch = alias.match(forIteratorRE);
  9065. if (iteratorMatch) {
  9066. res.alias = alias.replace(forIteratorRE, '').trim();
  9067. res.iterator1 = iteratorMatch[1].trim();
  9068. if (iteratorMatch[2]) {
  9069. res.iterator2 = iteratorMatch[2].trim();
  9070. }
  9071. } else {
  9072. res.alias = alias;
  9073. }
  9074. return res
  9075. }
  9076. function processIf (el) {
  9077. var exp = getAndRemoveAttr(el, 'v-if');
  9078. if (exp) {
  9079. el.if = exp;
  9080. addIfCondition(el, {
  9081. exp: exp,
  9082. block: el
  9083. });
  9084. } else {
  9085. if (getAndRemoveAttr(el, 'v-else') != null) {
  9086. el.else = true;
  9087. }
  9088. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9089. if (elseif) {
  9090. el.elseif = elseif;
  9091. }
  9092. }
  9093. }
  9094. function processIfConditions (el, parent) {
  9095. var prev = findPrevElement(parent.children);
  9096. if (prev && prev.if) {
  9097. addIfCondition(prev, {
  9098. exp: el.elseif,
  9099. block: el
  9100. });
  9101. } else if (process.env.NODE_ENV !== 'production') {
  9102. warn$2(
  9103. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  9104. "used on element <" + (el.tag) + "> without corresponding v-if.",
  9105. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  9106. );
  9107. }
  9108. }
  9109. function findPrevElement (children) {
  9110. var i = children.length;
  9111. while (i--) {
  9112. if (children[i].type === 1) {
  9113. return children[i]
  9114. } else {
  9115. if (process.env.NODE_ENV !== 'production' && children[i].text !== ' ') {
  9116. warn$2(
  9117. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  9118. "will be ignored.",
  9119. children[i]
  9120. );
  9121. }
  9122. children.pop();
  9123. }
  9124. }
  9125. }
  9126. function addIfCondition (el, condition) {
  9127. if (!el.ifConditions) {
  9128. el.ifConditions = [];
  9129. }
  9130. el.ifConditions.push(condition);
  9131. }
  9132. function processOnce (el) {
  9133. var once$$1 = getAndRemoveAttr(el, 'v-once');
  9134. if (once$$1 != null) {
  9135. el.once = true;
  9136. }
  9137. }
  9138. // handle content being passed to a component as slot,
  9139. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  9140. function processSlotContent (el) {
  9141. var slotScope;
  9142. if (el.tag === 'template') {
  9143. slotScope = getAndRemoveAttr(el, 'scope');
  9144. /* istanbul ignore if */
  9145. if (process.env.NODE_ENV !== 'production' && slotScope) {
  9146. warn$2(
  9147. "the \"scope\" attribute for scoped slots have been deprecated and " +
  9148. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  9149. "can also be used on plain elements in addition to <template> to " +
  9150. "denote scoped slots.",
  9151. el.rawAttrsMap['scope'],
  9152. true
  9153. );
  9154. }
  9155. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  9156. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  9157. /* istanbul ignore if */
  9158. if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
  9159. warn$2(
  9160. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  9161. "(v-for takes higher priority). Use a wrapper <template> for the " +
  9162. "scoped slot to make it clearer.",
  9163. el.rawAttrsMap['slot-scope'],
  9164. true
  9165. );
  9166. }
  9167. el.slotScope = slotScope;
  9168. }
  9169. // slot="xxx"
  9170. var slotTarget = getBindingAttr(el, 'slot');
  9171. if (slotTarget) {
  9172. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  9173. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  9174. // preserve slot as an attribute for native shadow DOM compat
  9175. // only for non-scoped slots.
  9176. if (el.tag !== 'template' && !el.slotScope) {
  9177. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  9178. }
  9179. }
  9180. // 2.6 v-slot syntax
  9181. {
  9182. if (el.tag === 'template') {
  9183. // v-slot on <template>
  9184. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  9185. if (slotBinding) {
  9186. if (process.env.NODE_ENV !== 'production') {
  9187. if (el.slotTarget || el.slotScope) {
  9188. warn$2(
  9189. "Unexpected mixed usage of different slot syntaxes.",
  9190. el
  9191. );
  9192. }
  9193. if (el.parent && !maybeComponent(el.parent)) {
  9194. warn$2(
  9195. "<template v-slot> can only appear at the root level inside " +
  9196. "the receiving the component",
  9197. el
  9198. );
  9199. }
  9200. }
  9201. var ref = getSlotName(slotBinding);
  9202. var name = ref.name;
  9203. var dynamic = ref.dynamic;
  9204. el.slotTarget = name;
  9205. el.slotTargetDynamic = dynamic;
  9206. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  9207. }
  9208. } else {
  9209. // v-slot on component, denotes default slot
  9210. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  9211. if (slotBinding$1) {
  9212. if (process.env.NODE_ENV !== 'production') {
  9213. if (!maybeComponent(el)) {
  9214. warn$2(
  9215. "v-slot can only be used on components or <template>.",
  9216. slotBinding$1
  9217. );
  9218. }
  9219. if (el.slotScope || el.slotTarget) {
  9220. warn$2(
  9221. "Unexpected mixed usage of different slot syntaxes.",
  9222. el
  9223. );
  9224. }
  9225. if (el.scopedSlots) {
  9226. warn$2(
  9227. "To avoid scope ambiguity, the default slot should also use " +
  9228. "<template> syntax when there are other named slots.",
  9229. slotBinding$1
  9230. );
  9231. }
  9232. }
  9233. // add the component's children to its default slot
  9234. var slots = el.scopedSlots || (el.scopedSlots = {});
  9235. var ref$1 = getSlotName(slotBinding$1);
  9236. var name$1 = ref$1.name;
  9237. var dynamic$1 = ref$1.dynamic;
  9238. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  9239. slotContainer.slotTarget = name$1;
  9240. slotContainer.slotTargetDynamic = dynamic$1;
  9241. slotContainer.children = el.children.filter(function (c) {
  9242. if (!c.slotScope) {
  9243. c.parent = slotContainer;
  9244. return true
  9245. }
  9246. });
  9247. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  9248. // remove children as they are returned from scopedSlots now
  9249. el.children = [];
  9250. // mark el non-plain so data gets generated
  9251. el.plain = false;
  9252. }
  9253. }
  9254. }
  9255. }
  9256. function getSlotName (binding) {
  9257. var name = binding.name.replace(slotRE, '');
  9258. if (!name) {
  9259. if (binding.name[0] !== '#') {
  9260. name = 'default';
  9261. } else if (process.env.NODE_ENV !== 'production') {
  9262. warn$2(
  9263. "v-slot shorthand syntax requires a slot name.",
  9264. binding
  9265. );
  9266. }
  9267. }
  9268. return dynamicArgRE.test(name)
  9269. // dynamic [name]
  9270. ? { name: name.slice(1, -1), dynamic: true }
  9271. // static name
  9272. : { name: ("\"" + name + "\""), dynamic: false }
  9273. }
  9274. // handle <slot/> outlets
  9275. function processSlotOutlet (el) {
  9276. if (el.tag === 'slot') {
  9277. el.slotName = getBindingAttr(el, 'name');
  9278. if (process.env.NODE_ENV !== 'production' && el.key) {
  9279. warn$2(
  9280. "`key` does not work on <slot> because slots are abstract outlets " +
  9281. "and can possibly expand into multiple elements. " +
  9282. "Use the key on a wrapping element instead.",
  9283. getRawBindingAttr(el, 'key')
  9284. );
  9285. }
  9286. }
  9287. }
  9288. function processComponent (el) {
  9289. var binding;
  9290. if ((binding = getBindingAttr(el, 'is'))) {
  9291. el.component = binding;
  9292. }
  9293. if (getAndRemoveAttr(el, 'inline-template') != null) {
  9294. el.inlineTemplate = true;
  9295. }
  9296. }
  9297. function processAttrs (el) {
  9298. var list = el.attrsList;
  9299. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  9300. for (i = 0, l = list.length; i < l; i++) {
  9301. name = rawName = list[i].name;
  9302. value = list[i].value;
  9303. if (dirRE.test(name)) {
  9304. // mark element as dynamic
  9305. el.hasBindings = true;
  9306. // modifiers
  9307. modifiers = parseModifiers(name.replace(dirRE, ''));
  9308. // support .foo shorthand syntax for the .prop modifier
  9309. if (modifiers) {
  9310. name = name.replace(modifierRE, '');
  9311. }
  9312. if (bindRE.test(name)) { // v-bind
  9313. name = name.replace(bindRE, '');
  9314. value = parseFilters(value);
  9315. isDynamic = dynamicArgRE.test(name);
  9316. if (isDynamic) {
  9317. name = name.slice(1, -1);
  9318. }
  9319. if (
  9320. process.env.NODE_ENV !== 'production' &&
  9321. value.trim().length === 0
  9322. ) {
  9323. warn$2(
  9324. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  9325. );
  9326. }
  9327. if (modifiers) {
  9328. if (modifiers.prop && !isDynamic) {
  9329. name = camelize(name);
  9330. if (name === 'innerHtml') { name = 'innerHTML'; }
  9331. }
  9332. if (modifiers.camel && !isDynamic) {
  9333. name = camelize(name);
  9334. }
  9335. if (modifiers.sync) {
  9336. syncGen = genAssignmentCode(value, "$event");
  9337. if (!isDynamic) {
  9338. addHandler(
  9339. el,
  9340. ("update:" + (camelize(name))),
  9341. syncGen,
  9342. null,
  9343. false,
  9344. warn$2,
  9345. list[i]
  9346. );
  9347. if (hyphenate(name) !== camelize(name)) {
  9348. addHandler(
  9349. el,
  9350. ("update:" + (hyphenate(name))),
  9351. syncGen,
  9352. null,
  9353. false,
  9354. warn$2,
  9355. list[i]
  9356. );
  9357. }
  9358. } else {
  9359. // handler w/ dynamic event name
  9360. addHandler(
  9361. el,
  9362. ("\"update:\"+(" + name + ")"),
  9363. syncGen,
  9364. null,
  9365. false,
  9366. warn$2,
  9367. list[i],
  9368. true // dynamic
  9369. );
  9370. }
  9371. }
  9372. }
  9373. if ((modifiers && modifiers.prop) || (
  9374. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  9375. )) {
  9376. addProp(el, name, value, list[i], isDynamic);
  9377. } else {
  9378. addAttr(el, name, value, list[i], isDynamic);
  9379. }
  9380. } else if (onRE.test(name)) { // v-on
  9381. name = name.replace(onRE, '');
  9382. isDynamic = dynamicArgRE.test(name);
  9383. if (isDynamic) {
  9384. name = name.slice(1, -1);
  9385. }
  9386. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  9387. } else { // normal directives
  9388. name = name.replace(dirRE, '');
  9389. // parse arg
  9390. var argMatch = name.match(argRE);
  9391. var arg = argMatch && argMatch[1];
  9392. isDynamic = false;
  9393. if (arg) {
  9394. name = name.slice(0, -(arg.length + 1));
  9395. if (dynamicArgRE.test(arg)) {
  9396. arg = arg.slice(1, -1);
  9397. isDynamic = true;
  9398. }
  9399. }
  9400. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  9401. if (process.env.NODE_ENV !== 'production' && name === 'model') {
  9402. checkForAliasModel(el, value);
  9403. }
  9404. }
  9405. } else {
  9406. // literal attribute
  9407. if (process.env.NODE_ENV !== 'production') {
  9408. var res = parseText(value, delimiters);
  9409. if (res) {
  9410. warn$2(
  9411. name + "=\"" + value + "\": " +
  9412. 'Interpolation inside attributes has been removed. ' +
  9413. 'Use v-bind or the colon shorthand instead. For example, ' +
  9414. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  9415. list[i]
  9416. );
  9417. }
  9418. }
  9419. addAttr(el, name, JSON.stringify(value), list[i]);
  9420. // #6887 firefox doesn't update muted state if set via attribute
  9421. // even immediately after element creation
  9422. if (!el.component &&
  9423. name === 'muted' &&
  9424. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  9425. addProp(el, name, 'true', list[i]);
  9426. }
  9427. }
  9428. }
  9429. }
  9430. function checkInFor (el) {
  9431. var parent = el;
  9432. while (parent) {
  9433. if (parent.for !== undefined) {
  9434. return true
  9435. }
  9436. parent = parent.parent;
  9437. }
  9438. return false
  9439. }
  9440. function parseModifiers (name) {
  9441. var match = name.match(modifierRE);
  9442. if (match) {
  9443. var ret = {};
  9444. match.forEach(function (m) { ret[m.slice(1)] = true; });
  9445. return ret
  9446. }
  9447. }
  9448. function makeAttrsMap (attrs) {
  9449. var map = {};
  9450. for (var i = 0, l = attrs.length; i < l; i++) {
  9451. if (
  9452. process.env.NODE_ENV !== 'production' &&
  9453. map[attrs[i].name] && !isIE && !isEdge
  9454. ) {
  9455. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  9456. }
  9457. map[attrs[i].name] = attrs[i].value;
  9458. }
  9459. return map
  9460. }
  9461. // for script (e.g. type="x/template") or style, do not decode content
  9462. function isTextTag (el) {
  9463. return el.tag === 'script' || el.tag === 'style'
  9464. }
  9465. function isForbiddenTag (el) {
  9466. return (
  9467. el.tag === 'style' ||
  9468. (el.tag === 'script' && (
  9469. !el.attrsMap.type ||
  9470. el.attrsMap.type === 'text/javascript'
  9471. ))
  9472. )
  9473. }
  9474. var ieNSBug = /^xmlns:NS\d+/;
  9475. var ieNSPrefix = /^NS\d+:/;
  9476. /* istanbul ignore next */
  9477. function guardIESVGBug (attrs) {
  9478. var res = [];
  9479. for (var i = 0; i < attrs.length; i++) {
  9480. var attr = attrs[i];
  9481. if (!ieNSBug.test(attr.name)) {
  9482. attr.name = attr.name.replace(ieNSPrefix, '');
  9483. res.push(attr);
  9484. }
  9485. }
  9486. return res
  9487. }
  9488. function checkForAliasModel (el, value) {
  9489. var _el = el;
  9490. while (_el) {
  9491. if (_el.for && _el.alias === value) {
  9492. warn$2(
  9493. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  9494. "You are binding v-model directly to a v-for iteration alias. " +
  9495. "This will not be able to modify the v-for source array because " +
  9496. "writing to the alias is like modifying a function local variable. " +
  9497. "Consider using an array of objects and use v-model on an object property instead.",
  9498. el.rawAttrsMap['v-model']
  9499. );
  9500. }
  9501. _el = _el.parent;
  9502. }
  9503. }
  9504. /* */
  9505. function preTransformNode (el, options) {
  9506. if (el.tag === 'input') {
  9507. var map = el.attrsMap;
  9508. if (!map['v-model']) {
  9509. return
  9510. }
  9511. var typeBinding;
  9512. if (map[':type'] || map['v-bind:type']) {
  9513. typeBinding = getBindingAttr(el, 'type');
  9514. }
  9515. if (!map.type && !typeBinding && map['v-bind']) {
  9516. typeBinding = "(" + (map['v-bind']) + ").type";
  9517. }
  9518. if (typeBinding) {
  9519. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  9520. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  9521. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  9522. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  9523. // 1. checkbox
  9524. var branch0 = cloneASTElement(el);
  9525. // process for on the main node
  9526. processFor(branch0);
  9527. addRawAttr(branch0, 'type', 'checkbox');
  9528. processElement(branch0, options);
  9529. branch0.processed = true; // prevent it from double-processed
  9530. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  9531. addIfCondition(branch0, {
  9532. exp: branch0.if,
  9533. block: branch0
  9534. });
  9535. // 2. add radio else-if condition
  9536. var branch1 = cloneASTElement(el);
  9537. getAndRemoveAttr(branch1, 'v-for', true);
  9538. addRawAttr(branch1, 'type', 'radio');
  9539. processElement(branch1, options);
  9540. addIfCondition(branch0, {
  9541. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  9542. block: branch1
  9543. });
  9544. // 3. other
  9545. var branch2 = cloneASTElement(el);
  9546. getAndRemoveAttr(branch2, 'v-for', true);
  9547. addRawAttr(branch2, ':type', typeBinding);
  9548. processElement(branch2, options);
  9549. addIfCondition(branch0, {
  9550. exp: ifCondition,
  9551. block: branch2
  9552. });
  9553. if (hasElse) {
  9554. branch0.else = true;
  9555. } else if (elseIfCondition) {
  9556. branch0.elseif = elseIfCondition;
  9557. }
  9558. return branch0
  9559. }
  9560. }
  9561. }
  9562. function cloneASTElement (el) {
  9563. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  9564. }
  9565. var model$1 = {
  9566. preTransformNode: preTransformNode
  9567. };
  9568. var modules$1 = [
  9569. klass$1,
  9570. style$1,
  9571. model$1
  9572. ];
  9573. /* */
  9574. function text (el, dir) {
  9575. if (dir.value) {
  9576. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  9577. }
  9578. }
  9579. /* */
  9580. function html (el, dir) {
  9581. if (dir.value) {
  9582. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  9583. }
  9584. }
  9585. var directives$1 = {
  9586. model: model,
  9587. text: text,
  9588. html: html
  9589. };
  9590. /* */
  9591. var baseOptions = {
  9592. expectHTML: true,
  9593. modules: modules$1,
  9594. directives: directives$1,
  9595. isPreTag: isPreTag,
  9596. isUnaryTag: isUnaryTag,
  9597. mustUseProp: mustUseProp,
  9598. canBeLeftOpenTag: canBeLeftOpenTag,
  9599. isReservedTag: isReservedTag,
  9600. getTagNamespace: getTagNamespace,
  9601. staticKeys: genStaticKeys(modules$1)
  9602. };
  9603. /* */
  9604. var isStaticKey;
  9605. var isPlatformReservedTag;
  9606. var genStaticKeysCached = cached(genStaticKeys$1);
  9607. /**
  9608. * Goal of the optimizer: walk the generated template AST tree
  9609. * and detect sub-trees that are purely static, i.e. parts of
  9610. * the DOM that never needs to change.
  9611. *
  9612. * Once we detect these sub-trees, we can:
  9613. *
  9614. * 1. Hoist them into constants, so that we no longer need to
  9615. * create fresh nodes for them on each re-render;
  9616. * 2. Completely skip them in the patching process.
  9617. */
  9618. function optimize (root, options) {
  9619. if (!root) { return }
  9620. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  9621. isPlatformReservedTag = options.isReservedTag || no;
  9622. // first pass: mark all non-static nodes.
  9623. markStatic$1(root);
  9624. // second pass: mark static roots.
  9625. markStaticRoots(root, false);
  9626. }
  9627. function genStaticKeys$1 (keys) {
  9628. return makeMap(
  9629. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  9630. (keys ? ',' + keys : '')
  9631. )
  9632. }
  9633. function markStatic$1 (node) {
  9634. node.static = isStatic(node);
  9635. if (node.type === 1) {
  9636. // do not make component slot content static. this avoids
  9637. // 1. components not able to mutate slot nodes
  9638. // 2. static slot content fails for hot-reloading
  9639. if (
  9640. !isPlatformReservedTag(node.tag) &&
  9641. node.tag !== 'slot' &&
  9642. node.attrsMap['inline-template'] == null
  9643. ) {
  9644. return
  9645. }
  9646. for (var i = 0, l = node.children.length; i < l; i++) {
  9647. var child = node.children[i];
  9648. markStatic$1(child);
  9649. if (!child.static) {
  9650. node.static = false;
  9651. }
  9652. }
  9653. if (node.ifConditions) {
  9654. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9655. var block = node.ifConditions[i$1].block;
  9656. markStatic$1(block);
  9657. if (!block.static) {
  9658. node.static = false;
  9659. }
  9660. }
  9661. }
  9662. }
  9663. }
  9664. function markStaticRoots (node, isInFor) {
  9665. if (node.type === 1) {
  9666. if (node.static || node.once) {
  9667. node.staticInFor = isInFor;
  9668. }
  9669. // For a node to qualify as a static root, it should have children that
  9670. // are not just static text. Otherwise the cost of hoisting out will
  9671. // outweigh the benefits and it's better off to just always render it fresh.
  9672. if (node.static && node.children.length && !(
  9673. node.children.length === 1 &&
  9674. node.children[0].type === 3
  9675. )) {
  9676. node.staticRoot = true;
  9677. return
  9678. } else {
  9679. node.staticRoot = false;
  9680. }
  9681. if (node.children) {
  9682. for (var i = 0, l = node.children.length; i < l; i++) {
  9683. markStaticRoots(node.children[i], isInFor || !!node.for);
  9684. }
  9685. }
  9686. if (node.ifConditions) {
  9687. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9688. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  9689. }
  9690. }
  9691. }
  9692. }
  9693. function isStatic (node) {
  9694. if (node.type === 2) { // expression
  9695. return false
  9696. }
  9697. if (node.type === 3) { // text
  9698. return true
  9699. }
  9700. return !!(node.pre || (
  9701. !node.hasBindings && // no dynamic bindings
  9702. !node.if && !node.for && // not v-if or v-for or v-else
  9703. !isBuiltInTag(node.tag) && // not a built-in
  9704. isPlatformReservedTag(node.tag) && // not a component
  9705. !isDirectChildOfTemplateFor(node) &&
  9706. Object.keys(node).every(isStaticKey)
  9707. ))
  9708. }
  9709. function isDirectChildOfTemplateFor (node) {
  9710. while (node.parent) {
  9711. node = node.parent;
  9712. if (node.tag !== 'template') {
  9713. return false
  9714. }
  9715. if (node.for) {
  9716. return true
  9717. }
  9718. }
  9719. return false
  9720. }
  9721. /* */
  9722. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
  9723. var fnInvokeRE = /\([^)]*?\);*$/;
  9724. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  9725. // KeyboardEvent.keyCode aliases
  9726. var keyCodes = {
  9727. esc: 27,
  9728. tab: 9,
  9729. enter: 13,
  9730. space: 32,
  9731. up: 38,
  9732. left: 37,
  9733. right: 39,
  9734. down: 40,
  9735. 'delete': [8, 46]
  9736. };
  9737. // KeyboardEvent.key aliases
  9738. var keyNames = {
  9739. // #7880: IE11 and Edge use `Esc` for Escape key name.
  9740. esc: ['Esc', 'Escape'],
  9741. tab: 'Tab',
  9742. enter: 'Enter',
  9743. // #9112: IE11 uses `Spacebar` for Space key name.
  9744. space: [' ', 'Spacebar'],
  9745. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  9746. up: ['Up', 'ArrowUp'],
  9747. left: ['Left', 'ArrowLeft'],
  9748. right: ['Right', 'ArrowRight'],
  9749. down: ['Down', 'ArrowDown'],
  9750. // #9112: IE11 uses `Del` for Delete key name.
  9751. 'delete': ['Backspace', 'Delete', 'Del']
  9752. };
  9753. // #4868: modifiers that prevent the execution of the listener
  9754. // need to explicitly return null so that we can determine whether to remove
  9755. // the listener for .once
  9756. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  9757. var modifierCode = {
  9758. stop: '$event.stopPropagation();',
  9759. prevent: '$event.preventDefault();',
  9760. self: genGuard("$event.target !== $event.currentTarget"),
  9761. ctrl: genGuard("!$event.ctrlKey"),
  9762. shift: genGuard("!$event.shiftKey"),
  9763. alt: genGuard("!$event.altKey"),
  9764. meta: genGuard("!$event.metaKey"),
  9765. left: genGuard("'button' in $event && $event.button !== 0"),
  9766. middle: genGuard("'button' in $event && $event.button !== 1"),
  9767. right: genGuard("'button' in $event && $event.button !== 2")
  9768. };
  9769. function genHandlers (
  9770. events,
  9771. isNative
  9772. ) {
  9773. var prefix = isNative ? 'nativeOn:' : 'on:';
  9774. var staticHandlers = "";
  9775. var dynamicHandlers = "";
  9776. for (var name in events) {
  9777. var handlerCode = genHandler(events[name]);
  9778. if (events[name] && events[name].dynamic) {
  9779. dynamicHandlers += name + "," + handlerCode + ",";
  9780. } else {
  9781. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  9782. }
  9783. }
  9784. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  9785. if (dynamicHandlers) {
  9786. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  9787. } else {
  9788. return prefix + staticHandlers
  9789. }
  9790. }
  9791. function genHandler (handler) {
  9792. if (!handler) {
  9793. return 'function(){}'
  9794. }
  9795. if (Array.isArray(handler)) {
  9796. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  9797. }
  9798. var isMethodPath = simplePathRE.test(handler.value);
  9799. var isFunctionExpression = fnExpRE.test(handler.value);
  9800. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  9801. if (!handler.modifiers) {
  9802. if (isMethodPath || isFunctionExpression) {
  9803. return handler.value
  9804. }
  9805. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  9806. } else {
  9807. var code = '';
  9808. var genModifierCode = '';
  9809. var keys = [];
  9810. for (var key in handler.modifiers) {
  9811. if (modifierCode[key]) {
  9812. genModifierCode += modifierCode[key];
  9813. // left/right
  9814. if (keyCodes[key]) {
  9815. keys.push(key);
  9816. }
  9817. } else if (key === 'exact') {
  9818. var modifiers = (handler.modifiers);
  9819. genModifierCode += genGuard(
  9820. ['ctrl', 'shift', 'alt', 'meta']
  9821. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9822. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9823. .join('||')
  9824. );
  9825. } else {
  9826. keys.push(key);
  9827. }
  9828. }
  9829. if (keys.length) {
  9830. code += genKeyFilter(keys);
  9831. }
  9832. // Make sure modifiers like prevent and stop get executed after key filtering
  9833. if (genModifierCode) {
  9834. code += genModifierCode;
  9835. }
  9836. var handlerCode = isMethodPath
  9837. ? ("return " + (handler.value) + "($event)")
  9838. : isFunctionExpression
  9839. ? ("return (" + (handler.value) + ")($event)")
  9840. : isFunctionInvocation
  9841. ? ("return " + (handler.value))
  9842. : handler.value;
  9843. return ("function($event){" + code + handlerCode + "}")
  9844. }
  9845. }
  9846. function genKeyFilter (keys) {
  9847. return (
  9848. // make sure the key filters only apply to KeyboardEvents
  9849. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  9850. // key events that do not have keyCode property...
  9851. "if(!$event.type.indexOf('key')&&" +
  9852. (keys.map(genFilterCode).join('&&')) + ")return null;"
  9853. )
  9854. }
  9855. function genFilterCode (key) {
  9856. var keyVal = parseInt(key, 10);
  9857. if (keyVal) {
  9858. return ("$event.keyCode!==" + keyVal)
  9859. }
  9860. var keyCode = keyCodes[key];
  9861. var keyName = keyNames[key];
  9862. return (
  9863. "_k($event.keyCode," +
  9864. (JSON.stringify(key)) + "," +
  9865. (JSON.stringify(keyCode)) + "," +
  9866. "$event.key," +
  9867. "" + (JSON.stringify(keyName)) +
  9868. ")"
  9869. )
  9870. }
  9871. /* */
  9872. function on (el, dir) {
  9873. if (process.env.NODE_ENV !== 'production' && dir.modifiers) {
  9874. warn("v-on without argument does not support modifiers.");
  9875. }
  9876. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9877. }
  9878. /* */
  9879. function bind$1 (el, dir) {
  9880. el.wrapData = function (code) {
  9881. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9882. };
  9883. }
  9884. /* */
  9885. var baseDirectives = {
  9886. on: on,
  9887. bind: bind$1,
  9888. cloak: noop
  9889. };
  9890. /* */
  9891. var CodegenState = function CodegenState (options) {
  9892. this.options = options;
  9893. this.warn = options.warn || baseWarn;
  9894. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9895. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9896. this.directives = extend(extend({}, baseDirectives), options.directives);
  9897. var isReservedTag = options.isReservedTag || no;
  9898. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  9899. this.onceId = 0;
  9900. this.staticRenderFns = [];
  9901. this.pre = false;
  9902. };
  9903. function generate (
  9904. ast,
  9905. options
  9906. ) {
  9907. var state = new CodegenState(options);
  9908. var code = ast ? genElement(ast, state) : '_c("div")';
  9909. return {
  9910. render: ("with(this){return " + code + "}"),
  9911. staticRenderFns: state.staticRenderFns
  9912. }
  9913. }
  9914. function genElement (el, state) {
  9915. if (el.parent) {
  9916. el.pre = el.pre || el.parent.pre;
  9917. }
  9918. if (el.staticRoot && !el.staticProcessed) {
  9919. return genStatic(el, state)
  9920. } else if (el.once && !el.onceProcessed) {
  9921. return genOnce(el, state)
  9922. } else if (el.for && !el.forProcessed) {
  9923. return genFor(el, state)
  9924. } else if (el.if && !el.ifProcessed) {
  9925. return genIf(el, state)
  9926. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  9927. return genChildren(el, state) || 'void 0'
  9928. } else if (el.tag === 'slot') {
  9929. return genSlot(el, state)
  9930. } else {
  9931. // component or element
  9932. var code;
  9933. if (el.component) {
  9934. code = genComponent(el.component, el, state);
  9935. } else {
  9936. var data;
  9937. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  9938. data = genData$2(el, state);
  9939. }
  9940. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9941. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9942. }
  9943. // module transforms
  9944. for (var i = 0; i < state.transforms.length; i++) {
  9945. code = state.transforms[i](el, code);
  9946. }
  9947. return code
  9948. }
  9949. }
  9950. // hoist static sub-trees out
  9951. function genStatic (el, state) {
  9952. el.staticProcessed = true;
  9953. // Some elements (templates) need to behave differently inside of a v-pre
  9954. // node. All pre nodes are static roots, so we can use this as a location to
  9955. // wrap a state change and reset it upon exiting the pre node.
  9956. var originalPreState = state.pre;
  9957. if (el.pre) {
  9958. state.pre = el.pre;
  9959. }
  9960. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9961. state.pre = originalPreState;
  9962. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9963. }
  9964. // v-once
  9965. function genOnce (el, state) {
  9966. el.onceProcessed = true;
  9967. if (el.if && !el.ifProcessed) {
  9968. return genIf(el, state)
  9969. } else if (el.staticInFor) {
  9970. var key = '';
  9971. var parent = el.parent;
  9972. while (parent) {
  9973. if (parent.for) {
  9974. key = parent.key;
  9975. break
  9976. }
  9977. parent = parent.parent;
  9978. }
  9979. if (!key) {
  9980. process.env.NODE_ENV !== 'production' && state.warn(
  9981. "v-once can only be used inside v-for that is keyed. ",
  9982. el.rawAttrsMap['v-once']
  9983. );
  9984. return genElement(el, state)
  9985. }
  9986. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9987. } else {
  9988. return genStatic(el, state)
  9989. }
  9990. }
  9991. function genIf (
  9992. el,
  9993. state,
  9994. altGen,
  9995. altEmpty
  9996. ) {
  9997. el.ifProcessed = true; // avoid recursion
  9998. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  9999. }
  10000. function genIfConditions (
  10001. conditions,
  10002. state,
  10003. altGen,
  10004. altEmpty
  10005. ) {
  10006. if (!conditions.length) {
  10007. return altEmpty || '_e()'
  10008. }
  10009. var condition = conditions.shift();
  10010. if (condition.exp) {
  10011. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  10012. } else {
  10013. return ("" + (genTernaryExp(condition.block)))
  10014. }
  10015. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  10016. function genTernaryExp (el) {
  10017. return altGen
  10018. ? altGen(el, state)
  10019. : el.once
  10020. ? genOnce(el, state)
  10021. : genElement(el, state)
  10022. }
  10023. }
  10024. function genFor (
  10025. el,
  10026. state,
  10027. altGen,
  10028. altHelper
  10029. ) {
  10030. var exp = el.for;
  10031. var alias = el.alias;
  10032. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  10033. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  10034. if (process.env.NODE_ENV !== 'production' &&
  10035. state.maybeComponent(el) &&
  10036. el.tag !== 'slot' &&
  10037. el.tag !== 'template' &&
  10038. !el.key
  10039. ) {
  10040. state.warn(
  10041. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  10042. "v-for should have explicit keys. " +
  10043. "See https://vuejs.org/guide/list.html#key for more info.",
  10044. el.rawAttrsMap['v-for'],
  10045. true /* tip */
  10046. );
  10047. }
  10048. el.forProcessed = true; // avoid recursion
  10049. return (altHelper || '_l') + "((" + exp + ")," +
  10050. "function(" + alias + iterator1 + iterator2 + "){" +
  10051. "return " + ((altGen || genElement)(el, state)) +
  10052. '})'
  10053. }
  10054. function genData$2 (el, state) {
  10055. var data = '{';
  10056. // directives first.
  10057. // directives may mutate the el's other properties before they are generated.
  10058. var dirs = genDirectives(el, state);
  10059. if (dirs) { data += dirs + ','; }
  10060. // key
  10061. if (el.key) {
  10062. data += "key:" + (el.key) + ",";
  10063. }
  10064. // ref
  10065. if (el.ref) {
  10066. data += "ref:" + (el.ref) + ",";
  10067. }
  10068. if (el.refInFor) {
  10069. data += "refInFor:true,";
  10070. }
  10071. // pre
  10072. if (el.pre) {
  10073. data += "pre:true,";
  10074. }
  10075. // record original tag name for components using "is" attribute
  10076. if (el.component) {
  10077. data += "tag:\"" + (el.tag) + "\",";
  10078. }
  10079. // module data generation functions
  10080. for (var i = 0; i < state.dataGenFns.length; i++) {
  10081. data += state.dataGenFns[i](el);
  10082. }
  10083. // attributes
  10084. if (el.attrs) {
  10085. data += "attrs:" + (genProps(el.attrs)) + ",";
  10086. }
  10087. // DOM props
  10088. if (el.props) {
  10089. data += "domProps:" + (genProps(el.props)) + ",";
  10090. }
  10091. // event handlers
  10092. if (el.events) {
  10093. data += (genHandlers(el.events, false)) + ",";
  10094. }
  10095. if (el.nativeEvents) {
  10096. data += (genHandlers(el.nativeEvents, true)) + ",";
  10097. }
  10098. // slot target
  10099. // only for non-scoped slots
  10100. if (el.slotTarget && !el.slotScope) {
  10101. data += "slot:" + (el.slotTarget) + ",";
  10102. }
  10103. // scoped slots
  10104. if (el.scopedSlots) {
  10105. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  10106. }
  10107. // component v-model
  10108. if (el.model) {
  10109. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10110. }
  10111. // inline-template
  10112. if (el.inlineTemplate) {
  10113. var inlineTemplate = genInlineTemplate(el, state);
  10114. if (inlineTemplate) {
  10115. data += inlineTemplate + ",";
  10116. }
  10117. }
  10118. data = data.replace(/,$/, '') + '}';
  10119. // v-bind dynamic argument wrap
  10120. // v-bind with dynamic arguments must be applied using the same v-bind object
  10121. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  10122. if (el.dynamicAttrs) {
  10123. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  10124. }
  10125. // v-bind data wrap
  10126. if (el.wrapData) {
  10127. data = el.wrapData(data);
  10128. }
  10129. // v-on data wrap
  10130. if (el.wrapListeners) {
  10131. data = el.wrapListeners(data);
  10132. }
  10133. return data
  10134. }
  10135. function genDirectives (el, state) {
  10136. var dirs = el.directives;
  10137. if (!dirs) { return }
  10138. var res = 'directives:[';
  10139. var hasRuntime = false;
  10140. var i, l, dir, needRuntime;
  10141. for (i = 0, l = dirs.length; i < l; i++) {
  10142. dir = dirs[i];
  10143. needRuntime = true;
  10144. var gen = state.directives[dir.name];
  10145. if (gen) {
  10146. // compile-time directive that manipulates AST.
  10147. // returns true if it also needs a runtime counterpart.
  10148. needRuntime = !!gen(el, dir, state.warn);
  10149. }
  10150. if (needRuntime) {
  10151. hasRuntime = true;
  10152. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  10153. }
  10154. }
  10155. if (hasRuntime) {
  10156. return res.slice(0, -1) + ']'
  10157. }
  10158. }
  10159. function genInlineTemplate (el, state) {
  10160. var ast = el.children[0];
  10161. if (process.env.NODE_ENV !== 'production' && (
  10162. el.children.length !== 1 || ast.type !== 1
  10163. )) {
  10164. state.warn(
  10165. 'Inline-template components must have exactly one child element.',
  10166. { start: el.start }
  10167. );
  10168. }
  10169. if (ast && ast.type === 1) {
  10170. var inlineRenderFns = generate(ast, state.options);
  10171. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  10172. }
  10173. }
  10174. function genScopedSlots (
  10175. el,
  10176. slots,
  10177. state
  10178. ) {
  10179. // by default scoped slots are considered "stable", this allows child
  10180. // components with only scoped slots to skip forced updates from parent.
  10181. // but in some cases we have to bail-out of this optimization
  10182. // for example if the slot contains dynamic names, has v-if or v-for on them...
  10183. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  10184. var slot = slots[key];
  10185. return (
  10186. slot.slotTargetDynamic ||
  10187. slot.if ||
  10188. slot.for ||
  10189. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  10190. )
  10191. });
  10192. // #9534: if a component with scoped slots is inside a conditional branch,
  10193. // it's possible for the same component to be reused but with different
  10194. // compiled slot content. To avoid that, we generate a unique key based on
  10195. // the generated code of all the slot contents.
  10196. var needsKey = !!el.if;
  10197. // OR when it is inside another scoped slot or v-for (the reactivity may be
  10198. // disconnected due to the intermediate scope variable)
  10199. // #9438, #9506
  10200. // TODO: this can be further optimized by properly analyzing in-scope bindings
  10201. // and skip force updating ones that do not actually use scope variables.
  10202. if (!needsForceUpdate) {
  10203. var parent = el.parent;
  10204. while (parent) {
  10205. if (
  10206. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  10207. parent.for
  10208. ) {
  10209. needsForceUpdate = true;
  10210. break
  10211. }
  10212. if (parent.if) {
  10213. needsKey = true;
  10214. }
  10215. parent = parent.parent;
  10216. }
  10217. }
  10218. var generatedSlots = Object.keys(slots)
  10219. .map(function (key) { return genScopedSlot(slots[key], state); })
  10220. .join(',');
  10221. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  10222. }
  10223. function hash(str) {
  10224. var hash = 5381;
  10225. var i = str.length;
  10226. while(i) {
  10227. hash = (hash * 33) ^ str.charCodeAt(--i);
  10228. }
  10229. return hash >>> 0
  10230. }
  10231. function containsSlotChild (el) {
  10232. if (el.type === 1) {
  10233. if (el.tag === 'slot') {
  10234. return true
  10235. }
  10236. return el.children.some(containsSlotChild)
  10237. }
  10238. return false
  10239. }
  10240. function genScopedSlot (
  10241. el,
  10242. state
  10243. ) {
  10244. var isLegacySyntax = el.attrsMap['slot-scope'];
  10245. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  10246. return genIf(el, state, genScopedSlot, "null")
  10247. }
  10248. if (el.for && !el.forProcessed) {
  10249. return genFor(el, state, genScopedSlot)
  10250. }
  10251. var slotScope = el.slotScope === emptySlotScopeToken
  10252. ? ""
  10253. : String(el.slotScope);
  10254. var fn = "function(" + slotScope + "){" +
  10255. "return " + (el.tag === 'template'
  10256. ? el.if && isLegacySyntax
  10257. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  10258. : genChildren(el, state) || 'undefined'
  10259. : genElement(el, state)) + "}";
  10260. // reverse proxy v-slot without scope on this.$slots
  10261. var reverseProxy = slotScope ? "" : ",proxy:true";
  10262. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  10263. }
  10264. function genChildren (
  10265. el,
  10266. state,
  10267. checkSkip,
  10268. altGenElement,
  10269. altGenNode
  10270. ) {
  10271. var children = el.children;
  10272. if (children.length) {
  10273. var el$1 = children[0];
  10274. // optimize single v-for
  10275. if (children.length === 1 &&
  10276. el$1.for &&
  10277. el$1.tag !== 'template' &&
  10278. el$1.tag !== 'slot'
  10279. ) {
  10280. var normalizationType = checkSkip
  10281. ? state.maybeComponent(el$1) ? ",1" : ",0"
  10282. : "";
  10283. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10284. }
  10285. var normalizationType$1 = checkSkip
  10286. ? getNormalizationType(children, state.maybeComponent)
  10287. : 0;
  10288. var gen = altGenNode || genNode;
  10289. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10290. }
  10291. }
  10292. // determine the normalization needed for the children array.
  10293. // 0: no normalization needed
  10294. // 1: simple normalization needed (possible 1-level deep nested array)
  10295. // 2: full normalization needed
  10296. function getNormalizationType (
  10297. children,
  10298. maybeComponent
  10299. ) {
  10300. var res = 0;
  10301. for (var i = 0; i < children.length; i++) {
  10302. var el = children[i];
  10303. if (el.type !== 1) {
  10304. continue
  10305. }
  10306. if (needsNormalization(el) ||
  10307. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  10308. res = 2;
  10309. break
  10310. }
  10311. if (maybeComponent(el) ||
  10312. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  10313. res = 1;
  10314. }
  10315. }
  10316. return res
  10317. }
  10318. function needsNormalization (el) {
  10319. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10320. }
  10321. function genNode (node, state) {
  10322. if (node.type === 1) {
  10323. return genElement(node, state)
  10324. } else if (node.type === 3 && node.isComment) {
  10325. return genComment(node)
  10326. } else {
  10327. return genText(node)
  10328. }
  10329. }
  10330. function genText (text) {
  10331. return ("_v(" + (text.type === 2
  10332. ? text.expression // no need for () because already wrapped in _s()
  10333. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  10334. }
  10335. function genComment (comment) {
  10336. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  10337. }
  10338. function genSlot (el, state) {
  10339. var slotName = el.slotName || '"default"';
  10340. var children = genChildren(el, state);
  10341. var res = "_t(" + slotName + (children ? ("," + children) : '');
  10342. var attrs = el.attrs || el.dynamicAttrs
  10343. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  10344. // slot props are camelized
  10345. name: camelize(attr.name),
  10346. value: attr.value,
  10347. dynamic: attr.dynamic
  10348. }); }))
  10349. : null;
  10350. var bind$$1 = el.attrsMap['v-bind'];
  10351. if ((attrs || bind$$1) && !children) {
  10352. res += ",null";
  10353. }
  10354. if (attrs) {
  10355. res += "," + attrs;
  10356. }
  10357. if (bind$$1) {
  10358. res += (attrs ? '' : ',null') + "," + bind$$1;
  10359. }
  10360. return res + ')'
  10361. }
  10362. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  10363. function genComponent (
  10364. componentName,
  10365. el,
  10366. state
  10367. ) {
  10368. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10369. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  10370. }
  10371. function genProps (props) {
  10372. var staticProps = "";
  10373. var dynamicProps = "";
  10374. for (var i = 0; i < props.length; i++) {
  10375. var prop = props[i];
  10376. var value = transformSpecialNewlines(prop.value);
  10377. if (prop.dynamic) {
  10378. dynamicProps += (prop.name) + "," + value + ",";
  10379. } else {
  10380. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  10381. }
  10382. }
  10383. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  10384. if (dynamicProps) {
  10385. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  10386. } else {
  10387. return staticProps
  10388. }
  10389. }
  10390. // #3895, #4268
  10391. function transformSpecialNewlines (text) {
  10392. return text
  10393. .replace(/\u2028/g, '\\u2028')
  10394. .replace(/\u2029/g, '\\u2029')
  10395. }
  10396. /* */
  10397. // these keywords should not appear inside expressions, but operators like
  10398. // typeof, instanceof and in are allowed
  10399. var prohibitedKeywordRE = new RegExp('\\b' + (
  10400. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  10401. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  10402. 'extends,finally,continue,debugger,function,arguments'
  10403. ).split(',').join('\\b|\\b') + '\\b');
  10404. // these unary operators should not be used as property/method names
  10405. var unaryOperatorsRE = new RegExp('\\b' + (
  10406. 'delete,typeof,void'
  10407. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  10408. // strip strings in expressions
  10409. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  10410. // detect problematic expressions in a template
  10411. function detectErrors (ast, warn) {
  10412. if (ast) {
  10413. checkNode(ast, warn);
  10414. }
  10415. }
  10416. function checkNode (node, warn) {
  10417. if (node.type === 1) {
  10418. for (var name in node.attrsMap) {
  10419. if (dirRE.test(name)) {
  10420. var value = node.attrsMap[name];
  10421. if (value) {
  10422. var range = node.rawAttrsMap[name];
  10423. if (name === 'v-for') {
  10424. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  10425. } else if (onRE.test(name)) {
  10426. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  10427. } else {
  10428. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  10429. }
  10430. }
  10431. }
  10432. }
  10433. if (node.children) {
  10434. for (var i = 0; i < node.children.length; i++) {
  10435. checkNode(node.children[i], warn);
  10436. }
  10437. }
  10438. } else if (node.type === 2) {
  10439. checkExpression(node.expression, node.text, warn, node);
  10440. }
  10441. }
  10442. function checkEvent (exp, text, warn, range) {
  10443. var stipped = exp.replace(stripStringRE, '');
  10444. var keywordMatch = stipped.match(unaryOperatorsRE);
  10445. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  10446. warn(
  10447. "avoid using JavaScript unary operator as property name: " +
  10448. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  10449. range
  10450. );
  10451. }
  10452. checkExpression(exp, text, warn, range);
  10453. }
  10454. function checkFor (node, text, warn, range) {
  10455. checkExpression(node.for || '', text, warn, range);
  10456. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  10457. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  10458. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  10459. }
  10460. function checkIdentifier (
  10461. ident,
  10462. type,
  10463. text,
  10464. warn,
  10465. range
  10466. ) {
  10467. if (typeof ident === 'string') {
  10468. try {
  10469. new Function(("var " + ident + "=_"));
  10470. } catch (e) {
  10471. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  10472. }
  10473. }
  10474. }
  10475. function checkExpression (exp, text, warn, range) {
  10476. try {
  10477. new Function(("return " + exp));
  10478. } catch (e) {
  10479. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  10480. if (keywordMatch) {
  10481. warn(
  10482. "avoid using JavaScript keyword as property name: " +
  10483. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  10484. range
  10485. );
  10486. } else {
  10487. warn(
  10488. "invalid expression: " + (e.message) + " in\n\n" +
  10489. " " + exp + "\n\n" +
  10490. " Raw expression: " + (text.trim()) + "\n",
  10491. range
  10492. );
  10493. }
  10494. }
  10495. }
  10496. /* */
  10497. var range = 2;
  10498. function generateCodeFrame (
  10499. source,
  10500. start,
  10501. end
  10502. ) {
  10503. if ( start === void 0 ) start = 0;
  10504. if ( end === void 0 ) end = source.length;
  10505. var lines = source.split(/\r?\n/);
  10506. var count = 0;
  10507. var res = [];
  10508. for (var i = 0; i < lines.length; i++) {
  10509. count += lines[i].length + 1;
  10510. if (count >= start) {
  10511. for (var j = i - range; j <= i + range || end > count; j++) {
  10512. if (j < 0 || j >= lines.length) { continue }
  10513. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  10514. var lineLength = lines[j].length;
  10515. if (j === i) {
  10516. // push underline
  10517. var pad = start - (count - lineLength) + 1;
  10518. var length = end > count ? lineLength - pad : end - start;
  10519. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  10520. } else if (j > i) {
  10521. if (end > count) {
  10522. var length$1 = Math.min(end - count, lineLength);
  10523. res.push(" | " + repeat$1("^", length$1));
  10524. }
  10525. count += lineLength + 1;
  10526. }
  10527. }
  10528. break
  10529. }
  10530. }
  10531. return res.join('\n')
  10532. }
  10533. function repeat$1 (str, n) {
  10534. var result = '';
  10535. if (n > 0) {
  10536. while (true) { // eslint-disable-line
  10537. if (n & 1) { result += str; }
  10538. n >>>= 1;
  10539. if (n <= 0) { break }
  10540. str += str;
  10541. }
  10542. }
  10543. return result
  10544. }
  10545. /* */
  10546. function createFunction (code, errors) {
  10547. try {
  10548. return new Function(code)
  10549. } catch (err) {
  10550. errors.push({ err: err, code: code });
  10551. return noop
  10552. }
  10553. }
  10554. function createCompileToFunctionFn (compile) {
  10555. var cache = Object.create(null);
  10556. return function compileToFunctions (
  10557. template,
  10558. options,
  10559. vm
  10560. ) {
  10561. options = extend({}, options);
  10562. var warn$$1 = options.warn || warn;
  10563. delete options.warn;
  10564. /* istanbul ignore if */
  10565. if (process.env.NODE_ENV !== 'production') {
  10566. // detect possible CSP restriction
  10567. try {
  10568. new Function('return 1');
  10569. } catch (e) {
  10570. if (e.toString().match(/unsafe-eval|CSP/)) {
  10571. warn$$1(
  10572. 'It seems you are using the standalone build of Vue.js in an ' +
  10573. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  10574. 'The template compiler cannot work in this environment. Consider ' +
  10575. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  10576. 'templates into render functions.'
  10577. );
  10578. }
  10579. }
  10580. }
  10581. // check cache
  10582. var key = options.delimiters
  10583. ? String(options.delimiters) + template
  10584. : template;
  10585. if (cache[key]) {
  10586. return cache[key]
  10587. }
  10588. // compile
  10589. var compiled = compile(template, options);
  10590. // check compilation errors/tips
  10591. if (process.env.NODE_ENV !== 'production') {
  10592. if (compiled.errors && compiled.errors.length) {
  10593. if (options.outputSourceRange) {
  10594. compiled.errors.forEach(function (e) {
  10595. warn$$1(
  10596. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  10597. generateCodeFrame(template, e.start, e.end),
  10598. vm
  10599. );
  10600. });
  10601. } else {
  10602. warn$$1(
  10603. "Error compiling template:\n\n" + template + "\n\n" +
  10604. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  10605. vm
  10606. );
  10607. }
  10608. }
  10609. if (compiled.tips && compiled.tips.length) {
  10610. if (options.outputSourceRange) {
  10611. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  10612. } else {
  10613. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  10614. }
  10615. }
  10616. }
  10617. // turn code into functions
  10618. var res = {};
  10619. var fnGenErrors = [];
  10620. res.render = createFunction(compiled.render, fnGenErrors);
  10621. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  10622. return createFunction(code, fnGenErrors)
  10623. });
  10624. // check function generation errors.
  10625. // this should only happen if there is a bug in the compiler itself.
  10626. // mostly for codegen development use
  10627. /* istanbul ignore if */
  10628. if (process.env.NODE_ENV !== 'production') {
  10629. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  10630. warn$$1(
  10631. "Failed to generate render function:\n\n" +
  10632. fnGenErrors.map(function (ref) {
  10633. var err = ref.err;
  10634. var code = ref.code;
  10635. return ((err.toString()) + " in\n\n" + code + "\n");
  10636. }).join('\n'),
  10637. vm
  10638. );
  10639. }
  10640. }
  10641. return (cache[key] = res)
  10642. }
  10643. }
  10644. /* */
  10645. function createCompilerCreator (baseCompile) {
  10646. return function createCompiler (baseOptions) {
  10647. function compile (
  10648. template,
  10649. options
  10650. ) {
  10651. var finalOptions = Object.create(baseOptions);
  10652. var errors = [];
  10653. var tips = [];
  10654. var warn = function (msg, range, tip) {
  10655. (tip ? tips : errors).push(msg);
  10656. };
  10657. if (options) {
  10658. if (process.env.NODE_ENV !== 'production' && options.outputSourceRange) {
  10659. // $flow-disable-line
  10660. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  10661. warn = function (msg, range, tip) {
  10662. var data = { msg: msg };
  10663. if (range) {
  10664. if (range.start != null) {
  10665. data.start = range.start + leadingSpaceLength;
  10666. }
  10667. if (range.end != null) {
  10668. data.end = range.end + leadingSpaceLength;
  10669. }
  10670. }
  10671. (tip ? tips : errors).push(data);
  10672. };
  10673. }
  10674. // merge custom modules
  10675. if (options.modules) {
  10676. finalOptions.modules =
  10677. (baseOptions.modules || []).concat(options.modules);
  10678. }
  10679. // merge custom directives
  10680. if (options.directives) {
  10681. finalOptions.directives = extend(
  10682. Object.create(baseOptions.directives || null),
  10683. options.directives
  10684. );
  10685. }
  10686. // copy other options
  10687. for (var key in options) {
  10688. if (key !== 'modules' && key !== 'directives') {
  10689. finalOptions[key] = options[key];
  10690. }
  10691. }
  10692. }
  10693. finalOptions.warn = warn;
  10694. var compiled = baseCompile(template.trim(), finalOptions);
  10695. if (process.env.NODE_ENV !== 'production') {
  10696. detectErrors(compiled.ast, warn);
  10697. }
  10698. compiled.errors = errors;
  10699. compiled.tips = tips;
  10700. return compiled
  10701. }
  10702. return {
  10703. compile: compile,
  10704. compileToFunctions: createCompileToFunctionFn(compile)
  10705. }
  10706. }
  10707. }
  10708. /* */
  10709. // `createCompilerCreator` allows creating compilers that use alternative
  10710. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  10711. // Here we just export a default compiler using the default parts.
  10712. var createCompiler = createCompilerCreator(function baseCompile (
  10713. template,
  10714. options
  10715. ) {
  10716. var ast = parse(template.trim(), options);
  10717. if (options.optimize !== false) {
  10718. optimize(ast, options);
  10719. }
  10720. var code = generate(ast, options);
  10721. return {
  10722. ast: ast,
  10723. render: code.render,
  10724. staticRenderFns: code.staticRenderFns
  10725. }
  10726. });
  10727. /* */
  10728. var ref$1 = createCompiler(baseOptions);
  10729. var compile = ref$1.compile;
  10730. var compileToFunctions = ref$1.compileToFunctions;
  10731. /* */
  10732. // check whether current browser encodes a char inside attribute values
  10733. var div;
  10734. function getShouldDecode (href) {
  10735. div = div || document.createElement('div');
  10736. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  10737. return div.innerHTML.indexOf('&#10;') > 0
  10738. }
  10739. // #3663: IE encodes newlines inside attribute values while other browsers don't
  10740. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  10741. // #6828: chrome encodes content in a[href]
  10742. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  10743. /* */
  10744. var idToTemplate = cached(function (id) {
  10745. var el = query(id);
  10746. return el && el.innerHTML
  10747. });
  10748. var mount = Vue.prototype.$mount;
  10749. Vue.prototype.$mount = function (
  10750. el,
  10751. hydrating
  10752. ) {
  10753. el = el && query(el);
  10754. /* istanbul ignore if */
  10755. if (el === document.body || el === document.documentElement) {
  10756. process.env.NODE_ENV !== 'production' && warn(
  10757. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  10758. );
  10759. return this
  10760. }
  10761. var options = this.$options;
  10762. // resolve template/el and convert to render function
  10763. if (!options.render) {
  10764. var template = options.template;
  10765. if (template) {
  10766. if (typeof template === 'string') {
  10767. if (template.charAt(0) === '#') {
  10768. template = idToTemplate(template);
  10769. /* istanbul ignore if */
  10770. if (process.env.NODE_ENV !== 'production' && !template) {
  10771. warn(
  10772. ("Template element not found or is empty: " + (options.template)),
  10773. this
  10774. );
  10775. }
  10776. }
  10777. } else if (template.nodeType) {
  10778. template = template.innerHTML;
  10779. } else {
  10780. if (process.env.NODE_ENV !== 'production') {
  10781. warn('invalid template option:' + template, this);
  10782. }
  10783. return this
  10784. }
  10785. } else if (el) {
  10786. template = getOuterHTML(el);
  10787. }
  10788. if (template) {
  10789. /* istanbul ignore if */
  10790. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  10791. mark('compile');
  10792. }
  10793. var ref = compileToFunctions(template, {
  10794. outputSourceRange: process.env.NODE_ENV !== 'production',
  10795. shouldDecodeNewlines: shouldDecodeNewlines,
  10796. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  10797. delimiters: options.delimiters,
  10798. comments: options.comments
  10799. }, this);
  10800. var render = ref.render;
  10801. var staticRenderFns = ref.staticRenderFns;
  10802. options.render = render;
  10803. options.staticRenderFns = staticRenderFns;
  10804. /* istanbul ignore if */
  10805. if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
  10806. mark('compile end');
  10807. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  10808. }
  10809. }
  10810. }
  10811. return mount.call(this, el, hydrating)
  10812. };
  10813. /**
  10814. * Get outerHTML of elements, taking care
  10815. * of SVG elements in IE as well.
  10816. */
  10817. function getOuterHTML (el) {
  10818. if (el.outerHTML) {
  10819. return el.outerHTML
  10820. } else {
  10821. var container = document.createElement('div');
  10822. container.appendChild(el.cloneNode(true));
  10823. return container.innerHTML
  10824. }
  10825. }
  10826. Vue.compile = compileToFunctions;
  10827. export default Vue;