vue2.js 274 KB

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