vue.js 283 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947
  1. /*!
  2. * Vue.js v2.5.17
  3. * (c) 2014-2018 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. var emptyObject = Object.freeze({});
  13. // these helpers produces better vm code in JS engines due to their
  14. // explicitness and function inlining
  15. function isUndef (v) {
  16. return v === undefined || v === null
  17. }
  18. function isDef (v) {
  19. return v !== undefined && v !== null
  20. }
  21. function isTrue (v) {
  22. return v === true
  23. }
  24. function isFalse (v) {
  25. return v === false
  26. }
  27. /**
  28. * Check if value is primitive
  29. */
  30. function isPrimitive (value) {
  31. return (
  32. typeof value === 'string' ||
  33. typeof value === 'number' ||
  34. // $flow-disable-line
  35. typeof value === 'symbol' ||
  36. typeof value === 'boolean'
  37. )
  38. }
  39. /**
  40. * Quick object check - this is primarily used to tell
  41. * Objects from primitive values when we know the value
  42. * is a JSON-compliant type.
  43. */
  44. function isObject (obj) {
  45. return obj !== null && typeof obj === 'object'
  46. }
  47. /**
  48. * Get the raw type string of a value e.g. [object Object]
  49. */
  50. var _toString = Object.prototype.toString;
  51. function toRawType (value) {
  52. return _toString.call(value).slice(8, -1)
  53. }
  54. /**
  55. * Strict object type check. Only returns true
  56. * for plain JavaScript objects.
  57. */
  58. function isPlainObject (obj) {
  59. return _toString.call(obj) === '[object Object]'
  60. }
  61. function isRegExp (v) {
  62. return _toString.call(v) === '[object RegExp]'
  63. }
  64. /**
  65. * Check if val is a valid array index.
  66. */
  67. function isValidArrayIndex (val) {
  68. var n = parseFloat(String(val));
  69. return n >= 0 && Math.floor(n) === n && isFinite(val)
  70. }
  71. /**
  72. * Convert a value to a string that is actually rendered.
  73. */
  74. function toString (val) {
  75. return val == null
  76. ? ''
  77. : typeof val === 'object'
  78. ? JSON.stringify(val, null, 2)
  79. : String(val)
  80. }
  81. /**
  82. * Convert a input value to a number for persistence.
  83. * If the conversion fails, return original string.
  84. */
  85. function toNumber (val) {
  86. var n = parseFloat(val);
  87. return isNaN(n) ? val : n
  88. }
  89. /**
  90. * Make a map and return a function for checking if a key
  91. * is in that map.
  92. */
  93. function makeMap (
  94. str,
  95. expectsLowerCase
  96. ) {
  97. var map = Object.create(null);
  98. var list = str.split(',');
  99. for (var i = 0; i < list.length; i++) {
  100. map[list[i]] = true;
  101. }
  102. return expectsLowerCase
  103. ? function (val) { return map[val.toLowerCase()]; }
  104. : function (val) { return map[val]; }
  105. }
  106. /**
  107. * Check if a tag is a built-in tag.
  108. */
  109. var isBuiltInTag = makeMap('slot,component', true);
  110. /**
  111. * Check if a attribute is a reserved attribute.
  112. */
  113. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  114. /**
  115. * Remove an item from an array
  116. */
  117. function remove (arr, item) {
  118. if (arr.length) {
  119. var index = arr.indexOf(item);
  120. if (index > -1) {
  121. return arr.splice(index, 1)
  122. }
  123. }
  124. }
  125. /**
  126. * Check whether the object has the property.
  127. */
  128. var hasOwnProperty = Object.prototype.hasOwnProperty;
  129. function hasOwn (obj, key) {
  130. return hasOwnProperty.call(obj, key)
  131. }
  132. /**
  133. * Create a cached version of a pure function.
  134. */
  135. function cached (fn) {
  136. var cache = Object.create(null);
  137. return (function cachedFn (str) {
  138. var hit = cache[str];
  139. return hit || (cache[str] = fn(str))
  140. })
  141. }
  142. /**
  143. * Camelize a hyphen-delimited string.
  144. */
  145. var camelizeRE = /-(\w)/g;
  146. var camelize = cached(function (str) {
  147. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  148. });
  149. /**
  150. * Capitalize a string.
  151. */
  152. var capitalize = cached(function (str) {
  153. return str.charAt(0).toUpperCase() + str.slice(1)
  154. });
  155. /**
  156. * Hyphenate a camelCase string.
  157. */
  158. var hyphenateRE = /\B([A-Z])/g;
  159. var hyphenate = cached(function (str) {
  160. return str.replace(hyphenateRE, '-$1').toLowerCase()
  161. });
  162. /**
  163. * Simple bind polyfill for environments that do not support it... e.g.
  164. * PhantomJS 1.x. Technically we don't need this anymore since native bind is
  165. * now more performant in most browsers, but removing it would be breaking for
  166. * code that was able to run in PhantomJS 1.x, so this must be kept for
  167. * backwards compatibility.
  168. */
  169. /* istanbul ignore next */
  170. function polyfillBind (fn, ctx) {
  171. function boundFn (a) {
  172. var l = arguments.length;
  173. return l
  174. ? l > 1
  175. ? fn.apply(ctx, arguments)
  176. : fn.call(ctx, a)
  177. : fn.call(ctx)
  178. }
  179. boundFn._length = fn.length;
  180. return boundFn
  181. }
  182. function nativeBind (fn, ctx) {
  183. return fn.bind(ctx)
  184. }
  185. var bind = Function.prototype.bind
  186. ? nativeBind
  187. : polyfillBind;
  188. /**
  189. * Convert an Array-like object to a real Array.
  190. */
  191. function toArray (list, start) {
  192. start = start || 0;
  193. var i = list.length - start;
  194. var ret = new Array(i);
  195. while (i--) {
  196. ret[i] = list[i + start];
  197. }
  198. return ret
  199. }
  200. /**
  201. * Mix properties into target object.
  202. */
  203. function extend (to, _from) {
  204. for (var key in _from) {
  205. to[key] = _from[key];
  206. }
  207. return to
  208. }
  209. /**
  210. * Merge an Array of Objects into a single Object.
  211. */
  212. function toObject (arr) {
  213. var res = {};
  214. for (var i = 0; i < arr.length; i++) {
  215. if (arr[i]) {
  216. extend(res, arr[i]);
  217. }
  218. }
  219. return res
  220. }
  221. /**
  222. * Perform no operation.
  223. * Stubbing args to make Flow happy without leaving useless transpiled code
  224. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
  225. */
  226. function noop (a, b, c) {}
  227. /**
  228. * Always return false.
  229. */
  230. var no = function (a, b, c) { return false; };
  231. /**
  232. * Return same value
  233. */
  234. var identity = function (_) { return _; };
  235. /**
  236. * Generate a static keys string from compiler modules.
  237. */
  238. function genStaticKeys (modules) {
  239. return modules.reduce(function (keys, m) {
  240. return keys.concat(m.staticKeys || [])
  241. }, []).join(',')
  242. }
  243. /**
  244. * Check if two values are loosely equal - that is,
  245. * if they are plain objects, do they have the same shape?
  246. */
  247. function looseEqual (a, b) {
  248. if (a === b) { return true }
  249. var isObjectA = isObject(a);
  250. var isObjectB = isObject(b);
  251. if (isObjectA && isObjectB) {
  252. try {
  253. var isArrayA = Array.isArray(a);
  254. var isArrayB = Array.isArray(b);
  255. if (isArrayA && isArrayB) {
  256. return a.length === b.length && a.every(function (e, i) {
  257. return looseEqual(e, b[i])
  258. })
  259. } else if (!isArrayA && !isArrayB) {
  260. var keysA = Object.keys(a);
  261. var keysB = Object.keys(b);
  262. return keysA.length === keysB.length && keysA.every(function (key) {
  263. return looseEqual(a[key], b[key])
  264. })
  265. } else {
  266. /* istanbul ignore next */
  267. return false
  268. }
  269. } catch (e) {
  270. /* istanbul ignore next */
  271. return false
  272. }
  273. } else if (!isObjectA && !isObjectB) {
  274. return String(a) === String(b)
  275. } else {
  276. return false
  277. }
  278. }
  279. function looseIndexOf (arr, val) {
  280. for (var i = 0; i < arr.length; i++) {
  281. if (looseEqual(arr[i], val)) { return i }
  282. }
  283. return -1
  284. }
  285. /**
  286. * Ensure a function is called only once.
  287. */
  288. function once (fn) {
  289. var called = false;
  290. return function () {
  291. if (!called) {
  292. called = true;
  293. fn.apply(this, arguments);
  294. }
  295. }
  296. }
  297. var SSR_ATTR = 'data-server-rendered';
  298. var ASSET_TYPES = [
  299. 'component',
  300. 'directive',
  301. 'filter'
  302. ];
  303. var LIFECYCLE_HOOKS = [
  304. 'beforeCreate',
  305. 'created',
  306. 'beforeMount',
  307. 'mounted',
  308. 'beforeUpdate',
  309. 'updated',
  310. 'beforeDestroy',
  311. 'destroyed',
  312. 'activated',
  313. 'deactivated',
  314. 'errorCaptured'
  315. ];
  316. /* */
  317. var config = ({
  318. /**
  319. * Option merge strategies (used in core/util/options)
  320. */
  321. // $flow-disable-line
  322. optionMergeStrategies: Object.create(null),
  323. /**
  324. * Whether to suppress warnings.
  325. */
  326. silent: false,
  327. /**
  328. * Show production mode tip message on boot?
  329. */
  330. productionTip: "development" !== 'production',
  331. /**
  332. * Whether to enable devtools
  333. */
  334. devtools: "development" !== 'production',
  335. /**
  336. * Whether to record perf
  337. */
  338. performance: false,
  339. /**
  340. * Error handler for watcher errors
  341. */
  342. errorHandler: null,
  343. /**
  344. * Warn handler for watcher warns
  345. */
  346. warnHandler: null,
  347. /**
  348. * Ignore certain custom elements
  349. */
  350. ignoredElements: [],
  351. /**
  352. * Custom user key aliases for v-on
  353. */
  354. // $flow-disable-line
  355. keyCodes: Object.create(null),
  356. /**
  357. * Check if a tag is reserved so that it cannot be registered as a
  358. * component. This is platform-dependent and may be overwritten.
  359. */
  360. isReservedTag: no,
  361. /**
  362. * Check if an attribute is reserved so that it cannot be used as a component
  363. * prop. This is platform-dependent and may be overwritten.
  364. */
  365. isReservedAttr: no,
  366. /**
  367. * Check if a tag is an unknown element.
  368. * Platform-dependent.
  369. */
  370. isUnknownElement: no,
  371. /**
  372. * Get the namespace of an element
  373. */
  374. getTagNamespace: noop,
  375. /**
  376. * Parse the real tag name for the specific platform.
  377. */
  378. parsePlatformTagName: identity,
  379. /**
  380. * Check if an attribute must be bound using property, e.g. value
  381. * Platform-dependent.
  382. */
  383. mustUseProp: no,
  384. /**
  385. * Exposed for legacy reasons
  386. */
  387. _lifecycleHooks: LIFECYCLE_HOOKS
  388. })
  389. /* */
  390. /**
  391. * Check if a string starts with $ or _
  392. */
  393. function isReserved (str) {
  394. var c = (str + '').charCodeAt(0);
  395. return c === 0x24 || c === 0x5F
  396. }
  397. /**
  398. * Define a property.
  399. */
  400. function def (obj, key, val, enumerable) {
  401. Object.defineProperty(obj, key, {
  402. value: val,
  403. enumerable: !!enumerable,
  404. writable: true,
  405. configurable: true
  406. });
  407. }
  408. /**
  409. * Parse simple path.
  410. */
  411. var bailRE = /[^\w.$]/;
  412. function parsePath (path) {
  413. if (bailRE.test(path)) {
  414. return
  415. }
  416. var segments = path.split('.');
  417. return function (obj) {
  418. for (var i = 0; i < segments.length; i++) {
  419. if (!obj) { return }
  420. obj = obj[segments[i]];
  421. }
  422. return obj
  423. }
  424. }
  425. /* */
  426. // can we use __proto__?
  427. var hasProto = '__proto__' in {};
  428. // Browser environment sniffing
  429. var inBrowser = typeof window !== 'undefined';
  430. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  431. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  432. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  433. var isIE = UA && /msie|trident/.test(UA);
  434. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  435. var isEdge = UA && UA.indexOf('edge/') > 0;
  436. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  437. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  438. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  439. // Firefox has a "watch" function on Object.prototype...
  440. var nativeWatch = ({}).watch;
  441. var supportsPassive = false;
  442. if (inBrowser) {
  443. try {
  444. var opts = {};
  445. Object.defineProperty(opts, 'passive', ({
  446. get: function get () {
  447. /* istanbul ignore next */
  448. supportsPassive = true;
  449. }
  450. })); // https://github.com/facebook/flow/issues/285
  451. window.addEventListener('test-passive', null, opts);
  452. } catch (e) {}
  453. }
  454. // this needs to be lazy-evaled because vue may be required before
  455. // vue-server-renderer can set VUE_ENV
  456. var _isServer;
  457. var isServerRendering = function () {
  458. if (_isServer === undefined) {
  459. /* istanbul ignore if */
  460. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  461. // detect presence of vue-server-renderer and avoid
  462. // Webpack shimming the process
  463. _isServer = global['process'].env.VUE_ENV === 'server';
  464. } else {
  465. _isServer = false;
  466. }
  467. }
  468. return _isServer
  469. };
  470. // detect devtools
  471. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  472. /* istanbul ignore next */
  473. function isNative (Ctor) {
  474. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  475. }
  476. var hasSymbol =
  477. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  478. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  479. var _Set;
  480. /* istanbul ignore if */ // $flow-disable-line
  481. if (typeof Set !== 'undefined' && isNative(Set)) {
  482. // use native Set when available.
  483. _Set = Set;
  484. } else {
  485. // a non-standard Set polyfill that only works with primitive keys.
  486. _Set = (function () {
  487. function Set () {
  488. this.set = Object.create(null);
  489. }
  490. Set.prototype.has = function has (key) {
  491. return this.set[key] === true
  492. };
  493. Set.prototype.add = function add (key) {
  494. this.set[key] = true;
  495. };
  496. Set.prototype.clear = function clear () {
  497. this.set = Object.create(null);
  498. };
  499. return Set;
  500. }());
  501. }
  502. /* */
  503. var warn = noop;
  504. var tip = noop;
  505. var generateComponentTrace = (noop); // work around flow check
  506. var formatComponentName = (noop);
  507. {
  508. var hasConsole = typeof console !== 'undefined';
  509. var classifyRE = /(?:^|[-_])(\w)/g;
  510. var classify = function (str) { return str
  511. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  512. .replace(/[-_]/g, ''); };
  513. warn = function (msg, vm) {
  514. var trace = vm ? generateComponentTrace(vm) : '';
  515. if (config.warnHandler) {
  516. config.warnHandler.call(null, msg, vm, trace);
  517. } else if (hasConsole && (!config.silent)) {
  518. console.error(("[Vue warn]: " + msg + trace));
  519. }
  520. };
  521. tip = function (msg, vm) {
  522. if (hasConsole && (!config.silent)) {
  523. console.warn("[Vue tip]: " + msg + (
  524. vm ? generateComponentTrace(vm) : ''
  525. ));
  526. }
  527. };
  528. formatComponentName = function (vm, includeFile) {
  529. if (vm.$root === vm) {
  530. return '<Root>'
  531. }
  532. var options = typeof vm === 'function' && vm.cid != null
  533. ? vm.options
  534. : vm._isVue
  535. ? vm.$options || vm.constructor.options
  536. : vm || {};
  537. var name = options.name || options._componentTag;
  538. var file = options.__file;
  539. if (!name && file) {
  540. var match = file.match(/([^/\\]+)\.vue$/);
  541. name = match && match[1];
  542. }
  543. return (
  544. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  545. (file && includeFile !== false ? (" at " + file) : '')
  546. )
  547. };
  548. var repeat = function (str, n) {
  549. var res = '';
  550. while (n) {
  551. if (n % 2 === 1) { res += str; }
  552. if (n > 1) { str += str; }
  553. n >>= 1;
  554. }
  555. return res
  556. };
  557. generateComponentTrace = function (vm) {
  558. if (vm._isVue && vm.$parent) {
  559. var tree = [];
  560. var currentRecursiveSequence = 0;
  561. while (vm) {
  562. if (tree.length > 0) {
  563. var last = tree[tree.length - 1];
  564. if (last.constructor === vm.constructor) {
  565. currentRecursiveSequence++;
  566. vm = vm.$parent;
  567. continue
  568. } else if (currentRecursiveSequence > 0) {
  569. tree[tree.length - 1] = [last, currentRecursiveSequence];
  570. currentRecursiveSequence = 0;
  571. }
  572. }
  573. tree.push(vm);
  574. vm = vm.$parent;
  575. }
  576. return '\n\nfound in\n\n' + tree
  577. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  578. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  579. : formatComponentName(vm))); })
  580. .join('\n')
  581. } else {
  582. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  583. }
  584. };
  585. }
  586. /* */
  587. var uid = 0;
  588. /**
  589. * A dep is an observable that can have multiple
  590. * directives subscribing to it.
  591. */
  592. var Dep = function Dep () {
  593. this.id = uid++;
  594. this.subs = [];
  595. };
  596. Dep.prototype.addSub = function addSub (sub) {
  597. this.subs.push(sub);
  598. };
  599. Dep.prototype.removeSub = function removeSub (sub) {
  600. remove(this.subs, sub);
  601. };
  602. Dep.prototype.depend = function depend () {
  603. if (Dep.target) {
  604. Dep.target.addDep(this);
  605. }
  606. };
  607. Dep.prototype.notify = function notify () {
  608. // stabilize the subscriber list first
  609. var subs = this.subs.slice();
  610. for (var i = 0, l = subs.length; i < l; i++) {
  611. subs[i].update();
  612. }
  613. };
  614. // the current target watcher being evaluated.
  615. // this is globally unique because there could be only one
  616. // watcher being evaluated at any time.
  617. Dep.target = null;
  618. var targetStack = [];
  619. function pushTarget (_target) {
  620. if (Dep.target) { targetStack.push(Dep.target); }
  621. Dep.target = _target;
  622. }
  623. function popTarget () {
  624. Dep.target = targetStack.pop();
  625. }
  626. /* */
  627. var VNode = function VNode (
  628. tag,
  629. data,
  630. children,
  631. text,
  632. elm,
  633. context,
  634. componentOptions,
  635. asyncFactory
  636. ) {
  637. this.tag = tag;
  638. this.data = data;
  639. this.children = children;
  640. this.text = text;
  641. this.elm = elm;
  642. this.ns = undefined;
  643. this.context = context;
  644. this.fnContext = undefined;
  645. this.fnOptions = undefined;
  646. this.fnScopeId = undefined;
  647. this.key = data && data.key;
  648. this.componentOptions = componentOptions;
  649. this.componentInstance = undefined;
  650. this.parent = undefined;
  651. this.raw = false;
  652. this.isStatic = false;
  653. this.isRootInsert = true;
  654. this.isComment = false;
  655. this.isCloned = false;
  656. this.isOnce = false;
  657. this.asyncFactory = asyncFactory;
  658. this.asyncMeta = undefined;
  659. this.isAsyncPlaceholder = false;
  660. };
  661. var prototypeAccessors = { child: { configurable: true } };
  662. // DEPRECATED: alias for componentInstance for backwards compat.
  663. /* istanbul ignore next */
  664. prototypeAccessors.child.get = function () {
  665. return this.componentInstance
  666. };
  667. Object.defineProperties( VNode.prototype, prototypeAccessors );
  668. var createEmptyVNode = function (text) {
  669. if ( text === void 0 ) text = '';
  670. var node = new VNode();
  671. node.text = text;
  672. node.isComment = true;
  673. return node
  674. };
  675. function createTextVNode (val) {
  676. return new VNode(undefined, undefined, undefined, String(val))
  677. }
  678. // optimized shallow clone
  679. // used for static nodes and slot nodes because they may be reused across
  680. // multiple renders, cloning them avoids errors when DOM manipulations rely
  681. // on their elm reference.
  682. function cloneVNode (vnode) {
  683. var cloned = new VNode(
  684. vnode.tag,
  685. vnode.data,
  686. vnode.children,
  687. vnode.text,
  688. vnode.elm,
  689. vnode.context,
  690. vnode.componentOptions,
  691. vnode.asyncFactory
  692. );
  693. cloned.ns = vnode.ns;
  694. cloned.isStatic = vnode.isStatic;
  695. cloned.key = vnode.key;
  696. cloned.isComment = vnode.isComment;
  697. cloned.fnContext = vnode.fnContext;
  698. cloned.fnOptions = vnode.fnOptions;
  699. cloned.fnScopeId = vnode.fnScopeId;
  700. cloned.isCloned = true;
  701. return cloned
  702. }
  703. /*
  704. * not type checking this file because flow doesn't play well with
  705. * dynamically accessing methods on Array prototype
  706. */
  707. var arrayProto = Array.prototype;
  708. var arrayMethods = Object.create(arrayProto);
  709. var methodsToPatch = [
  710. 'push',
  711. 'pop',
  712. 'shift',
  713. 'unshift',
  714. 'splice',
  715. 'sort',
  716. 'reverse'
  717. ];
  718. /**
  719. * Intercept mutating methods and emit events
  720. */
  721. methodsToPatch.forEach(function (method) {
  722. // cache original method
  723. var original = arrayProto[method];
  724. def(arrayMethods, method, function mutator () {
  725. var args = [], len = arguments.length;
  726. while ( len-- ) args[ len ] = arguments[ len ];
  727. var result = original.apply(this, args);
  728. var ob = this.__ob__;
  729. var inserted;
  730. switch (method) {
  731. case 'push':
  732. case 'unshift':
  733. inserted = args;
  734. break
  735. case 'splice':
  736. inserted = args.slice(2);
  737. break
  738. }
  739. if (inserted) { ob.observeArray(inserted); }
  740. // notify change
  741. ob.dep.notify();
  742. return result
  743. });
  744. });
  745. /* */
  746. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  747. /**
  748. * In some cases we may want to disable observation inside a component's
  749. * update computation.
  750. */
  751. var shouldObserve = true;
  752. function toggleObserving (value) {
  753. shouldObserve = value;
  754. }
  755. /**
  756. * Observer class that is attached to each observed
  757. * object. Once attached, the observer converts the target
  758. * object's property keys into getter/setters that
  759. * collect dependencies and dispatch updates.
  760. */
  761. var Observer = function Observer (value) {
  762. this.value = value;
  763. this.dep = new Dep();
  764. this.vmCount = 0;
  765. def(value, '__ob__', this);
  766. if (Array.isArray(value)) {
  767. var augment = hasProto
  768. ? protoAugment
  769. : copyAugment;
  770. augment(value, arrayMethods, arrayKeys);
  771. this.observeArray(value);
  772. } else {
  773. this.walk(value);
  774. }
  775. };
  776. /**
  777. * Walk through each property and convert them into
  778. * getter/setters. This method should only be called when
  779. * value type is Object.
  780. */
  781. Observer.prototype.walk = function walk (obj) {
  782. var keys = Object.keys(obj);
  783. for (var i = 0; i < keys.length; i++) {
  784. defineReactive(obj, keys[i]);
  785. }
  786. };
  787. /**
  788. * Observe a list of Array items.
  789. */
  790. Observer.prototype.observeArray = function observeArray (items) {
  791. for (var i = 0, l = items.length; i < l; i++) {
  792. observe(items[i]);
  793. }
  794. };
  795. // helpers
  796. /**
  797. * Augment an target Object or Array by intercepting
  798. * the prototype chain using __proto__
  799. */
  800. function protoAugment (target, src, keys) {
  801. /* eslint-disable no-proto */
  802. target.__proto__ = src;
  803. /* eslint-enable no-proto */
  804. }
  805. /**
  806. * Augment an target Object or Array by defining
  807. * hidden properties.
  808. */
  809. /* istanbul ignore next */
  810. function copyAugment (target, src, keys) {
  811. for (var i = 0, l = keys.length; i < l; i++) {
  812. var key = keys[i];
  813. def(target, key, src[key]);
  814. }
  815. }
  816. /**
  817. * Attempt to create an observer instance for a value,
  818. * returns the new observer if successfully observed,
  819. * or the existing observer if the value already has one.
  820. */
  821. function observe (value, asRootData) {
  822. if (!isObject(value) || value instanceof VNode) {
  823. return
  824. }
  825. var ob;
  826. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  827. ob = value.__ob__;
  828. } else if (
  829. shouldObserve &&
  830. !isServerRendering() &&
  831. (Array.isArray(value) || isPlainObject(value)) &&
  832. Object.isExtensible(value) &&
  833. !value._isVue
  834. ) {
  835. ob = new Observer(value);
  836. }
  837. if (asRootData && ob) {
  838. ob.vmCount++;
  839. }
  840. return ob
  841. }
  842. /**
  843. * Define a reactive property on an Object.
  844. */
  845. function defineReactive (
  846. obj,
  847. key,
  848. val,
  849. customSetter,
  850. shallow
  851. ) {
  852. var dep = new Dep();
  853. var property = Object.getOwnPropertyDescriptor(obj, key);
  854. if (property && property.configurable === false) {
  855. return
  856. }
  857. // cater for pre-defined getter/setters
  858. var getter = property && property.get;
  859. if (!getter && arguments.length === 2) {
  860. val = obj[key];
  861. }
  862. var setter = property && property.set;
  863. var childOb = !shallow && observe(val);
  864. Object.defineProperty(obj, key, {
  865. enumerable: true,
  866. configurable: true,
  867. get: function reactiveGetter () {
  868. var value = getter ? getter.call(obj) : val;
  869. if (Dep.target) {
  870. dep.depend();
  871. if (childOb) {
  872. childOb.dep.depend();
  873. if (Array.isArray(value)) {
  874. dependArray(value);
  875. }
  876. }
  877. }
  878. return value
  879. },
  880. set: function reactiveSetter (newVal) {
  881. var value = getter ? getter.call(obj) : val;
  882. /* eslint-disable no-self-compare */
  883. if (newVal === value || (newVal !== newVal && value !== value)) {
  884. return
  885. }
  886. /* eslint-enable no-self-compare */
  887. if ("development" !== 'production' && customSetter) {
  888. customSetter();
  889. }
  890. if (setter) {
  891. setter.call(obj, newVal);
  892. } else {
  893. val = newVal;
  894. }
  895. childOb = !shallow && observe(newVal);
  896. dep.notify();
  897. }
  898. });
  899. }
  900. /**
  901. * Set a property on an object. Adds the new property and
  902. * triggers change notification if the property doesn't
  903. * already exist.
  904. */
  905. function set (target, key, val) {
  906. if ("development" !== 'production' &&
  907. (isUndef(target) || isPrimitive(target))
  908. ) {
  909. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  910. }
  911. if (Array.isArray(target) && isValidArrayIndex(key)) {
  912. target.length = Math.max(target.length, key);
  913. target.splice(key, 1, val);
  914. return val
  915. }
  916. if (key in target && !(key in Object.prototype)) {
  917. target[key] = val;
  918. return val
  919. }
  920. var ob = (target).__ob__;
  921. if (target._isVue || (ob && ob.vmCount)) {
  922. "development" !== 'production' && warn(
  923. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  924. 'at runtime - declare it upfront in the data option.'
  925. );
  926. return val
  927. }
  928. if (!ob) {
  929. target[key] = val;
  930. return val
  931. }
  932. defineReactive(ob.value, key, val);
  933. ob.dep.notify();
  934. return val
  935. }
  936. /**
  937. * Delete a property and trigger change if necessary.
  938. */
  939. function del (target, key) {
  940. if ("development" !== 'production' &&
  941. (isUndef(target) || isPrimitive(target))
  942. ) {
  943. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  944. }
  945. if (Array.isArray(target) && isValidArrayIndex(key)) {
  946. target.splice(key, 1);
  947. return
  948. }
  949. var ob = (target).__ob__;
  950. if (target._isVue || (ob && ob.vmCount)) {
  951. "development" !== 'production' && warn(
  952. 'Avoid deleting properties on a Vue instance or its root $data ' +
  953. '- just set it to null.'
  954. );
  955. return
  956. }
  957. if (!hasOwn(target, key)) {
  958. return
  959. }
  960. delete target[key];
  961. if (!ob) {
  962. return
  963. }
  964. ob.dep.notify();
  965. }
  966. /**
  967. * Collect dependencies on array elements when the array is touched, since
  968. * we cannot intercept array element access like property getters.
  969. */
  970. function dependArray (value) {
  971. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  972. e = value[i];
  973. e && e.__ob__ && e.__ob__.dep.depend();
  974. if (Array.isArray(e)) {
  975. dependArray(e);
  976. }
  977. }
  978. }
  979. /* */
  980. /**
  981. * Option overwriting strategies are functions that handle
  982. * how to merge a parent option value and a child option
  983. * value into the final value.
  984. */
  985. var strats = config.optionMergeStrategies;
  986. /**
  987. * Options with restrictions
  988. */
  989. {
  990. strats.el = strats.propsData = function (parent, child, vm, key) {
  991. if (!vm) {
  992. warn(
  993. "option \"" + key + "\" can only be used during instance " +
  994. 'creation with the `new` keyword.'
  995. );
  996. }
  997. return defaultStrat(parent, child)
  998. };
  999. }
  1000. /**
  1001. * Helper that recursively merges two data objects together.
  1002. */
  1003. function mergeData (to, from) {
  1004. if (!from) { return to }
  1005. var key, toVal, fromVal;
  1006. var keys = Object.keys(from);
  1007. for (var i = 0; i < keys.length; i++) {
  1008. key = keys[i];
  1009. toVal = to[key];
  1010. fromVal = from[key];
  1011. if (!hasOwn(to, key)) {
  1012. set(to, key, fromVal);
  1013. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  1014. mergeData(toVal, fromVal);
  1015. }
  1016. }
  1017. return to
  1018. }
  1019. /**
  1020. * Data
  1021. */
  1022. function mergeDataOrFn (
  1023. parentVal,
  1024. childVal,
  1025. vm
  1026. ) {
  1027. if (!vm) {
  1028. // in a Vue.extend merge, both should be functions
  1029. if (!childVal) {
  1030. return parentVal
  1031. }
  1032. if (!parentVal) {
  1033. return childVal
  1034. }
  1035. // when parentVal & childVal are both present,
  1036. // we need to return a function that returns the
  1037. // merged result of both functions... no need to
  1038. // check if parentVal is a function here because
  1039. // it has to be a function to pass previous merges.
  1040. return function mergedDataFn () {
  1041. return mergeData(
  1042. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1043. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1044. )
  1045. }
  1046. } else {
  1047. return function mergedInstanceDataFn () {
  1048. // instance merge
  1049. var instanceData = typeof childVal === 'function'
  1050. ? childVal.call(vm, vm)
  1051. : childVal;
  1052. var defaultData = typeof parentVal === 'function'
  1053. ? parentVal.call(vm, vm)
  1054. : parentVal;
  1055. if (instanceData) {
  1056. return mergeData(instanceData, defaultData)
  1057. } else {
  1058. return defaultData
  1059. }
  1060. }
  1061. }
  1062. }
  1063. strats.data = function (
  1064. parentVal,
  1065. childVal,
  1066. vm
  1067. ) {
  1068. if (!vm) {
  1069. if (childVal && typeof childVal !== 'function') {
  1070. "development" !== 'production' && warn(
  1071. 'The "data" option should be a function ' +
  1072. 'that returns a per-instance value in component ' +
  1073. 'definitions.',
  1074. vm
  1075. );
  1076. return parentVal
  1077. }
  1078. return mergeDataOrFn(parentVal, childVal)
  1079. }
  1080. return mergeDataOrFn(parentVal, childVal, vm)
  1081. };
  1082. /**
  1083. * Hooks and props are merged as arrays.
  1084. */
  1085. function mergeHook (
  1086. parentVal,
  1087. childVal
  1088. ) {
  1089. return childVal
  1090. ? parentVal
  1091. ? parentVal.concat(childVal)
  1092. : Array.isArray(childVal)
  1093. ? childVal
  1094. : [childVal]
  1095. : parentVal
  1096. }
  1097. LIFECYCLE_HOOKS.forEach(function (hook) {
  1098. strats[hook] = mergeHook;
  1099. });
  1100. /**
  1101. * Assets
  1102. *
  1103. * When a vm is present (instance creation), we need to do
  1104. * a three-way merge between constructor options, instance
  1105. * options and parent options.
  1106. */
  1107. function mergeAssets (
  1108. parentVal,
  1109. childVal,
  1110. vm,
  1111. key
  1112. ) {
  1113. var res = Object.create(parentVal || null);
  1114. if (childVal) {
  1115. "development" !== 'production' && assertObjectType(key, childVal, vm);
  1116. return extend(res, childVal)
  1117. } else {
  1118. return res
  1119. }
  1120. }
  1121. ASSET_TYPES.forEach(function (type) {
  1122. strats[type + 's'] = mergeAssets;
  1123. });
  1124. /**
  1125. * Watchers.
  1126. *
  1127. * Watchers hashes should not overwrite one
  1128. * another, so we merge them as arrays.
  1129. */
  1130. strats.watch = function (
  1131. parentVal,
  1132. childVal,
  1133. vm,
  1134. key
  1135. ) {
  1136. // work around Firefox's Object.prototype.watch...
  1137. if (parentVal === nativeWatch) { parentVal = undefined; }
  1138. if (childVal === nativeWatch) { childVal = undefined; }
  1139. /* istanbul ignore if */
  1140. if (!childVal) { return Object.create(parentVal || null) }
  1141. {
  1142. assertObjectType(key, childVal, vm);
  1143. }
  1144. if (!parentVal) { return childVal }
  1145. var ret = {};
  1146. extend(ret, parentVal);
  1147. for (var key$1 in childVal) {
  1148. var parent = ret[key$1];
  1149. var child = childVal[key$1];
  1150. if (parent && !Array.isArray(parent)) {
  1151. parent = [parent];
  1152. }
  1153. ret[key$1] = parent
  1154. ? parent.concat(child)
  1155. : Array.isArray(child) ? child : [child];
  1156. }
  1157. return ret
  1158. };
  1159. /**
  1160. * Other object hashes.
  1161. */
  1162. strats.props =
  1163. strats.methods =
  1164. strats.inject =
  1165. strats.computed = function (
  1166. parentVal,
  1167. childVal,
  1168. vm,
  1169. key
  1170. ) {
  1171. if (childVal && "development" !== 'production') {
  1172. assertObjectType(key, childVal, vm);
  1173. }
  1174. if (!parentVal) { return childVal }
  1175. var ret = Object.create(null);
  1176. extend(ret, parentVal);
  1177. if (childVal) { extend(ret, childVal); }
  1178. return ret
  1179. };
  1180. strats.provide = mergeDataOrFn;
  1181. /**
  1182. * Default strategy.
  1183. */
  1184. var defaultStrat = function (parentVal, childVal) {
  1185. return childVal === undefined
  1186. ? parentVal
  1187. : childVal
  1188. };
  1189. /**
  1190. * Validate component names
  1191. */
  1192. function checkComponents (options) {
  1193. for (var key in options.components) {
  1194. validateComponentName(key);
  1195. }
  1196. }
  1197. function validateComponentName (name) {
  1198. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  1199. warn(
  1200. 'Invalid component name: "' + name + '". Component names ' +
  1201. 'can only contain alphanumeric characters and the hyphen, ' +
  1202. 'and must start with a letter.'
  1203. );
  1204. }
  1205. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1206. warn(
  1207. 'Do not use built-in or reserved HTML elements as component ' +
  1208. 'id: ' + name
  1209. );
  1210. }
  1211. }
  1212. /**
  1213. * Ensure all props option syntax are normalized into the
  1214. * Object-based format.
  1215. */
  1216. function normalizeProps (options, vm) {
  1217. var props = options.props;
  1218. if (!props) { return }
  1219. var res = {};
  1220. var i, val, name;
  1221. if (Array.isArray(props)) {
  1222. i = props.length;
  1223. while (i--) {
  1224. val = props[i];
  1225. if (typeof val === 'string') {
  1226. name = camelize(val);
  1227. res[name] = { type: null };
  1228. } else {
  1229. warn('props must be strings when using array syntax.');
  1230. }
  1231. }
  1232. } else if (isPlainObject(props)) {
  1233. for (var key in props) {
  1234. val = props[key];
  1235. name = camelize(key);
  1236. res[name] = isPlainObject(val)
  1237. ? val
  1238. : { type: val };
  1239. }
  1240. } else {
  1241. warn(
  1242. "Invalid value for option \"props\": expected an Array or an Object, " +
  1243. "but got " + (toRawType(props)) + ".",
  1244. vm
  1245. );
  1246. }
  1247. options.props = res;
  1248. }
  1249. /**
  1250. * Normalize all injections into Object-based format
  1251. */
  1252. function normalizeInject (options, vm) {
  1253. var inject = options.inject;
  1254. if (!inject) { return }
  1255. var normalized = options.inject = {};
  1256. if (Array.isArray(inject)) {
  1257. for (var i = 0; i < inject.length; i++) {
  1258. normalized[inject[i]] = { from: inject[i] };
  1259. }
  1260. } else if (isPlainObject(inject)) {
  1261. for (var key in inject) {
  1262. var val = inject[key];
  1263. normalized[key] = isPlainObject(val)
  1264. ? extend({ from: key }, val)
  1265. : { from: val };
  1266. }
  1267. } else {
  1268. warn(
  1269. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1270. "but got " + (toRawType(inject)) + ".",
  1271. vm
  1272. );
  1273. }
  1274. }
  1275. /**
  1276. * Normalize raw function directives into object format.
  1277. */
  1278. function normalizeDirectives (options) {
  1279. var dirs = options.directives;
  1280. if (dirs) {
  1281. for (var key in dirs) {
  1282. var def = dirs[key];
  1283. if (typeof def === 'function') {
  1284. dirs[key] = { bind: def, update: def };
  1285. }
  1286. }
  1287. }
  1288. }
  1289. function assertObjectType (name, value, vm) {
  1290. if (!isPlainObject(value)) {
  1291. warn(
  1292. "Invalid value for option \"" + name + "\": expected an Object, " +
  1293. "but got " + (toRawType(value)) + ".",
  1294. vm
  1295. );
  1296. }
  1297. }
  1298. /**
  1299. * Merge two option objects into a new one.
  1300. * Core utility used in both instantiation and inheritance.
  1301. */
  1302. function mergeOptions (
  1303. parent,
  1304. child,
  1305. vm
  1306. ) {
  1307. {
  1308. checkComponents(child);
  1309. }
  1310. if (typeof child === 'function') {
  1311. child = child.options;
  1312. }
  1313. normalizeProps(child, vm);
  1314. normalizeInject(child, vm);
  1315. normalizeDirectives(child);
  1316. var extendsFrom = child.extends;
  1317. if (extendsFrom) {
  1318. parent = mergeOptions(parent, extendsFrom, vm);
  1319. }
  1320. if (child.mixins) {
  1321. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1322. parent = mergeOptions(parent, child.mixins[i], vm);
  1323. }
  1324. }
  1325. var options = {};
  1326. var key;
  1327. for (key in parent) {
  1328. mergeField(key);
  1329. }
  1330. for (key in child) {
  1331. if (!hasOwn(parent, key)) {
  1332. mergeField(key);
  1333. }
  1334. }
  1335. function mergeField (key) {
  1336. var strat = strats[key] || defaultStrat;
  1337. options[key] = strat(parent[key], child[key], vm, key);
  1338. }
  1339. return options
  1340. }
  1341. /**
  1342. * Resolve an asset.
  1343. * This function is used because child instances need access
  1344. * to assets defined in its ancestor chain.
  1345. */
  1346. function resolveAsset (
  1347. options,
  1348. type,
  1349. id,
  1350. warnMissing
  1351. ) {
  1352. /* istanbul ignore if */
  1353. if (typeof id !== 'string') {
  1354. return
  1355. }
  1356. var assets = options[type];
  1357. // check local registration variations first
  1358. if (hasOwn(assets, id)) { return assets[id] }
  1359. var camelizedId = camelize(id);
  1360. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1361. var PascalCaseId = capitalize(camelizedId);
  1362. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1363. // fallback to prototype chain
  1364. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1365. if ("development" !== 'production' && warnMissing && !res) {
  1366. warn(
  1367. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1368. options
  1369. );
  1370. }
  1371. return res
  1372. }
  1373. /* */
  1374. function validateProp (
  1375. key,
  1376. propOptions,
  1377. propsData,
  1378. vm
  1379. ) {
  1380. var prop = propOptions[key];
  1381. var absent = !hasOwn(propsData, key);
  1382. var value = propsData[key];
  1383. // boolean casting
  1384. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1385. if (booleanIndex > -1) {
  1386. if (absent && !hasOwn(prop, 'default')) {
  1387. value = false;
  1388. } else if (value === '' || value === hyphenate(key)) {
  1389. // only cast empty string / same name to boolean if
  1390. // boolean has higher priority
  1391. var stringIndex = getTypeIndex(String, prop.type);
  1392. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1393. value = true;
  1394. }
  1395. }
  1396. }
  1397. // check default value
  1398. if (value === undefined) {
  1399. value = getPropDefaultValue(vm, prop, key);
  1400. // since the default value is a fresh copy,
  1401. // make sure to observe it.
  1402. var prevShouldObserve = shouldObserve;
  1403. toggleObserving(true);
  1404. observe(value);
  1405. toggleObserving(prevShouldObserve);
  1406. }
  1407. {
  1408. assertProp(prop, key, value, vm, absent);
  1409. }
  1410. return value
  1411. }
  1412. /**
  1413. * Get the default value of a prop.
  1414. */
  1415. function getPropDefaultValue (vm, prop, key) {
  1416. // no default, return undefined
  1417. if (!hasOwn(prop, 'default')) {
  1418. return undefined
  1419. }
  1420. var def = prop.default;
  1421. // warn against non-factory defaults for Object & Array
  1422. if ("development" !== 'production' && isObject(def)) {
  1423. warn(
  1424. 'Invalid default value for prop "' + key + '": ' +
  1425. 'Props with type Object/Array must use a factory function ' +
  1426. 'to return the default value.',
  1427. vm
  1428. );
  1429. }
  1430. // the raw prop value was also undefined from previous render,
  1431. // return previous default value to avoid unnecessary watcher trigger
  1432. if (vm && vm.$options.propsData &&
  1433. vm.$options.propsData[key] === undefined &&
  1434. vm._props[key] !== undefined
  1435. ) {
  1436. return vm._props[key]
  1437. }
  1438. // call factory function for non-Function types
  1439. // a value is Function if its prototype is function even across different execution context
  1440. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1441. ? def.call(vm)
  1442. : def
  1443. }
  1444. /**
  1445. * Assert whether a prop is valid.
  1446. */
  1447. function assertProp (
  1448. prop,
  1449. name,
  1450. value,
  1451. vm,
  1452. absent
  1453. ) {
  1454. if (prop.required && absent) {
  1455. warn(
  1456. 'Missing required prop: "' + name + '"',
  1457. vm
  1458. );
  1459. return
  1460. }
  1461. if (value == null && !prop.required) {
  1462. return
  1463. }
  1464. var type = prop.type;
  1465. var valid = !type || type === true;
  1466. var expectedTypes = [];
  1467. if (type) {
  1468. if (!Array.isArray(type)) {
  1469. type = [type];
  1470. }
  1471. for (var i = 0; i < type.length && !valid; i++) {
  1472. var assertedType = assertType(value, type[i]);
  1473. expectedTypes.push(assertedType.expectedType || '');
  1474. valid = assertedType.valid;
  1475. }
  1476. }
  1477. if (!valid) {
  1478. warn(
  1479. "Invalid prop: type check failed for prop \"" + name + "\"." +
  1480. " Expected " + (expectedTypes.map(capitalize).join(', ')) +
  1481. ", got " + (toRawType(value)) + ".",
  1482. vm
  1483. );
  1484. return
  1485. }
  1486. var validator = prop.validator;
  1487. if (validator) {
  1488. if (!validator(value)) {
  1489. warn(
  1490. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1491. vm
  1492. );
  1493. }
  1494. }
  1495. }
  1496. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1497. function assertType (value, type) {
  1498. var valid;
  1499. var expectedType = getType(type);
  1500. if (simpleCheckRE.test(expectedType)) {
  1501. var t = typeof value;
  1502. valid = t === expectedType.toLowerCase();
  1503. // for primitive wrapper objects
  1504. if (!valid && t === 'object') {
  1505. valid = value instanceof type;
  1506. }
  1507. } else if (expectedType === 'Object') {
  1508. valid = isPlainObject(value);
  1509. } else if (expectedType === 'Array') {
  1510. valid = Array.isArray(value);
  1511. } else {
  1512. valid = value instanceof type;
  1513. }
  1514. return {
  1515. valid: valid,
  1516. expectedType: expectedType
  1517. }
  1518. }
  1519. /**
  1520. * Use function string name to check built-in types,
  1521. * because a simple equality check will fail when running
  1522. * across different vms / iframes.
  1523. */
  1524. function getType (fn) {
  1525. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1526. return match ? match[1] : ''
  1527. }
  1528. function isSameType (a, b) {
  1529. return getType(a) === getType(b)
  1530. }
  1531. function getTypeIndex (type, expectedTypes) {
  1532. if (!Array.isArray(expectedTypes)) {
  1533. return isSameType(expectedTypes, type) ? 0 : -1
  1534. }
  1535. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1536. if (isSameType(expectedTypes[i], type)) {
  1537. return i
  1538. }
  1539. }
  1540. return -1
  1541. }
  1542. /* */
  1543. function handleError (err, vm, info) {
  1544. if (vm) {
  1545. var cur = vm;
  1546. while ((cur = cur.$parent)) {
  1547. var hooks = cur.$options.errorCaptured;
  1548. if (hooks) {
  1549. for (var i = 0; i < hooks.length; i++) {
  1550. try {
  1551. var capture = hooks[i].call(cur, err, vm, info) === false;
  1552. if (capture) { return }
  1553. } catch (e) {
  1554. globalHandleError(e, cur, 'errorCaptured hook');
  1555. }
  1556. }
  1557. }
  1558. }
  1559. }
  1560. globalHandleError(err, vm, info);
  1561. }
  1562. function globalHandleError (err, vm, info) {
  1563. if (config.errorHandler) {
  1564. try {
  1565. return config.errorHandler.call(null, err, vm, info)
  1566. } catch (e) {
  1567. logError(e, null, 'config.errorHandler');
  1568. }
  1569. }
  1570. logError(err, vm, info);
  1571. }
  1572. function logError (err, vm, info) {
  1573. {
  1574. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1575. }
  1576. /* istanbul ignore else */
  1577. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1578. console.error(err);
  1579. } else {
  1580. throw err
  1581. }
  1582. }
  1583. /* */
  1584. /* globals MessageChannel */
  1585. var callbacks = [];
  1586. var pending = false;
  1587. function flushCallbacks () {
  1588. pending = false;
  1589. var copies = callbacks.slice(0);
  1590. callbacks.length = 0;
  1591. for (var i = 0; i < copies.length; i++) {
  1592. copies[i]();
  1593. }
  1594. }
  1595. // Here we have async deferring wrappers using both microtasks and (macro) tasks.
  1596. // In < 2.4 we used microtasks everywhere, but there are some scenarios where
  1597. // microtasks have too high a priority and fire in between supposedly
  1598. // sequential events (e.g. #4521, #6690) or even between bubbling of the same
  1599. // event (#6566). However, using (macro) tasks everywhere also has subtle problems
  1600. // when state is changed right before repaint (e.g. #6813, out-in transitions).
  1601. // Here we use microtask by default, but expose a way to force (macro) task when
  1602. // needed (e.g. in event handlers attached by v-on).
  1603. var microTimerFunc;
  1604. var macroTimerFunc;
  1605. var useMacroTask = false;
  1606. // Determine (macro) task defer implementation.
  1607. // Technically setImmediate should be the ideal choice, but it's only available
  1608. // in IE. The only polyfill that consistently queues the callback after all DOM
  1609. // events triggered in the same loop is by using MessageChannel.
  1610. /* istanbul ignore if */
  1611. if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1612. macroTimerFunc = function () {
  1613. setImmediate(flushCallbacks);
  1614. };
  1615. } else if (typeof MessageChannel !== 'undefined' && (
  1616. isNative(MessageChannel) ||
  1617. // PhantomJS
  1618. MessageChannel.toString() === '[object MessageChannelConstructor]'
  1619. )) {
  1620. var channel = new MessageChannel();
  1621. var port = channel.port2;
  1622. channel.port1.onmessage = flushCallbacks;
  1623. macroTimerFunc = function () {
  1624. port.postMessage(1);
  1625. };
  1626. } else {
  1627. /* istanbul ignore next */
  1628. macroTimerFunc = function () {
  1629. setTimeout(flushCallbacks, 0);
  1630. };
  1631. }
  1632. // Determine microtask defer implementation.
  1633. /* istanbul ignore next, $flow-disable-line */
  1634. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1635. var p = Promise.resolve();
  1636. microTimerFunc = function () {
  1637. p.then(flushCallbacks);
  1638. // in problematic UIWebViews, Promise.then doesn't completely break, but
  1639. // it can get stuck in a weird state where callbacks are pushed into the
  1640. // microtask queue but the queue isn't being flushed, until the browser
  1641. // needs to do some other work, e.g. handle a timer. Therefore we can
  1642. // "force" the microtask queue to be flushed by adding an empty timer.
  1643. if (isIOS) { setTimeout(noop); }
  1644. };
  1645. } else {
  1646. // fallback to macro
  1647. microTimerFunc = macroTimerFunc;
  1648. }
  1649. /**
  1650. * Wrap a function so that if any code inside triggers state change,
  1651. * the changes are queued using a (macro) task instead of a microtask.
  1652. */
  1653. function withMacroTask (fn) {
  1654. return fn._withTask || (fn._withTask = function () {
  1655. useMacroTask = true;
  1656. var res = fn.apply(null, arguments);
  1657. useMacroTask = false;
  1658. return res
  1659. })
  1660. }
  1661. function nextTick (cb, ctx) {
  1662. var _resolve;
  1663. callbacks.push(function () {
  1664. if (cb) {
  1665. try {
  1666. cb.call(ctx);
  1667. } catch (e) {
  1668. handleError(e, ctx, 'nextTick');
  1669. }
  1670. } else if (_resolve) {
  1671. _resolve(ctx);
  1672. }
  1673. });
  1674. if (!pending) {
  1675. pending = true;
  1676. if (useMacroTask) {
  1677. macroTimerFunc();
  1678. } else {
  1679. microTimerFunc();
  1680. }
  1681. }
  1682. // $flow-disable-line
  1683. if (!cb && typeof Promise !== 'undefined') {
  1684. return new Promise(function (resolve) {
  1685. _resolve = resolve;
  1686. })
  1687. }
  1688. }
  1689. /* */
  1690. var mark;
  1691. var measure;
  1692. {
  1693. var perf = inBrowser && window.performance;
  1694. /* istanbul ignore if */
  1695. if (
  1696. perf &&
  1697. perf.mark &&
  1698. perf.measure &&
  1699. perf.clearMarks &&
  1700. perf.clearMeasures
  1701. ) {
  1702. mark = function (tag) { return perf.mark(tag); };
  1703. measure = function (name, startTag, endTag) {
  1704. perf.measure(name, startTag, endTag);
  1705. perf.clearMarks(startTag);
  1706. perf.clearMarks(endTag);
  1707. perf.clearMeasures(name);
  1708. };
  1709. }
  1710. }
  1711. /* not type checking this file because flow doesn't play well with Proxy */
  1712. var initProxy;
  1713. {
  1714. var allowedGlobals = makeMap(
  1715. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1716. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1717. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1718. 'require' // for Webpack/Browserify
  1719. );
  1720. var warnNonPresent = function (target, key) {
  1721. warn(
  1722. "Property or method \"" + key + "\" is not defined on the instance but " +
  1723. 'referenced during render. Make sure that this property is reactive, ' +
  1724. 'either in the data option, or for class-based components, by ' +
  1725. 'initializing the property. ' +
  1726. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1727. target
  1728. );
  1729. };
  1730. var hasProxy =
  1731. typeof Proxy !== 'undefined' && isNative(Proxy);
  1732. if (hasProxy) {
  1733. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1734. config.keyCodes = new Proxy(config.keyCodes, {
  1735. set: function set (target, key, value) {
  1736. if (isBuiltInModifier(key)) {
  1737. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1738. return false
  1739. } else {
  1740. target[key] = value;
  1741. return true
  1742. }
  1743. }
  1744. });
  1745. }
  1746. var hasHandler = {
  1747. has: function has (target, key) {
  1748. var has = key in target;
  1749. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  1750. if (!has && !isAllowed) {
  1751. warnNonPresent(target, key);
  1752. }
  1753. return has || !isAllowed
  1754. }
  1755. };
  1756. var getHandler = {
  1757. get: function get (target, key) {
  1758. if (typeof key === 'string' && !(key in target)) {
  1759. warnNonPresent(target, key);
  1760. }
  1761. return target[key]
  1762. }
  1763. };
  1764. initProxy = function initProxy (vm) {
  1765. if (hasProxy) {
  1766. // determine which proxy handler to use
  1767. var options = vm.$options;
  1768. var handlers = options.render && options.render._withStripped
  1769. ? getHandler
  1770. : hasHandler;
  1771. vm._renderProxy = new Proxy(vm, handlers);
  1772. } else {
  1773. vm._renderProxy = vm;
  1774. }
  1775. };
  1776. }
  1777. /* */
  1778. var seenObjects = new _Set();
  1779. /**
  1780. * Recursively traverse an object to evoke all converted
  1781. * getters, so that every nested property inside the object
  1782. * is collected as a "deep" dependency.
  1783. */
  1784. function traverse (val) {
  1785. _traverse(val, seenObjects);
  1786. seenObjects.clear();
  1787. }
  1788. function _traverse (val, seen) {
  1789. var i, keys;
  1790. var isA = Array.isArray(val);
  1791. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1792. return
  1793. }
  1794. if (val.__ob__) {
  1795. var depId = val.__ob__.dep.id;
  1796. if (seen.has(depId)) {
  1797. return
  1798. }
  1799. seen.add(depId);
  1800. }
  1801. if (isA) {
  1802. i = val.length;
  1803. while (i--) { _traverse(val[i], seen); }
  1804. } else {
  1805. keys = Object.keys(val);
  1806. i = keys.length;
  1807. while (i--) { _traverse(val[keys[i]], seen); }
  1808. }
  1809. }
  1810. /* */
  1811. var normalizeEvent = cached(function (name) {
  1812. var passive = name.charAt(0) === '&';
  1813. name = passive ? name.slice(1) : name;
  1814. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1815. name = once$$1 ? name.slice(1) : name;
  1816. var capture = name.charAt(0) === '!';
  1817. name = capture ? name.slice(1) : name;
  1818. return {
  1819. name: name,
  1820. once: once$$1,
  1821. capture: capture,
  1822. passive: passive
  1823. }
  1824. });
  1825. function createFnInvoker (fns) {
  1826. function invoker () {
  1827. var arguments$1 = arguments;
  1828. var fns = invoker.fns;
  1829. if (Array.isArray(fns)) {
  1830. var cloned = fns.slice();
  1831. for (var i = 0; i < cloned.length; i++) {
  1832. cloned[i].apply(null, arguments$1);
  1833. }
  1834. } else {
  1835. // return handler return value for single handlers
  1836. return fns.apply(null, arguments)
  1837. }
  1838. }
  1839. invoker.fns = fns;
  1840. return invoker
  1841. }
  1842. function updateListeners (
  1843. on,
  1844. oldOn,
  1845. add,
  1846. remove$$1,
  1847. vm
  1848. ) {
  1849. var name, def, cur, old, event;
  1850. for (name in on) {
  1851. def = cur = on[name];
  1852. old = oldOn[name];
  1853. event = normalizeEvent(name);
  1854. /* istanbul ignore if */
  1855. if (isUndef(cur)) {
  1856. "development" !== 'production' && warn(
  1857. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1858. vm
  1859. );
  1860. } else if (isUndef(old)) {
  1861. if (isUndef(cur.fns)) {
  1862. cur = on[name] = createFnInvoker(cur);
  1863. }
  1864. add(event.name, cur, event.once, event.capture, event.passive, event.params);
  1865. } else if (cur !== old) {
  1866. old.fns = cur;
  1867. on[name] = old;
  1868. }
  1869. }
  1870. for (name in oldOn) {
  1871. if (isUndef(on[name])) {
  1872. event = normalizeEvent(name);
  1873. remove$$1(event.name, oldOn[name], event.capture);
  1874. }
  1875. }
  1876. }
  1877. /* */
  1878. function mergeVNodeHook (def, hookKey, hook) {
  1879. if (def instanceof VNode) {
  1880. def = def.data.hook || (def.data.hook = {});
  1881. }
  1882. var invoker;
  1883. var oldHook = def[hookKey];
  1884. function wrappedHook () {
  1885. hook.apply(this, arguments);
  1886. // important: remove merged hook to ensure it's called only once
  1887. // and prevent memory leak
  1888. remove(invoker.fns, wrappedHook);
  1889. }
  1890. if (isUndef(oldHook)) {
  1891. // no existing hook
  1892. invoker = createFnInvoker([wrappedHook]);
  1893. } else {
  1894. /* istanbul ignore if */
  1895. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  1896. // already a merged invoker
  1897. invoker = oldHook;
  1898. invoker.fns.push(wrappedHook);
  1899. } else {
  1900. // existing plain hook
  1901. invoker = createFnInvoker([oldHook, wrappedHook]);
  1902. }
  1903. }
  1904. invoker.merged = true;
  1905. def[hookKey] = invoker;
  1906. }
  1907. /* */
  1908. function extractPropsFromVNodeData (
  1909. data,
  1910. Ctor,
  1911. tag
  1912. ) {
  1913. // we are only extracting raw values here.
  1914. // validation and default values are handled in the child
  1915. // component itself.
  1916. var propOptions = Ctor.options.props;
  1917. if (isUndef(propOptions)) {
  1918. return
  1919. }
  1920. var res = {};
  1921. var attrs = data.attrs;
  1922. var props = data.props;
  1923. if (isDef(attrs) || isDef(props)) {
  1924. for (var key in propOptions) {
  1925. var altKey = hyphenate(key);
  1926. {
  1927. var keyInLowerCase = key.toLowerCase();
  1928. if (
  1929. key !== keyInLowerCase &&
  1930. attrs && hasOwn(attrs, keyInLowerCase)
  1931. ) {
  1932. tip(
  1933. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  1934. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  1935. " \"" + key + "\". " +
  1936. "Note that HTML attributes are case-insensitive and camelCased " +
  1937. "props need to use their kebab-case equivalents when using in-DOM " +
  1938. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  1939. );
  1940. }
  1941. }
  1942. checkProp(res, props, key, altKey, true) ||
  1943. checkProp(res, attrs, key, altKey, false);
  1944. }
  1945. }
  1946. return res
  1947. }
  1948. function checkProp (
  1949. res,
  1950. hash,
  1951. key,
  1952. altKey,
  1953. preserve
  1954. ) {
  1955. if (isDef(hash)) {
  1956. if (hasOwn(hash, key)) {
  1957. res[key] = hash[key];
  1958. if (!preserve) {
  1959. delete hash[key];
  1960. }
  1961. return true
  1962. } else if (hasOwn(hash, altKey)) {
  1963. res[key] = hash[altKey];
  1964. if (!preserve) {
  1965. delete hash[altKey];
  1966. }
  1967. return true
  1968. }
  1969. }
  1970. return false
  1971. }
  1972. /* */
  1973. // The template compiler attempts to minimize the need for normalization by
  1974. // statically analyzing the template at compile time.
  1975. //
  1976. // For plain HTML markup, normalization can be completely skipped because the
  1977. // generated render function is guaranteed to return Array<VNode>. There are
  1978. // two cases where extra normalization is needed:
  1979. // 1. When the children contains components - because a functional component
  1980. // may return an Array instead of a single root. In this case, just a simple
  1981. // normalization is needed - if any child is an Array, we flatten the whole
  1982. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  1983. // because functional components already normalize their own children.
  1984. function simpleNormalizeChildren (children) {
  1985. for (var i = 0; i < children.length; i++) {
  1986. if (Array.isArray(children[i])) {
  1987. return Array.prototype.concat.apply([], children)
  1988. }
  1989. }
  1990. return children
  1991. }
  1992. // 2. When the children contains constructs that always generated nested Arrays,
  1993. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  1994. // with hand-written render functions / JSX. In such cases a full normalization
  1995. // is needed to cater to all possible types of children values.
  1996. function normalizeChildren (children) {
  1997. return isPrimitive(children)
  1998. ? [createTextVNode(children)]
  1999. : Array.isArray(children)
  2000. ? normalizeArrayChildren(children)
  2001. : undefined
  2002. }
  2003. function isTextNode (node) {
  2004. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2005. }
  2006. function normalizeArrayChildren (children, nestedIndex) {
  2007. var res = [];
  2008. var i, c, lastIndex, last;
  2009. for (i = 0; i < children.length; i++) {
  2010. c = children[i];
  2011. if (isUndef(c) || typeof c === 'boolean') { continue }
  2012. lastIndex = res.length - 1;
  2013. last = res[lastIndex];
  2014. // nested
  2015. if (Array.isArray(c)) {
  2016. if (c.length > 0) {
  2017. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2018. // merge adjacent text nodes
  2019. if (isTextNode(c[0]) && isTextNode(last)) {
  2020. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2021. c.shift();
  2022. }
  2023. res.push.apply(res, c);
  2024. }
  2025. } else if (isPrimitive(c)) {
  2026. if (isTextNode(last)) {
  2027. // merge adjacent text nodes
  2028. // this is necessary for SSR hydration because text nodes are
  2029. // essentially merged when rendered to HTML strings
  2030. res[lastIndex] = createTextVNode(last.text + c);
  2031. } else if (c !== '') {
  2032. // convert primitive to vnode
  2033. res.push(createTextVNode(c));
  2034. }
  2035. } else {
  2036. if (isTextNode(c) && isTextNode(last)) {
  2037. // merge adjacent text nodes
  2038. res[lastIndex] = createTextVNode(last.text + c.text);
  2039. } else {
  2040. // default key for nested array children (likely generated by v-for)
  2041. if (isTrue(children._isVList) &&
  2042. isDef(c.tag) &&
  2043. isUndef(c.key) &&
  2044. isDef(nestedIndex)) {
  2045. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2046. }
  2047. res.push(c);
  2048. }
  2049. }
  2050. }
  2051. return res
  2052. }
  2053. /* */
  2054. function ensureCtor (comp, base) {
  2055. if (
  2056. comp.__esModule ||
  2057. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  2058. ) {
  2059. comp = comp.default;
  2060. }
  2061. return isObject(comp)
  2062. ? base.extend(comp)
  2063. : comp
  2064. }
  2065. function createAsyncPlaceholder (
  2066. factory,
  2067. data,
  2068. context,
  2069. children,
  2070. tag
  2071. ) {
  2072. var node = createEmptyVNode();
  2073. node.asyncFactory = factory;
  2074. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  2075. return node
  2076. }
  2077. function resolveAsyncComponent (
  2078. factory,
  2079. baseCtor,
  2080. context
  2081. ) {
  2082. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  2083. return factory.errorComp
  2084. }
  2085. if (isDef(factory.resolved)) {
  2086. return factory.resolved
  2087. }
  2088. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  2089. return factory.loadingComp
  2090. }
  2091. if (isDef(factory.contexts)) {
  2092. // already pending
  2093. factory.contexts.push(context);
  2094. } else {
  2095. var contexts = factory.contexts = [context];
  2096. var sync = true;
  2097. var forceRender = function () {
  2098. for (var i = 0, l = contexts.length; i < l; i++) {
  2099. contexts[i].$forceUpdate();
  2100. }
  2101. };
  2102. var resolve = once(function (res) {
  2103. // cache resolved
  2104. factory.resolved = ensureCtor(res, baseCtor);
  2105. // invoke callbacks only if this is not a synchronous resolve
  2106. // (async resolves are shimmed as synchronous during SSR)
  2107. if (!sync) {
  2108. forceRender();
  2109. }
  2110. });
  2111. var reject = once(function (reason) {
  2112. "development" !== 'production' && warn(
  2113. "Failed to resolve async component: " + (String(factory)) +
  2114. (reason ? ("\nReason: " + reason) : '')
  2115. );
  2116. if (isDef(factory.errorComp)) {
  2117. factory.error = true;
  2118. forceRender();
  2119. }
  2120. });
  2121. var res = factory(resolve, reject);
  2122. if (isObject(res)) {
  2123. if (typeof res.then === 'function') {
  2124. // () => Promise
  2125. if (isUndef(factory.resolved)) {
  2126. res.then(resolve, reject);
  2127. }
  2128. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  2129. res.component.then(resolve, reject);
  2130. if (isDef(res.error)) {
  2131. factory.errorComp = ensureCtor(res.error, baseCtor);
  2132. }
  2133. if (isDef(res.loading)) {
  2134. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  2135. if (res.delay === 0) {
  2136. factory.loading = true;
  2137. } else {
  2138. setTimeout(function () {
  2139. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  2140. factory.loading = true;
  2141. forceRender();
  2142. }
  2143. }, res.delay || 200);
  2144. }
  2145. }
  2146. if (isDef(res.timeout)) {
  2147. setTimeout(function () {
  2148. if (isUndef(factory.resolved)) {
  2149. reject(
  2150. "timeout (" + (res.timeout) + "ms)"
  2151. );
  2152. }
  2153. }, res.timeout);
  2154. }
  2155. }
  2156. }
  2157. sync = false;
  2158. // return in case resolved synchronously
  2159. return factory.loading
  2160. ? factory.loadingComp
  2161. : factory.resolved
  2162. }
  2163. }
  2164. /* */
  2165. function isAsyncPlaceholder (node) {
  2166. return node.isComment && node.asyncFactory
  2167. }
  2168. /* */
  2169. function getFirstComponentChild (children) {
  2170. if (Array.isArray(children)) {
  2171. for (var i = 0; i < children.length; i++) {
  2172. var c = children[i];
  2173. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  2174. return c
  2175. }
  2176. }
  2177. }
  2178. }
  2179. /* */
  2180. /* */
  2181. function initEvents (vm) {
  2182. vm._events = Object.create(null);
  2183. vm._hasHookEvent = false;
  2184. // init parent attached events
  2185. var listeners = vm.$options._parentListeners;
  2186. if (listeners) {
  2187. updateComponentListeners(vm, listeners);
  2188. }
  2189. }
  2190. var target;
  2191. function add (event, fn, once) {
  2192. if (once) {
  2193. target.$once(event, fn);
  2194. } else {
  2195. target.$on(event, fn);
  2196. }
  2197. }
  2198. function remove$1 (event, fn) {
  2199. target.$off(event, fn);
  2200. }
  2201. function updateComponentListeners (
  2202. vm,
  2203. listeners,
  2204. oldListeners
  2205. ) {
  2206. target = vm;
  2207. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  2208. target = undefined;
  2209. }
  2210. function eventsMixin (Vue) {
  2211. var hookRE = /^hook:/;
  2212. Vue.prototype.$on = function (event, fn) {
  2213. var this$1 = this;
  2214. var vm = this;
  2215. if (Array.isArray(event)) {
  2216. for (var i = 0, l = event.length; i < l; i++) {
  2217. this$1.$on(event[i], fn);
  2218. }
  2219. } else {
  2220. (vm._events[event] || (vm._events[event] = [])).push(fn);
  2221. // optimize hook:event cost by using a boolean flag marked at registration
  2222. // instead of a hash lookup
  2223. if (hookRE.test(event)) {
  2224. vm._hasHookEvent = true;
  2225. }
  2226. }
  2227. return vm
  2228. };
  2229. Vue.prototype.$once = function (event, fn) {
  2230. var vm = this;
  2231. function on () {
  2232. vm.$off(event, on);
  2233. fn.apply(vm, arguments);
  2234. }
  2235. on.fn = fn;
  2236. vm.$on(event, on);
  2237. return vm
  2238. };
  2239. Vue.prototype.$off = function (event, fn) {
  2240. var this$1 = this;
  2241. var vm = this;
  2242. // all
  2243. if (!arguments.length) {
  2244. vm._events = Object.create(null);
  2245. return vm
  2246. }
  2247. // array of events
  2248. if (Array.isArray(event)) {
  2249. for (var i = 0, l = event.length; i < l; i++) {
  2250. this$1.$off(event[i], fn);
  2251. }
  2252. return vm
  2253. }
  2254. // specific event
  2255. var cbs = vm._events[event];
  2256. if (!cbs) {
  2257. return vm
  2258. }
  2259. if (!fn) {
  2260. vm._events[event] = null;
  2261. return vm
  2262. }
  2263. if (fn) {
  2264. // specific handler
  2265. var cb;
  2266. var i$1 = cbs.length;
  2267. while (i$1--) {
  2268. cb = cbs[i$1];
  2269. if (cb === fn || cb.fn === fn) {
  2270. cbs.splice(i$1, 1);
  2271. break
  2272. }
  2273. }
  2274. }
  2275. return vm
  2276. };
  2277. Vue.prototype.$emit = function (event) {
  2278. var vm = this;
  2279. {
  2280. var lowerCaseEvent = event.toLowerCase();
  2281. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  2282. tip(
  2283. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  2284. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  2285. "Note that HTML attributes are case-insensitive and you cannot use " +
  2286. "v-on to listen to camelCase events when using in-DOM templates. " +
  2287. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  2288. );
  2289. }
  2290. }
  2291. var cbs = vm._events[event];
  2292. if (cbs) {
  2293. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2294. var args = toArray(arguments, 1);
  2295. for (var i = 0, l = cbs.length; i < l; i++) {
  2296. try {
  2297. cbs[i].apply(vm, args);
  2298. } catch (e) {
  2299. handleError(e, vm, ("event handler for \"" + event + "\""));
  2300. }
  2301. }
  2302. }
  2303. return vm
  2304. };
  2305. }
  2306. /* */
  2307. /**
  2308. * Runtime helper for resolving raw children VNodes into a slot object.
  2309. */
  2310. function resolveSlots (
  2311. children,
  2312. context
  2313. ) {
  2314. var slots = {};
  2315. if (!children) {
  2316. return slots
  2317. }
  2318. for (var i = 0, l = children.length; i < l; i++) {
  2319. var child = children[i];
  2320. var data = child.data;
  2321. // remove slot attribute if the node is resolved as a Vue slot node
  2322. if (data && data.attrs && data.attrs.slot) {
  2323. delete data.attrs.slot;
  2324. }
  2325. // named slots should only be respected if the vnode was rendered in the
  2326. // same context.
  2327. if ((child.context === context || child.fnContext === context) &&
  2328. data && data.slot != null
  2329. ) {
  2330. var name = data.slot;
  2331. var slot = (slots[name] || (slots[name] = []));
  2332. if (child.tag === 'template') {
  2333. slot.push.apply(slot, child.children || []);
  2334. } else {
  2335. slot.push(child);
  2336. }
  2337. } else {
  2338. (slots.default || (slots.default = [])).push(child);
  2339. }
  2340. }
  2341. // ignore slots that contains only whitespace
  2342. for (var name$1 in slots) {
  2343. if (slots[name$1].every(isWhitespace)) {
  2344. delete slots[name$1];
  2345. }
  2346. }
  2347. return slots
  2348. }
  2349. function isWhitespace (node) {
  2350. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2351. }
  2352. function resolveScopedSlots (
  2353. fns, // see flow/vnode
  2354. res
  2355. ) {
  2356. res = res || {};
  2357. for (var i = 0; i < fns.length; i++) {
  2358. if (Array.isArray(fns[i])) {
  2359. resolveScopedSlots(fns[i], res);
  2360. } else {
  2361. res[fns[i].key] = fns[i].fn;
  2362. }
  2363. }
  2364. return res
  2365. }
  2366. /* */
  2367. var activeInstance = null;
  2368. var isUpdatingChildComponent = false;
  2369. function initLifecycle (vm) {
  2370. var options = vm.$options;
  2371. // locate first non-abstract parent
  2372. var parent = options.parent;
  2373. if (parent && !options.abstract) {
  2374. while (parent.$options.abstract && parent.$parent) {
  2375. parent = parent.$parent;
  2376. }
  2377. parent.$children.push(vm);
  2378. }
  2379. vm.$parent = parent;
  2380. vm.$root = parent ? parent.$root : vm;
  2381. vm.$children = [];
  2382. vm.$refs = {};
  2383. vm._watcher = null;
  2384. vm._inactive = null;
  2385. vm._directInactive = false;
  2386. vm._isMounted = false;
  2387. vm._isDestroyed = false;
  2388. vm._isBeingDestroyed = false;
  2389. }
  2390. function lifecycleMixin (Vue) {
  2391. Vue.prototype._update = function (vnode, hydrating) {
  2392. var vm = this;
  2393. if (vm._isMounted) {
  2394. callHook(vm, 'beforeUpdate');
  2395. }
  2396. var prevEl = vm.$el;
  2397. var prevVnode = vm._vnode;
  2398. var prevActiveInstance = activeInstance;
  2399. activeInstance = vm;
  2400. vm._vnode = vnode;
  2401. // Vue.prototype.__patch__ is injected in entry points
  2402. // based on the rendering backend used.
  2403. if (!prevVnode) {
  2404. // initial render
  2405. vm.$el = vm.__patch__(
  2406. vm.$el, vnode, hydrating, false /* removeOnly */,
  2407. vm.$options._parentElm,
  2408. vm.$options._refElm
  2409. );
  2410. // no need for the ref nodes after initial patch
  2411. // this prevents keeping a detached DOM tree in memory (#5851)
  2412. vm.$options._parentElm = vm.$options._refElm = null;
  2413. } else {
  2414. // updates
  2415. vm.$el = vm.__patch__(prevVnode, vnode);
  2416. }
  2417. activeInstance = prevActiveInstance;
  2418. // update __vue__ reference
  2419. if (prevEl) {
  2420. prevEl.__vue__ = null;
  2421. }
  2422. if (vm.$el) {
  2423. vm.$el.__vue__ = vm;
  2424. }
  2425. // if parent is an HOC, update its $el as well
  2426. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  2427. vm.$parent.$el = vm.$el;
  2428. }
  2429. // updated hook is called by the scheduler to ensure that children are
  2430. // updated in a parent's updated hook.
  2431. };
  2432. Vue.prototype.$forceUpdate = function () {
  2433. var vm = this;
  2434. if (vm._watcher) {
  2435. vm._watcher.update();
  2436. }
  2437. };
  2438. Vue.prototype.$destroy = function () {
  2439. var vm = this;
  2440. if (vm._isBeingDestroyed) {
  2441. return
  2442. }
  2443. callHook(vm, 'beforeDestroy');
  2444. vm._isBeingDestroyed = true;
  2445. // remove self from parent
  2446. var parent = vm.$parent;
  2447. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  2448. remove(parent.$children, vm);
  2449. }
  2450. // teardown watchers
  2451. if (vm._watcher) {
  2452. vm._watcher.teardown();
  2453. }
  2454. var i = vm._watchers.length;
  2455. while (i--) {
  2456. vm._watchers[i].teardown();
  2457. }
  2458. // remove reference from data ob
  2459. // frozen object may not have observer.
  2460. if (vm._data.__ob__) {
  2461. vm._data.__ob__.vmCount--;
  2462. }
  2463. // call the last hook...
  2464. vm._isDestroyed = true;
  2465. // invoke destroy hooks on current rendered tree
  2466. vm.__patch__(vm._vnode, null);
  2467. // fire destroyed hook
  2468. callHook(vm, 'destroyed');
  2469. // turn off all instance listeners.
  2470. vm.$off();
  2471. // remove __vue__ reference
  2472. if (vm.$el) {
  2473. vm.$el.__vue__ = null;
  2474. }
  2475. // release circular reference (#6759)
  2476. if (vm.$vnode) {
  2477. vm.$vnode.parent = null;
  2478. }
  2479. };
  2480. }
  2481. function mountComponent (
  2482. vm,
  2483. el,
  2484. hydrating
  2485. ) {
  2486. vm.$el = el;
  2487. if (!vm.$options.render) {
  2488. vm.$options.render = createEmptyVNode;
  2489. {
  2490. /* istanbul ignore if */
  2491. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  2492. vm.$options.el || el) {
  2493. warn(
  2494. 'You are using the runtime-only build of Vue where the template ' +
  2495. 'compiler is not available. Either pre-compile the templates into ' +
  2496. 'render functions, or use the compiler-included build.',
  2497. vm
  2498. );
  2499. } else {
  2500. warn(
  2501. 'Failed to mount component: template or render function not defined.',
  2502. vm
  2503. );
  2504. }
  2505. }
  2506. }
  2507. callHook(vm, 'beforeMount');
  2508. var updateComponent;
  2509. /* istanbul ignore if */
  2510. if ("development" !== 'production' && config.performance && mark) {
  2511. updateComponent = function () {
  2512. var name = vm._name;
  2513. var id = vm._uid;
  2514. var startTag = "vue-perf-start:" + id;
  2515. var endTag = "vue-perf-end:" + id;
  2516. mark(startTag);
  2517. var vnode = vm._render();
  2518. mark(endTag);
  2519. measure(("vue " + name + " render"), startTag, endTag);
  2520. mark(startTag);
  2521. vm._update(vnode, hydrating);
  2522. mark(endTag);
  2523. measure(("vue " + name + " patch"), startTag, endTag);
  2524. };
  2525. } else {
  2526. updateComponent = function () {
  2527. vm._update(vm._render(), hydrating);
  2528. };
  2529. }
  2530. // we set this to vm._watcher inside the watcher's constructor
  2531. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  2532. // component's mounted hook), which relies on vm._watcher being already defined
  2533. new Watcher(vm, updateComponent, noop, null, true /* isRenderWatcher */);
  2534. hydrating = false;
  2535. // manually mounted instance, call mounted on self
  2536. // mounted is called for render-created child components in its inserted hook
  2537. if (vm.$vnode == null) {
  2538. vm._isMounted = true;
  2539. callHook(vm, 'mounted');
  2540. }
  2541. return vm
  2542. }
  2543. function updateChildComponent (
  2544. vm,
  2545. propsData,
  2546. listeners,
  2547. parentVnode,
  2548. renderChildren
  2549. ) {
  2550. {
  2551. isUpdatingChildComponent = true;
  2552. }
  2553. // determine whether component has slot children
  2554. // we need to do this before overwriting $options._renderChildren
  2555. var hasChildren = !!(
  2556. renderChildren || // has new static slots
  2557. vm.$options._renderChildren || // has old static slots
  2558. parentVnode.data.scopedSlots || // has new scoped slots
  2559. vm.$scopedSlots !== emptyObject // has old scoped slots
  2560. );
  2561. vm.$options._parentVnode = parentVnode;
  2562. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  2563. if (vm._vnode) { // update child tree's parent
  2564. vm._vnode.parent = parentVnode;
  2565. }
  2566. vm.$options._renderChildren = renderChildren;
  2567. // update $attrs and $listeners hash
  2568. // these are also reactive so they may trigger child update if the child
  2569. // used them during render
  2570. vm.$attrs = parentVnode.data.attrs || emptyObject;
  2571. vm.$listeners = listeners || emptyObject;
  2572. // update props
  2573. if (propsData && vm.$options.props) {
  2574. toggleObserving(false);
  2575. var props = vm._props;
  2576. var propKeys = vm.$options._propKeys || [];
  2577. for (var i = 0; i < propKeys.length; i++) {
  2578. var key = propKeys[i];
  2579. var propOptions = vm.$options.props; // wtf flow?
  2580. props[key] = validateProp(key, propOptions, propsData, vm);
  2581. }
  2582. toggleObserving(true);
  2583. // keep a copy of raw propsData
  2584. vm.$options.propsData = propsData;
  2585. }
  2586. // update listeners
  2587. listeners = listeners || emptyObject;
  2588. var oldListeners = vm.$options._parentListeners;
  2589. vm.$options._parentListeners = listeners;
  2590. updateComponentListeners(vm, listeners, oldListeners);
  2591. // resolve slots + force update if has children
  2592. if (hasChildren) {
  2593. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  2594. vm.$forceUpdate();
  2595. }
  2596. {
  2597. isUpdatingChildComponent = false;
  2598. }
  2599. }
  2600. function isInInactiveTree (vm) {
  2601. while (vm && (vm = vm.$parent)) {
  2602. if (vm._inactive) { return true }
  2603. }
  2604. return false
  2605. }
  2606. function activateChildComponent (vm, direct) {
  2607. if (direct) {
  2608. vm._directInactive = false;
  2609. if (isInInactiveTree(vm)) {
  2610. return
  2611. }
  2612. } else if (vm._directInactive) {
  2613. return
  2614. }
  2615. if (vm._inactive || vm._inactive === null) {
  2616. vm._inactive = false;
  2617. for (var i = 0; i < vm.$children.length; i++) {
  2618. activateChildComponent(vm.$children[i]);
  2619. }
  2620. callHook(vm, 'activated');
  2621. }
  2622. }
  2623. function deactivateChildComponent (vm, direct) {
  2624. if (direct) {
  2625. vm._directInactive = true;
  2626. if (isInInactiveTree(vm)) {
  2627. return
  2628. }
  2629. }
  2630. if (!vm._inactive) {
  2631. vm._inactive = true;
  2632. for (var i = 0; i < vm.$children.length; i++) {
  2633. deactivateChildComponent(vm.$children[i]);
  2634. }
  2635. callHook(vm, 'deactivated');
  2636. }
  2637. }
  2638. function callHook (vm, hook) {
  2639. // #7573 disable dep collection when invoking lifecycle hooks
  2640. pushTarget();
  2641. var handlers = vm.$options[hook];
  2642. if (handlers) {
  2643. for (var i = 0, j = handlers.length; i < j; i++) {
  2644. try {
  2645. handlers[i].call(vm);
  2646. } catch (e) {
  2647. handleError(e, vm, (hook + " hook"));
  2648. }
  2649. }
  2650. }
  2651. if (vm._hasHookEvent) {
  2652. vm.$emit('hook:' + hook);
  2653. }
  2654. popTarget();
  2655. }
  2656. /* */
  2657. var MAX_UPDATE_COUNT = 100;
  2658. var queue = [];
  2659. var activatedChildren = [];
  2660. var has = {};
  2661. var circular = {};
  2662. var waiting = false;
  2663. var flushing = false;
  2664. var index = 0;
  2665. /**
  2666. * Reset the scheduler's state.
  2667. */
  2668. function resetSchedulerState () {
  2669. index = queue.length = activatedChildren.length = 0;
  2670. has = {};
  2671. {
  2672. circular = {};
  2673. }
  2674. waiting = flushing = false;
  2675. }
  2676. /**
  2677. * Flush both queues and run the watchers.
  2678. */
  2679. function flushSchedulerQueue () {
  2680. flushing = true;
  2681. var watcher, id;
  2682. // Sort queue before flush.
  2683. // This ensures that:
  2684. // 1. Components are updated from parent to child. (because parent is always
  2685. // created before the child)
  2686. // 2. A component's user watchers are run before its render watcher (because
  2687. // user watchers are created before the render watcher)
  2688. // 3. If a component is destroyed during a parent component's watcher run,
  2689. // its watchers can be skipped.
  2690. queue.sort(function (a, b) { return a.id - b.id; });
  2691. // do not cache length because more watchers might be pushed
  2692. // as we run existing watchers
  2693. for (index = 0; index < queue.length; index++) {
  2694. watcher = queue[index];
  2695. id = watcher.id;
  2696. has[id] = null;
  2697. watcher.run();
  2698. // in dev build, check and stop circular updates.
  2699. if ("development" !== 'production' && has[id] != null) {
  2700. circular[id] = (circular[id] || 0) + 1;
  2701. if (circular[id] > MAX_UPDATE_COUNT) {
  2702. warn(
  2703. 'You may have an infinite update loop ' + (
  2704. watcher.user
  2705. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  2706. : "in a component render function."
  2707. ),
  2708. watcher.vm
  2709. );
  2710. break
  2711. }
  2712. }
  2713. }
  2714. // keep copies of post queues before resetting state
  2715. var activatedQueue = activatedChildren.slice();
  2716. var updatedQueue = queue.slice();
  2717. resetSchedulerState();
  2718. // call component updated and activated hooks
  2719. callActivatedHooks(activatedQueue);
  2720. callUpdatedHooks(updatedQueue);
  2721. // devtool hook
  2722. /* istanbul ignore if */
  2723. if (devtools && config.devtools) {
  2724. devtools.emit('flush');
  2725. }
  2726. }
  2727. function callUpdatedHooks (queue) {
  2728. var i = queue.length;
  2729. while (i--) {
  2730. var watcher = queue[i];
  2731. var vm = watcher.vm;
  2732. if (vm._watcher === watcher && vm._isMounted) {
  2733. callHook(vm, 'updated');
  2734. }
  2735. }
  2736. }
  2737. /**
  2738. * Queue a kept-alive component that was activated during patch.
  2739. * The queue will be processed after the entire tree has been patched.
  2740. */
  2741. function queueActivatedComponent (vm) {
  2742. // setting _inactive to false here so that a render function can
  2743. // rely on checking whether it's in an inactive tree (e.g. router-view)
  2744. vm._inactive = false;
  2745. activatedChildren.push(vm);
  2746. }
  2747. function callActivatedHooks (queue) {
  2748. for (var i = 0; i < queue.length; i++) {
  2749. queue[i]._inactive = true;
  2750. activateChildComponent(queue[i], true /* true */);
  2751. }
  2752. }
  2753. /**
  2754. * Push a watcher into the watcher queue.
  2755. * Jobs with duplicate IDs will be skipped unless it's
  2756. * pushed when the queue is being flushed.
  2757. */
  2758. function queueWatcher (watcher) {
  2759. var id = watcher.id;
  2760. if (has[id] == null) {
  2761. has[id] = true;
  2762. if (!flushing) {
  2763. queue.push(watcher);
  2764. } else {
  2765. // if already flushing, splice the watcher based on its id
  2766. // if already past its id, it will be run next immediately.
  2767. var i = queue.length - 1;
  2768. while (i > index && queue[i].id > watcher.id) {
  2769. i--;
  2770. }
  2771. queue.splice(i + 1, 0, watcher);
  2772. }
  2773. // queue the flush
  2774. if (!waiting) {
  2775. waiting = true;
  2776. nextTick(flushSchedulerQueue);
  2777. }
  2778. }
  2779. }
  2780. /* */
  2781. var uid$1 = 0;
  2782. /**
  2783. * A watcher parses an expression, collects dependencies,
  2784. * and fires callback when the expression value changes.
  2785. * This is used for both the $watch() api and directives.
  2786. */
  2787. var Watcher = function Watcher (
  2788. vm,
  2789. expOrFn,
  2790. cb,
  2791. options,
  2792. isRenderWatcher
  2793. ) {
  2794. this.vm = vm;
  2795. if (isRenderWatcher) {
  2796. vm._watcher = this;
  2797. }
  2798. vm._watchers.push(this);
  2799. // options
  2800. if (options) {
  2801. this.deep = !!options.deep;
  2802. this.user = !!options.user;
  2803. this.lazy = !!options.lazy;
  2804. this.sync = !!options.sync;
  2805. } else {
  2806. this.deep = this.user = this.lazy = this.sync = false;
  2807. }
  2808. this.cb = cb;
  2809. this.id = ++uid$1; // uid for batching
  2810. this.active = true;
  2811. this.dirty = this.lazy; // for lazy watchers
  2812. this.deps = [];
  2813. this.newDeps = [];
  2814. this.depIds = new _Set();
  2815. this.newDepIds = new _Set();
  2816. this.expression = expOrFn.toString();
  2817. // parse expression for getter
  2818. if (typeof expOrFn === 'function') {
  2819. this.getter = expOrFn;
  2820. } else {
  2821. this.getter = parsePath(expOrFn);
  2822. if (!this.getter) {
  2823. this.getter = function () {};
  2824. "development" !== 'production' && warn(
  2825. "Failed watching path: \"" + expOrFn + "\" " +
  2826. 'Watcher only accepts simple dot-delimited paths. ' +
  2827. 'For full control, use a function instead.',
  2828. vm
  2829. );
  2830. }
  2831. }
  2832. this.value = this.lazy
  2833. ? undefined
  2834. : this.get();
  2835. };
  2836. /**
  2837. * Evaluate the getter, and re-collect dependencies.
  2838. */
  2839. Watcher.prototype.get = function get () {
  2840. pushTarget(this);
  2841. var value;
  2842. var vm = this.vm;
  2843. try {
  2844. value = this.getter.call(vm, vm);
  2845. } catch (e) {
  2846. if (this.user) {
  2847. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  2848. } else {
  2849. throw e
  2850. }
  2851. } finally {
  2852. // "touch" every property so they are all tracked as
  2853. // dependencies for deep watching
  2854. if (this.deep) {
  2855. traverse(value);
  2856. }
  2857. popTarget();
  2858. this.cleanupDeps();
  2859. }
  2860. return value
  2861. };
  2862. /**
  2863. * Add a dependency to this directive.
  2864. */
  2865. Watcher.prototype.addDep = function addDep (dep) {
  2866. var id = dep.id;
  2867. if (!this.newDepIds.has(id)) {
  2868. this.newDepIds.add(id);
  2869. this.newDeps.push(dep);
  2870. if (!this.depIds.has(id)) {
  2871. dep.addSub(this);
  2872. }
  2873. }
  2874. };
  2875. /**
  2876. * Clean up for dependency collection.
  2877. */
  2878. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  2879. var this$1 = this;
  2880. var i = this.deps.length;
  2881. while (i--) {
  2882. var dep = this$1.deps[i];
  2883. if (!this$1.newDepIds.has(dep.id)) {
  2884. dep.removeSub(this$1);
  2885. }
  2886. }
  2887. var tmp = this.depIds;
  2888. this.depIds = this.newDepIds;
  2889. this.newDepIds = tmp;
  2890. this.newDepIds.clear();
  2891. tmp = this.deps;
  2892. this.deps = this.newDeps;
  2893. this.newDeps = tmp;
  2894. this.newDeps.length = 0;
  2895. };
  2896. /**
  2897. * Subscriber interface.
  2898. * Will be called when a dependency changes.
  2899. */
  2900. Watcher.prototype.update = function update () {
  2901. /* istanbul ignore else */
  2902. if (this.lazy) {
  2903. this.dirty = true;
  2904. } else if (this.sync) {
  2905. this.run();
  2906. } else {
  2907. queueWatcher(this);
  2908. }
  2909. };
  2910. /**
  2911. * Scheduler job interface.
  2912. * Will be called by the scheduler.
  2913. */
  2914. Watcher.prototype.run = function run () {
  2915. if (this.active) {
  2916. var value = this.get();
  2917. if (
  2918. value !== this.value ||
  2919. // Deep watchers and watchers on Object/Arrays should fire even
  2920. // when the value is the same, because the value may
  2921. // have mutated.
  2922. isObject(value) ||
  2923. this.deep
  2924. ) {
  2925. // set new value
  2926. var oldValue = this.value;
  2927. this.value = value;
  2928. if (this.user) {
  2929. try {
  2930. this.cb.call(this.vm, value, oldValue);
  2931. } catch (e) {
  2932. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  2933. }
  2934. } else {
  2935. this.cb.call(this.vm, value, oldValue);
  2936. }
  2937. }
  2938. }
  2939. };
  2940. /**
  2941. * Evaluate the value of the watcher.
  2942. * This only gets called for lazy watchers.
  2943. */
  2944. Watcher.prototype.evaluate = function evaluate () {
  2945. this.value = this.get();
  2946. this.dirty = false;
  2947. };
  2948. /**
  2949. * Depend on all deps collected by this watcher.
  2950. */
  2951. Watcher.prototype.depend = function depend () {
  2952. var this$1 = this;
  2953. var i = this.deps.length;
  2954. while (i--) {
  2955. this$1.deps[i].depend();
  2956. }
  2957. };
  2958. /**
  2959. * Remove self from all dependencies' subscriber list.
  2960. */
  2961. Watcher.prototype.teardown = function teardown () {
  2962. var this$1 = this;
  2963. if (this.active) {
  2964. // remove self from vm's watcher list
  2965. // this is a somewhat expensive operation so we skip it
  2966. // if the vm is being destroyed.
  2967. if (!this.vm._isBeingDestroyed) {
  2968. remove(this.vm._watchers, this);
  2969. }
  2970. var i = this.deps.length;
  2971. while (i--) {
  2972. this$1.deps[i].removeSub(this$1);
  2973. }
  2974. this.active = false;
  2975. }
  2976. };
  2977. /* */
  2978. var sharedPropertyDefinition = {
  2979. enumerable: true,
  2980. configurable: true,
  2981. get: noop,
  2982. set: noop
  2983. };
  2984. function proxy (target, sourceKey, key) {
  2985. sharedPropertyDefinition.get = function proxyGetter () {
  2986. return this[sourceKey][key]
  2987. };
  2988. sharedPropertyDefinition.set = function proxySetter (val) {
  2989. this[sourceKey][key] = val;
  2990. };
  2991. Object.defineProperty(target, key, sharedPropertyDefinition);
  2992. }
  2993. function initState (vm) {
  2994. vm._watchers = [];
  2995. var opts = vm.$options;
  2996. if (opts.props) { initProps(vm, opts.props); }
  2997. if (opts.methods) { initMethods(vm, opts.methods); }
  2998. if (opts.data) {
  2999. initData(vm);
  3000. } else {
  3001. observe(vm._data = {}, true /* asRootData */);
  3002. }
  3003. if (opts.computed) { initComputed(vm, opts.computed); }
  3004. if (opts.watch && opts.watch !== nativeWatch) {
  3005. initWatch(vm, opts.watch);
  3006. }
  3007. }
  3008. function initProps (vm, propsOptions) {
  3009. var propsData = vm.$options.propsData || {};
  3010. var props = vm._props = {};
  3011. // cache prop keys so that future props updates can iterate using Array
  3012. // instead of dynamic object key enumeration.
  3013. var keys = vm.$options._propKeys = [];
  3014. var isRoot = !vm.$parent;
  3015. // root instance props should be converted
  3016. if (!isRoot) {
  3017. toggleObserving(false);
  3018. }
  3019. var loop = function ( key ) {
  3020. keys.push(key);
  3021. var value = validateProp(key, propsOptions, propsData, vm);
  3022. /* istanbul ignore else */
  3023. {
  3024. var hyphenatedKey = hyphenate(key);
  3025. if (isReservedAttribute(hyphenatedKey) ||
  3026. config.isReservedAttr(hyphenatedKey)) {
  3027. warn(
  3028. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  3029. vm
  3030. );
  3031. }
  3032. defineReactive(props, key, value, function () {
  3033. if (vm.$parent && !isUpdatingChildComponent) {
  3034. warn(
  3035. "Avoid mutating a prop directly since the value will be " +
  3036. "overwritten whenever the parent component re-renders. " +
  3037. "Instead, use a data or computed property based on the prop's " +
  3038. "value. Prop being mutated: \"" + key + "\"",
  3039. vm
  3040. );
  3041. }
  3042. });
  3043. }
  3044. // static props are already proxied on the component's prototype
  3045. // during Vue.extend(). We only need to proxy props defined at
  3046. // instantiation here.
  3047. if (!(key in vm)) {
  3048. proxy(vm, "_props", key);
  3049. }
  3050. };
  3051. for (var key in propsOptions) loop( key );
  3052. toggleObserving(true);
  3053. }
  3054. function initData (vm) {
  3055. var data = vm.$options.data;
  3056. data = vm._data = typeof data === 'function'
  3057. ? getData(data, vm)
  3058. : data || {};
  3059. if (!isPlainObject(data)) {
  3060. data = {};
  3061. "development" !== 'production' && warn(
  3062. 'data functions should return an object:\n' +
  3063. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  3064. vm
  3065. );
  3066. }
  3067. // proxy data on instance
  3068. var keys = Object.keys(data);
  3069. var props = vm.$options.props;
  3070. var methods = vm.$options.methods;
  3071. var i = keys.length;
  3072. while (i--) {
  3073. var key = keys[i];
  3074. {
  3075. if (methods && hasOwn(methods, key)) {
  3076. warn(
  3077. ("Method \"" + key + "\" has already been defined as a data property."),
  3078. vm
  3079. );
  3080. }
  3081. }
  3082. if (props && hasOwn(props, key)) {
  3083. "development" !== 'production' && warn(
  3084. "The data property \"" + key + "\" is already declared as a prop. " +
  3085. "Use prop default value instead.",
  3086. vm
  3087. );
  3088. } else if (!isReserved(key)) {
  3089. proxy(vm, "_data", key);
  3090. }
  3091. }
  3092. // observe data
  3093. observe(data, true /* asRootData */);
  3094. }
  3095. function getData (data, vm) {
  3096. // #7573 disable dep collection when invoking data getters
  3097. pushTarget();
  3098. try {
  3099. return data.call(vm, vm)
  3100. } catch (e) {
  3101. handleError(e, vm, "data()");
  3102. return {}
  3103. } finally {
  3104. popTarget();
  3105. }
  3106. }
  3107. var computedWatcherOptions = { lazy: true };
  3108. function initComputed (vm, computed) {
  3109. // $flow-disable-line
  3110. var watchers = vm._computedWatchers = Object.create(null);
  3111. // computed properties are just getters during SSR
  3112. var isSSR = isServerRendering();
  3113. for (var key in computed) {
  3114. var userDef = computed[key];
  3115. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  3116. if ("development" !== 'production' && getter == null) {
  3117. warn(
  3118. ("Getter is missing for computed property \"" + key + "\"."),
  3119. vm
  3120. );
  3121. }
  3122. if (!isSSR) {
  3123. // create internal watcher for the computed property.
  3124. watchers[key] = new Watcher(
  3125. vm,
  3126. getter || noop,
  3127. noop,
  3128. computedWatcherOptions
  3129. );
  3130. }
  3131. // component-defined computed properties are already defined on the
  3132. // component prototype. We only need to define computed properties defined
  3133. // at instantiation here.
  3134. if (!(key in vm)) {
  3135. defineComputed(vm, key, userDef);
  3136. } else {
  3137. if (key in vm.$data) {
  3138. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  3139. } else if (vm.$options.props && key in vm.$options.props) {
  3140. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  3141. }
  3142. }
  3143. }
  3144. }
  3145. function defineComputed (
  3146. target,
  3147. key,
  3148. userDef
  3149. ) {
  3150. var shouldCache = !isServerRendering();
  3151. if (typeof userDef === 'function') {
  3152. sharedPropertyDefinition.get = shouldCache
  3153. ? createComputedGetter(key)
  3154. : userDef;
  3155. sharedPropertyDefinition.set = noop;
  3156. } else {
  3157. sharedPropertyDefinition.get = userDef.get
  3158. ? shouldCache && userDef.cache !== false
  3159. ? createComputedGetter(key)
  3160. : userDef.get
  3161. : noop;
  3162. sharedPropertyDefinition.set = userDef.set
  3163. ? userDef.set
  3164. : noop;
  3165. }
  3166. if ("development" !== 'production' &&
  3167. sharedPropertyDefinition.set === noop) {
  3168. sharedPropertyDefinition.set = function () {
  3169. warn(
  3170. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  3171. this
  3172. );
  3173. };
  3174. }
  3175. Object.defineProperty(target, key, sharedPropertyDefinition);
  3176. }
  3177. function createComputedGetter (key) {
  3178. return function computedGetter () {
  3179. var watcher = this._computedWatchers && this._computedWatchers[key];
  3180. if (watcher) {
  3181. if (watcher.dirty) {
  3182. watcher.evaluate();
  3183. }
  3184. if (Dep.target) {
  3185. watcher.depend();
  3186. }
  3187. return watcher.value
  3188. }
  3189. }
  3190. }
  3191. function initMethods (vm, methods) {
  3192. var props = vm.$options.props;
  3193. for (var key in methods) {
  3194. {
  3195. if (methods[key] == null) {
  3196. warn(
  3197. "Method \"" + key + "\" has an undefined value in the component definition. " +
  3198. "Did you reference the function correctly?",
  3199. vm
  3200. );
  3201. }
  3202. if (props && hasOwn(props, key)) {
  3203. warn(
  3204. ("Method \"" + key + "\" has already been defined as a prop."),
  3205. vm
  3206. );
  3207. }
  3208. if ((key in vm) && isReserved(key)) {
  3209. warn(
  3210. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  3211. "Avoid defining component methods that start with _ or $."
  3212. );
  3213. }
  3214. }
  3215. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  3216. }
  3217. }
  3218. function initWatch (vm, watch) {
  3219. for (var key in watch) {
  3220. var handler = watch[key];
  3221. if (Array.isArray(handler)) {
  3222. for (var i = 0; i < handler.length; i++) {
  3223. createWatcher(vm, key, handler[i]);
  3224. }
  3225. } else {
  3226. createWatcher(vm, key, handler);
  3227. }
  3228. }
  3229. }
  3230. function createWatcher (
  3231. vm,
  3232. expOrFn,
  3233. handler,
  3234. options
  3235. ) {
  3236. if (isPlainObject(handler)) {
  3237. options = handler;
  3238. handler = handler.handler;
  3239. }
  3240. if (typeof handler === 'string') {
  3241. handler = vm[handler];
  3242. }
  3243. return vm.$watch(expOrFn, handler, options)
  3244. }
  3245. function stateMixin (Vue) {
  3246. // flow somehow has problems with directly declared definition object
  3247. // when using Object.defineProperty, so we have to procedurally build up
  3248. // the object here.
  3249. var dataDef = {};
  3250. dataDef.get = function () { return this._data };
  3251. var propsDef = {};
  3252. propsDef.get = function () { return this._props };
  3253. {
  3254. dataDef.set = function (newData) {
  3255. warn(
  3256. 'Avoid replacing instance root $data. ' +
  3257. 'Use nested data properties instead.',
  3258. this
  3259. );
  3260. };
  3261. propsDef.set = function () {
  3262. warn("$props is readonly.", this);
  3263. };
  3264. }
  3265. Object.defineProperty(Vue.prototype, '$data', dataDef);
  3266. Object.defineProperty(Vue.prototype, '$props', propsDef);
  3267. Vue.prototype.$set = set;
  3268. Vue.prototype.$delete = del;
  3269. Vue.prototype.$watch = function (
  3270. expOrFn,
  3271. cb,
  3272. options
  3273. ) {
  3274. var vm = this;
  3275. if (isPlainObject(cb)) {
  3276. return createWatcher(vm, expOrFn, cb, options)
  3277. }
  3278. options = options || {};
  3279. options.user = true;
  3280. var watcher = new Watcher(vm, expOrFn, cb, options);
  3281. if (options.immediate) {
  3282. cb.call(vm, watcher.value);
  3283. }
  3284. return function unwatchFn () {
  3285. watcher.teardown();
  3286. }
  3287. };
  3288. }
  3289. /* */
  3290. function initProvide (vm) {
  3291. var provide = vm.$options.provide;
  3292. if (provide) {
  3293. vm._provided = typeof provide === 'function'
  3294. ? provide.call(vm)
  3295. : provide;
  3296. }
  3297. }
  3298. function initInjections (vm) {
  3299. var result = resolveInject(vm.$options.inject, vm);
  3300. if (result) {
  3301. toggleObserving(false);
  3302. Object.keys(result).forEach(function (key) {
  3303. /* istanbul ignore else */
  3304. {
  3305. defineReactive(vm, key, result[key], function () {
  3306. warn(
  3307. "Avoid mutating an injected value directly since the changes will be " +
  3308. "overwritten whenever the provided component re-renders. " +
  3309. "injection being mutated: \"" + key + "\"",
  3310. vm
  3311. );
  3312. });
  3313. }
  3314. });
  3315. toggleObserving(true);
  3316. }
  3317. }
  3318. function resolveInject (inject, vm) {
  3319. if (inject) {
  3320. // inject is :any because flow is not smart enough to figure out cached
  3321. var result = Object.create(null);
  3322. var keys = hasSymbol
  3323. ? Reflect.ownKeys(inject).filter(function (key) {
  3324. /* istanbul ignore next */
  3325. return Object.getOwnPropertyDescriptor(inject, key).enumerable
  3326. })
  3327. : Object.keys(inject);
  3328. for (var i = 0; i < keys.length; i++) {
  3329. var key = keys[i];
  3330. var provideKey = inject[key].from;
  3331. var source = vm;
  3332. while (source) {
  3333. if (source._provided && hasOwn(source._provided, provideKey)) {
  3334. result[key] = source._provided[provideKey];
  3335. break
  3336. }
  3337. source = source.$parent;
  3338. }
  3339. if (!source) {
  3340. if ('default' in inject[key]) {
  3341. var provideDefault = inject[key].default;
  3342. result[key] = typeof provideDefault === 'function'
  3343. ? provideDefault.call(vm)
  3344. : provideDefault;
  3345. } else {
  3346. warn(("Injection \"" + key + "\" not found"), vm);
  3347. }
  3348. }
  3349. }
  3350. return result
  3351. }
  3352. }
  3353. /* */
  3354. /**
  3355. * Runtime helper for rendering v-for lists.
  3356. */
  3357. function renderList (
  3358. val,
  3359. render
  3360. ) {
  3361. var ret, i, l, keys, key;
  3362. if (Array.isArray(val) || typeof val === 'string') {
  3363. ret = new Array(val.length);
  3364. for (i = 0, l = val.length; i < l; i++) {
  3365. ret[i] = render(val[i], i);
  3366. }
  3367. } else if (typeof val === 'number') {
  3368. ret = new Array(val);
  3369. for (i = 0; i < val; i++) {
  3370. ret[i] = render(i + 1, i);
  3371. }
  3372. } else if (isObject(val)) {
  3373. keys = Object.keys(val);
  3374. ret = new Array(keys.length);
  3375. for (i = 0, l = keys.length; i < l; i++) {
  3376. key = keys[i];
  3377. ret[i] = render(val[key], key, i);
  3378. }
  3379. }
  3380. if (isDef(ret)) {
  3381. (ret)._isVList = true;
  3382. }
  3383. return ret
  3384. }
  3385. /* */
  3386. /**
  3387. * Runtime helper for rendering <slot>
  3388. */
  3389. function renderSlot (
  3390. name,
  3391. fallback,
  3392. props,
  3393. bindObject
  3394. ) {
  3395. var scopedSlotFn = this.$scopedSlots[name];
  3396. var nodes;
  3397. if (scopedSlotFn) { // scoped slot
  3398. props = props || {};
  3399. if (bindObject) {
  3400. if ("development" !== 'production' && !isObject(bindObject)) {
  3401. warn(
  3402. 'slot v-bind without argument expects an Object',
  3403. this
  3404. );
  3405. }
  3406. props = extend(extend({}, bindObject), props);
  3407. }
  3408. nodes = scopedSlotFn(props) || fallback;
  3409. } else {
  3410. var slotNodes = this.$slots[name];
  3411. // warn duplicate slot usage
  3412. if (slotNodes) {
  3413. if ("development" !== 'production' && slotNodes._rendered) {
  3414. warn(
  3415. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  3416. "- this will likely cause render errors.",
  3417. this
  3418. );
  3419. }
  3420. slotNodes._rendered = true;
  3421. }
  3422. nodes = slotNodes || fallback;
  3423. }
  3424. var target = props && props.slot;
  3425. if (target) {
  3426. return this.$createElement('template', { slot: target }, nodes)
  3427. } else {
  3428. return nodes
  3429. }
  3430. }
  3431. /* */
  3432. /**
  3433. * Runtime helper for resolving filters
  3434. */
  3435. function resolveFilter (id) {
  3436. return resolveAsset(this.$options, 'filters', id, true) || identity
  3437. }
  3438. /* */
  3439. function isKeyNotMatch (expect, actual) {
  3440. if (Array.isArray(expect)) {
  3441. return expect.indexOf(actual) === -1
  3442. } else {
  3443. return expect !== actual
  3444. }
  3445. }
  3446. /**
  3447. * Runtime helper for checking keyCodes from config.
  3448. * exposed as Vue.prototype._k
  3449. * passing in eventKeyName as last argument separately for backwards compat
  3450. */
  3451. function checkKeyCodes (
  3452. eventKeyCode,
  3453. key,
  3454. builtInKeyCode,
  3455. eventKeyName,
  3456. builtInKeyName
  3457. ) {
  3458. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  3459. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  3460. return isKeyNotMatch(builtInKeyName, eventKeyName)
  3461. } else if (mappedKeyCode) {
  3462. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  3463. } else if (eventKeyName) {
  3464. return hyphenate(eventKeyName) !== key
  3465. }
  3466. }
  3467. /* */
  3468. /**
  3469. * Runtime helper for merging v-bind="object" into a VNode's data.
  3470. */
  3471. function bindObjectProps (
  3472. data,
  3473. tag,
  3474. value,
  3475. asProp,
  3476. isSync
  3477. ) {
  3478. if (value) {
  3479. if (!isObject(value)) {
  3480. "development" !== 'production' && warn(
  3481. 'v-bind without argument expects an Object or Array value',
  3482. this
  3483. );
  3484. } else {
  3485. if (Array.isArray(value)) {
  3486. value = toObject(value);
  3487. }
  3488. var hash;
  3489. var loop = function ( key ) {
  3490. if (
  3491. key === 'class' ||
  3492. key === 'style' ||
  3493. isReservedAttribute(key)
  3494. ) {
  3495. hash = data;
  3496. } else {
  3497. var type = data.attrs && data.attrs.type;
  3498. hash = asProp || config.mustUseProp(tag, type, key)
  3499. ? data.domProps || (data.domProps = {})
  3500. : data.attrs || (data.attrs = {});
  3501. }
  3502. if (!(key in hash)) {
  3503. hash[key] = value[key];
  3504. if (isSync) {
  3505. var on = data.on || (data.on = {});
  3506. on[("update:" + key)] = function ($event) {
  3507. value[key] = $event;
  3508. };
  3509. }
  3510. }
  3511. };
  3512. for (var key in value) loop( key );
  3513. }
  3514. }
  3515. return data
  3516. }
  3517. /* */
  3518. /**
  3519. * Runtime helper for rendering static trees.
  3520. */
  3521. function renderStatic (
  3522. index,
  3523. isInFor
  3524. ) {
  3525. var cached = this._staticTrees || (this._staticTrees = []);
  3526. var tree = cached[index];
  3527. // if has already-rendered static tree and not inside v-for,
  3528. // we can reuse the same tree.
  3529. if (tree && !isInFor) {
  3530. return tree
  3531. }
  3532. // otherwise, render a fresh tree.
  3533. tree = cached[index] = this.$options.staticRenderFns[index].call(
  3534. this._renderProxy,
  3535. null,
  3536. this // for render fns generated for functional component templates
  3537. );
  3538. markStatic(tree, ("__static__" + index), false);
  3539. return tree
  3540. }
  3541. /**
  3542. * Runtime helper for v-once.
  3543. * Effectively it means marking the node as static with a unique key.
  3544. */
  3545. function markOnce (
  3546. tree,
  3547. index,
  3548. key
  3549. ) {
  3550. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  3551. return tree
  3552. }
  3553. function markStatic (
  3554. tree,
  3555. key,
  3556. isOnce
  3557. ) {
  3558. if (Array.isArray(tree)) {
  3559. for (var i = 0; i < tree.length; i++) {
  3560. if (tree[i] && typeof tree[i] !== 'string') {
  3561. markStaticNode(tree[i], (key + "_" + i), isOnce);
  3562. }
  3563. }
  3564. } else {
  3565. markStaticNode(tree, key, isOnce);
  3566. }
  3567. }
  3568. function markStaticNode (node, key, isOnce) {
  3569. node.isStatic = true;
  3570. node.key = key;
  3571. node.isOnce = isOnce;
  3572. }
  3573. /* */
  3574. function bindObjectListeners (data, value) {
  3575. if (value) {
  3576. if (!isPlainObject(value)) {
  3577. "development" !== 'production' && warn(
  3578. 'v-on without argument expects an Object value',
  3579. this
  3580. );
  3581. } else {
  3582. var on = data.on = data.on ? extend({}, data.on) : {};
  3583. for (var key in value) {
  3584. var existing = on[key];
  3585. var ours = value[key];
  3586. on[key] = existing ? [].concat(existing, ours) : ours;
  3587. }
  3588. }
  3589. }
  3590. return data
  3591. }
  3592. /* */
  3593. function installRenderHelpers (target) {
  3594. target._o = markOnce;
  3595. target._n = toNumber;
  3596. target._s = toString;
  3597. target._l = renderList;
  3598. target._t = renderSlot;
  3599. target._q = looseEqual;
  3600. target._i = looseIndexOf;
  3601. target._m = renderStatic;
  3602. target._f = resolveFilter;
  3603. target._k = checkKeyCodes;
  3604. target._b = bindObjectProps;
  3605. target._v = createTextVNode;
  3606. target._e = createEmptyVNode;
  3607. target._u = resolveScopedSlots;
  3608. target._g = bindObjectListeners;
  3609. }
  3610. /* */
  3611. function FunctionalRenderContext (
  3612. data,
  3613. props,
  3614. children,
  3615. parent,
  3616. Ctor
  3617. ) {
  3618. var options = Ctor.options;
  3619. // ensure the createElement function in functional components
  3620. // gets a unique context - this is necessary for correct named slot check
  3621. var contextVm;
  3622. if (hasOwn(parent, '_uid')) {
  3623. contextVm = Object.create(parent);
  3624. // $flow-disable-line
  3625. contextVm._original = parent;
  3626. } else {
  3627. // the context vm passed in is a functional context as well.
  3628. // in this case we want to make sure we are able to get a hold to the
  3629. // real context instance.
  3630. contextVm = parent;
  3631. // $flow-disable-line
  3632. parent = parent._original;
  3633. }
  3634. var isCompiled = isTrue(options._compiled);
  3635. var needNormalization = !isCompiled;
  3636. this.data = data;
  3637. this.props = props;
  3638. this.children = children;
  3639. this.parent = parent;
  3640. this.listeners = data.on || emptyObject;
  3641. this.injections = resolveInject(options.inject, parent);
  3642. this.slots = function () { return resolveSlots(children, parent); };
  3643. // support for compiled functional template
  3644. if (isCompiled) {
  3645. // exposing $options for renderStatic()
  3646. this.$options = options;
  3647. // pre-resolve slots for renderSlot()
  3648. this.$slots = this.slots();
  3649. this.$scopedSlots = data.scopedSlots || emptyObject;
  3650. }
  3651. if (options._scopeId) {
  3652. this._c = function (a, b, c, d) {
  3653. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  3654. if (vnode && !Array.isArray(vnode)) {
  3655. vnode.fnScopeId = options._scopeId;
  3656. vnode.fnContext = parent;
  3657. }
  3658. return vnode
  3659. };
  3660. } else {
  3661. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  3662. }
  3663. }
  3664. installRenderHelpers(FunctionalRenderContext.prototype);
  3665. function createFunctionalComponent (
  3666. Ctor,
  3667. propsData,
  3668. data,
  3669. contextVm,
  3670. children
  3671. ) {
  3672. var options = Ctor.options;
  3673. var props = {};
  3674. var propOptions = options.props;
  3675. if (isDef(propOptions)) {
  3676. for (var key in propOptions) {
  3677. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  3678. }
  3679. } else {
  3680. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  3681. if (isDef(data.props)) { mergeProps(props, data.props); }
  3682. }
  3683. var renderContext = new FunctionalRenderContext(
  3684. data,
  3685. props,
  3686. children,
  3687. contextVm,
  3688. Ctor
  3689. );
  3690. var vnode = options.render.call(null, renderContext._c, renderContext);
  3691. if (vnode instanceof VNode) {
  3692. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options)
  3693. } else if (Array.isArray(vnode)) {
  3694. var vnodes = normalizeChildren(vnode) || [];
  3695. var res = new Array(vnodes.length);
  3696. for (var i = 0; i < vnodes.length; i++) {
  3697. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options);
  3698. }
  3699. return res
  3700. }
  3701. }
  3702. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options) {
  3703. // #7817 clone node before setting fnContext, otherwise if the node is reused
  3704. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  3705. // that should not be matched to match.
  3706. var clone = cloneVNode(vnode);
  3707. clone.fnContext = contextVm;
  3708. clone.fnOptions = options;
  3709. if (data.slot) {
  3710. (clone.data || (clone.data = {})).slot = data.slot;
  3711. }
  3712. return clone
  3713. }
  3714. function mergeProps (to, from) {
  3715. for (var key in from) {
  3716. to[camelize(key)] = from[key];
  3717. }
  3718. }
  3719. /* */
  3720. // Register the component hook to weex native render engine.
  3721. // The hook will be triggered by native, not javascript.
  3722. // Updates the state of the component to weex native render engine.
  3723. /* */
  3724. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  3725. // listening on native callback
  3726. /* */
  3727. /* */
  3728. // inline hooks to be invoked on component VNodes during patch
  3729. var componentVNodeHooks = {
  3730. init: function init (
  3731. vnode,
  3732. hydrating,
  3733. parentElm,
  3734. refElm
  3735. ) {
  3736. if (
  3737. vnode.componentInstance &&
  3738. !vnode.componentInstance._isDestroyed &&
  3739. vnode.data.keepAlive
  3740. ) {
  3741. // kept-alive components, treat as a patch
  3742. var mountedNode = vnode; // work around flow
  3743. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  3744. } else {
  3745. var child = vnode.componentInstance = createComponentInstanceForVnode(
  3746. vnode,
  3747. activeInstance,
  3748. parentElm,
  3749. refElm
  3750. );
  3751. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  3752. }
  3753. },
  3754. prepatch: function prepatch (oldVnode, vnode) {
  3755. var options = vnode.componentOptions;
  3756. var child = vnode.componentInstance = oldVnode.componentInstance;
  3757. updateChildComponent(
  3758. child,
  3759. options.propsData, // updated props
  3760. options.listeners, // updated listeners
  3761. vnode, // new parent vnode
  3762. options.children // new children
  3763. );
  3764. },
  3765. insert: function insert (vnode) {
  3766. var context = vnode.context;
  3767. var componentInstance = vnode.componentInstance;
  3768. if (!componentInstance._isMounted) {
  3769. componentInstance._isMounted = true;
  3770. callHook(componentInstance, 'mounted');
  3771. }
  3772. if (vnode.data.keepAlive) {
  3773. if (context._isMounted) {
  3774. // vue-router#1212
  3775. // During updates, a kept-alive component's child components may
  3776. // change, so directly walking the tree here may call activated hooks
  3777. // on incorrect children. Instead we push them into a queue which will
  3778. // be processed after the whole patch process ended.
  3779. queueActivatedComponent(componentInstance);
  3780. } else {
  3781. activateChildComponent(componentInstance, true /* direct */);
  3782. }
  3783. }
  3784. },
  3785. destroy: function destroy (vnode) {
  3786. var componentInstance = vnode.componentInstance;
  3787. if (!componentInstance._isDestroyed) {
  3788. if (!vnode.data.keepAlive) {
  3789. componentInstance.$destroy();
  3790. } else {
  3791. deactivateChildComponent(componentInstance, true /* direct */);
  3792. }
  3793. }
  3794. }
  3795. };
  3796. var hooksToMerge = Object.keys(componentVNodeHooks);
  3797. function createComponent (
  3798. Ctor,
  3799. data,
  3800. context,
  3801. children,
  3802. tag
  3803. ) {
  3804. if (isUndef(Ctor)) {
  3805. return
  3806. }
  3807. var baseCtor = context.$options._base;
  3808. // plain options object: turn it into a constructor
  3809. if (isObject(Ctor)) {
  3810. Ctor = baseCtor.extend(Ctor);
  3811. }
  3812. // if at this stage it's not a constructor or an async component factory,
  3813. // reject.
  3814. if (typeof Ctor !== 'function') {
  3815. {
  3816. warn(("Invalid Component definition: " + (String(Ctor))), context);
  3817. }
  3818. return
  3819. }
  3820. // async component
  3821. var asyncFactory;
  3822. if (isUndef(Ctor.cid)) {
  3823. asyncFactory = Ctor;
  3824. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  3825. if (Ctor === undefined) {
  3826. // return a placeholder node for async component, which is rendered
  3827. // as a comment node but preserves all the raw information for the node.
  3828. // the information will be used for async server-rendering and hydration.
  3829. return createAsyncPlaceholder(
  3830. asyncFactory,
  3831. data,
  3832. context,
  3833. children,
  3834. tag
  3835. )
  3836. }
  3837. }
  3838. data = data || {};
  3839. // resolve constructor options in case global mixins are applied after
  3840. // component constructor creation
  3841. resolveConstructorOptions(Ctor);
  3842. // transform component v-model data into props & events
  3843. if (isDef(data.model)) {
  3844. transformModel(Ctor.options, data);
  3845. }
  3846. // extract props
  3847. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  3848. // functional component
  3849. if (isTrue(Ctor.options.functional)) {
  3850. return createFunctionalComponent(Ctor, propsData, data, context, children)
  3851. }
  3852. // extract listeners, since these needs to be treated as
  3853. // child component listeners instead of DOM listeners
  3854. var listeners = data.on;
  3855. // replace with listeners with .native modifier
  3856. // so it gets processed during parent component patch.
  3857. data.on = data.nativeOn;
  3858. if (isTrue(Ctor.options.abstract)) {
  3859. // abstract components do not keep anything
  3860. // other than props & listeners & slot
  3861. // work around flow
  3862. var slot = data.slot;
  3863. data = {};
  3864. if (slot) {
  3865. data.slot = slot;
  3866. }
  3867. }
  3868. // install component management hooks onto the placeholder node
  3869. installComponentHooks(data);
  3870. // return a placeholder vnode
  3871. var name = Ctor.options.name || tag;
  3872. var vnode = new VNode(
  3873. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  3874. data, undefined, undefined, undefined, context,
  3875. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  3876. asyncFactory
  3877. );
  3878. // Weex specific: invoke recycle-list optimized @render function for
  3879. // extracting cell-slot template.
  3880. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  3881. /* istanbul ignore if */
  3882. return vnode
  3883. }
  3884. function createComponentInstanceForVnode (
  3885. vnode, // we know it's MountedComponentVNode but flow doesn't
  3886. parent, // activeInstance in lifecycle state
  3887. parentElm,
  3888. refElm
  3889. ) {
  3890. var options = {
  3891. _isComponent: true,
  3892. parent: parent,
  3893. _parentVnode: vnode,
  3894. _parentElm: parentElm || null,
  3895. _refElm: refElm || null
  3896. };
  3897. // check inline-template render functions
  3898. var inlineTemplate = vnode.data.inlineTemplate;
  3899. if (isDef(inlineTemplate)) {
  3900. options.render = inlineTemplate.render;
  3901. options.staticRenderFns = inlineTemplate.staticRenderFns;
  3902. }
  3903. return new vnode.componentOptions.Ctor(options)
  3904. }
  3905. function installComponentHooks (data) {
  3906. var hooks = data.hook || (data.hook = {});
  3907. for (var i = 0; i < hooksToMerge.length; i++) {
  3908. var key = hooksToMerge[i];
  3909. hooks[key] = componentVNodeHooks[key];
  3910. }
  3911. }
  3912. // transform component v-model info (value and callback) into
  3913. // prop and event handler respectively.
  3914. function transformModel (options, data) {
  3915. var prop = (options.model && options.model.prop) || 'value';
  3916. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  3917. var on = data.on || (data.on = {});
  3918. if (isDef(on[event])) {
  3919. on[event] = [data.model.callback].concat(on[event]);
  3920. } else {
  3921. on[event] = data.model.callback;
  3922. }
  3923. }
  3924. /* */
  3925. var SIMPLE_NORMALIZE = 1;
  3926. var ALWAYS_NORMALIZE = 2;
  3927. // wrapper function for providing a more flexible interface
  3928. // without getting yelled at by flow
  3929. function createElement (
  3930. context,
  3931. tag,
  3932. data,
  3933. children,
  3934. normalizationType,
  3935. alwaysNormalize
  3936. ) {
  3937. if (Array.isArray(data) || isPrimitive(data)) {
  3938. normalizationType = children;
  3939. children = data;
  3940. data = undefined;
  3941. }
  3942. if (isTrue(alwaysNormalize)) {
  3943. normalizationType = ALWAYS_NORMALIZE;
  3944. }
  3945. return _createElement(context, tag, data, children, normalizationType)
  3946. }
  3947. function _createElement (
  3948. context,
  3949. tag,
  3950. data,
  3951. children,
  3952. normalizationType
  3953. ) {
  3954. if (isDef(data) && isDef((data).__ob__)) {
  3955. "development" !== 'production' && warn(
  3956. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3957. 'Always create fresh vnode data objects in each render!',
  3958. context
  3959. );
  3960. return createEmptyVNode()
  3961. }
  3962. // object syntax in v-bind
  3963. if (isDef(data) && isDef(data.is)) {
  3964. tag = data.is;
  3965. }
  3966. if (!tag) {
  3967. // in case of component :is set to falsy value
  3968. return createEmptyVNode()
  3969. }
  3970. // warn against non-primitive key
  3971. if ("development" !== 'production' &&
  3972. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3973. ) {
  3974. {
  3975. warn(
  3976. 'Avoid using non-primitive value as key, ' +
  3977. 'use string/number value instead.',
  3978. context
  3979. );
  3980. }
  3981. }
  3982. // support single function children as default scoped slot
  3983. if (Array.isArray(children) &&
  3984. typeof children[0] === 'function'
  3985. ) {
  3986. data = data || {};
  3987. data.scopedSlots = { default: children[0] };
  3988. children.length = 0;
  3989. }
  3990. if (normalizationType === ALWAYS_NORMALIZE) {
  3991. children = normalizeChildren(children);
  3992. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3993. children = simpleNormalizeChildren(children);
  3994. }
  3995. var vnode, ns;
  3996. if (typeof tag === 'string') {
  3997. var Ctor;
  3998. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3999. if (config.isReservedTag(tag)) {
  4000. // platform built-in elements
  4001. vnode = new VNode(
  4002. config.parsePlatformTagName(tag), data, children,
  4003. undefined, undefined, context
  4004. );
  4005. } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  4006. // component
  4007. vnode = createComponent(Ctor, data, context, children, tag);
  4008. } else {
  4009. // unknown or unlisted namespaced elements
  4010. // check at runtime because it may get assigned a namespace when its
  4011. // parent normalizes children
  4012. vnode = new VNode(
  4013. tag, data, children,
  4014. undefined, undefined, context
  4015. );
  4016. }
  4017. } else {
  4018. // direct component options / constructor
  4019. vnode = createComponent(tag, data, context, children);
  4020. }
  4021. if (Array.isArray(vnode)) {
  4022. return vnode
  4023. } else if (isDef(vnode)) {
  4024. if (isDef(ns)) { applyNS(vnode, ns); }
  4025. if (isDef(data)) { registerDeepBindings(data); }
  4026. return vnode
  4027. } else {
  4028. return createEmptyVNode()
  4029. }
  4030. }
  4031. function applyNS (vnode, ns, force) {
  4032. vnode.ns = ns;
  4033. if (vnode.tag === 'foreignObject') {
  4034. // use default namespace inside foreignObject
  4035. ns = undefined;
  4036. force = true;
  4037. }
  4038. if (isDef(vnode.children)) {
  4039. for (var i = 0, l = vnode.children.length; i < l; i++) {
  4040. var child = vnode.children[i];
  4041. if (isDef(child.tag) && (
  4042. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  4043. applyNS(child, ns, force);
  4044. }
  4045. }
  4046. }
  4047. }
  4048. // ref #5318
  4049. // necessary to ensure parent re-render when deep bindings like :style and
  4050. // :class are used on slot nodes
  4051. function registerDeepBindings (data) {
  4052. if (isObject(data.style)) {
  4053. traverse(data.style);
  4054. }
  4055. if (isObject(data.class)) {
  4056. traverse(data.class);
  4057. }
  4058. }
  4059. /* */
  4060. function initRender (vm) {
  4061. vm._vnode = null; // the root of the child tree
  4062. vm._staticTrees = null; // v-once cached trees
  4063. var options = vm.$options;
  4064. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  4065. var renderContext = parentVnode && parentVnode.context;
  4066. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  4067. vm.$scopedSlots = emptyObject;
  4068. // bind the createElement fn to this instance
  4069. // so that we get proper render context inside it.
  4070. // args order: tag, data, children, normalizationType, alwaysNormalize
  4071. // internal version is used by render functions compiled from templates
  4072. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  4073. // normalization is always applied for the public version, used in
  4074. // user-written render functions.
  4075. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  4076. // $attrs & $listeners are exposed for easier HOC creation.
  4077. // they need to be reactive so that HOCs using them are always updated
  4078. var parentData = parentVnode && parentVnode.data;
  4079. /* istanbul ignore else */
  4080. {
  4081. defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  4082. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  4083. }, true);
  4084. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
  4085. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  4086. }, true);
  4087. }
  4088. }
  4089. function renderMixin (Vue) {
  4090. // install runtime convenience helpers
  4091. installRenderHelpers(Vue.prototype);
  4092. Vue.prototype.$nextTick = function (fn) {
  4093. return nextTick(fn, this)
  4094. };
  4095. Vue.prototype._render = function () {
  4096. var vm = this;
  4097. var ref = vm.$options;
  4098. var render = ref.render;
  4099. var _parentVnode = ref._parentVnode;
  4100. // reset _rendered flag on slots for duplicate slot check
  4101. {
  4102. for (var key in vm.$slots) {
  4103. // $flow-disable-line
  4104. vm.$slots[key]._rendered = false;
  4105. }
  4106. }
  4107. if (_parentVnode) {
  4108. vm.$scopedSlots = _parentVnode.data.scopedSlots || emptyObject;
  4109. }
  4110. // set parent vnode. this allows render functions to have access
  4111. // to the data on the placeholder node.
  4112. vm.$vnode = _parentVnode;
  4113. // render self
  4114. var vnode;
  4115. try {
  4116. vnode = render.call(vm._renderProxy, vm.$createElement);
  4117. } catch (e) {
  4118. handleError(e, vm, "render");
  4119. // return error render result,
  4120. // or previous vnode to prevent render error causing blank component
  4121. /* istanbul ignore else */
  4122. {
  4123. if (vm.$options.renderError) {
  4124. try {
  4125. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  4126. } catch (e) {
  4127. handleError(e, vm, "renderError");
  4128. vnode = vm._vnode;
  4129. }
  4130. } else {
  4131. vnode = vm._vnode;
  4132. }
  4133. }
  4134. }
  4135. // return empty vnode in case the render function errored out
  4136. if (!(vnode instanceof VNode)) {
  4137. if ("development" !== 'production' && Array.isArray(vnode)) {
  4138. warn(
  4139. 'Multiple root nodes returned from render function. Render function ' +
  4140. 'should return a single root node.',
  4141. vm
  4142. );
  4143. }
  4144. vnode = createEmptyVNode();
  4145. }
  4146. // set parent
  4147. vnode.parent = _parentVnode;
  4148. return vnode
  4149. };
  4150. }
  4151. /* */
  4152. var uid$3 = 0;
  4153. function initMixin (Vue) {
  4154. Vue.prototype._init = function (options) {
  4155. var vm = this;
  4156. // a uid
  4157. vm._uid = uid$3++;
  4158. var startTag, endTag;
  4159. /* istanbul ignore if */
  4160. if ("development" !== 'production' && config.performance && mark) {
  4161. startTag = "vue-perf-start:" + (vm._uid);
  4162. endTag = "vue-perf-end:" + (vm._uid);
  4163. mark(startTag);
  4164. }
  4165. // a flag to avoid this being observed
  4166. vm._isVue = true;
  4167. // merge options
  4168. if (options && options._isComponent) {
  4169. // optimize internal component instantiation
  4170. // since dynamic options merging is pretty slow, and none of the
  4171. // internal component options needs special treatment.
  4172. initInternalComponent(vm, options);
  4173. } else {
  4174. vm.$options = mergeOptions(
  4175. resolveConstructorOptions(vm.constructor),
  4176. options || {},
  4177. vm
  4178. );
  4179. }
  4180. /* istanbul ignore else */
  4181. {
  4182. initProxy(vm);
  4183. }
  4184. // expose real self
  4185. vm._self = vm;
  4186. initLifecycle(vm);
  4187. initEvents(vm);
  4188. initRender(vm);
  4189. callHook(vm, 'beforeCreate');
  4190. initInjections(vm); // resolve injections before data/props
  4191. initState(vm);
  4192. initProvide(vm); // resolve provide after data/props
  4193. callHook(vm, 'created');
  4194. /* istanbul ignore if */
  4195. if ("development" !== 'production' && config.performance && mark) {
  4196. vm._name = formatComponentName(vm, false);
  4197. mark(endTag);
  4198. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4199. }
  4200. if (vm.$options.el) {
  4201. vm.$mount(vm.$options.el);
  4202. }
  4203. };
  4204. }
  4205. function initInternalComponent (vm, options) {
  4206. var opts = vm.$options = Object.create(vm.constructor.options);
  4207. // doing this because it's faster than dynamic enumeration.
  4208. var parentVnode = options._parentVnode;
  4209. opts.parent = options.parent;
  4210. opts._parentVnode = parentVnode;
  4211. opts._parentElm = options._parentElm;
  4212. opts._refElm = options._refElm;
  4213. var vnodeComponentOptions = parentVnode.componentOptions;
  4214. opts.propsData = vnodeComponentOptions.propsData;
  4215. opts._parentListeners = vnodeComponentOptions.listeners;
  4216. opts._renderChildren = vnodeComponentOptions.children;
  4217. opts._componentTag = vnodeComponentOptions.tag;
  4218. if (options.render) {
  4219. opts.render = options.render;
  4220. opts.staticRenderFns = options.staticRenderFns;
  4221. }
  4222. }
  4223. function resolveConstructorOptions (Ctor) {
  4224. var options = Ctor.options;
  4225. if (Ctor.super) {
  4226. var superOptions = resolveConstructorOptions(Ctor.super);
  4227. var cachedSuperOptions = Ctor.superOptions;
  4228. if (superOptions !== cachedSuperOptions) {
  4229. // super option changed,
  4230. // need to resolve new options.
  4231. Ctor.superOptions = superOptions;
  4232. // check if there are any late-modified/attached options (#4976)
  4233. var modifiedOptions = resolveModifiedOptions(Ctor);
  4234. // update base extend options
  4235. if (modifiedOptions) {
  4236. extend(Ctor.extendOptions, modifiedOptions);
  4237. }
  4238. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4239. if (options.name) {
  4240. options.components[options.name] = Ctor;
  4241. }
  4242. }
  4243. }
  4244. return options
  4245. }
  4246. function resolveModifiedOptions (Ctor) {
  4247. var modified;
  4248. var latest = Ctor.options;
  4249. var extended = Ctor.extendOptions;
  4250. var sealed = Ctor.sealedOptions;
  4251. for (var key in latest) {
  4252. if (latest[key] !== sealed[key]) {
  4253. if (!modified) { modified = {}; }
  4254. modified[key] = dedupe(latest[key], extended[key], sealed[key]);
  4255. }
  4256. }
  4257. return modified
  4258. }
  4259. function dedupe (latest, extended, sealed) {
  4260. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  4261. // between merges
  4262. if (Array.isArray(latest)) {
  4263. var res = [];
  4264. sealed = Array.isArray(sealed) ? sealed : [sealed];
  4265. extended = Array.isArray(extended) ? extended : [extended];
  4266. for (var i = 0; i < latest.length; i++) {
  4267. // push original options and not sealed options to exclude duplicated options
  4268. if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
  4269. res.push(latest[i]);
  4270. }
  4271. }
  4272. return res
  4273. } else {
  4274. return latest
  4275. }
  4276. }
  4277. function Vue (options) {
  4278. if ("development" !== 'production' &&
  4279. !(this instanceof Vue)
  4280. ) {
  4281. warn('Vue is a constructor and should be called with the `new` keyword');
  4282. }
  4283. this._init(options);
  4284. }
  4285. initMixin(Vue);
  4286. stateMixin(Vue);
  4287. eventsMixin(Vue);
  4288. lifecycleMixin(Vue);
  4289. renderMixin(Vue);
  4290. /* */
  4291. function initUse (Vue) {
  4292. Vue.use = function (plugin) {
  4293. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4294. if (installedPlugins.indexOf(plugin) > -1) {
  4295. return this
  4296. }
  4297. // additional parameters
  4298. var args = toArray(arguments, 1);
  4299. args.unshift(this);
  4300. if (typeof plugin.install === 'function') {
  4301. plugin.install.apply(plugin, args);
  4302. } else if (typeof plugin === 'function') {
  4303. plugin.apply(null, args);
  4304. }
  4305. installedPlugins.push(plugin);
  4306. return this
  4307. };
  4308. }
  4309. /* */
  4310. function initMixin$1 (Vue) {
  4311. Vue.mixin = function (mixin) {
  4312. this.options = mergeOptions(this.options, mixin);
  4313. return this
  4314. };
  4315. }
  4316. /* */
  4317. function initExtend (Vue) {
  4318. /**
  4319. * Each instance constructor, including Vue, has a unique
  4320. * cid. This enables us to create wrapped "child
  4321. * constructors" for prototypal inheritance and cache them.
  4322. */
  4323. Vue.cid = 0;
  4324. var cid = 1;
  4325. /**
  4326. * Class inheritance
  4327. */
  4328. Vue.extend = function (extendOptions) {
  4329. extendOptions = extendOptions || {};
  4330. var Super = this;
  4331. var SuperId = Super.cid;
  4332. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4333. if (cachedCtors[SuperId]) {
  4334. return cachedCtors[SuperId]
  4335. }
  4336. var name = extendOptions.name || Super.options.name;
  4337. if ("development" !== 'production' && name) {
  4338. validateComponentName(name);
  4339. }
  4340. var Sub = function VueComponent (options) {
  4341. this._init(options);
  4342. };
  4343. Sub.prototype = Object.create(Super.prototype);
  4344. Sub.prototype.constructor = Sub;
  4345. Sub.cid = cid++;
  4346. Sub.options = mergeOptions(
  4347. Super.options,
  4348. extendOptions
  4349. );
  4350. Sub['super'] = Super;
  4351. // For props and computed properties, we define the proxy getters on
  4352. // the Vue instances at extension time, on the extended prototype. This
  4353. // avoids Object.defineProperty calls for each instance created.
  4354. if (Sub.options.props) {
  4355. initProps$1(Sub);
  4356. }
  4357. if (Sub.options.computed) {
  4358. initComputed$1(Sub);
  4359. }
  4360. // allow further extension/mixin/plugin usage
  4361. Sub.extend = Super.extend;
  4362. Sub.mixin = Super.mixin;
  4363. Sub.use = Super.use;
  4364. // create asset registers, so extended classes
  4365. // can have their private assets too.
  4366. ASSET_TYPES.forEach(function (type) {
  4367. Sub[type] = Super[type];
  4368. });
  4369. // enable recursive self-lookup
  4370. if (name) {
  4371. Sub.options.components[name] = Sub;
  4372. }
  4373. // keep a reference to the super options at extension time.
  4374. // later at instantiation we can check if Super's options have
  4375. // been updated.
  4376. Sub.superOptions = Super.options;
  4377. Sub.extendOptions = extendOptions;
  4378. Sub.sealedOptions = extend({}, Sub.options);
  4379. // cache constructor
  4380. cachedCtors[SuperId] = Sub;
  4381. return Sub
  4382. };
  4383. }
  4384. function initProps$1 (Comp) {
  4385. var props = Comp.options.props;
  4386. for (var key in props) {
  4387. proxy(Comp.prototype, "_props", key);
  4388. }
  4389. }
  4390. function initComputed$1 (Comp) {
  4391. var computed = Comp.options.computed;
  4392. for (var key in computed) {
  4393. defineComputed(Comp.prototype, key, computed[key]);
  4394. }
  4395. }
  4396. /* */
  4397. function initAssetRegisters (Vue) {
  4398. /**
  4399. * Create asset registration methods.
  4400. */
  4401. ASSET_TYPES.forEach(function (type) {
  4402. Vue[type] = function (
  4403. id,
  4404. definition
  4405. ) {
  4406. if (!definition) {
  4407. return this.options[type + 's'][id]
  4408. } else {
  4409. /* istanbul ignore if */
  4410. if ("development" !== 'production' && type === 'component') {
  4411. validateComponentName(id);
  4412. }
  4413. if (type === 'component' && isPlainObject(definition)) {
  4414. definition.name = definition.name || id;
  4415. definition = this.options._base.extend(definition);
  4416. }
  4417. if (type === 'directive' && typeof definition === 'function') {
  4418. definition = { bind: definition, update: definition };
  4419. }
  4420. this.options[type + 's'][id] = definition;
  4421. return definition
  4422. }
  4423. };
  4424. });
  4425. }
  4426. /* */
  4427. function getComponentName (opts) {
  4428. return opts && (opts.Ctor.options.name || opts.tag)
  4429. }
  4430. function matches (pattern, name) {
  4431. if (Array.isArray(pattern)) {
  4432. return pattern.indexOf(name) > -1
  4433. } else if (typeof pattern === 'string') {
  4434. return pattern.split(',').indexOf(name) > -1
  4435. } else if (isRegExp(pattern)) {
  4436. return pattern.test(name)
  4437. }
  4438. /* istanbul ignore next */
  4439. return false
  4440. }
  4441. function pruneCache (keepAliveInstance, filter) {
  4442. var cache = keepAliveInstance.cache;
  4443. var keys = keepAliveInstance.keys;
  4444. var _vnode = keepAliveInstance._vnode;
  4445. for (var key in cache) {
  4446. var cachedNode = cache[key];
  4447. if (cachedNode) {
  4448. var name = getComponentName(cachedNode.componentOptions);
  4449. if (name && !filter(name)) {
  4450. pruneCacheEntry(cache, key, keys, _vnode);
  4451. }
  4452. }
  4453. }
  4454. }
  4455. function pruneCacheEntry (
  4456. cache,
  4457. key,
  4458. keys,
  4459. current
  4460. ) {
  4461. var cached$$1 = cache[key];
  4462. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4463. cached$$1.componentInstance.$destroy();
  4464. }
  4465. cache[key] = null;
  4466. remove(keys, key);
  4467. }
  4468. var patternTypes = [String, RegExp, Array];
  4469. var KeepAlive = {
  4470. name: 'keep-alive',
  4471. abstract: true,
  4472. props: {
  4473. include: patternTypes,
  4474. exclude: patternTypes,
  4475. max: [String, Number]
  4476. },
  4477. created: function created () {
  4478. this.cache = Object.create(null);
  4479. this.keys = [];
  4480. },
  4481. destroyed: function destroyed () {
  4482. var this$1 = this;
  4483. for (var key in this$1.cache) {
  4484. pruneCacheEntry(this$1.cache, key, this$1.keys);
  4485. }
  4486. },
  4487. mounted: function mounted () {
  4488. var this$1 = this;
  4489. this.$watch('include', function (val) {
  4490. pruneCache(this$1, function (name) { return matches(val, name); });
  4491. });
  4492. this.$watch('exclude', function (val) {
  4493. pruneCache(this$1, function (name) { return !matches(val, name); });
  4494. });
  4495. },
  4496. render: function render () {
  4497. var slot = this.$slots.default;
  4498. var vnode = getFirstComponentChild(slot);
  4499. var componentOptions = vnode && vnode.componentOptions;
  4500. if (componentOptions) {
  4501. // check pattern
  4502. var name = getComponentName(componentOptions);
  4503. var ref = this;
  4504. var include = ref.include;
  4505. var exclude = ref.exclude;
  4506. if (
  4507. // not included
  4508. (include && (!name || !matches(include, name))) ||
  4509. // excluded
  4510. (exclude && name && matches(exclude, name))
  4511. ) {
  4512. return vnode
  4513. }
  4514. var ref$1 = this;
  4515. var cache = ref$1.cache;
  4516. var keys = ref$1.keys;
  4517. var key = vnode.key == null
  4518. // same constructor may get registered as different local components
  4519. // so cid alone is not enough (#3269)
  4520. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4521. : vnode.key;
  4522. if (cache[key]) {
  4523. vnode.componentInstance = cache[key].componentInstance;
  4524. // make current key freshest
  4525. remove(keys, key);
  4526. keys.push(key);
  4527. } else {
  4528. cache[key] = vnode;
  4529. keys.push(key);
  4530. // prune oldest entry
  4531. if (this.max && keys.length > parseInt(this.max)) {
  4532. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4533. }
  4534. }
  4535. vnode.data.keepAlive = true;
  4536. }
  4537. return vnode || (slot && slot[0])
  4538. }
  4539. }
  4540. var builtInComponents = {
  4541. KeepAlive: KeepAlive
  4542. }
  4543. /* */
  4544. function initGlobalAPI (Vue) {
  4545. // config
  4546. var configDef = {};
  4547. configDef.get = function () { return config; };
  4548. {
  4549. configDef.set = function () {
  4550. warn(
  4551. 'Do not replace the Vue.config object, set individual fields instead.'
  4552. );
  4553. };
  4554. }
  4555. Object.defineProperty(Vue, 'config', configDef);
  4556. // exposed util methods.
  4557. // NOTE: these are not considered part of the public API - avoid relying on
  4558. // them unless you are aware of the risk.
  4559. Vue.util = {
  4560. warn: warn,
  4561. extend: extend,
  4562. mergeOptions: mergeOptions,
  4563. defineReactive: defineReactive
  4564. };
  4565. Vue.set = set;
  4566. Vue.delete = del;
  4567. Vue.nextTick = nextTick;
  4568. Vue.options = Object.create(null);
  4569. ASSET_TYPES.forEach(function (type) {
  4570. Vue.options[type + 's'] = Object.create(null);
  4571. });
  4572. // this is used to identify the "base" constructor to extend all plain-object
  4573. // components with in Weex's multi-instance scenarios.
  4574. Vue.options._base = Vue;
  4575. extend(Vue.options.components, builtInComponents);
  4576. initUse(Vue);
  4577. initMixin$1(Vue);
  4578. initExtend(Vue);
  4579. initAssetRegisters(Vue);
  4580. }
  4581. initGlobalAPI(Vue);
  4582. Object.defineProperty(Vue.prototype, '$isServer', {
  4583. get: isServerRendering
  4584. });
  4585. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4586. get: function get () {
  4587. /* istanbul ignore next */
  4588. return this.$vnode && this.$vnode.ssrContext
  4589. }
  4590. });
  4591. // expose FunctionalRenderContext for ssr runtime helper installation
  4592. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4593. value: FunctionalRenderContext
  4594. });
  4595. Vue.version = '2.5.17';
  4596. /* */
  4597. // these are reserved for web because they are directly compiled away
  4598. // during template compilation
  4599. var isReservedAttr = makeMap('style,class');
  4600. // attributes that should be using props for binding
  4601. var acceptValue = makeMap('input,textarea,option,select,progress');
  4602. var mustUseProp = function (tag, type, attr) {
  4603. return (
  4604. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4605. (attr === 'selected' && tag === 'option') ||
  4606. (attr === 'checked' && tag === 'input') ||
  4607. (attr === 'muted' && tag === 'video')
  4608. )
  4609. };
  4610. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4611. var isBooleanAttr = makeMap(
  4612. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4613. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4614. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4615. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4616. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4617. 'truespeed,typemustmatch,visible'
  4618. );
  4619. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4620. var isXlink = function (name) {
  4621. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4622. };
  4623. var getXlinkProp = function (name) {
  4624. return isXlink(name) ? name.slice(6, name.length) : ''
  4625. };
  4626. var isFalsyAttrValue = function (val) {
  4627. return val == null || val === false
  4628. };
  4629. /* */
  4630. function genClassForVnode (vnode) {
  4631. var data = vnode.data;
  4632. var parentNode = vnode;
  4633. var childNode = vnode;
  4634. while (isDef(childNode.componentInstance)) {
  4635. childNode = childNode.componentInstance._vnode;
  4636. if (childNode && childNode.data) {
  4637. data = mergeClassData(childNode.data, data);
  4638. }
  4639. }
  4640. while (isDef(parentNode = parentNode.parent)) {
  4641. if (parentNode && parentNode.data) {
  4642. data = mergeClassData(data, parentNode.data);
  4643. }
  4644. }
  4645. return renderClass(data.staticClass, data.class)
  4646. }
  4647. function mergeClassData (child, parent) {
  4648. return {
  4649. staticClass: concat(child.staticClass, parent.staticClass),
  4650. class: isDef(child.class)
  4651. ? [child.class, parent.class]
  4652. : parent.class
  4653. }
  4654. }
  4655. function renderClass (
  4656. staticClass,
  4657. dynamicClass
  4658. ) {
  4659. if (isDef(staticClass) || isDef(dynamicClass)) {
  4660. return concat(staticClass, stringifyClass(dynamicClass))
  4661. }
  4662. /* istanbul ignore next */
  4663. return ''
  4664. }
  4665. function concat (a, b) {
  4666. return a ? b ? (a + ' ' + b) : a : (b || '')
  4667. }
  4668. function stringifyClass (value) {
  4669. if (Array.isArray(value)) {
  4670. return stringifyArray(value)
  4671. }
  4672. if (isObject(value)) {
  4673. return stringifyObject(value)
  4674. }
  4675. if (typeof value === 'string') {
  4676. return value
  4677. }
  4678. /* istanbul ignore next */
  4679. return ''
  4680. }
  4681. function stringifyArray (value) {
  4682. var res = '';
  4683. var stringified;
  4684. for (var i = 0, l = value.length; i < l; i++) {
  4685. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  4686. if (res) { res += ' '; }
  4687. res += stringified;
  4688. }
  4689. }
  4690. return res
  4691. }
  4692. function stringifyObject (value) {
  4693. var res = '';
  4694. for (var key in value) {
  4695. if (value[key]) {
  4696. if (res) { res += ' '; }
  4697. res += key;
  4698. }
  4699. }
  4700. return res
  4701. }
  4702. /* */
  4703. var namespaceMap = {
  4704. svg: 'http://www.w3.org/2000/svg',
  4705. math: 'http://www.w3.org/1998/Math/MathML'
  4706. };
  4707. var isHTMLTag = makeMap(
  4708. 'html,body,base,head,link,meta,style,title,' +
  4709. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  4710. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  4711. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  4712. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  4713. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  4714. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  4715. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  4716. 'output,progress,select,textarea,' +
  4717. 'details,dialog,menu,menuitem,summary,' +
  4718. 'content,element,shadow,template,blockquote,iframe,tfoot'
  4719. );
  4720. // this map is intentionally selective, only covering SVG elements that may
  4721. // contain child elements.
  4722. var isSVG = makeMap(
  4723. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  4724. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  4725. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  4726. true
  4727. );
  4728. var isPreTag = function (tag) { return tag === 'pre'; };
  4729. var isReservedTag = function (tag) {
  4730. return isHTMLTag(tag) || isSVG(tag)
  4731. };
  4732. function getTagNamespace (tag) {
  4733. if (isSVG(tag)) {
  4734. return 'svg'
  4735. }
  4736. // basic support for MathML
  4737. // note it doesn't support other MathML elements being component roots
  4738. if (tag === 'math') {
  4739. return 'math'
  4740. }
  4741. }
  4742. var unknownElementCache = Object.create(null);
  4743. function isUnknownElement (tag) {
  4744. /* istanbul ignore if */
  4745. if (!inBrowser) {
  4746. return true
  4747. }
  4748. if (isReservedTag(tag)) {
  4749. return false
  4750. }
  4751. tag = tag.toLowerCase();
  4752. /* istanbul ignore if */
  4753. if (unknownElementCache[tag] != null) {
  4754. return unknownElementCache[tag]
  4755. }
  4756. var el = document.createElement(tag);
  4757. if (tag.indexOf('-') > -1) {
  4758. // http://stackoverflow.com/a/28210364/1070244
  4759. return (unknownElementCache[tag] = (
  4760. el.constructor === window.HTMLUnknownElement ||
  4761. el.constructor === window.HTMLElement
  4762. ))
  4763. } else {
  4764. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  4765. }
  4766. }
  4767. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  4768. /* */
  4769. /**
  4770. * Query an element selector if it's not an element already.
  4771. */
  4772. function query (el) {
  4773. if (typeof el === 'string') {
  4774. var selected = document.querySelector(el);
  4775. if (!selected) {
  4776. "development" !== 'production' && warn(
  4777. 'Cannot find element: ' + el
  4778. );
  4779. return document.createElement('div')
  4780. }
  4781. return selected
  4782. } else {
  4783. return el
  4784. }
  4785. }
  4786. /* */
  4787. function createElement$1 (tagName, vnode) {
  4788. var elm = document.createElement(tagName);
  4789. if (tagName !== 'select') {
  4790. return elm
  4791. }
  4792. // false or null will remove the attribute but undefined will not
  4793. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  4794. elm.setAttribute('multiple', 'multiple');
  4795. }
  4796. return elm
  4797. }
  4798. function createElementNS (namespace, tagName) {
  4799. return document.createElementNS(namespaceMap[namespace], tagName)
  4800. }
  4801. function createTextNode (text) {
  4802. return document.createTextNode(text)
  4803. }
  4804. function createComment (text) {
  4805. return document.createComment(text)
  4806. }
  4807. function insertBefore (parentNode, newNode, referenceNode) {
  4808. parentNode.insertBefore(newNode, referenceNode);
  4809. }
  4810. function removeChild (node, child) {
  4811. node.removeChild(child);
  4812. }
  4813. function appendChild (node, child) {
  4814. node.appendChild(child);
  4815. }
  4816. function parentNode (node) {
  4817. return node.parentNode
  4818. }
  4819. function nextSibling (node) {
  4820. return node.nextSibling
  4821. }
  4822. function tagName (node) {
  4823. return node.tagName
  4824. }
  4825. function setTextContent (node, text) {
  4826. node.textContent = text;
  4827. }
  4828. function setStyleScope (node, scopeId) {
  4829. node.setAttribute(scopeId, '');
  4830. }
  4831. var nodeOps = Object.freeze({
  4832. createElement: createElement$1,
  4833. createElementNS: createElementNS,
  4834. createTextNode: createTextNode,
  4835. createComment: createComment,
  4836. insertBefore: insertBefore,
  4837. removeChild: removeChild,
  4838. appendChild: appendChild,
  4839. parentNode: parentNode,
  4840. nextSibling: nextSibling,
  4841. tagName: tagName,
  4842. setTextContent: setTextContent,
  4843. setStyleScope: setStyleScope
  4844. });
  4845. /* */
  4846. var ref = {
  4847. create: function create (_, vnode) {
  4848. registerRef(vnode);
  4849. },
  4850. update: function update (oldVnode, vnode) {
  4851. if (oldVnode.data.ref !== vnode.data.ref) {
  4852. registerRef(oldVnode, true);
  4853. registerRef(vnode);
  4854. }
  4855. },
  4856. destroy: function destroy (vnode) {
  4857. registerRef(vnode, true);
  4858. }
  4859. }
  4860. function registerRef (vnode, isRemoval) {
  4861. var key = vnode.data.ref;
  4862. if (!isDef(key)) { return }
  4863. var vm = vnode.context;
  4864. var ref = vnode.componentInstance || vnode.elm;
  4865. var refs = vm.$refs;
  4866. if (isRemoval) {
  4867. if (Array.isArray(refs[key])) {
  4868. remove(refs[key], ref);
  4869. } else if (refs[key] === ref) {
  4870. refs[key] = undefined;
  4871. }
  4872. } else {
  4873. if (vnode.data.refInFor) {
  4874. if (!Array.isArray(refs[key])) {
  4875. refs[key] = [ref];
  4876. } else if (refs[key].indexOf(ref) < 0) {
  4877. // $flow-disable-line
  4878. refs[key].push(ref);
  4879. }
  4880. } else {
  4881. refs[key] = ref;
  4882. }
  4883. }
  4884. }
  4885. /**
  4886. * Virtual DOM patching algorithm based on Snabbdom by
  4887. * Simon Friis Vindum (@paldepind)
  4888. * Licensed under the MIT License
  4889. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  4890. *
  4891. * modified by Evan You (@yyx990803)
  4892. *
  4893. * Not type-checking this because this file is perf-critical and the cost
  4894. * of making flow understand it is not worth it.
  4895. */
  4896. var emptyNode = new VNode('', {}, []);
  4897. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  4898. function sameVnode (a, b) {
  4899. return (
  4900. a.key === b.key && (
  4901. (
  4902. a.tag === b.tag &&
  4903. a.isComment === b.isComment &&
  4904. isDef(a.data) === isDef(b.data) &&
  4905. sameInputType(a, b)
  4906. ) || (
  4907. isTrue(a.isAsyncPlaceholder) &&
  4908. a.asyncFactory === b.asyncFactory &&
  4909. isUndef(b.asyncFactory.error)
  4910. )
  4911. )
  4912. )
  4913. }
  4914. function sameInputType (a, b) {
  4915. if (a.tag !== 'input') { return true }
  4916. var i;
  4917. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  4918. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  4919. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  4920. }
  4921. function createKeyToOldIdx (children, beginIdx, endIdx) {
  4922. var i, key;
  4923. var map = {};
  4924. for (i = beginIdx; i <= endIdx; ++i) {
  4925. key = children[i].key;
  4926. if (isDef(key)) { map[key] = i; }
  4927. }
  4928. return map
  4929. }
  4930. function createPatchFunction (backend) {
  4931. var i, j;
  4932. var cbs = {};
  4933. var modules = backend.modules;
  4934. var nodeOps = backend.nodeOps;
  4935. for (i = 0; i < hooks.length; ++i) {
  4936. cbs[hooks[i]] = [];
  4937. for (j = 0; j < modules.length; ++j) {
  4938. if (isDef(modules[j][hooks[i]])) {
  4939. cbs[hooks[i]].push(modules[j][hooks[i]]);
  4940. }
  4941. }
  4942. }
  4943. function emptyNodeAt (elm) {
  4944. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  4945. }
  4946. function createRmCb (childElm, listeners) {
  4947. function remove () {
  4948. if (--remove.listeners === 0) {
  4949. removeNode(childElm);
  4950. }
  4951. }
  4952. remove.listeners = listeners;
  4953. return remove
  4954. }
  4955. function removeNode (el) {
  4956. var parent = nodeOps.parentNode(el);
  4957. // element may have already been removed due to v-html / v-text
  4958. if (isDef(parent)) {
  4959. nodeOps.removeChild(parent, el);
  4960. }
  4961. }
  4962. function isUnknownElement$$1 (vnode, inVPre) {
  4963. return (
  4964. !inVPre &&
  4965. !vnode.ns &&
  4966. !(
  4967. config.ignoredElements.length &&
  4968. config.ignoredElements.some(function (ignore) {
  4969. return isRegExp(ignore)
  4970. ? ignore.test(vnode.tag)
  4971. : ignore === vnode.tag
  4972. })
  4973. ) &&
  4974. config.isUnknownElement(vnode.tag)
  4975. )
  4976. }
  4977. var creatingElmInVPre = 0;
  4978. function createElm (
  4979. vnode,
  4980. insertedVnodeQueue,
  4981. parentElm,
  4982. refElm,
  4983. nested,
  4984. ownerArray,
  4985. index
  4986. ) {
  4987. if (isDef(vnode.elm) && isDef(ownerArray)) {
  4988. // This vnode was used in a previous render!
  4989. // now it's used as a new node, overwriting its elm would cause
  4990. // potential patch errors down the road when it's used as an insertion
  4991. // reference node. Instead, we clone the node on-demand before creating
  4992. // associated DOM element for it.
  4993. vnode = ownerArray[index] = cloneVNode(vnode);
  4994. }
  4995. vnode.isRootInsert = !nested; // for transition enter check
  4996. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  4997. return
  4998. }
  4999. var data = vnode.data;
  5000. var children = vnode.children;
  5001. var tag = vnode.tag;
  5002. if (isDef(tag)) {
  5003. {
  5004. if (data && data.pre) {
  5005. creatingElmInVPre++;
  5006. }
  5007. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5008. warn(
  5009. 'Unknown custom element: <' + tag + '> - did you ' +
  5010. 'register the component correctly? For recursive components, ' +
  5011. 'make sure to provide the "name" option.',
  5012. vnode.context
  5013. );
  5014. }
  5015. }
  5016. vnode.elm = vnode.ns
  5017. ? nodeOps.createElementNS(vnode.ns, tag)
  5018. : nodeOps.createElement(tag, vnode);
  5019. setScope(vnode);
  5020. /* istanbul ignore if */
  5021. {
  5022. createChildren(vnode, children, insertedVnodeQueue);
  5023. if (isDef(data)) {
  5024. invokeCreateHooks(vnode, insertedVnodeQueue);
  5025. }
  5026. insert(parentElm, vnode.elm, refElm);
  5027. }
  5028. if ("development" !== 'production' && data && data.pre) {
  5029. creatingElmInVPre--;
  5030. }
  5031. } else if (isTrue(vnode.isComment)) {
  5032. vnode.elm = nodeOps.createComment(vnode.text);
  5033. insert(parentElm, vnode.elm, refElm);
  5034. } else {
  5035. vnode.elm = nodeOps.createTextNode(vnode.text);
  5036. insert(parentElm, vnode.elm, refElm);
  5037. }
  5038. }
  5039. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5040. var i = vnode.data;
  5041. if (isDef(i)) {
  5042. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5043. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5044. i(vnode, false /* hydrating */, parentElm, refElm);
  5045. }
  5046. // after calling the init hook, if the vnode is a child component
  5047. // it should've created a child instance and mounted it. the child
  5048. // component also has set the placeholder vnode's elm.
  5049. // in that case we can just return the element and be done.
  5050. if (isDef(vnode.componentInstance)) {
  5051. initComponent(vnode, insertedVnodeQueue);
  5052. if (isTrue(isReactivated)) {
  5053. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5054. }
  5055. return true
  5056. }
  5057. }
  5058. }
  5059. function initComponent (vnode, insertedVnodeQueue) {
  5060. if (isDef(vnode.data.pendingInsert)) {
  5061. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5062. vnode.data.pendingInsert = null;
  5063. }
  5064. vnode.elm = vnode.componentInstance.$el;
  5065. if (isPatchable(vnode)) {
  5066. invokeCreateHooks(vnode, insertedVnodeQueue);
  5067. setScope(vnode);
  5068. } else {
  5069. // empty component root.
  5070. // skip all element-related modules except for ref (#3455)
  5071. registerRef(vnode);
  5072. // make sure to invoke the insert hook
  5073. insertedVnodeQueue.push(vnode);
  5074. }
  5075. }
  5076. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5077. var i;
  5078. // hack for #4339: a reactivated component with inner transition
  5079. // does not trigger because the inner node's created hooks are not called
  5080. // again. It's not ideal to involve module-specific logic in here but
  5081. // there doesn't seem to be a better way to do it.
  5082. var innerNode = vnode;
  5083. while (innerNode.componentInstance) {
  5084. innerNode = innerNode.componentInstance._vnode;
  5085. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5086. for (i = 0; i < cbs.activate.length; ++i) {
  5087. cbs.activate[i](emptyNode, innerNode);
  5088. }
  5089. insertedVnodeQueue.push(innerNode);
  5090. break
  5091. }
  5092. }
  5093. // unlike a newly created component,
  5094. // a reactivated keep-alive component doesn't insert itself
  5095. insert(parentElm, vnode.elm, refElm);
  5096. }
  5097. function insert (parent, elm, ref$$1) {
  5098. if (isDef(parent)) {
  5099. if (isDef(ref$$1)) {
  5100. if (ref$$1.parentNode === parent) {
  5101. nodeOps.insertBefore(parent, elm, ref$$1);
  5102. }
  5103. } else {
  5104. nodeOps.appendChild(parent, elm);
  5105. }
  5106. }
  5107. }
  5108. function createChildren (vnode, children, insertedVnodeQueue) {
  5109. if (Array.isArray(children)) {
  5110. {
  5111. checkDuplicateKeys(children);
  5112. }
  5113. for (var i = 0; i < children.length; ++i) {
  5114. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5115. }
  5116. } else if (isPrimitive(vnode.text)) {
  5117. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5118. }
  5119. }
  5120. function isPatchable (vnode) {
  5121. while (vnode.componentInstance) {
  5122. vnode = vnode.componentInstance._vnode;
  5123. }
  5124. return isDef(vnode.tag)
  5125. }
  5126. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5127. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5128. cbs.create[i$1](emptyNode, vnode);
  5129. }
  5130. i = vnode.data.hook; // Reuse variable
  5131. if (isDef(i)) {
  5132. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5133. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5134. }
  5135. }
  5136. // set scope id attribute for scoped CSS.
  5137. // this is implemented as a special case to avoid the overhead
  5138. // of going through the normal attribute patching process.
  5139. function setScope (vnode) {
  5140. var i;
  5141. if (isDef(i = vnode.fnScopeId)) {
  5142. nodeOps.setStyleScope(vnode.elm, i);
  5143. } else {
  5144. var ancestor = vnode;
  5145. while (ancestor) {
  5146. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5147. nodeOps.setStyleScope(vnode.elm, i);
  5148. }
  5149. ancestor = ancestor.parent;
  5150. }
  5151. }
  5152. // for slot content they should also get the scopeId from the host instance.
  5153. if (isDef(i = activeInstance) &&
  5154. i !== vnode.context &&
  5155. i !== vnode.fnContext &&
  5156. isDef(i = i.$options._scopeId)
  5157. ) {
  5158. nodeOps.setStyleScope(vnode.elm, i);
  5159. }
  5160. }
  5161. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5162. for (; startIdx <= endIdx; ++startIdx) {
  5163. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5164. }
  5165. }
  5166. function invokeDestroyHook (vnode) {
  5167. var i, j;
  5168. var data = vnode.data;
  5169. if (isDef(data)) {
  5170. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5171. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5172. }
  5173. if (isDef(i = vnode.children)) {
  5174. for (j = 0; j < vnode.children.length; ++j) {
  5175. invokeDestroyHook(vnode.children[j]);
  5176. }
  5177. }
  5178. }
  5179. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5180. for (; startIdx <= endIdx; ++startIdx) {
  5181. var ch = vnodes[startIdx];
  5182. if (isDef(ch)) {
  5183. if (isDef(ch.tag)) {
  5184. removeAndInvokeRemoveHook(ch);
  5185. invokeDestroyHook(ch);
  5186. } else { // Text node
  5187. removeNode(ch.elm);
  5188. }
  5189. }
  5190. }
  5191. }
  5192. function removeAndInvokeRemoveHook (vnode, rm) {
  5193. if (isDef(rm) || isDef(vnode.data)) {
  5194. var i;
  5195. var listeners = cbs.remove.length + 1;
  5196. if (isDef(rm)) {
  5197. // we have a recursively passed down rm callback
  5198. // increase the listeners count
  5199. rm.listeners += listeners;
  5200. } else {
  5201. // directly removing
  5202. rm = createRmCb(vnode.elm, listeners);
  5203. }
  5204. // recursively invoke hooks on child component root node
  5205. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5206. removeAndInvokeRemoveHook(i, rm);
  5207. }
  5208. for (i = 0; i < cbs.remove.length; ++i) {
  5209. cbs.remove[i](vnode, rm);
  5210. }
  5211. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5212. i(vnode, rm);
  5213. } else {
  5214. rm();
  5215. }
  5216. } else {
  5217. removeNode(vnode.elm);
  5218. }
  5219. }
  5220. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5221. var oldStartIdx = 0;
  5222. var newStartIdx = 0;
  5223. var oldEndIdx = oldCh.length - 1;
  5224. var oldStartVnode = oldCh[0];
  5225. var oldEndVnode = oldCh[oldEndIdx];
  5226. var newEndIdx = newCh.length - 1;
  5227. var newStartVnode = newCh[0];
  5228. var newEndVnode = newCh[newEndIdx];
  5229. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5230. // removeOnly is a special flag used only by <transition-group>
  5231. // to ensure removed elements stay in correct relative positions
  5232. // during leaving transitions
  5233. var canMove = !removeOnly;
  5234. {
  5235. checkDuplicateKeys(newCh);
  5236. }
  5237. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5238. if (isUndef(oldStartVnode)) {
  5239. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5240. } else if (isUndef(oldEndVnode)) {
  5241. oldEndVnode = oldCh[--oldEndIdx];
  5242. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5243. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  5244. oldStartVnode = oldCh[++oldStartIdx];
  5245. newStartVnode = newCh[++newStartIdx];
  5246. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5247. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  5248. oldEndVnode = oldCh[--oldEndIdx];
  5249. newEndVnode = newCh[--newEndIdx];
  5250. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5251. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  5252. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5253. oldStartVnode = oldCh[++oldStartIdx];
  5254. newEndVnode = newCh[--newEndIdx];
  5255. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5256. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  5257. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5258. oldEndVnode = oldCh[--oldEndIdx];
  5259. newStartVnode = newCh[++newStartIdx];
  5260. } else {
  5261. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5262. idxInOld = isDef(newStartVnode.key)
  5263. ? oldKeyToIdx[newStartVnode.key]
  5264. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5265. if (isUndef(idxInOld)) { // New element
  5266. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5267. } else {
  5268. vnodeToMove = oldCh[idxInOld];
  5269. if (sameVnode(vnodeToMove, newStartVnode)) {
  5270. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue);
  5271. oldCh[idxInOld] = undefined;
  5272. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5273. } else {
  5274. // same key but different element. treat as new element
  5275. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5276. }
  5277. }
  5278. newStartVnode = newCh[++newStartIdx];
  5279. }
  5280. }
  5281. if (oldStartIdx > oldEndIdx) {
  5282. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5283. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5284. } else if (newStartIdx > newEndIdx) {
  5285. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5286. }
  5287. }
  5288. function checkDuplicateKeys (children) {
  5289. var seenKeys = {};
  5290. for (var i = 0; i < children.length; i++) {
  5291. var vnode = children[i];
  5292. var key = vnode.key;
  5293. if (isDef(key)) {
  5294. if (seenKeys[key]) {
  5295. warn(
  5296. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5297. vnode.context
  5298. );
  5299. } else {
  5300. seenKeys[key] = true;
  5301. }
  5302. }
  5303. }
  5304. }
  5305. function findIdxInOld (node, oldCh, start, end) {
  5306. for (var i = start; i < end; i++) {
  5307. var c = oldCh[i];
  5308. if (isDef(c) && sameVnode(node, c)) { return i }
  5309. }
  5310. }
  5311. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  5312. if (oldVnode === vnode) {
  5313. return
  5314. }
  5315. var elm = vnode.elm = oldVnode.elm;
  5316. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5317. if (isDef(vnode.asyncFactory.resolved)) {
  5318. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5319. } else {
  5320. vnode.isAsyncPlaceholder = true;
  5321. }
  5322. return
  5323. }
  5324. // reuse element for static trees.
  5325. // note we only do this if the vnode is cloned -
  5326. // if the new node is not cloned it means the render functions have been
  5327. // reset by the hot-reload-api and we need to do a proper re-render.
  5328. if (isTrue(vnode.isStatic) &&
  5329. isTrue(oldVnode.isStatic) &&
  5330. vnode.key === oldVnode.key &&
  5331. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5332. ) {
  5333. vnode.componentInstance = oldVnode.componentInstance;
  5334. return
  5335. }
  5336. var i;
  5337. var data = vnode.data;
  5338. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5339. i(oldVnode, vnode);
  5340. }
  5341. var oldCh = oldVnode.children;
  5342. var ch = vnode.children;
  5343. if (isDef(data) && isPatchable(vnode)) {
  5344. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5345. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5346. }
  5347. if (isUndef(vnode.text)) {
  5348. if (isDef(oldCh) && isDef(ch)) {
  5349. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5350. } else if (isDef(ch)) {
  5351. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5352. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5353. } else if (isDef(oldCh)) {
  5354. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5355. } else if (isDef(oldVnode.text)) {
  5356. nodeOps.setTextContent(elm, '');
  5357. }
  5358. } else if (oldVnode.text !== vnode.text) {
  5359. nodeOps.setTextContent(elm, vnode.text);
  5360. }
  5361. if (isDef(data)) {
  5362. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5363. }
  5364. }
  5365. function invokeInsertHook (vnode, queue, initial) {
  5366. // delay insert hooks for component root nodes, invoke them after the
  5367. // element is really inserted
  5368. if (isTrue(initial) && isDef(vnode.parent)) {
  5369. vnode.parent.data.pendingInsert = queue;
  5370. } else {
  5371. for (var i = 0; i < queue.length; ++i) {
  5372. queue[i].data.hook.insert(queue[i]);
  5373. }
  5374. }
  5375. }
  5376. var hydrationBailed = false;
  5377. // list of modules that can skip create hook during hydration because they
  5378. // are already rendered on the client or has no need for initialization
  5379. // Note: style is excluded because it relies on initial clone for future
  5380. // deep updates (#7063).
  5381. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5382. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5383. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5384. var i;
  5385. var tag = vnode.tag;
  5386. var data = vnode.data;
  5387. var children = vnode.children;
  5388. inVPre = inVPre || (data && data.pre);
  5389. vnode.elm = elm;
  5390. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5391. vnode.isAsyncPlaceholder = true;
  5392. return true
  5393. }
  5394. // assert node match
  5395. {
  5396. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5397. return false
  5398. }
  5399. }
  5400. if (isDef(data)) {
  5401. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5402. if (isDef(i = vnode.componentInstance)) {
  5403. // child component. it should have hydrated its own tree.
  5404. initComponent(vnode, insertedVnodeQueue);
  5405. return true
  5406. }
  5407. }
  5408. if (isDef(tag)) {
  5409. if (isDef(children)) {
  5410. // empty element, allow client to pick up and populate children
  5411. if (!elm.hasChildNodes()) {
  5412. createChildren(vnode, children, insertedVnodeQueue);
  5413. } else {
  5414. // v-html and domProps: innerHTML
  5415. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5416. if (i !== elm.innerHTML) {
  5417. /* istanbul ignore if */
  5418. if ("development" !== 'production' &&
  5419. typeof console !== 'undefined' &&
  5420. !hydrationBailed
  5421. ) {
  5422. hydrationBailed = true;
  5423. console.warn('Parent: ', elm);
  5424. console.warn('server innerHTML: ', i);
  5425. console.warn('client innerHTML: ', elm.innerHTML);
  5426. }
  5427. return false
  5428. }
  5429. } else {
  5430. // iterate and compare children lists
  5431. var childrenMatch = true;
  5432. var childNode = elm.firstChild;
  5433. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5434. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5435. childrenMatch = false;
  5436. break
  5437. }
  5438. childNode = childNode.nextSibling;
  5439. }
  5440. // if childNode is not null, it means the actual childNodes list is
  5441. // longer than the virtual children list.
  5442. if (!childrenMatch || childNode) {
  5443. /* istanbul ignore if */
  5444. if ("development" !== 'production' &&
  5445. typeof console !== 'undefined' &&
  5446. !hydrationBailed
  5447. ) {
  5448. hydrationBailed = true;
  5449. console.warn('Parent: ', elm);
  5450. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5451. }
  5452. return false
  5453. }
  5454. }
  5455. }
  5456. }
  5457. if (isDef(data)) {
  5458. var fullInvoke = false;
  5459. for (var key in data) {
  5460. if (!isRenderedModule(key)) {
  5461. fullInvoke = true;
  5462. invokeCreateHooks(vnode, insertedVnodeQueue);
  5463. break
  5464. }
  5465. }
  5466. if (!fullInvoke && data['class']) {
  5467. // ensure collecting deps for deep class bindings for future updates
  5468. traverse(data['class']);
  5469. }
  5470. }
  5471. } else if (elm.data !== vnode.text) {
  5472. elm.data = vnode.text;
  5473. }
  5474. return true
  5475. }
  5476. function assertNodeMatch (node, vnode, inVPre) {
  5477. if (isDef(vnode.tag)) {
  5478. return vnode.tag.indexOf('vue-component') === 0 || (
  5479. !isUnknownElement$$1(vnode, inVPre) &&
  5480. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5481. )
  5482. } else {
  5483. return node.nodeType === (vnode.isComment ? 8 : 3)
  5484. }
  5485. }
  5486. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  5487. if (isUndef(vnode)) {
  5488. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5489. return
  5490. }
  5491. var isInitialPatch = false;
  5492. var insertedVnodeQueue = [];
  5493. if (isUndef(oldVnode)) {
  5494. // empty mount (likely as component), create new root element
  5495. isInitialPatch = true;
  5496. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  5497. } else {
  5498. var isRealElement = isDef(oldVnode.nodeType);
  5499. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5500. // patch existing root node
  5501. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  5502. } else {
  5503. if (isRealElement) {
  5504. // mounting to a real element
  5505. // check if this is server-rendered content and if we can perform
  5506. // a successful hydration.
  5507. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5508. oldVnode.removeAttribute(SSR_ATTR);
  5509. hydrating = true;
  5510. }
  5511. if (isTrue(hydrating)) {
  5512. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5513. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5514. return oldVnode
  5515. } else {
  5516. warn(
  5517. 'The client-side rendered virtual DOM tree is not matching ' +
  5518. 'server-rendered content. This is likely caused by incorrect ' +
  5519. 'HTML markup, for example nesting block-level elements inside ' +
  5520. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5521. 'full client-side render.'
  5522. );
  5523. }
  5524. }
  5525. // either not server-rendered, or hydration failed.
  5526. // create an empty node and replace it
  5527. oldVnode = emptyNodeAt(oldVnode);
  5528. }
  5529. // replacing existing element
  5530. var oldElm = oldVnode.elm;
  5531. var parentElm$1 = nodeOps.parentNode(oldElm);
  5532. // create new node
  5533. createElm(
  5534. vnode,
  5535. insertedVnodeQueue,
  5536. // extremely rare edge case: do not insert if old element is in a
  5537. // leaving transition. Only happens when combining transition +
  5538. // keep-alive + HOCs. (#4590)
  5539. oldElm._leaveCb ? null : parentElm$1,
  5540. nodeOps.nextSibling(oldElm)
  5541. );
  5542. // update parent placeholder node element, recursively
  5543. if (isDef(vnode.parent)) {
  5544. var ancestor = vnode.parent;
  5545. var patchable = isPatchable(vnode);
  5546. while (ancestor) {
  5547. for (var i = 0; i < cbs.destroy.length; ++i) {
  5548. cbs.destroy[i](ancestor);
  5549. }
  5550. ancestor.elm = vnode.elm;
  5551. if (patchable) {
  5552. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5553. cbs.create[i$1](emptyNode, ancestor);
  5554. }
  5555. // #6513
  5556. // invoke insert hooks that may have been merged by create hooks.
  5557. // e.g. for directives that uses the "inserted" hook.
  5558. var insert = ancestor.data.hook.insert;
  5559. if (insert.merged) {
  5560. // start at index 1 to avoid re-invoking component mounted hook
  5561. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5562. insert.fns[i$2]();
  5563. }
  5564. }
  5565. } else {
  5566. registerRef(ancestor);
  5567. }
  5568. ancestor = ancestor.parent;
  5569. }
  5570. }
  5571. // destroy old node
  5572. if (isDef(parentElm$1)) {
  5573. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  5574. } else if (isDef(oldVnode.tag)) {
  5575. invokeDestroyHook(oldVnode);
  5576. }
  5577. }
  5578. }
  5579. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5580. return vnode.elm
  5581. }
  5582. }
  5583. /* */
  5584. var directives = {
  5585. create: updateDirectives,
  5586. update: updateDirectives,
  5587. destroy: function unbindDirectives (vnode) {
  5588. updateDirectives(vnode, emptyNode);
  5589. }
  5590. }
  5591. function updateDirectives (oldVnode, vnode) {
  5592. if (oldVnode.data.directives || vnode.data.directives) {
  5593. _update(oldVnode, vnode);
  5594. }
  5595. }
  5596. function _update (oldVnode, vnode) {
  5597. var isCreate = oldVnode === emptyNode;
  5598. var isDestroy = vnode === emptyNode;
  5599. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5600. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5601. var dirsWithInsert = [];
  5602. var dirsWithPostpatch = [];
  5603. var key, oldDir, dir;
  5604. for (key in newDirs) {
  5605. oldDir = oldDirs[key];
  5606. dir = newDirs[key];
  5607. if (!oldDir) {
  5608. // new directive, bind
  5609. callHook$1(dir, 'bind', vnode, oldVnode);
  5610. if (dir.def && dir.def.inserted) {
  5611. dirsWithInsert.push(dir);
  5612. }
  5613. } else {
  5614. // existing directive, update
  5615. dir.oldValue = oldDir.value;
  5616. callHook$1(dir, 'update', vnode, oldVnode);
  5617. if (dir.def && dir.def.componentUpdated) {
  5618. dirsWithPostpatch.push(dir);
  5619. }
  5620. }
  5621. }
  5622. if (dirsWithInsert.length) {
  5623. var callInsert = function () {
  5624. for (var i = 0; i < dirsWithInsert.length; i++) {
  5625. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5626. }
  5627. };
  5628. if (isCreate) {
  5629. mergeVNodeHook(vnode, 'insert', callInsert);
  5630. } else {
  5631. callInsert();
  5632. }
  5633. }
  5634. if (dirsWithPostpatch.length) {
  5635. mergeVNodeHook(vnode, 'postpatch', function () {
  5636. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5637. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5638. }
  5639. });
  5640. }
  5641. if (!isCreate) {
  5642. for (key in oldDirs) {
  5643. if (!newDirs[key]) {
  5644. // no longer present, unbind
  5645. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  5646. }
  5647. }
  5648. }
  5649. }
  5650. var emptyModifiers = Object.create(null);
  5651. function normalizeDirectives$1 (
  5652. dirs,
  5653. vm
  5654. ) {
  5655. var res = Object.create(null);
  5656. if (!dirs) {
  5657. // $flow-disable-line
  5658. return res
  5659. }
  5660. var i, dir;
  5661. for (i = 0; i < dirs.length; i++) {
  5662. dir = dirs[i];
  5663. if (!dir.modifiers) {
  5664. // $flow-disable-line
  5665. dir.modifiers = emptyModifiers;
  5666. }
  5667. res[getRawDirName(dir)] = dir;
  5668. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  5669. }
  5670. // $flow-disable-line
  5671. return res
  5672. }
  5673. function getRawDirName (dir) {
  5674. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  5675. }
  5676. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  5677. var fn = dir.def && dir.def[hook];
  5678. if (fn) {
  5679. try {
  5680. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  5681. } catch (e) {
  5682. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  5683. }
  5684. }
  5685. }
  5686. var baseModules = [
  5687. ref,
  5688. directives
  5689. ]
  5690. /* */
  5691. function updateAttrs (oldVnode, vnode) {
  5692. var opts = vnode.componentOptions;
  5693. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  5694. return
  5695. }
  5696. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  5697. return
  5698. }
  5699. var key, cur, old;
  5700. var elm = vnode.elm;
  5701. var oldAttrs = oldVnode.data.attrs || {};
  5702. var attrs = vnode.data.attrs || {};
  5703. // clone observed objects, as the user probably wants to mutate it
  5704. if (isDef(attrs.__ob__)) {
  5705. attrs = vnode.data.attrs = extend({}, attrs);
  5706. }
  5707. for (key in attrs) {
  5708. cur = attrs[key];
  5709. old = oldAttrs[key];
  5710. if (old !== cur) {
  5711. setAttr(elm, key, cur);
  5712. }
  5713. }
  5714. // #4391: in IE9, setting type can reset value for input[type=radio]
  5715. // #6666: IE/Edge forces progress value down to 1 before setting a max
  5716. /* istanbul ignore if */
  5717. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  5718. setAttr(elm, 'value', attrs.value);
  5719. }
  5720. for (key in oldAttrs) {
  5721. if (isUndef(attrs[key])) {
  5722. if (isXlink(key)) {
  5723. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  5724. } else if (!isEnumeratedAttr(key)) {
  5725. elm.removeAttribute(key);
  5726. }
  5727. }
  5728. }
  5729. }
  5730. function setAttr (el, key, value) {
  5731. if (el.tagName.indexOf('-') > -1) {
  5732. baseSetAttr(el, key, value);
  5733. } else if (isBooleanAttr(key)) {
  5734. // set attribute for blank value
  5735. // e.g. <option disabled>Select one</option>
  5736. if (isFalsyAttrValue(value)) {
  5737. el.removeAttribute(key);
  5738. } else {
  5739. // technically allowfullscreen is a boolean attribute for <iframe>,
  5740. // but Flash expects a value of "true" when used on <embed> tag
  5741. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  5742. ? 'true'
  5743. : key;
  5744. el.setAttribute(key, value);
  5745. }
  5746. } else if (isEnumeratedAttr(key)) {
  5747. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  5748. } else if (isXlink(key)) {
  5749. if (isFalsyAttrValue(value)) {
  5750. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  5751. } else {
  5752. el.setAttributeNS(xlinkNS, key, value);
  5753. }
  5754. } else {
  5755. baseSetAttr(el, key, value);
  5756. }
  5757. }
  5758. function baseSetAttr (el, key, value) {
  5759. if (isFalsyAttrValue(value)) {
  5760. el.removeAttribute(key);
  5761. } else {
  5762. // #7138: IE10 & 11 fires input event when setting placeholder on
  5763. // <textarea>... block the first input event and remove the blocker
  5764. // immediately.
  5765. /* istanbul ignore if */
  5766. if (
  5767. isIE && !isIE9 &&
  5768. el.tagName === 'TEXTAREA' &&
  5769. key === 'placeholder' && !el.__ieph
  5770. ) {
  5771. var blocker = function (e) {
  5772. e.stopImmediatePropagation();
  5773. el.removeEventListener('input', blocker);
  5774. };
  5775. el.addEventListener('input', blocker);
  5776. // $flow-disable-line
  5777. el.__ieph = true; /* IE placeholder patched */
  5778. }
  5779. el.setAttribute(key, value);
  5780. }
  5781. }
  5782. var attrs = {
  5783. create: updateAttrs,
  5784. update: updateAttrs
  5785. }
  5786. /* */
  5787. function updateClass (oldVnode, vnode) {
  5788. var el = vnode.elm;
  5789. var data = vnode.data;
  5790. var oldData = oldVnode.data;
  5791. if (
  5792. isUndef(data.staticClass) &&
  5793. isUndef(data.class) && (
  5794. isUndef(oldData) || (
  5795. isUndef(oldData.staticClass) &&
  5796. isUndef(oldData.class)
  5797. )
  5798. )
  5799. ) {
  5800. return
  5801. }
  5802. var cls = genClassForVnode(vnode);
  5803. // handle transition classes
  5804. var transitionClass = el._transitionClasses;
  5805. if (isDef(transitionClass)) {
  5806. cls = concat(cls, stringifyClass(transitionClass));
  5807. }
  5808. // set the class
  5809. if (cls !== el._prevClass) {
  5810. el.setAttribute('class', cls);
  5811. el._prevClass = cls;
  5812. }
  5813. }
  5814. var klass = {
  5815. create: updateClass,
  5816. update: updateClass
  5817. }
  5818. /* */
  5819. var validDivisionCharRE = /[\w).+\-_$\]]/;
  5820. function parseFilters (exp) {
  5821. var inSingle = false;
  5822. var inDouble = false;
  5823. var inTemplateString = false;
  5824. var inRegex = false;
  5825. var curly = 0;
  5826. var square = 0;
  5827. var paren = 0;
  5828. var lastFilterIndex = 0;
  5829. var c, prev, i, expression, filters;
  5830. for (i = 0; i < exp.length; i++) {
  5831. prev = c;
  5832. c = exp.charCodeAt(i);
  5833. if (inSingle) {
  5834. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  5835. } else if (inDouble) {
  5836. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  5837. } else if (inTemplateString) {
  5838. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  5839. } else if (inRegex) {
  5840. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  5841. } else if (
  5842. c === 0x7C && // pipe
  5843. exp.charCodeAt(i + 1) !== 0x7C &&
  5844. exp.charCodeAt(i - 1) !== 0x7C &&
  5845. !curly && !square && !paren
  5846. ) {
  5847. if (expression === undefined) {
  5848. // first filter, end of expression
  5849. lastFilterIndex = i + 1;
  5850. expression = exp.slice(0, i).trim();
  5851. } else {
  5852. pushFilter();
  5853. }
  5854. } else {
  5855. switch (c) {
  5856. case 0x22: inDouble = true; break // "
  5857. case 0x27: inSingle = true; break // '
  5858. case 0x60: inTemplateString = true; break // `
  5859. case 0x28: paren++; break // (
  5860. case 0x29: paren--; break // )
  5861. case 0x5B: square++; break // [
  5862. case 0x5D: square--; break // ]
  5863. case 0x7B: curly++; break // {
  5864. case 0x7D: curly--; break // }
  5865. }
  5866. if (c === 0x2f) { // /
  5867. var j = i - 1;
  5868. var p = (void 0);
  5869. // find first non-whitespace prev char
  5870. for (; j >= 0; j--) {
  5871. p = exp.charAt(j);
  5872. if (p !== ' ') { break }
  5873. }
  5874. if (!p || !validDivisionCharRE.test(p)) {
  5875. inRegex = true;
  5876. }
  5877. }
  5878. }
  5879. }
  5880. if (expression === undefined) {
  5881. expression = exp.slice(0, i).trim();
  5882. } else if (lastFilterIndex !== 0) {
  5883. pushFilter();
  5884. }
  5885. function pushFilter () {
  5886. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  5887. lastFilterIndex = i + 1;
  5888. }
  5889. if (filters) {
  5890. for (i = 0; i < filters.length; i++) {
  5891. expression = wrapFilter(expression, filters[i]);
  5892. }
  5893. }
  5894. return expression
  5895. }
  5896. function wrapFilter (exp, filter) {
  5897. var i = filter.indexOf('(');
  5898. if (i < 0) {
  5899. // _f: resolveFilter
  5900. return ("_f(\"" + filter + "\")(" + exp + ")")
  5901. } else {
  5902. var name = filter.slice(0, i);
  5903. var args = filter.slice(i + 1);
  5904. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  5905. }
  5906. }
  5907. /* */
  5908. function baseWarn (msg) {
  5909. console.error(("[Vue compiler]: " + msg));
  5910. }
  5911. function pluckModuleFunction (
  5912. modules,
  5913. key
  5914. ) {
  5915. return modules
  5916. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  5917. : []
  5918. }
  5919. function addProp (el, name, value) {
  5920. (el.props || (el.props = [])).push({ name: name, value: value });
  5921. el.plain = false;
  5922. }
  5923. function addAttr (el, name, value) {
  5924. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  5925. el.plain = false;
  5926. }
  5927. // add a raw attr (use this in preTransforms)
  5928. function addRawAttr (el, name, value) {
  5929. el.attrsMap[name] = value;
  5930. el.attrsList.push({ name: name, value: value });
  5931. }
  5932. function addDirective (
  5933. el,
  5934. name,
  5935. rawName,
  5936. value,
  5937. arg,
  5938. modifiers
  5939. ) {
  5940. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  5941. el.plain = false;
  5942. }
  5943. function addHandler (
  5944. el,
  5945. name,
  5946. value,
  5947. modifiers,
  5948. important,
  5949. warn
  5950. ) {
  5951. modifiers = modifiers || emptyObject;
  5952. // warn prevent and passive modifier
  5953. /* istanbul ignore if */
  5954. if (
  5955. "development" !== 'production' && warn &&
  5956. modifiers.prevent && modifiers.passive
  5957. ) {
  5958. warn(
  5959. 'passive and prevent can\'t be used together. ' +
  5960. 'Passive handler can\'t prevent default event.'
  5961. );
  5962. }
  5963. // check capture modifier
  5964. if (modifiers.capture) {
  5965. delete modifiers.capture;
  5966. name = '!' + name; // mark the event as captured
  5967. }
  5968. if (modifiers.once) {
  5969. delete modifiers.once;
  5970. name = '~' + name; // mark the event as once
  5971. }
  5972. /* istanbul ignore if */
  5973. if (modifiers.passive) {
  5974. delete modifiers.passive;
  5975. name = '&' + name; // mark the event as passive
  5976. }
  5977. // normalize click.right and click.middle since they don't actually fire
  5978. // this is technically browser-specific, but at least for now browsers are
  5979. // the only target envs that have right/middle clicks.
  5980. if (name === 'click') {
  5981. if (modifiers.right) {
  5982. name = 'contextmenu';
  5983. delete modifiers.right;
  5984. } else if (modifiers.middle) {
  5985. name = 'mouseup';
  5986. }
  5987. }
  5988. var events;
  5989. if (modifiers.native) {
  5990. delete modifiers.native;
  5991. events = el.nativeEvents || (el.nativeEvents = {});
  5992. } else {
  5993. events = el.events || (el.events = {});
  5994. }
  5995. var newHandler = {
  5996. value: value.trim()
  5997. };
  5998. if (modifiers !== emptyObject) {
  5999. newHandler.modifiers = modifiers;
  6000. }
  6001. var handlers = events[name];
  6002. /* istanbul ignore if */
  6003. if (Array.isArray(handlers)) {
  6004. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6005. } else if (handlers) {
  6006. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6007. } else {
  6008. events[name] = newHandler;
  6009. }
  6010. el.plain = false;
  6011. }
  6012. function getBindingAttr (
  6013. el,
  6014. name,
  6015. getStatic
  6016. ) {
  6017. var dynamicValue =
  6018. getAndRemoveAttr(el, ':' + name) ||
  6019. getAndRemoveAttr(el, 'v-bind:' + name);
  6020. if (dynamicValue != null) {
  6021. return parseFilters(dynamicValue)
  6022. } else if (getStatic !== false) {
  6023. var staticValue = getAndRemoveAttr(el, name);
  6024. if (staticValue != null) {
  6025. return JSON.stringify(staticValue)
  6026. }
  6027. }
  6028. }
  6029. // note: this only removes the attr from the Array (attrsList) so that it
  6030. // doesn't get processed by processAttrs.
  6031. // By default it does NOT remove it from the map (attrsMap) because the map is
  6032. // needed during codegen.
  6033. function getAndRemoveAttr (
  6034. el,
  6035. name,
  6036. removeFromMap
  6037. ) {
  6038. var val;
  6039. if ((val = el.attrsMap[name]) != null) {
  6040. var list = el.attrsList;
  6041. for (var i = 0, l = list.length; i < l; i++) {
  6042. if (list[i].name === name) {
  6043. list.splice(i, 1);
  6044. break
  6045. }
  6046. }
  6047. }
  6048. if (removeFromMap) {
  6049. delete el.attrsMap[name];
  6050. }
  6051. return val
  6052. }
  6053. /* */
  6054. /**
  6055. * Cross-platform code generation for component v-model
  6056. */
  6057. function genComponentModel (
  6058. el,
  6059. value,
  6060. modifiers
  6061. ) {
  6062. var ref = modifiers || {};
  6063. var number = ref.number;
  6064. var trim = ref.trim;
  6065. var baseValueExpression = '$$v';
  6066. var valueExpression = baseValueExpression;
  6067. if (trim) {
  6068. valueExpression =
  6069. "(typeof " + baseValueExpression + " === 'string'" +
  6070. "? " + baseValueExpression + ".trim()" +
  6071. ": " + baseValueExpression + ")";
  6072. }
  6073. if (number) {
  6074. valueExpression = "_n(" + valueExpression + ")";
  6075. }
  6076. var assignment = genAssignmentCode(value, valueExpression);
  6077. el.model = {
  6078. value: ("(" + value + ")"),
  6079. expression: ("\"" + value + "\""),
  6080. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6081. };
  6082. }
  6083. /**
  6084. * Cross-platform codegen helper for generating v-model value assignment code.
  6085. */
  6086. function genAssignmentCode (
  6087. value,
  6088. assignment
  6089. ) {
  6090. var res = parseModel(value);
  6091. if (res.key === null) {
  6092. return (value + "=" + assignment)
  6093. } else {
  6094. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6095. }
  6096. }
  6097. /**
  6098. * Parse a v-model expression into a base path and a final key segment.
  6099. * Handles both dot-path and possible square brackets.
  6100. *
  6101. * Possible cases:
  6102. *
  6103. * - test
  6104. * - test[key]
  6105. * - test[test1[key]]
  6106. * - test["a"][key]
  6107. * - xxx.test[a[a].test1[key]]
  6108. * - test.xxx.a["asa"][test1[key]]
  6109. *
  6110. */
  6111. var len;
  6112. var str;
  6113. var chr;
  6114. var index$1;
  6115. var expressionPos;
  6116. var expressionEndPos;
  6117. function parseModel (val) {
  6118. // Fix https://github.com/vuejs/vue/pull/7730
  6119. // allow v-model="obj.val " (trailing whitespace)
  6120. val = val.trim();
  6121. len = val.length;
  6122. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6123. index$1 = val.lastIndexOf('.');
  6124. if (index$1 > -1) {
  6125. return {
  6126. exp: val.slice(0, index$1),
  6127. key: '"' + val.slice(index$1 + 1) + '"'
  6128. }
  6129. } else {
  6130. return {
  6131. exp: val,
  6132. key: null
  6133. }
  6134. }
  6135. }
  6136. str = val;
  6137. index$1 = expressionPos = expressionEndPos = 0;
  6138. while (!eof()) {
  6139. chr = next();
  6140. /* istanbul ignore if */
  6141. if (isStringStart(chr)) {
  6142. parseString(chr);
  6143. } else if (chr === 0x5B) {
  6144. parseBracket(chr);
  6145. }
  6146. }
  6147. return {
  6148. exp: val.slice(0, expressionPos),
  6149. key: val.slice(expressionPos + 1, expressionEndPos)
  6150. }
  6151. }
  6152. function next () {
  6153. return str.charCodeAt(++index$1)
  6154. }
  6155. function eof () {
  6156. return index$1 >= len
  6157. }
  6158. function isStringStart (chr) {
  6159. return chr === 0x22 || chr === 0x27
  6160. }
  6161. function parseBracket (chr) {
  6162. var inBracket = 1;
  6163. expressionPos = index$1;
  6164. while (!eof()) {
  6165. chr = next();
  6166. if (isStringStart(chr)) {
  6167. parseString(chr);
  6168. continue
  6169. }
  6170. if (chr === 0x5B) { inBracket++; }
  6171. if (chr === 0x5D) { inBracket--; }
  6172. if (inBracket === 0) {
  6173. expressionEndPos = index$1;
  6174. break
  6175. }
  6176. }
  6177. }
  6178. function parseString (chr) {
  6179. var stringQuote = chr;
  6180. while (!eof()) {
  6181. chr = next();
  6182. if (chr === stringQuote) {
  6183. break
  6184. }
  6185. }
  6186. }
  6187. /* */
  6188. var warn$1;
  6189. // in some cases, the event used has to be determined at runtime
  6190. // so we used some reserved tokens during compile.
  6191. var RANGE_TOKEN = '__r';
  6192. var CHECKBOX_RADIO_TOKEN = '__c';
  6193. function model (
  6194. el,
  6195. dir,
  6196. _warn
  6197. ) {
  6198. warn$1 = _warn;
  6199. var value = dir.value;
  6200. var modifiers = dir.modifiers;
  6201. var tag = el.tag;
  6202. var type = el.attrsMap.type;
  6203. {
  6204. // inputs with type="file" are read only and setting the input's
  6205. // value will throw an error.
  6206. if (tag === 'input' && type === 'file') {
  6207. warn$1(
  6208. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6209. "File inputs are read only. Use a v-on:change listener instead."
  6210. );
  6211. }
  6212. }
  6213. if (el.component) {
  6214. genComponentModel(el, value, modifiers);
  6215. // component v-model doesn't need extra runtime
  6216. return false
  6217. } else if (tag === 'select') {
  6218. genSelect(el, value, modifiers);
  6219. } else if (tag === 'input' && type === 'checkbox') {
  6220. genCheckboxModel(el, value, modifiers);
  6221. } else if (tag === 'input' && type === 'radio') {
  6222. genRadioModel(el, value, modifiers);
  6223. } else if (tag === 'input' || tag === 'textarea') {
  6224. genDefaultModel(el, value, modifiers);
  6225. } else if (!config.isReservedTag(tag)) {
  6226. genComponentModel(el, value, modifiers);
  6227. // component v-model doesn't need extra runtime
  6228. return false
  6229. } else {
  6230. warn$1(
  6231. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6232. "v-model is not supported on this element type. " +
  6233. 'If you are working with contenteditable, it\'s recommended to ' +
  6234. 'wrap a library dedicated for that purpose inside a custom component.'
  6235. );
  6236. }
  6237. // ensure runtime directive metadata
  6238. return true
  6239. }
  6240. function genCheckboxModel (
  6241. el,
  6242. value,
  6243. modifiers
  6244. ) {
  6245. var number = modifiers && modifiers.number;
  6246. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6247. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6248. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6249. addProp(el, 'checked',
  6250. "Array.isArray(" + value + ")" +
  6251. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6252. trueValueBinding === 'true'
  6253. ? (":(" + value + ")")
  6254. : (":_q(" + value + "," + trueValueBinding + ")")
  6255. )
  6256. );
  6257. addHandler(el, 'change',
  6258. "var $$a=" + value + "," +
  6259. '$$el=$event.target,' +
  6260. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6261. 'if(Array.isArray($$a)){' +
  6262. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6263. '$$i=_i($$a,$$v);' +
  6264. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6265. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6266. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6267. null, true
  6268. );
  6269. }
  6270. function genRadioModel (
  6271. el,
  6272. value,
  6273. modifiers
  6274. ) {
  6275. var number = modifiers && modifiers.number;
  6276. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6277. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6278. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6279. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6280. }
  6281. function genSelect (
  6282. el,
  6283. value,
  6284. modifiers
  6285. ) {
  6286. var number = modifiers && modifiers.number;
  6287. var selectedVal = "Array.prototype.filter" +
  6288. ".call($event.target.options,function(o){return o.selected})" +
  6289. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6290. "return " + (number ? '_n(val)' : 'val') + "})";
  6291. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6292. var code = "var $$selectedVal = " + selectedVal + ";";
  6293. code = code + " " + (genAssignmentCode(value, assignment));
  6294. addHandler(el, 'change', code, null, true);
  6295. }
  6296. function genDefaultModel (
  6297. el,
  6298. value,
  6299. modifiers
  6300. ) {
  6301. var type = el.attrsMap.type;
  6302. // warn if v-bind:value conflicts with v-model
  6303. // except for inputs with v-bind:type
  6304. {
  6305. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6306. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6307. if (value$1 && !typeBinding) {
  6308. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6309. warn$1(
  6310. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6311. 'because the latter already expands to a value binding internally'
  6312. );
  6313. }
  6314. }
  6315. var ref = modifiers || {};
  6316. var lazy = ref.lazy;
  6317. var number = ref.number;
  6318. var trim = ref.trim;
  6319. var needCompositionGuard = !lazy && type !== 'range';
  6320. var event = lazy
  6321. ? 'change'
  6322. : type === 'range'
  6323. ? RANGE_TOKEN
  6324. : 'input';
  6325. var valueExpression = '$event.target.value';
  6326. if (trim) {
  6327. valueExpression = "$event.target.value.trim()";
  6328. }
  6329. if (number) {
  6330. valueExpression = "_n(" + valueExpression + ")";
  6331. }
  6332. var code = genAssignmentCode(value, valueExpression);
  6333. if (needCompositionGuard) {
  6334. code = "if($event.target.composing)return;" + code;
  6335. }
  6336. addProp(el, 'value', ("(" + value + ")"));
  6337. addHandler(el, event, code, null, true);
  6338. if (trim || number) {
  6339. addHandler(el, 'blur', '$forceUpdate()');
  6340. }
  6341. }
  6342. /* */
  6343. // normalize v-model event tokens that can only be determined at runtime.
  6344. // it's important to place the event as the first in the array because
  6345. // the whole point is ensuring the v-model callback gets called before
  6346. // user-attached handlers.
  6347. function normalizeEvents (on) {
  6348. /* istanbul ignore if */
  6349. if (isDef(on[RANGE_TOKEN])) {
  6350. // IE input[type=range] only supports `change` event
  6351. var event = isIE ? 'change' : 'input';
  6352. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6353. delete on[RANGE_TOKEN];
  6354. }
  6355. // This was originally intended to fix #4521 but no longer necessary
  6356. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6357. /* istanbul ignore if */
  6358. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6359. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6360. delete on[CHECKBOX_RADIO_TOKEN];
  6361. }
  6362. }
  6363. var target$1;
  6364. function createOnceHandler (handler, event, capture) {
  6365. var _target = target$1; // save current target element in closure
  6366. return function onceHandler () {
  6367. var res = handler.apply(null, arguments);
  6368. if (res !== null) {
  6369. remove$2(event, onceHandler, capture, _target);
  6370. }
  6371. }
  6372. }
  6373. function add$1 (
  6374. event,
  6375. handler,
  6376. once$$1,
  6377. capture,
  6378. passive
  6379. ) {
  6380. handler = withMacroTask(handler);
  6381. if (once$$1) { handler = createOnceHandler(handler, event, capture); }
  6382. target$1.addEventListener(
  6383. event,
  6384. handler,
  6385. supportsPassive
  6386. ? { capture: capture, passive: passive }
  6387. : capture
  6388. );
  6389. }
  6390. function remove$2 (
  6391. event,
  6392. handler,
  6393. capture,
  6394. _target
  6395. ) {
  6396. (_target || target$1).removeEventListener(
  6397. event,
  6398. handler._withTask || handler,
  6399. capture
  6400. );
  6401. }
  6402. function updateDOMListeners (oldVnode, vnode) {
  6403. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6404. return
  6405. }
  6406. var on = vnode.data.on || {};
  6407. var oldOn = oldVnode.data.on || {};
  6408. target$1 = vnode.elm;
  6409. normalizeEvents(on);
  6410. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  6411. target$1 = undefined;
  6412. }
  6413. var events = {
  6414. create: updateDOMListeners,
  6415. update: updateDOMListeners
  6416. }
  6417. /* */
  6418. function updateDOMProps (oldVnode, vnode) {
  6419. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6420. return
  6421. }
  6422. var key, cur;
  6423. var elm = vnode.elm;
  6424. var oldProps = oldVnode.data.domProps || {};
  6425. var props = vnode.data.domProps || {};
  6426. // clone observed objects, as the user probably wants to mutate it
  6427. if (isDef(props.__ob__)) {
  6428. props = vnode.data.domProps = extend({}, props);
  6429. }
  6430. for (key in oldProps) {
  6431. if (isUndef(props[key])) {
  6432. elm[key] = '';
  6433. }
  6434. }
  6435. for (key in props) {
  6436. cur = props[key];
  6437. // ignore children if the node has textContent or innerHTML,
  6438. // as these will throw away existing DOM nodes and cause removal errors
  6439. // on subsequent patches (#3360)
  6440. if (key === 'textContent' || key === 'innerHTML') {
  6441. if (vnode.children) { vnode.children.length = 0; }
  6442. if (cur === oldProps[key]) { continue }
  6443. // #6601 work around Chrome version <= 55 bug where single textNode
  6444. // replaced by innerHTML/textContent retains its parentNode property
  6445. if (elm.childNodes.length === 1) {
  6446. elm.removeChild(elm.childNodes[0]);
  6447. }
  6448. }
  6449. if (key === 'value') {
  6450. // store value as _value as well since
  6451. // non-string values will be stringified
  6452. elm._value = cur;
  6453. // avoid resetting cursor position when value is the same
  6454. var strCur = isUndef(cur) ? '' : String(cur);
  6455. if (shouldUpdateValue(elm, strCur)) {
  6456. elm.value = strCur;
  6457. }
  6458. } else {
  6459. elm[key] = cur;
  6460. }
  6461. }
  6462. }
  6463. // check platforms/web/util/attrs.js acceptValue
  6464. function shouldUpdateValue (elm, checkVal) {
  6465. return (!elm.composing && (
  6466. elm.tagName === 'OPTION' ||
  6467. isNotInFocusAndDirty(elm, checkVal) ||
  6468. isDirtyWithModifiers(elm, checkVal)
  6469. ))
  6470. }
  6471. function isNotInFocusAndDirty (elm, checkVal) {
  6472. // return true when textbox (.number and .trim) loses focus and its value is
  6473. // not equal to the updated value
  6474. var notInFocus = true;
  6475. // #6157
  6476. // work around IE bug when accessing document.activeElement in an iframe
  6477. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6478. return notInFocus && elm.value !== checkVal
  6479. }
  6480. function isDirtyWithModifiers (elm, newVal) {
  6481. var value = elm.value;
  6482. var modifiers = elm._vModifiers; // injected by v-model runtime
  6483. if (isDef(modifiers)) {
  6484. if (modifiers.lazy) {
  6485. // inputs with lazy should only be updated when not in focus
  6486. return false
  6487. }
  6488. if (modifiers.number) {
  6489. return toNumber(value) !== toNumber(newVal)
  6490. }
  6491. if (modifiers.trim) {
  6492. return value.trim() !== newVal.trim()
  6493. }
  6494. }
  6495. return value !== newVal
  6496. }
  6497. var domProps = {
  6498. create: updateDOMProps,
  6499. update: updateDOMProps
  6500. }
  6501. /* */
  6502. var parseStyleText = cached(function (cssText) {
  6503. var res = {};
  6504. var listDelimiter = /;(?![^(]*\))/g;
  6505. var propertyDelimiter = /:(.+)/;
  6506. cssText.split(listDelimiter).forEach(function (item) {
  6507. if (item) {
  6508. var tmp = item.split(propertyDelimiter);
  6509. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6510. }
  6511. });
  6512. return res
  6513. });
  6514. // merge static and dynamic style data on the same vnode
  6515. function normalizeStyleData (data) {
  6516. var style = normalizeStyleBinding(data.style);
  6517. // static style is pre-processed into an object during compilation
  6518. // and is always a fresh object, so it's safe to merge into it
  6519. return data.staticStyle
  6520. ? extend(data.staticStyle, style)
  6521. : style
  6522. }
  6523. // normalize possible array / string values into Object
  6524. function normalizeStyleBinding (bindingStyle) {
  6525. if (Array.isArray(bindingStyle)) {
  6526. return toObject(bindingStyle)
  6527. }
  6528. if (typeof bindingStyle === 'string') {
  6529. return parseStyleText(bindingStyle)
  6530. }
  6531. return bindingStyle
  6532. }
  6533. /**
  6534. * parent component style should be after child's
  6535. * so that parent component's style could override it
  6536. */
  6537. function getStyle (vnode, checkChild) {
  6538. var res = {};
  6539. var styleData;
  6540. if (checkChild) {
  6541. var childNode = vnode;
  6542. while (childNode.componentInstance) {
  6543. childNode = childNode.componentInstance._vnode;
  6544. if (
  6545. childNode && childNode.data &&
  6546. (styleData = normalizeStyleData(childNode.data))
  6547. ) {
  6548. extend(res, styleData);
  6549. }
  6550. }
  6551. }
  6552. if ((styleData = normalizeStyleData(vnode.data))) {
  6553. extend(res, styleData);
  6554. }
  6555. var parentNode = vnode;
  6556. while ((parentNode = parentNode.parent)) {
  6557. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  6558. extend(res, styleData);
  6559. }
  6560. }
  6561. return res
  6562. }
  6563. /* */
  6564. var cssVarRE = /^--/;
  6565. var importantRE = /\s*!important$/;
  6566. var setProp = function (el, name, val) {
  6567. /* istanbul ignore if */
  6568. if (cssVarRE.test(name)) {
  6569. el.style.setProperty(name, val);
  6570. } else if (importantRE.test(val)) {
  6571. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  6572. } else {
  6573. var normalizedName = normalize(name);
  6574. if (Array.isArray(val)) {
  6575. // Support values array created by autoprefixer, e.g.
  6576. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  6577. // Set them one by one, and the browser will only set those it can recognize
  6578. for (var i = 0, len = val.length; i < len; i++) {
  6579. el.style[normalizedName] = val[i];
  6580. }
  6581. } else {
  6582. el.style[normalizedName] = val;
  6583. }
  6584. }
  6585. };
  6586. var vendorNames = ['Webkit', 'Moz', 'ms'];
  6587. var emptyStyle;
  6588. var normalize = cached(function (prop) {
  6589. emptyStyle = emptyStyle || document.createElement('div').style;
  6590. prop = camelize(prop);
  6591. if (prop !== 'filter' && (prop in emptyStyle)) {
  6592. return prop
  6593. }
  6594. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  6595. for (var i = 0; i < vendorNames.length; i++) {
  6596. var name = vendorNames[i] + capName;
  6597. if (name in emptyStyle) {
  6598. return name
  6599. }
  6600. }
  6601. });
  6602. function updateStyle (oldVnode, vnode) {
  6603. var data = vnode.data;
  6604. var oldData = oldVnode.data;
  6605. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  6606. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  6607. ) {
  6608. return
  6609. }
  6610. var cur, name;
  6611. var el = vnode.elm;
  6612. var oldStaticStyle = oldData.staticStyle;
  6613. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  6614. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  6615. var oldStyle = oldStaticStyle || oldStyleBinding;
  6616. var style = normalizeStyleBinding(vnode.data.style) || {};
  6617. // store normalized style under a different key for next diff
  6618. // make sure to clone it if it's reactive, since the user likely wants
  6619. // to mutate it.
  6620. vnode.data.normalizedStyle = isDef(style.__ob__)
  6621. ? extend({}, style)
  6622. : style;
  6623. var newStyle = getStyle(vnode, true);
  6624. for (name in oldStyle) {
  6625. if (isUndef(newStyle[name])) {
  6626. setProp(el, name, '');
  6627. }
  6628. }
  6629. for (name in newStyle) {
  6630. cur = newStyle[name];
  6631. if (cur !== oldStyle[name]) {
  6632. // ie9 setting to null has no effect, must use empty string
  6633. setProp(el, name, cur == null ? '' : cur);
  6634. }
  6635. }
  6636. }
  6637. var style = {
  6638. create: updateStyle,
  6639. update: updateStyle
  6640. }
  6641. /* */
  6642. /**
  6643. * Add class with compatibility for SVG since classList is not supported on
  6644. * SVG elements in IE
  6645. */
  6646. function addClass (el, cls) {
  6647. /* istanbul ignore if */
  6648. if (!cls || !(cls = cls.trim())) {
  6649. return
  6650. }
  6651. /* istanbul ignore else */
  6652. if (el.classList) {
  6653. if (cls.indexOf(' ') > -1) {
  6654. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  6655. } else {
  6656. el.classList.add(cls);
  6657. }
  6658. } else {
  6659. var cur = " " + (el.getAttribute('class') || '') + " ";
  6660. if (cur.indexOf(' ' + cls + ' ') < 0) {
  6661. el.setAttribute('class', (cur + cls).trim());
  6662. }
  6663. }
  6664. }
  6665. /**
  6666. * Remove class with compatibility for SVG since classList is not supported on
  6667. * SVG elements in IE
  6668. */
  6669. function removeClass (el, cls) {
  6670. /* istanbul ignore if */
  6671. if (!cls || !(cls = cls.trim())) {
  6672. return
  6673. }
  6674. /* istanbul ignore else */
  6675. if (el.classList) {
  6676. if (cls.indexOf(' ') > -1) {
  6677. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  6678. } else {
  6679. el.classList.remove(cls);
  6680. }
  6681. if (!el.classList.length) {
  6682. el.removeAttribute('class');
  6683. }
  6684. } else {
  6685. var cur = " " + (el.getAttribute('class') || '') + " ";
  6686. var tar = ' ' + cls + ' ';
  6687. while (cur.indexOf(tar) >= 0) {
  6688. cur = cur.replace(tar, ' ');
  6689. }
  6690. cur = cur.trim();
  6691. if (cur) {
  6692. el.setAttribute('class', cur);
  6693. } else {
  6694. el.removeAttribute('class');
  6695. }
  6696. }
  6697. }
  6698. /* */
  6699. function resolveTransition (def) {
  6700. if (!def) {
  6701. return
  6702. }
  6703. /* istanbul ignore else */
  6704. if (typeof def === 'object') {
  6705. var res = {};
  6706. if (def.css !== false) {
  6707. extend(res, autoCssTransition(def.name || 'v'));
  6708. }
  6709. extend(res, def);
  6710. return res
  6711. } else if (typeof def === 'string') {
  6712. return autoCssTransition(def)
  6713. }
  6714. }
  6715. var autoCssTransition = cached(function (name) {
  6716. return {
  6717. enterClass: (name + "-enter"),
  6718. enterToClass: (name + "-enter-to"),
  6719. enterActiveClass: (name + "-enter-active"),
  6720. leaveClass: (name + "-leave"),
  6721. leaveToClass: (name + "-leave-to"),
  6722. leaveActiveClass: (name + "-leave-active")
  6723. }
  6724. });
  6725. var hasTransition = inBrowser && !isIE9;
  6726. var TRANSITION = 'transition';
  6727. var ANIMATION = 'animation';
  6728. // Transition property/event sniffing
  6729. var transitionProp = 'transition';
  6730. var transitionEndEvent = 'transitionend';
  6731. var animationProp = 'animation';
  6732. var animationEndEvent = 'animationend';
  6733. if (hasTransition) {
  6734. /* istanbul ignore if */
  6735. if (window.ontransitionend === undefined &&
  6736. window.onwebkittransitionend !== undefined
  6737. ) {
  6738. transitionProp = 'WebkitTransition';
  6739. transitionEndEvent = 'webkitTransitionEnd';
  6740. }
  6741. if (window.onanimationend === undefined &&
  6742. window.onwebkitanimationend !== undefined
  6743. ) {
  6744. animationProp = 'WebkitAnimation';
  6745. animationEndEvent = 'webkitAnimationEnd';
  6746. }
  6747. }
  6748. // binding to window is necessary to make hot reload work in IE in strict mode
  6749. var raf = inBrowser
  6750. ? window.requestAnimationFrame
  6751. ? window.requestAnimationFrame.bind(window)
  6752. : setTimeout
  6753. : /* istanbul ignore next */ function (fn) { return fn(); };
  6754. function nextFrame (fn) {
  6755. raf(function () {
  6756. raf(fn);
  6757. });
  6758. }
  6759. function addTransitionClass (el, cls) {
  6760. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  6761. if (transitionClasses.indexOf(cls) < 0) {
  6762. transitionClasses.push(cls);
  6763. addClass(el, cls);
  6764. }
  6765. }
  6766. function removeTransitionClass (el, cls) {
  6767. if (el._transitionClasses) {
  6768. remove(el._transitionClasses, cls);
  6769. }
  6770. removeClass(el, cls);
  6771. }
  6772. function whenTransitionEnds (
  6773. el,
  6774. expectedType,
  6775. cb
  6776. ) {
  6777. var ref = getTransitionInfo(el, expectedType);
  6778. var type = ref.type;
  6779. var timeout = ref.timeout;
  6780. var propCount = ref.propCount;
  6781. if (!type) { return cb() }
  6782. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  6783. var ended = 0;
  6784. var end = function () {
  6785. el.removeEventListener(event, onEnd);
  6786. cb();
  6787. };
  6788. var onEnd = function (e) {
  6789. if (e.target === el) {
  6790. if (++ended >= propCount) {
  6791. end();
  6792. }
  6793. }
  6794. };
  6795. setTimeout(function () {
  6796. if (ended < propCount) {
  6797. end();
  6798. }
  6799. }, timeout + 1);
  6800. el.addEventListener(event, onEnd);
  6801. }
  6802. var transformRE = /\b(transform|all)(,|$)/;
  6803. function getTransitionInfo (el, expectedType) {
  6804. var styles = window.getComputedStyle(el);
  6805. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  6806. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  6807. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  6808. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  6809. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  6810. var animationTimeout = getTimeout(animationDelays, animationDurations);
  6811. var type;
  6812. var timeout = 0;
  6813. var propCount = 0;
  6814. /* istanbul ignore if */
  6815. if (expectedType === TRANSITION) {
  6816. if (transitionTimeout > 0) {
  6817. type = TRANSITION;
  6818. timeout = transitionTimeout;
  6819. propCount = transitionDurations.length;
  6820. }
  6821. } else if (expectedType === ANIMATION) {
  6822. if (animationTimeout > 0) {
  6823. type = ANIMATION;
  6824. timeout = animationTimeout;
  6825. propCount = animationDurations.length;
  6826. }
  6827. } else {
  6828. timeout = Math.max(transitionTimeout, animationTimeout);
  6829. type = timeout > 0
  6830. ? transitionTimeout > animationTimeout
  6831. ? TRANSITION
  6832. : ANIMATION
  6833. : null;
  6834. propCount = type
  6835. ? type === TRANSITION
  6836. ? transitionDurations.length
  6837. : animationDurations.length
  6838. : 0;
  6839. }
  6840. var hasTransform =
  6841. type === TRANSITION &&
  6842. transformRE.test(styles[transitionProp + 'Property']);
  6843. return {
  6844. type: type,
  6845. timeout: timeout,
  6846. propCount: propCount,
  6847. hasTransform: hasTransform
  6848. }
  6849. }
  6850. function getTimeout (delays, durations) {
  6851. /* istanbul ignore next */
  6852. while (delays.length < durations.length) {
  6853. delays = delays.concat(delays);
  6854. }
  6855. return Math.max.apply(null, durations.map(function (d, i) {
  6856. return toMs(d) + toMs(delays[i])
  6857. }))
  6858. }
  6859. function toMs (s) {
  6860. return Number(s.slice(0, -1)) * 1000
  6861. }
  6862. /* */
  6863. function enter (vnode, toggleDisplay) {
  6864. var el = vnode.elm;
  6865. // call leave callback now
  6866. if (isDef(el._leaveCb)) {
  6867. el._leaveCb.cancelled = true;
  6868. el._leaveCb();
  6869. }
  6870. var data = resolveTransition(vnode.data.transition);
  6871. if (isUndef(data)) {
  6872. return
  6873. }
  6874. /* istanbul ignore if */
  6875. if (isDef(el._enterCb) || el.nodeType !== 1) {
  6876. return
  6877. }
  6878. var css = data.css;
  6879. var type = data.type;
  6880. var enterClass = data.enterClass;
  6881. var enterToClass = data.enterToClass;
  6882. var enterActiveClass = data.enterActiveClass;
  6883. var appearClass = data.appearClass;
  6884. var appearToClass = data.appearToClass;
  6885. var appearActiveClass = data.appearActiveClass;
  6886. var beforeEnter = data.beforeEnter;
  6887. var enter = data.enter;
  6888. var afterEnter = data.afterEnter;
  6889. var enterCancelled = data.enterCancelled;
  6890. var beforeAppear = data.beforeAppear;
  6891. var appear = data.appear;
  6892. var afterAppear = data.afterAppear;
  6893. var appearCancelled = data.appearCancelled;
  6894. var duration = data.duration;
  6895. // activeInstance will always be the <transition> component managing this
  6896. // transition. One edge case to check is when the <transition> is placed
  6897. // as the root node of a child component. In that case we need to check
  6898. // <transition>'s parent for appear check.
  6899. var context = activeInstance;
  6900. var transitionNode = activeInstance.$vnode;
  6901. while (transitionNode && transitionNode.parent) {
  6902. transitionNode = transitionNode.parent;
  6903. context = transitionNode.context;
  6904. }
  6905. var isAppear = !context._isMounted || !vnode.isRootInsert;
  6906. if (isAppear && !appear && appear !== '') {
  6907. return
  6908. }
  6909. var startClass = isAppear && appearClass
  6910. ? appearClass
  6911. : enterClass;
  6912. var activeClass = isAppear && appearActiveClass
  6913. ? appearActiveClass
  6914. : enterActiveClass;
  6915. var toClass = isAppear && appearToClass
  6916. ? appearToClass
  6917. : enterToClass;
  6918. var beforeEnterHook = isAppear
  6919. ? (beforeAppear || beforeEnter)
  6920. : beforeEnter;
  6921. var enterHook = isAppear
  6922. ? (typeof appear === 'function' ? appear : enter)
  6923. : enter;
  6924. var afterEnterHook = isAppear
  6925. ? (afterAppear || afterEnter)
  6926. : afterEnter;
  6927. var enterCancelledHook = isAppear
  6928. ? (appearCancelled || enterCancelled)
  6929. : enterCancelled;
  6930. var explicitEnterDuration = toNumber(
  6931. isObject(duration)
  6932. ? duration.enter
  6933. : duration
  6934. );
  6935. if ("development" !== 'production' && explicitEnterDuration != null) {
  6936. checkDuration(explicitEnterDuration, 'enter', vnode);
  6937. }
  6938. var expectsCSS = css !== false && !isIE9;
  6939. var userWantsControl = getHookArgumentsLength(enterHook);
  6940. var cb = el._enterCb = once(function () {
  6941. if (expectsCSS) {
  6942. removeTransitionClass(el, toClass);
  6943. removeTransitionClass(el, activeClass);
  6944. }
  6945. if (cb.cancelled) {
  6946. if (expectsCSS) {
  6947. removeTransitionClass(el, startClass);
  6948. }
  6949. enterCancelledHook && enterCancelledHook(el);
  6950. } else {
  6951. afterEnterHook && afterEnterHook(el);
  6952. }
  6953. el._enterCb = null;
  6954. });
  6955. if (!vnode.data.show) {
  6956. // remove pending leave element on enter by injecting an insert hook
  6957. mergeVNodeHook(vnode, 'insert', function () {
  6958. var parent = el.parentNode;
  6959. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  6960. if (pendingNode &&
  6961. pendingNode.tag === vnode.tag &&
  6962. pendingNode.elm._leaveCb
  6963. ) {
  6964. pendingNode.elm._leaveCb();
  6965. }
  6966. enterHook && enterHook(el, cb);
  6967. });
  6968. }
  6969. // start enter transition
  6970. beforeEnterHook && beforeEnterHook(el);
  6971. if (expectsCSS) {
  6972. addTransitionClass(el, startClass);
  6973. addTransitionClass(el, activeClass);
  6974. nextFrame(function () {
  6975. removeTransitionClass(el, startClass);
  6976. if (!cb.cancelled) {
  6977. addTransitionClass(el, toClass);
  6978. if (!userWantsControl) {
  6979. if (isValidDuration(explicitEnterDuration)) {
  6980. setTimeout(cb, explicitEnterDuration);
  6981. } else {
  6982. whenTransitionEnds(el, type, cb);
  6983. }
  6984. }
  6985. }
  6986. });
  6987. }
  6988. if (vnode.data.show) {
  6989. toggleDisplay && toggleDisplay();
  6990. enterHook && enterHook(el, cb);
  6991. }
  6992. if (!expectsCSS && !userWantsControl) {
  6993. cb();
  6994. }
  6995. }
  6996. function leave (vnode, rm) {
  6997. var el = vnode.elm;
  6998. // call enter callback now
  6999. if (isDef(el._enterCb)) {
  7000. el._enterCb.cancelled = true;
  7001. el._enterCb();
  7002. }
  7003. var data = resolveTransition(vnode.data.transition);
  7004. if (isUndef(data) || el.nodeType !== 1) {
  7005. return rm()
  7006. }
  7007. /* istanbul ignore if */
  7008. if (isDef(el._leaveCb)) {
  7009. return
  7010. }
  7011. var css = data.css;
  7012. var type = data.type;
  7013. var leaveClass = data.leaveClass;
  7014. var leaveToClass = data.leaveToClass;
  7015. var leaveActiveClass = data.leaveActiveClass;
  7016. var beforeLeave = data.beforeLeave;
  7017. var leave = data.leave;
  7018. var afterLeave = data.afterLeave;
  7019. var leaveCancelled = data.leaveCancelled;
  7020. var delayLeave = data.delayLeave;
  7021. var duration = data.duration;
  7022. var expectsCSS = css !== false && !isIE9;
  7023. var userWantsControl = getHookArgumentsLength(leave);
  7024. var explicitLeaveDuration = toNumber(
  7025. isObject(duration)
  7026. ? duration.leave
  7027. : duration
  7028. );
  7029. if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
  7030. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7031. }
  7032. var cb = el._leaveCb = once(function () {
  7033. if (el.parentNode && el.parentNode._pending) {
  7034. el.parentNode._pending[vnode.key] = null;
  7035. }
  7036. if (expectsCSS) {
  7037. removeTransitionClass(el, leaveToClass);
  7038. removeTransitionClass(el, leaveActiveClass);
  7039. }
  7040. if (cb.cancelled) {
  7041. if (expectsCSS) {
  7042. removeTransitionClass(el, leaveClass);
  7043. }
  7044. leaveCancelled && leaveCancelled(el);
  7045. } else {
  7046. rm();
  7047. afterLeave && afterLeave(el);
  7048. }
  7049. el._leaveCb = null;
  7050. });
  7051. if (delayLeave) {
  7052. delayLeave(performLeave);
  7053. } else {
  7054. performLeave();
  7055. }
  7056. function performLeave () {
  7057. // the delayed leave may have already been cancelled
  7058. if (cb.cancelled) {
  7059. return
  7060. }
  7061. // record leaving element
  7062. if (!vnode.data.show) {
  7063. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7064. }
  7065. beforeLeave && beforeLeave(el);
  7066. if (expectsCSS) {
  7067. addTransitionClass(el, leaveClass);
  7068. addTransitionClass(el, leaveActiveClass);
  7069. nextFrame(function () {
  7070. removeTransitionClass(el, leaveClass);
  7071. if (!cb.cancelled) {
  7072. addTransitionClass(el, leaveToClass);
  7073. if (!userWantsControl) {
  7074. if (isValidDuration(explicitLeaveDuration)) {
  7075. setTimeout(cb, explicitLeaveDuration);
  7076. } else {
  7077. whenTransitionEnds(el, type, cb);
  7078. }
  7079. }
  7080. }
  7081. });
  7082. }
  7083. leave && leave(el, cb);
  7084. if (!expectsCSS && !userWantsControl) {
  7085. cb();
  7086. }
  7087. }
  7088. }
  7089. // only used in dev mode
  7090. function checkDuration (val, name, vnode) {
  7091. if (typeof val !== 'number') {
  7092. warn(
  7093. "<transition> explicit " + name + " duration is not a valid number - " +
  7094. "got " + (JSON.stringify(val)) + ".",
  7095. vnode.context
  7096. );
  7097. } else if (isNaN(val)) {
  7098. warn(
  7099. "<transition> explicit " + name + " duration is NaN - " +
  7100. 'the duration expression might be incorrect.',
  7101. vnode.context
  7102. );
  7103. }
  7104. }
  7105. function isValidDuration (val) {
  7106. return typeof val === 'number' && !isNaN(val)
  7107. }
  7108. /**
  7109. * Normalize a transition hook's argument length. The hook may be:
  7110. * - a merged hook (invoker) with the original in .fns
  7111. * - a wrapped component method (check ._length)
  7112. * - a plain function (.length)
  7113. */
  7114. function getHookArgumentsLength (fn) {
  7115. if (isUndef(fn)) {
  7116. return false
  7117. }
  7118. var invokerFns = fn.fns;
  7119. if (isDef(invokerFns)) {
  7120. // invoker
  7121. return getHookArgumentsLength(
  7122. Array.isArray(invokerFns)
  7123. ? invokerFns[0]
  7124. : invokerFns
  7125. )
  7126. } else {
  7127. return (fn._length || fn.length) > 1
  7128. }
  7129. }
  7130. function _enter (_, vnode) {
  7131. if (vnode.data.show !== true) {
  7132. enter(vnode);
  7133. }
  7134. }
  7135. var transition = inBrowser ? {
  7136. create: _enter,
  7137. activate: _enter,
  7138. remove: function remove$$1 (vnode, rm) {
  7139. /* istanbul ignore else */
  7140. if (vnode.data.show !== true) {
  7141. leave(vnode, rm);
  7142. } else {
  7143. rm();
  7144. }
  7145. }
  7146. } : {}
  7147. var platformModules = [
  7148. attrs,
  7149. klass,
  7150. events,
  7151. domProps,
  7152. style,
  7153. transition
  7154. ]
  7155. /* */
  7156. // the directive module should be applied last, after all
  7157. // built-in modules have been applied.
  7158. var modules = platformModules.concat(baseModules);
  7159. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7160. /**
  7161. * Not type checking this file because flow doesn't like attaching
  7162. * properties to Elements.
  7163. */
  7164. /* istanbul ignore if */
  7165. if (isIE9) {
  7166. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7167. document.addEventListener('selectionchange', function () {
  7168. var el = document.activeElement;
  7169. if (el && el.vmodel) {
  7170. trigger(el, 'input');
  7171. }
  7172. });
  7173. }
  7174. var directive = {
  7175. inserted: function inserted (el, binding, vnode, oldVnode) {
  7176. if (vnode.tag === 'select') {
  7177. // #6903
  7178. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7179. mergeVNodeHook(vnode, 'postpatch', function () {
  7180. directive.componentUpdated(el, binding, vnode);
  7181. });
  7182. } else {
  7183. setSelected(el, binding, vnode.context);
  7184. }
  7185. el._vOptions = [].map.call(el.options, getValue);
  7186. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7187. el._vModifiers = binding.modifiers;
  7188. if (!binding.modifiers.lazy) {
  7189. el.addEventListener('compositionstart', onCompositionStart);
  7190. el.addEventListener('compositionend', onCompositionEnd);
  7191. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7192. // switching focus before confirming composition choice
  7193. // this also fixes the issue where some browsers e.g. iOS Chrome
  7194. // fires "change" instead of "input" on autocomplete.
  7195. el.addEventListener('change', onCompositionEnd);
  7196. /* istanbul ignore if */
  7197. if (isIE9) {
  7198. el.vmodel = true;
  7199. }
  7200. }
  7201. }
  7202. },
  7203. componentUpdated: function componentUpdated (el, binding, vnode) {
  7204. if (vnode.tag === 'select') {
  7205. setSelected(el, binding, vnode.context);
  7206. // in case the options rendered by v-for have changed,
  7207. // it's possible that the value is out-of-sync with the rendered options.
  7208. // detect such cases and filter out values that no longer has a matching
  7209. // option in the DOM.
  7210. var prevOptions = el._vOptions;
  7211. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7212. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7213. // trigger change event if
  7214. // no matching option found for at least one value
  7215. var needReset = el.multiple
  7216. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7217. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7218. if (needReset) {
  7219. trigger(el, 'change');
  7220. }
  7221. }
  7222. }
  7223. }
  7224. };
  7225. function setSelected (el, binding, vm) {
  7226. actuallySetSelected(el, binding, vm);
  7227. /* istanbul ignore if */
  7228. if (isIE || isEdge) {
  7229. setTimeout(function () {
  7230. actuallySetSelected(el, binding, vm);
  7231. }, 0);
  7232. }
  7233. }
  7234. function actuallySetSelected (el, binding, vm) {
  7235. var value = binding.value;
  7236. var isMultiple = el.multiple;
  7237. if (isMultiple && !Array.isArray(value)) {
  7238. "development" !== 'production' && warn(
  7239. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7240. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7241. vm
  7242. );
  7243. return
  7244. }
  7245. var selected, option;
  7246. for (var i = 0, l = el.options.length; i < l; i++) {
  7247. option = el.options[i];
  7248. if (isMultiple) {
  7249. selected = looseIndexOf(value, getValue(option)) > -1;
  7250. if (option.selected !== selected) {
  7251. option.selected = selected;
  7252. }
  7253. } else {
  7254. if (looseEqual(getValue(option), value)) {
  7255. if (el.selectedIndex !== i) {
  7256. el.selectedIndex = i;
  7257. }
  7258. return
  7259. }
  7260. }
  7261. }
  7262. if (!isMultiple) {
  7263. el.selectedIndex = -1;
  7264. }
  7265. }
  7266. function hasNoMatchingOption (value, options) {
  7267. return options.every(function (o) { return !looseEqual(o, value); })
  7268. }
  7269. function getValue (option) {
  7270. return '_value' in option
  7271. ? option._value
  7272. : option.value
  7273. }
  7274. function onCompositionStart (e) {
  7275. e.target.composing = true;
  7276. }
  7277. function onCompositionEnd (e) {
  7278. // prevent triggering an input event for no reason
  7279. if (!e.target.composing) { return }
  7280. e.target.composing = false;
  7281. trigger(e.target, 'input');
  7282. }
  7283. function trigger (el, type) {
  7284. var e = document.createEvent('HTMLEvents');
  7285. e.initEvent(type, true, true);
  7286. el.dispatchEvent(e);
  7287. }
  7288. /* */
  7289. // recursively search for possible transition defined inside the component root
  7290. function locateNode (vnode) {
  7291. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7292. ? locateNode(vnode.componentInstance._vnode)
  7293. : vnode
  7294. }
  7295. var show = {
  7296. bind: function bind (el, ref, vnode) {
  7297. var value = ref.value;
  7298. vnode = locateNode(vnode);
  7299. var transition$$1 = vnode.data && vnode.data.transition;
  7300. var originalDisplay = el.__vOriginalDisplay =
  7301. el.style.display === 'none' ? '' : el.style.display;
  7302. if (value && transition$$1) {
  7303. vnode.data.show = true;
  7304. enter(vnode, function () {
  7305. el.style.display = originalDisplay;
  7306. });
  7307. } else {
  7308. el.style.display = value ? originalDisplay : 'none';
  7309. }
  7310. },
  7311. update: function update (el, ref, vnode) {
  7312. var value = ref.value;
  7313. var oldValue = ref.oldValue;
  7314. /* istanbul ignore if */
  7315. if (!value === !oldValue) { return }
  7316. vnode = locateNode(vnode);
  7317. var transition$$1 = vnode.data && vnode.data.transition;
  7318. if (transition$$1) {
  7319. vnode.data.show = true;
  7320. if (value) {
  7321. enter(vnode, function () {
  7322. el.style.display = el.__vOriginalDisplay;
  7323. });
  7324. } else {
  7325. leave(vnode, function () {
  7326. el.style.display = 'none';
  7327. });
  7328. }
  7329. } else {
  7330. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7331. }
  7332. },
  7333. unbind: function unbind (
  7334. el,
  7335. binding,
  7336. vnode,
  7337. oldVnode,
  7338. isDestroy
  7339. ) {
  7340. if (!isDestroy) {
  7341. el.style.display = el.__vOriginalDisplay;
  7342. }
  7343. }
  7344. }
  7345. var platformDirectives = {
  7346. model: directive,
  7347. show: show
  7348. }
  7349. /* */
  7350. // Provides transition support for a single element/component.
  7351. // supports transition mode (out-in / in-out)
  7352. var transitionProps = {
  7353. name: String,
  7354. appear: Boolean,
  7355. css: Boolean,
  7356. mode: String,
  7357. type: String,
  7358. enterClass: String,
  7359. leaveClass: String,
  7360. enterToClass: String,
  7361. leaveToClass: String,
  7362. enterActiveClass: String,
  7363. leaveActiveClass: String,
  7364. appearClass: String,
  7365. appearActiveClass: String,
  7366. appearToClass: String,
  7367. duration: [Number, String, Object]
  7368. };
  7369. // in case the child is also an abstract component, e.g. <keep-alive>
  7370. // we want to recursively retrieve the real component to be rendered
  7371. function getRealChild (vnode) {
  7372. var compOptions = vnode && vnode.componentOptions;
  7373. if (compOptions && compOptions.Ctor.options.abstract) {
  7374. return getRealChild(getFirstComponentChild(compOptions.children))
  7375. } else {
  7376. return vnode
  7377. }
  7378. }
  7379. function extractTransitionData (comp) {
  7380. var data = {};
  7381. var options = comp.$options;
  7382. // props
  7383. for (var key in options.propsData) {
  7384. data[key] = comp[key];
  7385. }
  7386. // events.
  7387. // extract listeners and pass them directly to the transition methods
  7388. var listeners = options._parentListeners;
  7389. for (var key$1 in listeners) {
  7390. data[camelize(key$1)] = listeners[key$1];
  7391. }
  7392. return data
  7393. }
  7394. function placeholder (h, rawChild) {
  7395. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7396. return h('keep-alive', {
  7397. props: rawChild.componentOptions.propsData
  7398. })
  7399. }
  7400. }
  7401. function hasParentTransition (vnode) {
  7402. while ((vnode = vnode.parent)) {
  7403. if (vnode.data.transition) {
  7404. return true
  7405. }
  7406. }
  7407. }
  7408. function isSameChild (child, oldChild) {
  7409. return oldChild.key === child.key && oldChild.tag === child.tag
  7410. }
  7411. var Transition = {
  7412. name: 'transition',
  7413. props: transitionProps,
  7414. abstract: true,
  7415. render: function render (h) {
  7416. var this$1 = this;
  7417. var children = this.$slots.default;
  7418. if (!children) {
  7419. return
  7420. }
  7421. // filter out text nodes (possible whitespaces)
  7422. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  7423. /* istanbul ignore if */
  7424. if (!children.length) {
  7425. return
  7426. }
  7427. // warn multiple elements
  7428. if ("development" !== 'production' && children.length > 1) {
  7429. warn(
  7430. '<transition> can only be used on a single element. Use ' +
  7431. '<transition-group> for lists.',
  7432. this.$parent
  7433. );
  7434. }
  7435. var mode = this.mode;
  7436. // warn invalid mode
  7437. if ("development" !== 'production' &&
  7438. mode && mode !== 'in-out' && mode !== 'out-in'
  7439. ) {
  7440. warn(
  7441. 'invalid <transition> mode: ' + mode,
  7442. this.$parent
  7443. );
  7444. }
  7445. var rawChild = children[0];
  7446. // if this is a component root node and the component's
  7447. // parent container node also has transition, skip.
  7448. if (hasParentTransition(this.$vnode)) {
  7449. return rawChild
  7450. }
  7451. // apply transition data to child
  7452. // use getRealChild() to ignore abstract components e.g. keep-alive
  7453. var child = getRealChild(rawChild);
  7454. /* istanbul ignore if */
  7455. if (!child) {
  7456. return rawChild
  7457. }
  7458. if (this._leaving) {
  7459. return placeholder(h, rawChild)
  7460. }
  7461. // ensure a key that is unique to the vnode type and to this transition
  7462. // component instance. This key will be used to remove pending leaving nodes
  7463. // during entering.
  7464. var id = "__transition-" + (this._uid) + "-";
  7465. child.key = child.key == null
  7466. ? child.isComment
  7467. ? id + 'comment'
  7468. : id + child.tag
  7469. : isPrimitive(child.key)
  7470. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7471. : child.key;
  7472. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7473. var oldRawChild = this._vnode;
  7474. var oldChild = getRealChild(oldRawChild);
  7475. // mark v-show
  7476. // so that the transition module can hand over the control to the directive
  7477. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  7478. child.data.show = true;
  7479. }
  7480. if (
  7481. oldChild &&
  7482. oldChild.data &&
  7483. !isSameChild(child, oldChild) &&
  7484. !isAsyncPlaceholder(oldChild) &&
  7485. // #6687 component root is a comment node
  7486. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7487. ) {
  7488. // replace old child transition data with fresh one
  7489. // important for dynamic transitions!
  7490. var oldData = oldChild.data.transition = extend({}, data);
  7491. // handle transition mode
  7492. if (mode === 'out-in') {
  7493. // return placeholder node and queue update when leave finishes
  7494. this._leaving = true;
  7495. mergeVNodeHook(oldData, 'afterLeave', function () {
  7496. this$1._leaving = false;
  7497. this$1.$forceUpdate();
  7498. });
  7499. return placeholder(h, rawChild)
  7500. } else if (mode === 'in-out') {
  7501. if (isAsyncPlaceholder(child)) {
  7502. return oldRawChild
  7503. }
  7504. var delayedLeave;
  7505. var performLeave = function () { delayedLeave(); };
  7506. mergeVNodeHook(data, 'afterEnter', performLeave);
  7507. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7508. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7509. }
  7510. }
  7511. return rawChild
  7512. }
  7513. }
  7514. /* */
  7515. // Provides transition support for list items.
  7516. // supports move transitions using the FLIP technique.
  7517. // Because the vdom's children update algorithm is "unstable" - i.e.
  7518. // it doesn't guarantee the relative positioning of removed elements,
  7519. // we force transition-group to update its children into two passes:
  7520. // in the first pass, we remove all nodes that need to be removed,
  7521. // triggering their leaving transition; in the second pass, we insert/move
  7522. // into the final desired state. This way in the second pass removed
  7523. // nodes will remain where they should be.
  7524. var props = extend({
  7525. tag: String,
  7526. moveClass: String
  7527. }, transitionProps);
  7528. delete props.mode;
  7529. var TransitionGroup = {
  7530. props: props,
  7531. render: function render (h) {
  7532. var tag = this.tag || this.$vnode.data.tag || 'span';
  7533. var map = Object.create(null);
  7534. var prevChildren = this.prevChildren = this.children;
  7535. var rawChildren = this.$slots.default || [];
  7536. var children = this.children = [];
  7537. var transitionData = extractTransitionData(this);
  7538. for (var i = 0; i < rawChildren.length; i++) {
  7539. var c = rawChildren[i];
  7540. if (c.tag) {
  7541. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  7542. children.push(c);
  7543. map[c.key] = c
  7544. ;(c.data || (c.data = {})).transition = transitionData;
  7545. } else {
  7546. var opts = c.componentOptions;
  7547. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  7548. warn(("<transition-group> children must be keyed: <" + name + ">"));
  7549. }
  7550. }
  7551. }
  7552. if (prevChildren) {
  7553. var kept = [];
  7554. var removed = [];
  7555. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  7556. var c$1 = prevChildren[i$1];
  7557. c$1.data.transition = transitionData;
  7558. c$1.data.pos = c$1.elm.getBoundingClientRect();
  7559. if (map[c$1.key]) {
  7560. kept.push(c$1);
  7561. } else {
  7562. removed.push(c$1);
  7563. }
  7564. }
  7565. this.kept = h(tag, null, kept);
  7566. this.removed = removed;
  7567. }
  7568. return h(tag, null, children)
  7569. },
  7570. beforeUpdate: function beforeUpdate () {
  7571. // force removing pass
  7572. this.__patch__(
  7573. this._vnode,
  7574. this.kept,
  7575. false, // hydrating
  7576. true // removeOnly (!important, avoids unnecessary moves)
  7577. );
  7578. this._vnode = this.kept;
  7579. },
  7580. updated: function updated () {
  7581. var children = this.prevChildren;
  7582. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  7583. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  7584. return
  7585. }
  7586. // we divide the work into three loops to avoid mixing DOM reads and writes
  7587. // in each iteration - which helps prevent layout thrashing.
  7588. children.forEach(callPendingCbs);
  7589. children.forEach(recordPosition);
  7590. children.forEach(applyTranslation);
  7591. // force reflow to put everything in position
  7592. // assign to this to avoid being removed in tree-shaking
  7593. // $flow-disable-line
  7594. this._reflow = document.body.offsetHeight;
  7595. children.forEach(function (c) {
  7596. if (c.data.moved) {
  7597. var el = c.elm;
  7598. var s = el.style;
  7599. addTransitionClass(el, moveClass);
  7600. s.transform = s.WebkitTransform = s.transitionDuration = '';
  7601. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  7602. if (!e || /transform$/.test(e.propertyName)) {
  7603. el.removeEventListener(transitionEndEvent, cb);
  7604. el._moveCb = null;
  7605. removeTransitionClass(el, moveClass);
  7606. }
  7607. });
  7608. }
  7609. });
  7610. },
  7611. methods: {
  7612. hasMove: function hasMove (el, moveClass) {
  7613. /* istanbul ignore if */
  7614. if (!hasTransition) {
  7615. return false
  7616. }
  7617. /* istanbul ignore if */
  7618. if (this._hasMove) {
  7619. return this._hasMove
  7620. }
  7621. // Detect whether an element with the move class applied has
  7622. // CSS transitions. Since the element may be inside an entering
  7623. // transition at this very moment, we make a clone of it and remove
  7624. // all other transition classes applied to ensure only the move class
  7625. // is applied.
  7626. var clone = el.cloneNode();
  7627. if (el._transitionClasses) {
  7628. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  7629. }
  7630. addClass(clone, moveClass);
  7631. clone.style.display = 'none';
  7632. this.$el.appendChild(clone);
  7633. var info = getTransitionInfo(clone);
  7634. this.$el.removeChild(clone);
  7635. return (this._hasMove = info.hasTransform)
  7636. }
  7637. }
  7638. }
  7639. function callPendingCbs (c) {
  7640. /* istanbul ignore if */
  7641. if (c.elm._moveCb) {
  7642. c.elm._moveCb();
  7643. }
  7644. /* istanbul ignore if */
  7645. if (c.elm._enterCb) {
  7646. c.elm._enterCb();
  7647. }
  7648. }
  7649. function recordPosition (c) {
  7650. c.data.newPos = c.elm.getBoundingClientRect();
  7651. }
  7652. function applyTranslation (c) {
  7653. var oldPos = c.data.pos;
  7654. var newPos = c.data.newPos;
  7655. var dx = oldPos.left - newPos.left;
  7656. var dy = oldPos.top - newPos.top;
  7657. if (dx || dy) {
  7658. c.data.moved = true;
  7659. var s = c.elm.style;
  7660. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  7661. s.transitionDuration = '0s';
  7662. }
  7663. }
  7664. var platformComponents = {
  7665. Transition: Transition,
  7666. TransitionGroup: TransitionGroup
  7667. }
  7668. /* */
  7669. // install platform specific utils
  7670. Vue.config.mustUseProp = mustUseProp;
  7671. Vue.config.isReservedTag = isReservedTag;
  7672. Vue.config.isReservedAttr = isReservedAttr;
  7673. Vue.config.getTagNamespace = getTagNamespace;
  7674. Vue.config.isUnknownElement = isUnknownElement;
  7675. // install platform runtime directives & components
  7676. extend(Vue.options.directives, platformDirectives);
  7677. extend(Vue.options.components, platformComponents);
  7678. // install platform patch function
  7679. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  7680. // public mount method
  7681. Vue.prototype.$mount = function (
  7682. el,
  7683. hydrating
  7684. ) {
  7685. el = el && inBrowser ? query(el) : undefined;
  7686. return mountComponent(this, el, hydrating)
  7687. };
  7688. // devtools global hook
  7689. /* istanbul ignore next */
  7690. if (inBrowser) {
  7691. setTimeout(function () {
  7692. if (config.devtools) {
  7693. if (devtools) {
  7694. devtools.emit('init', Vue);
  7695. } else if (
  7696. "development" !== 'production' &&
  7697. "development" !== 'test' &&
  7698. isChrome
  7699. ) {
  7700. console[console.info ? 'info' : 'log'](
  7701. 'Download the Vue Devtools extension for a better development experience:\n' +
  7702. 'https://github.com/vuejs/vue-devtools'
  7703. );
  7704. }
  7705. }
  7706. if ("development" !== 'production' &&
  7707. "development" !== 'test' &&
  7708. config.productionTip !== false &&
  7709. typeof console !== 'undefined'
  7710. ) {
  7711. console[console.info ? 'info' : 'log'](
  7712. "You are running Vue in development mode.\n" +
  7713. "Make sure to turn on production mode when deploying for production.\n" +
  7714. "See more tips at https://vuejs.org/guide/deployment.html"
  7715. );
  7716. }
  7717. }, 0);
  7718. }
  7719. /* */
  7720. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  7721. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  7722. var buildRegex = cached(function (delimiters) {
  7723. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  7724. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  7725. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  7726. });
  7727. function parseText (
  7728. text,
  7729. delimiters
  7730. ) {
  7731. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  7732. if (!tagRE.test(text)) {
  7733. return
  7734. }
  7735. var tokens = [];
  7736. var rawTokens = [];
  7737. var lastIndex = tagRE.lastIndex = 0;
  7738. var match, index, tokenValue;
  7739. while ((match = tagRE.exec(text))) {
  7740. index = match.index;
  7741. // push text token
  7742. if (index > lastIndex) {
  7743. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  7744. tokens.push(JSON.stringify(tokenValue));
  7745. }
  7746. // tag token
  7747. var exp = parseFilters(match[1].trim());
  7748. tokens.push(("_s(" + exp + ")"));
  7749. rawTokens.push({ '@binding': exp });
  7750. lastIndex = index + match[0].length;
  7751. }
  7752. if (lastIndex < text.length) {
  7753. rawTokens.push(tokenValue = text.slice(lastIndex));
  7754. tokens.push(JSON.stringify(tokenValue));
  7755. }
  7756. return {
  7757. expression: tokens.join('+'),
  7758. tokens: rawTokens
  7759. }
  7760. }
  7761. /* */
  7762. function transformNode (el, options) {
  7763. var warn = options.warn || baseWarn;
  7764. var staticClass = getAndRemoveAttr(el, 'class');
  7765. if ("development" !== 'production' && staticClass) {
  7766. var res = parseText(staticClass, options.delimiters);
  7767. if (res) {
  7768. warn(
  7769. "class=\"" + staticClass + "\": " +
  7770. 'Interpolation inside attributes has been removed. ' +
  7771. 'Use v-bind or the colon shorthand instead. For example, ' +
  7772. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  7773. );
  7774. }
  7775. }
  7776. if (staticClass) {
  7777. el.staticClass = JSON.stringify(staticClass);
  7778. }
  7779. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  7780. if (classBinding) {
  7781. el.classBinding = classBinding;
  7782. }
  7783. }
  7784. function genData (el) {
  7785. var data = '';
  7786. if (el.staticClass) {
  7787. data += "staticClass:" + (el.staticClass) + ",";
  7788. }
  7789. if (el.classBinding) {
  7790. data += "class:" + (el.classBinding) + ",";
  7791. }
  7792. return data
  7793. }
  7794. var klass$1 = {
  7795. staticKeys: ['staticClass'],
  7796. transformNode: transformNode,
  7797. genData: genData
  7798. }
  7799. /* */
  7800. function transformNode$1 (el, options) {
  7801. var warn = options.warn || baseWarn;
  7802. var staticStyle = getAndRemoveAttr(el, 'style');
  7803. if (staticStyle) {
  7804. /* istanbul ignore if */
  7805. {
  7806. var res = parseText(staticStyle, options.delimiters);
  7807. if (res) {
  7808. warn(
  7809. "style=\"" + staticStyle + "\": " +
  7810. 'Interpolation inside attributes has been removed. ' +
  7811. 'Use v-bind or the colon shorthand instead. For example, ' +
  7812. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  7813. );
  7814. }
  7815. }
  7816. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  7817. }
  7818. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  7819. if (styleBinding) {
  7820. el.styleBinding = styleBinding;
  7821. }
  7822. }
  7823. function genData$1 (el) {
  7824. var data = '';
  7825. if (el.staticStyle) {
  7826. data += "staticStyle:" + (el.staticStyle) + ",";
  7827. }
  7828. if (el.styleBinding) {
  7829. data += "style:(" + (el.styleBinding) + "),";
  7830. }
  7831. return data
  7832. }
  7833. var style$1 = {
  7834. staticKeys: ['staticStyle'],
  7835. transformNode: transformNode$1,
  7836. genData: genData$1
  7837. }
  7838. /* */
  7839. var decoder;
  7840. var he = {
  7841. decode: function decode (html) {
  7842. decoder = decoder || document.createElement('div');
  7843. decoder.innerHTML = html;
  7844. return decoder.textContent
  7845. }
  7846. }
  7847. /* */
  7848. var isUnaryTag = makeMap(
  7849. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  7850. 'link,meta,param,source,track,wbr'
  7851. );
  7852. // Elements that you can, intentionally, leave open
  7853. // (and which close themselves)
  7854. var canBeLeftOpenTag = makeMap(
  7855. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  7856. );
  7857. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  7858. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  7859. var isNonPhrasingTag = makeMap(
  7860. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  7861. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  7862. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  7863. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  7864. 'title,tr,track'
  7865. );
  7866. /**
  7867. * Not type-checking this file because it's mostly vendor code.
  7868. */
  7869. /*!
  7870. * HTML Parser By John Resig (ejohn.org)
  7871. * Modified by Juriy "kangax" Zaytsev
  7872. * Original code by Erik Arvidsson, Mozilla Public License
  7873. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  7874. */
  7875. // Regular Expressions for parsing tags and attributes
  7876. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  7877. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  7878. // but for Vue templates we can enforce a simple charset
  7879. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  7880. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  7881. var startTagOpen = new RegExp(("^<" + qnameCapture));
  7882. var startTagClose = /^\s*(\/?)>/;
  7883. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  7884. var doctype = /^<!DOCTYPE [^>]+>/i;
  7885. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  7886. var comment = /^<!\--/;
  7887. var conditionalComment = /^<!\[/;
  7888. var IS_REGEX_CAPTURING_BROKEN = false;
  7889. 'x'.replace(/x(.)?/g, function (m, g) {
  7890. IS_REGEX_CAPTURING_BROKEN = g === '';
  7891. });
  7892. // Special Elements (can contain anything)
  7893. var isPlainTextElement = makeMap('script,style,textarea', true);
  7894. var reCache = {};
  7895. var decodingMap = {
  7896. '&lt;': '<',
  7897. '&gt;': '>',
  7898. '&quot;': '"',
  7899. '&amp;': '&',
  7900. '&#10;': '\n',
  7901. '&#9;': '\t'
  7902. };
  7903. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  7904. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10|#9);/g;
  7905. // #5992
  7906. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  7907. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  7908. function decodeAttr (value, shouldDecodeNewlines) {
  7909. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  7910. return value.replace(re, function (match) { return decodingMap[match]; })
  7911. }
  7912. function parseHTML (html, options) {
  7913. var stack = [];
  7914. var expectHTML = options.expectHTML;
  7915. var isUnaryTag$$1 = options.isUnaryTag || no;
  7916. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  7917. var index = 0;
  7918. var last, lastTag;
  7919. while (html) {
  7920. last = html;
  7921. // Make sure we're not in a plaintext content element like script/style
  7922. if (!lastTag || !isPlainTextElement(lastTag)) {
  7923. var textEnd = html.indexOf('<');
  7924. if (textEnd === 0) {
  7925. // Comment:
  7926. if (comment.test(html)) {
  7927. var commentEnd = html.indexOf('-->');
  7928. if (commentEnd >= 0) {
  7929. if (options.shouldKeepComment) {
  7930. options.comment(html.substring(4, commentEnd));
  7931. }
  7932. advance(commentEnd + 3);
  7933. continue
  7934. }
  7935. }
  7936. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  7937. if (conditionalComment.test(html)) {
  7938. var conditionalEnd = html.indexOf(']>');
  7939. if (conditionalEnd >= 0) {
  7940. advance(conditionalEnd + 2);
  7941. continue
  7942. }
  7943. }
  7944. // Doctype:
  7945. var doctypeMatch = html.match(doctype);
  7946. if (doctypeMatch) {
  7947. advance(doctypeMatch[0].length);
  7948. continue
  7949. }
  7950. // End tag:
  7951. var endTagMatch = html.match(endTag);
  7952. if (endTagMatch) {
  7953. var curIndex = index;
  7954. advance(endTagMatch[0].length);
  7955. parseEndTag(endTagMatch[1], curIndex, index);
  7956. continue
  7957. }
  7958. // Start tag:
  7959. var startTagMatch = parseStartTag();
  7960. if (startTagMatch) {
  7961. handleStartTag(startTagMatch);
  7962. if (shouldIgnoreFirstNewline(lastTag, html)) {
  7963. advance(1);
  7964. }
  7965. continue
  7966. }
  7967. }
  7968. var text = (void 0), rest = (void 0), next = (void 0);
  7969. if (textEnd >= 0) {
  7970. rest = html.slice(textEnd);
  7971. while (
  7972. !endTag.test(rest) &&
  7973. !startTagOpen.test(rest) &&
  7974. !comment.test(rest) &&
  7975. !conditionalComment.test(rest)
  7976. ) {
  7977. // < in plain text, be forgiving and treat it as text
  7978. next = rest.indexOf('<', 1);
  7979. if (next < 0) { break }
  7980. textEnd += next;
  7981. rest = html.slice(textEnd);
  7982. }
  7983. text = html.substring(0, textEnd);
  7984. advance(textEnd);
  7985. }
  7986. if (textEnd < 0) {
  7987. text = html;
  7988. html = '';
  7989. }
  7990. if (options.chars && text) {
  7991. options.chars(text);
  7992. }
  7993. } else {
  7994. var endTagLength = 0;
  7995. var stackedTag = lastTag.toLowerCase();
  7996. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  7997. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  7998. endTagLength = endTag.length;
  7999. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8000. text = text
  8001. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8002. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8003. }
  8004. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8005. text = text.slice(1);
  8006. }
  8007. if (options.chars) {
  8008. options.chars(text);
  8009. }
  8010. return ''
  8011. });
  8012. index += html.length - rest$1.length;
  8013. html = rest$1;
  8014. parseEndTag(stackedTag, index - endTagLength, index);
  8015. }
  8016. if (html === last) {
  8017. options.chars && options.chars(html);
  8018. if ("development" !== 'production' && !stack.length && options.warn) {
  8019. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  8020. }
  8021. break
  8022. }
  8023. }
  8024. // Clean up any remaining tags
  8025. parseEndTag();
  8026. function advance (n) {
  8027. index += n;
  8028. html = html.substring(n);
  8029. }
  8030. function parseStartTag () {
  8031. var start = html.match(startTagOpen);
  8032. if (start) {
  8033. var match = {
  8034. tagName: start[1],
  8035. attrs: [],
  8036. start: index
  8037. };
  8038. advance(start[0].length);
  8039. var end, attr;
  8040. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  8041. advance(attr[0].length);
  8042. match.attrs.push(attr);
  8043. }
  8044. if (end) {
  8045. match.unarySlash = end[1];
  8046. advance(end[0].length);
  8047. match.end = index;
  8048. return match
  8049. }
  8050. }
  8051. }
  8052. function handleStartTag (match) {
  8053. var tagName = match.tagName;
  8054. var unarySlash = match.unarySlash;
  8055. if (expectHTML) {
  8056. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8057. parseEndTag(lastTag);
  8058. }
  8059. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8060. parseEndTag(tagName);
  8061. }
  8062. }
  8063. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8064. var l = match.attrs.length;
  8065. var attrs = new Array(l);
  8066. for (var i = 0; i < l; i++) {
  8067. var args = match.attrs[i];
  8068. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  8069. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  8070. if (args[3] === '') { delete args[3]; }
  8071. if (args[4] === '') { delete args[4]; }
  8072. if (args[5] === '') { delete args[5]; }
  8073. }
  8074. var value = args[3] || args[4] || args[5] || '';
  8075. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8076. ? options.shouldDecodeNewlinesForHref
  8077. : options.shouldDecodeNewlines;
  8078. attrs[i] = {
  8079. name: args[1],
  8080. value: decodeAttr(value, shouldDecodeNewlines)
  8081. };
  8082. }
  8083. if (!unary) {
  8084. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  8085. lastTag = tagName;
  8086. }
  8087. if (options.start) {
  8088. options.start(tagName, attrs, unary, match.start, match.end);
  8089. }
  8090. }
  8091. function parseEndTag (tagName, start, end) {
  8092. var pos, lowerCasedTagName;
  8093. if (start == null) { start = index; }
  8094. if (end == null) { end = index; }
  8095. if (tagName) {
  8096. lowerCasedTagName = tagName.toLowerCase();
  8097. }
  8098. // Find the closest opened tag of the same type
  8099. if (tagName) {
  8100. for (pos = stack.length - 1; pos >= 0; pos--) {
  8101. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8102. break
  8103. }
  8104. }
  8105. } else {
  8106. // If no tag name is provided, clean shop
  8107. pos = 0;
  8108. }
  8109. if (pos >= 0) {
  8110. // Close all the open elements, up the stack
  8111. for (var i = stack.length - 1; i >= pos; i--) {
  8112. if ("development" !== 'production' &&
  8113. (i > pos || !tagName) &&
  8114. options.warn
  8115. ) {
  8116. options.warn(
  8117. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  8118. );
  8119. }
  8120. if (options.end) {
  8121. options.end(stack[i].tag, start, end);
  8122. }
  8123. }
  8124. // Remove the open elements from the stack
  8125. stack.length = pos;
  8126. lastTag = pos && stack[pos - 1].tag;
  8127. } else if (lowerCasedTagName === 'br') {
  8128. if (options.start) {
  8129. options.start(tagName, [], true, start, end);
  8130. }
  8131. } else if (lowerCasedTagName === 'p') {
  8132. if (options.start) {
  8133. options.start(tagName, [], false, start, end);
  8134. }
  8135. if (options.end) {
  8136. options.end(tagName, start, end);
  8137. }
  8138. }
  8139. }
  8140. }
  8141. /* */
  8142. var onRE = /^@|^v-on:/;
  8143. var dirRE = /^v-|^@|^:/;
  8144. var forAliasRE = /([^]*?)\s+(?:in|of)\s+([^]*)/;
  8145. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8146. var stripParensRE = /^\(|\)$/g;
  8147. var argRE = /:(.*)$/;
  8148. var bindRE = /^:|^v-bind:/;
  8149. var modifierRE = /\.[^.]+/g;
  8150. var decodeHTMLCached = cached(he.decode);
  8151. // configurable state
  8152. var warn$2;
  8153. var delimiters;
  8154. var transforms;
  8155. var preTransforms;
  8156. var postTransforms;
  8157. var platformIsPreTag;
  8158. var platformMustUseProp;
  8159. var platformGetTagNamespace;
  8160. function createASTElement (
  8161. tag,
  8162. attrs,
  8163. parent
  8164. ) {
  8165. return {
  8166. type: 1,
  8167. tag: tag,
  8168. attrsList: attrs,
  8169. attrsMap: makeAttrsMap(attrs),
  8170. parent: parent,
  8171. children: []
  8172. }
  8173. }
  8174. /**
  8175. * Convert HTML string to AST.
  8176. */
  8177. function parse (
  8178. template,
  8179. options
  8180. ) {
  8181. warn$2 = options.warn || baseWarn;
  8182. platformIsPreTag = options.isPreTag || no;
  8183. platformMustUseProp = options.mustUseProp || no;
  8184. platformGetTagNamespace = options.getTagNamespace || no;
  8185. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8186. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8187. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8188. delimiters = options.delimiters;
  8189. var stack = [];
  8190. var preserveWhitespace = options.preserveWhitespace !== false;
  8191. var root;
  8192. var currentParent;
  8193. var inVPre = false;
  8194. var inPre = false;
  8195. var warned = false;
  8196. function warnOnce (msg) {
  8197. if (!warned) {
  8198. warned = true;
  8199. warn$2(msg);
  8200. }
  8201. }
  8202. function closeElement (element) {
  8203. // check pre state
  8204. if (element.pre) {
  8205. inVPre = false;
  8206. }
  8207. if (platformIsPreTag(element.tag)) {
  8208. inPre = false;
  8209. }
  8210. // apply post-transforms
  8211. for (var i = 0; i < postTransforms.length; i++) {
  8212. postTransforms[i](element, options);
  8213. }
  8214. }
  8215. parseHTML(template, {
  8216. warn: warn$2,
  8217. expectHTML: options.expectHTML,
  8218. isUnaryTag: options.isUnaryTag,
  8219. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8220. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8221. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8222. shouldKeepComment: options.comments,
  8223. start: function start (tag, attrs, unary) {
  8224. // check namespace.
  8225. // inherit parent ns if there is one
  8226. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8227. // handle IE svg bug
  8228. /* istanbul ignore if */
  8229. if (isIE && ns === 'svg') {
  8230. attrs = guardIESVGBug(attrs);
  8231. }
  8232. var element = createASTElement(tag, attrs, currentParent);
  8233. if (ns) {
  8234. element.ns = ns;
  8235. }
  8236. if (isForbiddenTag(element) && !isServerRendering()) {
  8237. element.forbidden = true;
  8238. "development" !== 'production' && warn$2(
  8239. 'Templates should only be responsible for mapping the state to the ' +
  8240. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8241. "<" + tag + ">" + ', as they will not be parsed.'
  8242. );
  8243. }
  8244. // apply pre-transforms
  8245. for (var i = 0; i < preTransforms.length; i++) {
  8246. element = preTransforms[i](element, options) || element;
  8247. }
  8248. if (!inVPre) {
  8249. processPre(element);
  8250. if (element.pre) {
  8251. inVPre = true;
  8252. }
  8253. }
  8254. if (platformIsPreTag(element.tag)) {
  8255. inPre = true;
  8256. }
  8257. if (inVPre) {
  8258. processRawAttrs(element);
  8259. } else if (!element.processed) {
  8260. // structural directives
  8261. processFor(element);
  8262. processIf(element);
  8263. processOnce(element);
  8264. // element-scope stuff
  8265. processElement(element, options);
  8266. }
  8267. function checkRootConstraints (el) {
  8268. {
  8269. if (el.tag === 'slot' || el.tag === 'template') {
  8270. warnOnce(
  8271. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8272. 'contain multiple nodes.'
  8273. );
  8274. }
  8275. if (el.attrsMap.hasOwnProperty('v-for')) {
  8276. warnOnce(
  8277. 'Cannot use v-for on stateful component root element because ' +
  8278. 'it renders multiple elements.'
  8279. );
  8280. }
  8281. }
  8282. }
  8283. // tree management
  8284. if (!root) {
  8285. root = element;
  8286. checkRootConstraints(root);
  8287. } else if (!stack.length) {
  8288. // allow root elements with v-if, v-else-if and v-else
  8289. if (root.if && (element.elseif || element.else)) {
  8290. checkRootConstraints(element);
  8291. addIfCondition(root, {
  8292. exp: element.elseif,
  8293. block: element
  8294. });
  8295. } else {
  8296. warnOnce(
  8297. "Component template should contain exactly one root element. " +
  8298. "If you are using v-if on multiple elements, " +
  8299. "use v-else-if to chain them instead."
  8300. );
  8301. }
  8302. }
  8303. if (currentParent && !element.forbidden) {
  8304. if (element.elseif || element.else) {
  8305. processIfConditions(element, currentParent);
  8306. } else if (element.slotScope) { // scoped slot
  8307. currentParent.plain = false;
  8308. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8309. } else {
  8310. currentParent.children.push(element);
  8311. element.parent = currentParent;
  8312. }
  8313. }
  8314. if (!unary) {
  8315. currentParent = element;
  8316. stack.push(element);
  8317. } else {
  8318. closeElement(element);
  8319. }
  8320. },
  8321. end: function end () {
  8322. // remove trailing whitespace
  8323. var element = stack[stack.length - 1];
  8324. var lastNode = element.children[element.children.length - 1];
  8325. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  8326. element.children.pop();
  8327. }
  8328. // pop stack
  8329. stack.length -= 1;
  8330. currentParent = stack[stack.length - 1];
  8331. closeElement(element);
  8332. },
  8333. chars: function chars (text) {
  8334. if (!currentParent) {
  8335. {
  8336. if (text === template) {
  8337. warnOnce(
  8338. 'Component template requires a root element, rather than just text.'
  8339. );
  8340. } else if ((text = text.trim())) {
  8341. warnOnce(
  8342. ("text \"" + text + "\" outside root element will be ignored.")
  8343. );
  8344. }
  8345. }
  8346. return
  8347. }
  8348. // IE textarea placeholder bug
  8349. /* istanbul ignore if */
  8350. if (isIE &&
  8351. currentParent.tag === 'textarea' &&
  8352. currentParent.attrsMap.placeholder === text
  8353. ) {
  8354. return
  8355. }
  8356. var children = currentParent.children;
  8357. text = inPre || text.trim()
  8358. ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
  8359. // only preserve whitespace if its not right after a starting tag
  8360. : preserveWhitespace && children.length ? ' ' : '';
  8361. if (text) {
  8362. var res;
  8363. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8364. children.push({
  8365. type: 2,
  8366. expression: res.expression,
  8367. tokens: res.tokens,
  8368. text: text
  8369. });
  8370. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8371. children.push({
  8372. type: 3,
  8373. text: text
  8374. });
  8375. }
  8376. }
  8377. },
  8378. comment: function comment (text) {
  8379. currentParent.children.push({
  8380. type: 3,
  8381. text: text,
  8382. isComment: true
  8383. });
  8384. }
  8385. });
  8386. return root
  8387. }
  8388. function processPre (el) {
  8389. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8390. el.pre = true;
  8391. }
  8392. }
  8393. function processRawAttrs (el) {
  8394. var l = el.attrsList.length;
  8395. if (l) {
  8396. var attrs = el.attrs = new Array(l);
  8397. for (var i = 0; i < l; i++) {
  8398. attrs[i] = {
  8399. name: el.attrsList[i].name,
  8400. value: JSON.stringify(el.attrsList[i].value)
  8401. };
  8402. }
  8403. } else if (!el.pre) {
  8404. // non root node in pre blocks with no attributes
  8405. el.plain = true;
  8406. }
  8407. }
  8408. function processElement (element, options) {
  8409. processKey(element);
  8410. // determine whether this is a plain element after
  8411. // removing structural attributes
  8412. element.plain = !element.key && !element.attrsList.length;
  8413. processRef(element);
  8414. processSlot(element);
  8415. processComponent(element);
  8416. for (var i = 0; i < transforms.length; i++) {
  8417. element = transforms[i](element, options) || element;
  8418. }
  8419. processAttrs(element);
  8420. }
  8421. function processKey (el) {
  8422. var exp = getBindingAttr(el, 'key');
  8423. if (exp) {
  8424. if ("development" !== 'production' && el.tag === 'template') {
  8425. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  8426. }
  8427. el.key = exp;
  8428. }
  8429. }
  8430. function processRef (el) {
  8431. var ref = getBindingAttr(el, 'ref');
  8432. if (ref) {
  8433. el.ref = ref;
  8434. el.refInFor = checkInFor(el);
  8435. }
  8436. }
  8437. function processFor (el) {
  8438. var exp;
  8439. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  8440. var res = parseFor(exp);
  8441. if (res) {
  8442. extend(el, res);
  8443. } else {
  8444. warn$2(
  8445. ("Invalid v-for expression: " + exp)
  8446. );
  8447. }
  8448. }
  8449. }
  8450. function parseFor (exp) {
  8451. var inMatch = exp.match(forAliasRE);
  8452. if (!inMatch) { return }
  8453. var res = {};
  8454. res.for = inMatch[2].trim();
  8455. var alias = inMatch[1].trim().replace(stripParensRE, '');
  8456. var iteratorMatch = alias.match(forIteratorRE);
  8457. if (iteratorMatch) {
  8458. res.alias = alias.replace(forIteratorRE, '');
  8459. res.iterator1 = iteratorMatch[1].trim();
  8460. if (iteratorMatch[2]) {
  8461. res.iterator2 = iteratorMatch[2].trim();
  8462. }
  8463. } else {
  8464. res.alias = alias;
  8465. }
  8466. return res
  8467. }
  8468. function processIf (el) {
  8469. var exp = getAndRemoveAttr(el, 'v-if');
  8470. if (exp) {
  8471. el.if = exp;
  8472. addIfCondition(el, {
  8473. exp: exp,
  8474. block: el
  8475. });
  8476. } else {
  8477. if (getAndRemoveAttr(el, 'v-else') != null) {
  8478. el.else = true;
  8479. }
  8480. var elseif = getAndRemoveAttr(el, 'v-else-if');
  8481. if (elseif) {
  8482. el.elseif = elseif;
  8483. }
  8484. }
  8485. }
  8486. function processIfConditions (el, parent) {
  8487. var prev = findPrevElement(parent.children);
  8488. if (prev && prev.if) {
  8489. addIfCondition(prev, {
  8490. exp: el.elseif,
  8491. block: el
  8492. });
  8493. } else {
  8494. warn$2(
  8495. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  8496. "used on element <" + (el.tag) + "> without corresponding v-if."
  8497. );
  8498. }
  8499. }
  8500. function findPrevElement (children) {
  8501. var i = children.length;
  8502. while (i--) {
  8503. if (children[i].type === 1) {
  8504. return children[i]
  8505. } else {
  8506. if ("development" !== 'production' && children[i].text !== ' ') {
  8507. warn$2(
  8508. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  8509. "will be ignored."
  8510. );
  8511. }
  8512. children.pop();
  8513. }
  8514. }
  8515. }
  8516. function addIfCondition (el, condition) {
  8517. if (!el.ifConditions) {
  8518. el.ifConditions = [];
  8519. }
  8520. el.ifConditions.push(condition);
  8521. }
  8522. function processOnce (el) {
  8523. var once$$1 = getAndRemoveAttr(el, 'v-once');
  8524. if (once$$1 != null) {
  8525. el.once = true;
  8526. }
  8527. }
  8528. function processSlot (el) {
  8529. if (el.tag === 'slot') {
  8530. el.slotName = getBindingAttr(el, 'name');
  8531. if ("development" !== 'production' && el.key) {
  8532. warn$2(
  8533. "`key` does not work on <slot> because slots are abstract outlets " +
  8534. "and can possibly expand into multiple elements. " +
  8535. "Use the key on a wrapping element instead."
  8536. );
  8537. }
  8538. } else {
  8539. var slotScope;
  8540. if (el.tag === 'template') {
  8541. slotScope = getAndRemoveAttr(el, 'scope');
  8542. /* istanbul ignore if */
  8543. if ("development" !== 'production' && slotScope) {
  8544. warn$2(
  8545. "the \"scope\" attribute for scoped slots have been deprecated and " +
  8546. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  8547. "can also be used on plain elements in addition to <template> to " +
  8548. "denote scoped slots.",
  8549. true
  8550. );
  8551. }
  8552. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  8553. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  8554. /* istanbul ignore if */
  8555. if ("development" !== 'production' && el.attrsMap['v-for']) {
  8556. warn$2(
  8557. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  8558. "(v-for takes higher priority). Use a wrapper <template> for the " +
  8559. "scoped slot to make it clearer.",
  8560. true
  8561. );
  8562. }
  8563. el.slotScope = slotScope;
  8564. }
  8565. var slotTarget = getBindingAttr(el, 'slot');
  8566. if (slotTarget) {
  8567. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  8568. // preserve slot as an attribute for native shadow DOM compat
  8569. // only for non-scoped slots.
  8570. if (el.tag !== 'template' && !el.slotScope) {
  8571. addAttr(el, 'slot', slotTarget);
  8572. }
  8573. }
  8574. }
  8575. }
  8576. function processComponent (el) {
  8577. var binding;
  8578. if ((binding = getBindingAttr(el, 'is'))) {
  8579. el.component = binding;
  8580. }
  8581. if (getAndRemoveAttr(el, 'inline-template') != null) {
  8582. el.inlineTemplate = true;
  8583. }
  8584. }
  8585. function processAttrs (el) {
  8586. var list = el.attrsList;
  8587. var i, l, name, rawName, value, modifiers, isProp;
  8588. for (i = 0, l = list.length; i < l; i++) {
  8589. name = rawName = list[i].name;
  8590. value = list[i].value;
  8591. if (dirRE.test(name)) {
  8592. // mark element as dynamic
  8593. el.hasBindings = true;
  8594. // modifiers
  8595. modifiers = parseModifiers(name);
  8596. if (modifiers) {
  8597. name = name.replace(modifierRE, '');
  8598. }
  8599. if (bindRE.test(name)) { // v-bind
  8600. name = name.replace(bindRE, '');
  8601. value = parseFilters(value);
  8602. isProp = false;
  8603. if (modifiers) {
  8604. if (modifiers.prop) {
  8605. isProp = true;
  8606. name = camelize(name);
  8607. if (name === 'innerHtml') { name = 'innerHTML'; }
  8608. }
  8609. if (modifiers.camel) {
  8610. name = camelize(name);
  8611. }
  8612. if (modifiers.sync) {
  8613. addHandler(
  8614. el,
  8615. ("update:" + (camelize(name))),
  8616. genAssignmentCode(value, "$event")
  8617. );
  8618. }
  8619. }
  8620. if (isProp || (
  8621. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  8622. )) {
  8623. addProp(el, name, value);
  8624. } else {
  8625. addAttr(el, name, value);
  8626. }
  8627. } else if (onRE.test(name)) { // v-on
  8628. name = name.replace(onRE, '');
  8629. addHandler(el, name, value, modifiers, false, warn$2);
  8630. } else { // normal directives
  8631. name = name.replace(dirRE, '');
  8632. // parse arg
  8633. var argMatch = name.match(argRE);
  8634. var arg = argMatch && argMatch[1];
  8635. if (arg) {
  8636. name = name.slice(0, -(arg.length + 1));
  8637. }
  8638. addDirective(el, name, rawName, value, arg, modifiers);
  8639. if ("development" !== 'production' && name === 'model') {
  8640. checkForAliasModel(el, value);
  8641. }
  8642. }
  8643. } else {
  8644. // literal attribute
  8645. {
  8646. var res = parseText(value, delimiters);
  8647. if (res) {
  8648. warn$2(
  8649. name + "=\"" + value + "\": " +
  8650. 'Interpolation inside attributes has been removed. ' +
  8651. 'Use v-bind or the colon shorthand instead. For example, ' +
  8652. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  8653. );
  8654. }
  8655. }
  8656. addAttr(el, name, JSON.stringify(value));
  8657. // #6887 firefox doesn't update muted state if set via attribute
  8658. // even immediately after element creation
  8659. if (!el.component &&
  8660. name === 'muted' &&
  8661. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  8662. addProp(el, name, 'true');
  8663. }
  8664. }
  8665. }
  8666. }
  8667. function checkInFor (el) {
  8668. var parent = el;
  8669. while (parent) {
  8670. if (parent.for !== undefined) {
  8671. return true
  8672. }
  8673. parent = parent.parent;
  8674. }
  8675. return false
  8676. }
  8677. function parseModifiers (name) {
  8678. var match = name.match(modifierRE);
  8679. if (match) {
  8680. var ret = {};
  8681. match.forEach(function (m) { ret[m.slice(1)] = true; });
  8682. return ret
  8683. }
  8684. }
  8685. function makeAttrsMap (attrs) {
  8686. var map = {};
  8687. for (var i = 0, l = attrs.length; i < l; i++) {
  8688. if (
  8689. "development" !== 'production' &&
  8690. map[attrs[i].name] && !isIE && !isEdge
  8691. ) {
  8692. warn$2('duplicate attribute: ' + attrs[i].name);
  8693. }
  8694. map[attrs[i].name] = attrs[i].value;
  8695. }
  8696. return map
  8697. }
  8698. // for script (e.g. type="x/template") or style, do not decode content
  8699. function isTextTag (el) {
  8700. return el.tag === 'script' || el.tag === 'style'
  8701. }
  8702. function isForbiddenTag (el) {
  8703. return (
  8704. el.tag === 'style' ||
  8705. (el.tag === 'script' && (
  8706. !el.attrsMap.type ||
  8707. el.attrsMap.type === 'text/javascript'
  8708. ))
  8709. )
  8710. }
  8711. var ieNSBug = /^xmlns:NS\d+/;
  8712. var ieNSPrefix = /^NS\d+:/;
  8713. /* istanbul ignore next */
  8714. function guardIESVGBug (attrs) {
  8715. var res = [];
  8716. for (var i = 0; i < attrs.length; i++) {
  8717. var attr = attrs[i];
  8718. if (!ieNSBug.test(attr.name)) {
  8719. attr.name = attr.name.replace(ieNSPrefix, '');
  8720. res.push(attr);
  8721. }
  8722. }
  8723. return res
  8724. }
  8725. function checkForAliasModel (el, value) {
  8726. var _el = el;
  8727. while (_el) {
  8728. if (_el.for && _el.alias === value) {
  8729. warn$2(
  8730. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  8731. "You are binding v-model directly to a v-for iteration alias. " +
  8732. "This will not be able to modify the v-for source array because " +
  8733. "writing to the alias is like modifying a function local variable. " +
  8734. "Consider using an array of objects and use v-model on an object property instead."
  8735. );
  8736. }
  8737. _el = _el.parent;
  8738. }
  8739. }
  8740. /* */
  8741. /**
  8742. * Expand input[v-model] with dyanmic type bindings into v-if-else chains
  8743. * Turn this:
  8744. * <input v-model="data[type]" :type="type">
  8745. * into this:
  8746. * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
  8747. * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
  8748. * <input v-else :type="type" v-model="data[type]">
  8749. */
  8750. function preTransformNode (el, options) {
  8751. if (el.tag === 'input') {
  8752. var map = el.attrsMap;
  8753. if (!map['v-model']) {
  8754. return
  8755. }
  8756. var typeBinding;
  8757. if (map[':type'] || map['v-bind:type']) {
  8758. typeBinding = getBindingAttr(el, 'type');
  8759. }
  8760. if (!map.type && !typeBinding && map['v-bind']) {
  8761. typeBinding = "(" + (map['v-bind']) + ").type";
  8762. }
  8763. if (typeBinding) {
  8764. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  8765. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  8766. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  8767. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  8768. // 1. checkbox
  8769. var branch0 = cloneASTElement(el);
  8770. // process for on the main node
  8771. processFor(branch0);
  8772. addRawAttr(branch0, 'type', 'checkbox');
  8773. processElement(branch0, options);
  8774. branch0.processed = true; // prevent it from double-processed
  8775. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  8776. addIfCondition(branch0, {
  8777. exp: branch0.if,
  8778. block: branch0
  8779. });
  8780. // 2. add radio else-if condition
  8781. var branch1 = cloneASTElement(el);
  8782. getAndRemoveAttr(branch1, 'v-for', true);
  8783. addRawAttr(branch1, 'type', 'radio');
  8784. processElement(branch1, options);
  8785. addIfCondition(branch0, {
  8786. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  8787. block: branch1
  8788. });
  8789. // 3. other
  8790. var branch2 = cloneASTElement(el);
  8791. getAndRemoveAttr(branch2, 'v-for', true);
  8792. addRawAttr(branch2, ':type', typeBinding);
  8793. processElement(branch2, options);
  8794. addIfCondition(branch0, {
  8795. exp: ifCondition,
  8796. block: branch2
  8797. });
  8798. if (hasElse) {
  8799. branch0.else = true;
  8800. } else if (elseIfCondition) {
  8801. branch0.elseif = elseIfCondition;
  8802. }
  8803. return branch0
  8804. }
  8805. }
  8806. }
  8807. function cloneASTElement (el) {
  8808. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  8809. }
  8810. var model$2 = {
  8811. preTransformNode: preTransformNode
  8812. }
  8813. var modules$1 = [
  8814. klass$1,
  8815. style$1,
  8816. model$2
  8817. ]
  8818. /* */
  8819. function text (el, dir) {
  8820. if (dir.value) {
  8821. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  8822. }
  8823. }
  8824. /* */
  8825. function html (el, dir) {
  8826. if (dir.value) {
  8827. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  8828. }
  8829. }
  8830. var directives$1 = {
  8831. model: model,
  8832. text: text,
  8833. html: html
  8834. }
  8835. /* */
  8836. var baseOptions = {
  8837. expectHTML: true,
  8838. modules: modules$1,
  8839. directives: directives$1,
  8840. isPreTag: isPreTag,
  8841. isUnaryTag: isUnaryTag,
  8842. mustUseProp: mustUseProp,
  8843. canBeLeftOpenTag: canBeLeftOpenTag,
  8844. isReservedTag: isReservedTag,
  8845. getTagNamespace: getTagNamespace,
  8846. staticKeys: genStaticKeys(modules$1)
  8847. };
  8848. /* */
  8849. var isStaticKey;
  8850. var isPlatformReservedTag;
  8851. var genStaticKeysCached = cached(genStaticKeys$1);
  8852. /**
  8853. * Goal of the optimizer: walk the generated template AST tree
  8854. * and detect sub-trees that are purely static, i.e. parts of
  8855. * the DOM that never needs to change.
  8856. *
  8857. * Once we detect these sub-trees, we can:
  8858. *
  8859. * 1. Hoist them into constants, so that we no longer need to
  8860. * create fresh nodes for them on each re-render;
  8861. * 2. Completely skip them in the patching process.
  8862. */
  8863. function optimize (root, options) {
  8864. if (!root) { return }
  8865. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  8866. isPlatformReservedTag = options.isReservedTag || no;
  8867. // first pass: mark all non-static nodes.
  8868. markStatic$1(root);
  8869. // second pass: mark static roots.
  8870. markStaticRoots(root, false);
  8871. }
  8872. function genStaticKeys$1 (keys) {
  8873. return makeMap(
  8874. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  8875. (keys ? ',' + keys : '')
  8876. )
  8877. }
  8878. function markStatic$1 (node) {
  8879. node.static = isStatic(node);
  8880. if (node.type === 1) {
  8881. // do not make component slot content static. this avoids
  8882. // 1. components not able to mutate slot nodes
  8883. // 2. static slot content fails for hot-reloading
  8884. if (
  8885. !isPlatformReservedTag(node.tag) &&
  8886. node.tag !== 'slot' &&
  8887. node.attrsMap['inline-template'] == null
  8888. ) {
  8889. return
  8890. }
  8891. for (var i = 0, l = node.children.length; i < l; i++) {
  8892. var child = node.children[i];
  8893. markStatic$1(child);
  8894. if (!child.static) {
  8895. node.static = false;
  8896. }
  8897. }
  8898. if (node.ifConditions) {
  8899. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  8900. var block = node.ifConditions[i$1].block;
  8901. markStatic$1(block);
  8902. if (!block.static) {
  8903. node.static = false;
  8904. }
  8905. }
  8906. }
  8907. }
  8908. }
  8909. function markStaticRoots (node, isInFor) {
  8910. if (node.type === 1) {
  8911. if (node.static || node.once) {
  8912. node.staticInFor = isInFor;
  8913. }
  8914. // For a node to qualify as a static root, it should have children that
  8915. // are not just static text. Otherwise the cost of hoisting out will
  8916. // outweigh the benefits and it's better off to just always render it fresh.
  8917. if (node.static && node.children.length && !(
  8918. node.children.length === 1 &&
  8919. node.children[0].type === 3
  8920. )) {
  8921. node.staticRoot = true;
  8922. return
  8923. } else {
  8924. node.staticRoot = false;
  8925. }
  8926. if (node.children) {
  8927. for (var i = 0, l = node.children.length; i < l; i++) {
  8928. markStaticRoots(node.children[i], isInFor || !!node.for);
  8929. }
  8930. }
  8931. if (node.ifConditions) {
  8932. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  8933. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  8934. }
  8935. }
  8936. }
  8937. }
  8938. function isStatic (node) {
  8939. if (node.type === 2) { // expression
  8940. return false
  8941. }
  8942. if (node.type === 3) { // text
  8943. return true
  8944. }
  8945. return !!(node.pre || (
  8946. !node.hasBindings && // no dynamic bindings
  8947. !node.if && !node.for && // not v-if or v-for or v-else
  8948. !isBuiltInTag(node.tag) && // not a built-in
  8949. isPlatformReservedTag(node.tag) && // not a component
  8950. !isDirectChildOfTemplateFor(node) &&
  8951. Object.keys(node).every(isStaticKey)
  8952. ))
  8953. }
  8954. function isDirectChildOfTemplateFor (node) {
  8955. while (node.parent) {
  8956. node = node.parent;
  8957. if (node.tag !== 'template') {
  8958. return false
  8959. }
  8960. if (node.for) {
  8961. return true
  8962. }
  8963. }
  8964. return false
  8965. }
  8966. /* */
  8967. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  8968. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  8969. // KeyboardEvent.keyCode aliases
  8970. var keyCodes = {
  8971. esc: 27,
  8972. tab: 9,
  8973. enter: 13,
  8974. space: 32,
  8975. up: 38,
  8976. left: 37,
  8977. right: 39,
  8978. down: 40,
  8979. 'delete': [8, 46]
  8980. };
  8981. // KeyboardEvent.key aliases
  8982. var keyNames = {
  8983. esc: 'Escape',
  8984. tab: 'Tab',
  8985. enter: 'Enter',
  8986. space: ' ',
  8987. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  8988. up: ['Up', 'ArrowUp'],
  8989. left: ['Left', 'ArrowLeft'],
  8990. right: ['Right', 'ArrowRight'],
  8991. down: ['Down', 'ArrowDown'],
  8992. 'delete': ['Backspace', 'Delete']
  8993. };
  8994. // #4868: modifiers that prevent the execution of the listener
  8995. // need to explicitly return null so that we can determine whether to remove
  8996. // the listener for .once
  8997. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  8998. var modifierCode = {
  8999. stop: '$event.stopPropagation();',
  9000. prevent: '$event.preventDefault();',
  9001. self: genGuard("$event.target !== $event.currentTarget"),
  9002. ctrl: genGuard("!$event.ctrlKey"),
  9003. shift: genGuard("!$event.shiftKey"),
  9004. alt: genGuard("!$event.altKey"),
  9005. meta: genGuard("!$event.metaKey"),
  9006. left: genGuard("'button' in $event && $event.button !== 0"),
  9007. middle: genGuard("'button' in $event && $event.button !== 1"),
  9008. right: genGuard("'button' in $event && $event.button !== 2")
  9009. };
  9010. function genHandlers (
  9011. events,
  9012. isNative,
  9013. warn
  9014. ) {
  9015. var res = isNative ? 'nativeOn:{' : 'on:{';
  9016. for (var name in events) {
  9017. res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  9018. }
  9019. return res.slice(0, -1) + '}'
  9020. }
  9021. function genHandler (
  9022. name,
  9023. handler
  9024. ) {
  9025. if (!handler) {
  9026. return 'function(){}'
  9027. }
  9028. if (Array.isArray(handler)) {
  9029. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  9030. }
  9031. var isMethodPath = simplePathRE.test(handler.value);
  9032. var isFunctionExpression = fnExpRE.test(handler.value);
  9033. if (!handler.modifiers) {
  9034. if (isMethodPath || isFunctionExpression) {
  9035. return handler.value
  9036. }
  9037. /* istanbul ignore if */
  9038. return ("function($event){" + (handler.value) + "}") // inline statement
  9039. } else {
  9040. var code = '';
  9041. var genModifierCode = '';
  9042. var keys = [];
  9043. for (var key in handler.modifiers) {
  9044. if (modifierCode[key]) {
  9045. genModifierCode += modifierCode[key];
  9046. // left/right
  9047. if (keyCodes[key]) {
  9048. keys.push(key);
  9049. }
  9050. } else if (key === 'exact') {
  9051. var modifiers = (handler.modifiers);
  9052. genModifierCode += genGuard(
  9053. ['ctrl', 'shift', 'alt', 'meta']
  9054. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9055. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9056. .join('||')
  9057. );
  9058. } else {
  9059. keys.push(key);
  9060. }
  9061. }
  9062. if (keys.length) {
  9063. code += genKeyFilter(keys);
  9064. }
  9065. // Make sure modifiers like prevent and stop get executed after key filtering
  9066. if (genModifierCode) {
  9067. code += genModifierCode;
  9068. }
  9069. var handlerCode = isMethodPath
  9070. ? ("return " + (handler.value) + "($event)")
  9071. : isFunctionExpression
  9072. ? ("return (" + (handler.value) + ")($event)")
  9073. : handler.value;
  9074. /* istanbul ignore if */
  9075. return ("function($event){" + code + handlerCode + "}")
  9076. }
  9077. }
  9078. function genKeyFilter (keys) {
  9079. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  9080. }
  9081. function genFilterCode (key) {
  9082. var keyVal = parseInt(key, 10);
  9083. if (keyVal) {
  9084. return ("$event.keyCode!==" + keyVal)
  9085. }
  9086. var keyCode = keyCodes[key];
  9087. var keyName = keyNames[key];
  9088. return (
  9089. "_k($event.keyCode," +
  9090. (JSON.stringify(key)) + "," +
  9091. (JSON.stringify(keyCode)) + "," +
  9092. "$event.key," +
  9093. "" + (JSON.stringify(keyName)) +
  9094. ")"
  9095. )
  9096. }
  9097. /* */
  9098. function on (el, dir) {
  9099. if ("development" !== 'production' && dir.modifiers) {
  9100. warn("v-on without argument does not support modifiers.");
  9101. }
  9102. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9103. }
  9104. /* */
  9105. function bind$1 (el, dir) {
  9106. el.wrapData = function (code) {
  9107. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9108. };
  9109. }
  9110. /* */
  9111. var baseDirectives = {
  9112. on: on,
  9113. bind: bind$1,
  9114. cloak: noop
  9115. }
  9116. /* */
  9117. var CodegenState = function CodegenState (options) {
  9118. this.options = options;
  9119. this.warn = options.warn || baseWarn;
  9120. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9121. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9122. this.directives = extend(extend({}, baseDirectives), options.directives);
  9123. var isReservedTag = options.isReservedTag || no;
  9124. this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
  9125. this.onceId = 0;
  9126. this.staticRenderFns = [];
  9127. };
  9128. function generate (
  9129. ast,
  9130. options
  9131. ) {
  9132. var state = new CodegenState(options);
  9133. var code = ast ? genElement(ast, state) : '_c("div")';
  9134. return {
  9135. render: ("with(this){return " + code + "}"),
  9136. staticRenderFns: state.staticRenderFns
  9137. }
  9138. }
  9139. function genElement (el, state) {
  9140. if (el.staticRoot && !el.staticProcessed) {
  9141. return genStatic(el, state)
  9142. } else if (el.once && !el.onceProcessed) {
  9143. return genOnce(el, state)
  9144. } else if (el.for && !el.forProcessed) {
  9145. return genFor(el, state)
  9146. } else if (el.if && !el.ifProcessed) {
  9147. return genIf(el, state)
  9148. } else if (el.tag === 'template' && !el.slotTarget) {
  9149. return genChildren(el, state) || 'void 0'
  9150. } else if (el.tag === 'slot') {
  9151. return genSlot(el, state)
  9152. } else {
  9153. // component or element
  9154. var code;
  9155. if (el.component) {
  9156. code = genComponent(el.component, el, state);
  9157. } else {
  9158. var data = el.plain ? undefined : genData$2(el, state);
  9159. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9160. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9161. }
  9162. // module transforms
  9163. for (var i = 0; i < state.transforms.length; i++) {
  9164. code = state.transforms[i](el, code);
  9165. }
  9166. return code
  9167. }
  9168. }
  9169. // hoist static sub-trees out
  9170. function genStatic (el, state) {
  9171. el.staticProcessed = true;
  9172. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9173. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9174. }
  9175. // v-once
  9176. function genOnce (el, state) {
  9177. el.onceProcessed = true;
  9178. if (el.if && !el.ifProcessed) {
  9179. return genIf(el, state)
  9180. } else if (el.staticInFor) {
  9181. var key = '';
  9182. var parent = el.parent;
  9183. while (parent) {
  9184. if (parent.for) {
  9185. key = parent.key;
  9186. break
  9187. }
  9188. parent = parent.parent;
  9189. }
  9190. if (!key) {
  9191. "development" !== 'production' && state.warn(
  9192. "v-once can only be used inside v-for that is keyed. "
  9193. );
  9194. return genElement(el, state)
  9195. }
  9196. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9197. } else {
  9198. return genStatic(el, state)
  9199. }
  9200. }
  9201. function genIf (
  9202. el,
  9203. state,
  9204. altGen,
  9205. altEmpty
  9206. ) {
  9207. el.ifProcessed = true; // avoid recursion
  9208. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  9209. }
  9210. function genIfConditions (
  9211. conditions,
  9212. state,
  9213. altGen,
  9214. altEmpty
  9215. ) {
  9216. if (!conditions.length) {
  9217. return altEmpty || '_e()'
  9218. }
  9219. var condition = conditions.shift();
  9220. if (condition.exp) {
  9221. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  9222. } else {
  9223. return ("" + (genTernaryExp(condition.block)))
  9224. }
  9225. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  9226. function genTernaryExp (el) {
  9227. return altGen
  9228. ? altGen(el, state)
  9229. : el.once
  9230. ? genOnce(el, state)
  9231. : genElement(el, state)
  9232. }
  9233. }
  9234. function genFor (
  9235. el,
  9236. state,
  9237. altGen,
  9238. altHelper
  9239. ) {
  9240. var exp = el.for;
  9241. var alias = el.alias;
  9242. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  9243. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  9244. if ("development" !== 'production' &&
  9245. state.maybeComponent(el) &&
  9246. el.tag !== 'slot' &&
  9247. el.tag !== 'template' &&
  9248. !el.key
  9249. ) {
  9250. state.warn(
  9251. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  9252. "v-for should have explicit keys. " +
  9253. "See https://vuejs.org/guide/list.html#key for more info.",
  9254. true /* tip */
  9255. );
  9256. }
  9257. el.forProcessed = true; // avoid recursion
  9258. return (altHelper || '_l') + "((" + exp + ")," +
  9259. "function(" + alias + iterator1 + iterator2 + "){" +
  9260. "return " + ((altGen || genElement)(el, state)) +
  9261. '})'
  9262. }
  9263. function genData$2 (el, state) {
  9264. var data = '{';
  9265. // directives first.
  9266. // directives may mutate the el's other properties before they are generated.
  9267. var dirs = genDirectives(el, state);
  9268. if (dirs) { data += dirs + ','; }
  9269. // key
  9270. if (el.key) {
  9271. data += "key:" + (el.key) + ",";
  9272. }
  9273. // ref
  9274. if (el.ref) {
  9275. data += "ref:" + (el.ref) + ",";
  9276. }
  9277. if (el.refInFor) {
  9278. data += "refInFor:true,";
  9279. }
  9280. // pre
  9281. if (el.pre) {
  9282. data += "pre:true,";
  9283. }
  9284. // record original tag name for components using "is" attribute
  9285. if (el.component) {
  9286. data += "tag:\"" + (el.tag) + "\",";
  9287. }
  9288. // module data generation functions
  9289. for (var i = 0; i < state.dataGenFns.length; i++) {
  9290. data += state.dataGenFns[i](el);
  9291. }
  9292. // attributes
  9293. if (el.attrs) {
  9294. data += "attrs:{" + (genProps(el.attrs)) + "},";
  9295. }
  9296. // DOM props
  9297. if (el.props) {
  9298. data += "domProps:{" + (genProps(el.props)) + "},";
  9299. }
  9300. // event handlers
  9301. if (el.events) {
  9302. data += (genHandlers(el.events, false, state.warn)) + ",";
  9303. }
  9304. if (el.nativeEvents) {
  9305. data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
  9306. }
  9307. // slot target
  9308. // only for non-scoped slots
  9309. if (el.slotTarget && !el.slotScope) {
  9310. data += "slot:" + (el.slotTarget) + ",";
  9311. }
  9312. // scoped slots
  9313. if (el.scopedSlots) {
  9314. data += (genScopedSlots(el.scopedSlots, state)) + ",";
  9315. }
  9316. // component v-model
  9317. if (el.model) {
  9318. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  9319. }
  9320. // inline-template
  9321. if (el.inlineTemplate) {
  9322. var inlineTemplate = genInlineTemplate(el, state);
  9323. if (inlineTemplate) {
  9324. data += inlineTemplate + ",";
  9325. }
  9326. }
  9327. data = data.replace(/,$/, '') + '}';
  9328. // v-bind data wrap
  9329. if (el.wrapData) {
  9330. data = el.wrapData(data);
  9331. }
  9332. // v-on data wrap
  9333. if (el.wrapListeners) {
  9334. data = el.wrapListeners(data);
  9335. }
  9336. return data
  9337. }
  9338. function genDirectives (el, state) {
  9339. var dirs = el.directives;
  9340. if (!dirs) { return }
  9341. var res = 'directives:[';
  9342. var hasRuntime = false;
  9343. var i, l, dir, needRuntime;
  9344. for (i = 0, l = dirs.length; i < l; i++) {
  9345. dir = dirs[i];
  9346. needRuntime = true;
  9347. var gen = state.directives[dir.name];
  9348. if (gen) {
  9349. // compile-time directive that manipulates AST.
  9350. // returns true if it also needs a runtime counterpart.
  9351. needRuntime = !!gen(el, dir, state.warn);
  9352. }
  9353. if (needRuntime) {
  9354. hasRuntime = true;
  9355. 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))) : '') + "},";
  9356. }
  9357. }
  9358. if (hasRuntime) {
  9359. return res.slice(0, -1) + ']'
  9360. }
  9361. }
  9362. function genInlineTemplate (el, state) {
  9363. var ast = el.children[0];
  9364. if ("development" !== 'production' && (
  9365. el.children.length !== 1 || ast.type !== 1
  9366. )) {
  9367. state.warn('Inline-template components must have exactly one child element.');
  9368. }
  9369. if (ast.type === 1) {
  9370. var inlineRenderFns = generate(ast, state.options);
  9371. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  9372. }
  9373. }
  9374. function genScopedSlots (
  9375. slots,
  9376. state
  9377. ) {
  9378. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  9379. return genScopedSlot(key, slots[key], state)
  9380. }).join(',')) + "])")
  9381. }
  9382. function genScopedSlot (
  9383. key,
  9384. el,
  9385. state
  9386. ) {
  9387. if (el.for && !el.forProcessed) {
  9388. return genForScopedSlot(key, el, state)
  9389. }
  9390. var fn = "function(" + (String(el.slotScope)) + "){" +
  9391. "return " + (el.tag === 'template'
  9392. ? el.if
  9393. ? ((el.if) + "?" + (genChildren(el, state) || 'undefined') + ":undefined")
  9394. : genChildren(el, state) || 'undefined'
  9395. : genElement(el, state)) + "}";
  9396. return ("{key:" + key + ",fn:" + fn + "}")
  9397. }
  9398. function genForScopedSlot (
  9399. key,
  9400. el,
  9401. state
  9402. ) {
  9403. var exp = el.for;
  9404. var alias = el.alias;
  9405. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  9406. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  9407. el.forProcessed = true; // avoid recursion
  9408. return "_l((" + exp + ")," +
  9409. "function(" + alias + iterator1 + iterator2 + "){" +
  9410. "return " + (genScopedSlot(key, el, state)) +
  9411. '})'
  9412. }
  9413. function genChildren (
  9414. el,
  9415. state,
  9416. checkSkip,
  9417. altGenElement,
  9418. altGenNode
  9419. ) {
  9420. var children = el.children;
  9421. if (children.length) {
  9422. var el$1 = children[0];
  9423. // optimize single v-for
  9424. if (children.length === 1 &&
  9425. el$1.for &&
  9426. el$1.tag !== 'template' &&
  9427. el$1.tag !== 'slot'
  9428. ) {
  9429. return (altGenElement || genElement)(el$1, state)
  9430. }
  9431. var normalizationType = checkSkip
  9432. ? getNormalizationType(children, state.maybeComponent)
  9433. : 0;
  9434. var gen = altGenNode || genNode;
  9435. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
  9436. }
  9437. }
  9438. // determine the normalization needed for the children array.
  9439. // 0: no normalization needed
  9440. // 1: simple normalization needed (possible 1-level deep nested array)
  9441. // 2: full normalization needed
  9442. function getNormalizationType (
  9443. children,
  9444. maybeComponent
  9445. ) {
  9446. var res = 0;
  9447. for (var i = 0; i < children.length; i++) {
  9448. var el = children[i];
  9449. if (el.type !== 1) {
  9450. continue
  9451. }
  9452. if (needsNormalization(el) ||
  9453. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  9454. res = 2;
  9455. break
  9456. }
  9457. if (maybeComponent(el) ||
  9458. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  9459. res = 1;
  9460. }
  9461. }
  9462. return res
  9463. }
  9464. function needsNormalization (el) {
  9465. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  9466. }
  9467. function genNode (node, state) {
  9468. if (node.type === 1) {
  9469. return genElement(node, state)
  9470. } if (node.type === 3 && node.isComment) {
  9471. return genComment(node)
  9472. } else {
  9473. return genText(node)
  9474. }
  9475. }
  9476. function genText (text) {
  9477. return ("_v(" + (text.type === 2
  9478. ? text.expression // no need for () because already wrapped in _s()
  9479. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  9480. }
  9481. function genComment (comment) {
  9482. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  9483. }
  9484. function genSlot (el, state) {
  9485. var slotName = el.slotName || '"default"';
  9486. var children = genChildren(el, state);
  9487. var res = "_t(" + slotName + (children ? ("," + children) : '');
  9488. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  9489. var bind$$1 = el.attrsMap['v-bind'];
  9490. if ((attrs || bind$$1) && !children) {
  9491. res += ",null";
  9492. }
  9493. if (attrs) {
  9494. res += "," + attrs;
  9495. }
  9496. if (bind$$1) {
  9497. res += (attrs ? '' : ',null') + "," + bind$$1;
  9498. }
  9499. return res + ')'
  9500. }
  9501. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  9502. function genComponent (
  9503. componentName,
  9504. el,
  9505. state
  9506. ) {
  9507. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9508. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  9509. }
  9510. function genProps (props) {
  9511. var res = '';
  9512. for (var i = 0; i < props.length; i++) {
  9513. var prop = props[i];
  9514. /* istanbul ignore if */
  9515. {
  9516. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  9517. }
  9518. }
  9519. return res.slice(0, -1)
  9520. }
  9521. // #3895, #4268
  9522. function transformSpecialNewlines (text) {
  9523. return text
  9524. .replace(/\u2028/g, '\\u2028')
  9525. .replace(/\u2029/g, '\\u2029')
  9526. }
  9527. /* */
  9528. // these keywords should not appear inside expressions, but operators like
  9529. // typeof, instanceof and in are allowed
  9530. var prohibitedKeywordRE = new RegExp('\\b' + (
  9531. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  9532. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  9533. 'extends,finally,continue,debugger,function,arguments'
  9534. ).split(',').join('\\b|\\b') + '\\b');
  9535. // these unary operators should not be used as property/method names
  9536. var unaryOperatorsRE = new RegExp('\\b' + (
  9537. 'delete,typeof,void'
  9538. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  9539. // strip strings in expressions
  9540. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  9541. // detect problematic expressions in a template
  9542. function detectErrors (ast) {
  9543. var errors = [];
  9544. if (ast) {
  9545. checkNode(ast, errors);
  9546. }
  9547. return errors
  9548. }
  9549. function checkNode (node, errors) {
  9550. if (node.type === 1) {
  9551. for (var name in node.attrsMap) {
  9552. if (dirRE.test(name)) {
  9553. var value = node.attrsMap[name];
  9554. if (value) {
  9555. if (name === 'v-for') {
  9556. checkFor(node, ("v-for=\"" + value + "\""), errors);
  9557. } else if (onRE.test(name)) {
  9558. checkEvent(value, (name + "=\"" + value + "\""), errors);
  9559. } else {
  9560. checkExpression(value, (name + "=\"" + value + "\""), errors);
  9561. }
  9562. }
  9563. }
  9564. }
  9565. if (node.children) {
  9566. for (var i = 0; i < node.children.length; i++) {
  9567. checkNode(node.children[i], errors);
  9568. }
  9569. }
  9570. } else if (node.type === 2) {
  9571. checkExpression(node.expression, node.text, errors);
  9572. }
  9573. }
  9574. function checkEvent (exp, text, errors) {
  9575. var stipped = exp.replace(stripStringRE, '');
  9576. var keywordMatch = stipped.match(unaryOperatorsRE);
  9577. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  9578. errors.push(
  9579. "avoid using JavaScript unary operator as property name: " +
  9580. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  9581. );
  9582. }
  9583. checkExpression(exp, text, errors);
  9584. }
  9585. function checkFor (node, text, errors) {
  9586. checkExpression(node.for || '', text, errors);
  9587. checkIdentifier(node.alias, 'v-for alias', text, errors);
  9588. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  9589. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  9590. }
  9591. function checkIdentifier (
  9592. ident,
  9593. type,
  9594. text,
  9595. errors
  9596. ) {
  9597. if (typeof ident === 'string') {
  9598. try {
  9599. new Function(("var " + ident + "=_"));
  9600. } catch (e) {
  9601. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  9602. }
  9603. }
  9604. }
  9605. function checkExpression (exp, text, errors) {
  9606. try {
  9607. new Function(("return " + exp));
  9608. } catch (e) {
  9609. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  9610. if (keywordMatch) {
  9611. errors.push(
  9612. "avoid using JavaScript keyword as property name: " +
  9613. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim())
  9614. );
  9615. } else {
  9616. errors.push(
  9617. "invalid expression: " + (e.message) + " in\n\n" +
  9618. " " + exp + "\n\n" +
  9619. " Raw expression: " + (text.trim()) + "\n"
  9620. );
  9621. }
  9622. }
  9623. }
  9624. /* */
  9625. function createFunction (code, errors) {
  9626. try {
  9627. return new Function(code)
  9628. } catch (err) {
  9629. errors.push({ err: err, code: code });
  9630. return noop
  9631. }
  9632. }
  9633. function createCompileToFunctionFn (compile) {
  9634. var cache = Object.create(null);
  9635. return function compileToFunctions (
  9636. template,
  9637. options,
  9638. vm
  9639. ) {
  9640. options = extend({}, options);
  9641. var warn$$1 = options.warn || warn;
  9642. delete options.warn;
  9643. /* istanbul ignore if */
  9644. {
  9645. // detect possible CSP restriction
  9646. try {
  9647. new Function('return 1');
  9648. } catch (e) {
  9649. if (e.toString().match(/unsafe-eval|CSP/)) {
  9650. warn$$1(
  9651. 'It seems you are using the standalone build of Vue.js in an ' +
  9652. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  9653. 'The template compiler cannot work in this environment. Consider ' +
  9654. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  9655. 'templates into render functions.'
  9656. );
  9657. }
  9658. }
  9659. }
  9660. // check cache
  9661. var key = options.delimiters
  9662. ? String(options.delimiters) + template
  9663. : template;
  9664. if (cache[key]) {
  9665. return cache[key]
  9666. }
  9667. // compile
  9668. var compiled = compile(template, options);
  9669. // check compilation errors/tips
  9670. {
  9671. if (compiled.errors && compiled.errors.length) {
  9672. warn$$1(
  9673. "Error compiling template:\n\n" + template + "\n\n" +
  9674. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  9675. vm
  9676. );
  9677. }
  9678. if (compiled.tips && compiled.tips.length) {
  9679. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  9680. }
  9681. }
  9682. // turn code into functions
  9683. var res = {};
  9684. var fnGenErrors = [];
  9685. res.render = createFunction(compiled.render, fnGenErrors);
  9686. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  9687. return createFunction(code, fnGenErrors)
  9688. });
  9689. // check function generation errors.
  9690. // this should only happen if there is a bug in the compiler itself.
  9691. // mostly for codegen development use
  9692. /* istanbul ignore if */
  9693. {
  9694. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  9695. warn$$1(
  9696. "Failed to generate render function:\n\n" +
  9697. fnGenErrors.map(function (ref) {
  9698. var err = ref.err;
  9699. var code = ref.code;
  9700. return ((err.toString()) + " in\n\n" + code + "\n");
  9701. }).join('\n'),
  9702. vm
  9703. );
  9704. }
  9705. }
  9706. return (cache[key] = res)
  9707. }
  9708. }
  9709. /* */
  9710. function createCompilerCreator (baseCompile) {
  9711. return function createCompiler (baseOptions) {
  9712. function compile (
  9713. template,
  9714. options
  9715. ) {
  9716. var finalOptions = Object.create(baseOptions);
  9717. var errors = [];
  9718. var tips = [];
  9719. finalOptions.warn = function (msg, tip) {
  9720. (tip ? tips : errors).push(msg);
  9721. };
  9722. if (options) {
  9723. // merge custom modules
  9724. if (options.modules) {
  9725. finalOptions.modules =
  9726. (baseOptions.modules || []).concat(options.modules);
  9727. }
  9728. // merge custom directives
  9729. if (options.directives) {
  9730. finalOptions.directives = extend(
  9731. Object.create(baseOptions.directives || null),
  9732. options.directives
  9733. );
  9734. }
  9735. // copy other options
  9736. for (var key in options) {
  9737. if (key !== 'modules' && key !== 'directives') {
  9738. finalOptions[key] = options[key];
  9739. }
  9740. }
  9741. }
  9742. var compiled = baseCompile(template, finalOptions);
  9743. {
  9744. errors.push.apply(errors, detectErrors(compiled.ast));
  9745. }
  9746. compiled.errors = errors;
  9747. compiled.tips = tips;
  9748. return compiled
  9749. }
  9750. return {
  9751. compile: compile,
  9752. compileToFunctions: createCompileToFunctionFn(compile)
  9753. }
  9754. }
  9755. }
  9756. /* */
  9757. // `createCompilerCreator` allows creating compilers that use alternative
  9758. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  9759. // Here we just export a default compiler using the default parts.
  9760. var createCompiler = createCompilerCreator(function baseCompile (
  9761. template,
  9762. options
  9763. ) {
  9764. var ast = parse(template.trim(), options);
  9765. if (options.optimize !== false) {
  9766. optimize(ast, options);
  9767. }
  9768. var code = generate(ast, options);
  9769. return {
  9770. ast: ast,
  9771. render: code.render,
  9772. staticRenderFns: code.staticRenderFns
  9773. }
  9774. });
  9775. /* */
  9776. var ref$1 = createCompiler(baseOptions);
  9777. var compileToFunctions = ref$1.compileToFunctions;
  9778. /* */
  9779. // check whether current browser encodes a char inside attribute values
  9780. var div;
  9781. function getShouldDecode (href) {
  9782. div = div || document.createElement('div');
  9783. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  9784. return div.innerHTML.indexOf('&#10;') > 0
  9785. }
  9786. // #3663: IE encodes newlines inside attribute values while other browsers don't
  9787. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  9788. // #6828: chrome encodes content in a[href]
  9789. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  9790. /* */
  9791. var idToTemplate = cached(function (id) {
  9792. var el = query(id);
  9793. return el && el.innerHTML
  9794. });
  9795. var mount = Vue.prototype.$mount;
  9796. Vue.prototype.$mount = function (
  9797. el,
  9798. hydrating
  9799. ) {
  9800. el = el && query(el);
  9801. /* istanbul ignore if */
  9802. if (el === document.body || el === document.documentElement) {
  9803. "development" !== 'production' && warn(
  9804. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  9805. );
  9806. return this
  9807. }
  9808. var options = this.$options;
  9809. // resolve template/el and convert to render function
  9810. if (!options.render) {
  9811. var template = options.template;
  9812. if (template) {
  9813. if (typeof template === 'string') {
  9814. if (template.charAt(0) === '#') {
  9815. template = idToTemplate(template);
  9816. /* istanbul ignore if */
  9817. if ("development" !== 'production' && !template) {
  9818. warn(
  9819. ("Template element not found or is empty: " + (options.template)),
  9820. this
  9821. );
  9822. }
  9823. }
  9824. } else if (template.nodeType) {
  9825. template = template.innerHTML;
  9826. } else {
  9827. {
  9828. warn('invalid template option:' + template, this);
  9829. }
  9830. return this
  9831. }
  9832. } else if (el) {
  9833. template = getOuterHTML(el);
  9834. }
  9835. if (template) {
  9836. /* istanbul ignore if */
  9837. if ("development" !== 'production' && config.performance && mark) {
  9838. mark('compile');
  9839. }
  9840. var ref = compileToFunctions(template, {
  9841. shouldDecodeNewlines: shouldDecodeNewlines,
  9842. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  9843. delimiters: options.delimiters,
  9844. comments: options.comments
  9845. }, this);
  9846. var render = ref.render;
  9847. var staticRenderFns = ref.staticRenderFns;
  9848. options.render = render;
  9849. options.staticRenderFns = staticRenderFns;
  9850. /* istanbul ignore if */
  9851. if ("development" !== 'production' && config.performance && mark) {
  9852. mark('compile end');
  9853. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  9854. }
  9855. }
  9856. }
  9857. return mount.call(this, el, hydrating)
  9858. };
  9859. /**
  9860. * Get outerHTML of elements, taking care
  9861. * of SVG elements in IE as well.
  9862. */
  9863. function getOuterHTML (el) {
  9864. if (el.outerHTML) {
  9865. return el.outerHTML
  9866. } else {
  9867. var container = document.createElement('div');
  9868. container.appendChild(el.cloneNode(true));
  9869. return container.innerHTML
  9870. }
  9871. }
  9872. Vue.compile = compileToFunctions;
  9873. return Vue;
  9874. })));