vue-2.1.3.js 206 KB

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