build.js 154 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  4. var stream = require('stream');
  5. var stream__default = _interopDefault(stream);
  6. var he = require('he');
  7. var NativeModule = _interopDefault(require('module'));
  8. var vm = _interopDefault(require('vm'));
  9. /* */
  10. var MAX_STACK_DEPTH = 1000;
  11. function createWriteFunction (
  12. write,
  13. onError
  14. ) {
  15. var stackDepth = 0;
  16. var cachedWrite = function (text, next) {
  17. if (text && cachedWrite.caching) {
  18. cachedWrite.cacheBuffer[cachedWrite.cacheBuffer.length - 1] += text;
  19. }
  20. var waitForNext = write(text, next);
  21. if (!waitForNext) {
  22. if (stackDepth >= MAX_STACK_DEPTH) {
  23. process.nextTick(function () {
  24. try { next(); } catch (e) {
  25. onError(e);
  26. }
  27. });
  28. } else {
  29. stackDepth++;
  30. next();
  31. stackDepth--;
  32. }
  33. }
  34. };
  35. cachedWrite.caching = false;
  36. cachedWrite.cacheBuffer = [];
  37. return cachedWrite
  38. }
  39. /* */
  40. /**
  41. * Original RenderStream implementation by Sasha Aickin (@aickin)
  42. * Licensed under the Apache License, Version 2.0
  43. * http://www.apache.org/licenses/LICENSE-2.0
  44. *
  45. * Modified by Evan You (@yyx990803)
  46. */
  47. var RenderStream = (function (superclass) {
  48. function RenderStream (render) {
  49. var this$1 = this;
  50. superclass.call(this);
  51. this.buffer = '';
  52. this.render = render;
  53. this.expectedSize = 0;
  54. this.write = createWriteFunction(function (text, next) {
  55. var n = this$1.expectedSize;
  56. this$1.buffer += text;
  57. if (this$1.buffer.length >= n) {
  58. this$1.next = next;
  59. this$1.pushBySize(n);
  60. return true // we will decide when to call next
  61. }
  62. }, function (err) {
  63. this$1.emit('error', err);
  64. });
  65. this.end = function () {
  66. // the rendering is finished; we should push out the last of the buffer.
  67. this$1.done = true;
  68. this$1.push(this$1.buffer);
  69. };
  70. }
  71. if ( superclass ) RenderStream.__proto__ = superclass;
  72. RenderStream.prototype = Object.create( superclass && superclass.prototype );
  73. RenderStream.prototype.constructor = RenderStream;
  74. RenderStream.prototype.pushBySize = function pushBySize (n) {
  75. var bufferToPush = this.buffer.substring(0, n);
  76. this.buffer = this.buffer.substring(n);
  77. this.push(bufferToPush);
  78. };
  79. RenderStream.prototype.tryRender = function tryRender () {
  80. try {
  81. this.render(this.write, this.end);
  82. } catch (e) {
  83. this.emit('error', e);
  84. }
  85. };
  86. RenderStream.prototype.tryNext = function tryNext () {
  87. try {
  88. this.next();
  89. } catch (e) {
  90. this.emit('error', e);
  91. }
  92. };
  93. RenderStream.prototype._read = function _read (n) {
  94. this.expectedSize = n;
  95. // it's possible that the last chunk added bumped the buffer up to > 2 * n,
  96. // which means we will need to go through multiple read calls to drain it
  97. // down to < n.
  98. if (this.done) {
  99. this.push(null);
  100. return
  101. }
  102. if (this.buffer.length >= n) {
  103. this.pushBySize(n);
  104. return
  105. }
  106. if (!this.next) {
  107. // start the rendering chain.
  108. this.tryRender();
  109. } else {
  110. // continue with the rendering.
  111. this.tryNext();
  112. }
  113. };
  114. return RenderStream;
  115. }(stream__default.Readable));
  116. /* */
  117. /**
  118. * Convert a value to a string that is actually rendered.
  119. */
  120. function _toString (val) {
  121. return val == null
  122. ? ''
  123. : typeof val === 'object'
  124. ? JSON.stringify(val, null, 2)
  125. : String(val)
  126. }
  127. /**
  128. * Convert a input value to a number for persistence.
  129. * If the conversion fails, return original string.
  130. */
  131. function toNumber (val) {
  132. var n = parseFloat(val, 10);
  133. return (n || n === 0) ? n : val
  134. }
  135. /**
  136. * Make a map and return a function for checking if a key
  137. * is in that map.
  138. */
  139. function makeMap (
  140. str,
  141. expectsLowerCase
  142. ) {
  143. var map = Object.create(null);
  144. var list = str.split(',');
  145. for (var i = 0; i < list.length; i++) {
  146. map[list[i]] = true;
  147. }
  148. return expectsLowerCase
  149. ? function (val) { return map[val.toLowerCase()]; }
  150. : function (val) { return map[val]; }
  151. }
  152. /**
  153. * Check if a tag is a built-in tag.
  154. */
  155. var isBuiltInTag = makeMap('slot,component', true);
  156. /**
  157. * Remove an item from an array
  158. */
  159. function remove (arr, item) {
  160. if (arr.length) {
  161. var index = arr.indexOf(item);
  162. if (index > -1) {
  163. return arr.splice(index, 1)
  164. }
  165. }
  166. }
  167. /**
  168. * Check whether the object has the property.
  169. */
  170. var hasOwnProperty = Object.prototype.hasOwnProperty;
  171. function hasOwn (obj, key) {
  172. return hasOwnProperty.call(obj, key)
  173. }
  174. /**
  175. * Check if value is primitive
  176. */
  177. function isPrimitive (value) {
  178. return typeof value === 'string' || typeof value === 'number'
  179. }
  180. /**
  181. * Create a cached version of a pure function.
  182. */
  183. function cached (fn) {
  184. var cache = Object.create(null);
  185. return function cachedFn (str) {
  186. var hit = cache[str];
  187. return hit || (cache[str] = fn(str))
  188. }
  189. }
  190. /**
  191. * Camelize a hyphen-delmited string.
  192. */
  193. var camelizeRE = /-(\w)/g;
  194. var camelize = cached(function (str) {
  195. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  196. });
  197. /**
  198. * Capitalize a string.
  199. */
  200. var capitalize = cached(function (str) {
  201. return str.charAt(0).toUpperCase() + str.slice(1)
  202. });
  203. /**
  204. * Hyphenate a camelCase string.
  205. */
  206. var hyphenateRE = /([^-])([A-Z])/g;
  207. var hyphenate = cached(function (str) {
  208. return str
  209. .replace(hyphenateRE, '$1-$2')
  210. .replace(hyphenateRE, '$1-$2')
  211. .toLowerCase()
  212. });
  213. /**
  214. * Simple bind, faster than native
  215. */
  216. function bind (fn, ctx) {
  217. function boundFn (a) {
  218. var l = arguments.length;
  219. return l
  220. ? l > 1
  221. ? fn.apply(ctx, arguments)
  222. : fn.call(ctx, a)
  223. : fn.call(ctx)
  224. }
  225. // record original fn length
  226. boundFn._length = fn.length;
  227. return boundFn
  228. }
  229. /**
  230. * Convert an Array-like object to a real Array.
  231. */
  232. function toArray (list, start) {
  233. start = start || 0;
  234. var i = list.length - start;
  235. var ret = new Array(i);
  236. while (i--) {
  237. ret[i] = list[i + start];
  238. }
  239. return ret
  240. }
  241. /**
  242. * Mix properties into target object.
  243. */
  244. function extend (to, _from) {
  245. for (var key in _from) {
  246. to[key] = _from[key];
  247. }
  248. return to
  249. }
  250. /**
  251. * Quick object check - this is primarily used to tell
  252. * Objects from primitive values when we know the value
  253. * is a JSON-compliant type.
  254. */
  255. function isObject (obj) {
  256. return obj !== null && typeof obj === 'object'
  257. }
  258. /**
  259. * Strict object type check. Only returns true
  260. * for plain JavaScript objects.
  261. */
  262. var toString = Object.prototype.toString;
  263. var OBJECT_STRING = '[object Object]';
  264. function isPlainObject (obj) {
  265. return toString.call(obj) === OBJECT_STRING
  266. }
  267. /**
  268. * Merge an Array of Objects into a single Object.
  269. */
  270. function toObject (arr) {
  271. var res = {};
  272. for (var i = 0; i < arr.length; i++) {
  273. if (arr[i]) {
  274. extend(res, arr[i]);
  275. }
  276. }
  277. return res
  278. }
  279. /**
  280. * Perform no operation.
  281. */
  282. function noop () {}
  283. /**
  284. * Always return false.
  285. */
  286. var no = function () { return false; };
  287. /**
  288. * Generate a static keys string from compiler modules.
  289. */
  290. function genStaticKeys (modules) {
  291. return modules.reduce(function (keys, m) {
  292. return keys.concat(m.staticKeys || [])
  293. }, []).join(',')
  294. }
  295. /**
  296. * Check if two values are loosely equal - that is,
  297. * if they are plain objects, do they have the same shape?
  298. */
  299. function looseEqual (a, b) {
  300. /* eslint-disable eqeqeq */
  301. return a == b || (
  302. isObject(a) && isObject(b)
  303. ? JSON.stringify(a) === JSON.stringify(b)
  304. : false
  305. )
  306. /* eslint-enable eqeqeq */
  307. }
  308. function looseIndexOf (arr, val) {
  309. for (var i = 0; i < arr.length; i++) {
  310. if (looseEqual(arr[i], val)) { return i }
  311. }
  312. return -1
  313. }
  314. /* */
  315. /* globals MutationObserver */
  316. // can we use __proto__?
  317. var hasProto = '__proto__' in {};
  318. // Browser environment sniffing
  319. var inBrowser =
  320. typeof window !== 'undefined' &&
  321. Object.prototype.toString.call(window) !== '[object Object]';
  322. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  323. var isIE = UA && /msie|trident/.test(UA);
  324. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  325. var isEdge = UA && UA.indexOf('edge/') > 0;
  326. var isAndroid = UA && UA.indexOf('android') > 0;
  327. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  328. // detect devtools
  329. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  330. /* istanbul ignore next */
  331. function isNative (Ctor) {
  332. return /native code/.test(Ctor.toString())
  333. }
  334. /**
  335. * Defer a task to execute it asynchronously.
  336. */
  337. var nextTick = (function () {
  338. var callbacks = [];
  339. var pending = false;
  340. var timerFunc;
  341. function nextTickHandler () {
  342. pending = false;
  343. var copies = callbacks.slice(0);
  344. callbacks.length = 0;
  345. for (var i = 0; i < copies.length; i++) {
  346. copies[i]();
  347. }
  348. }
  349. // the nextTick behavior leverages the microtask queue, which can be accessed
  350. // via either native Promise.then or MutationObserver.
  351. // MutationObserver has wider support, however it is seriously bugged in
  352. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  353. // completely stops working after triggering a few times... so, if native
  354. // Promise is available, we will use it:
  355. /* istanbul ignore if */
  356. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  357. var p = Promise.resolve();
  358. timerFunc = function () {
  359. p.then(nextTickHandler);
  360. // in problematic UIWebViews, Promise.then doesn't completely break, but
  361. // it can get stuck in a weird state where callbacks are pushed into the
  362. // microtask queue but the queue isn't being flushed, until the browser
  363. // needs to do some other work, e.g. handle a timer. Therefore we can
  364. // "force" the microtask queue to be flushed by adding an empty timer.
  365. if (isIOS) { setTimeout(noop); }
  366. };
  367. } else if (typeof MutationObserver !== 'undefined' && (
  368. isNative(MutationObserver) ||
  369. // PhantomJS and iOS 7.x
  370. MutationObserver.toString() === '[object MutationObserverConstructor]'
  371. )) {
  372. // use MutationObserver where native Promise is not available,
  373. // e.g. PhantomJS IE11, iOS7, Android 4.4
  374. var counter = 1;
  375. var observer = new MutationObserver(nextTickHandler);
  376. var textNode = document.createTextNode(String(counter));
  377. observer.observe(textNode, {
  378. characterData: true
  379. });
  380. timerFunc = function () {
  381. counter = (counter + 1) % 2;
  382. textNode.data = String(counter);
  383. };
  384. } else {
  385. // fallback to setTimeout
  386. /* istanbul ignore next */
  387. timerFunc = function () {
  388. setTimeout(nextTickHandler, 0);
  389. };
  390. }
  391. return function queueNextTick (cb, ctx) {
  392. var func = ctx
  393. ? function () { cb.call(ctx); }
  394. : cb;
  395. callbacks.push(func);
  396. if (!pending) {
  397. pending = true;
  398. timerFunc();
  399. }
  400. }
  401. })();
  402. var _Set;
  403. /* istanbul ignore if */
  404. if (typeof Set !== 'undefined' && isNative(Set)) {
  405. // use native Set when available.
  406. _Set = Set;
  407. } else {
  408. // a non-standard Set polyfill that only works with primitive keys.
  409. _Set = (function () {
  410. function Set () {
  411. this.set = Object.create(null);
  412. }
  413. Set.prototype.has = function has (key) {
  414. return this.set[key] !== undefined
  415. };
  416. Set.prototype.add = function add (key) {
  417. this.set[key] = 1;
  418. };
  419. Set.prototype.clear = function clear () {
  420. this.set = Object.create(null);
  421. };
  422. return Set;
  423. }());
  424. }
  425. /* */
  426. var config = {
  427. /**
  428. * Option merge strategies (used in core/util/options)
  429. */
  430. optionMergeStrategies: Object.create(null),
  431. /**
  432. * Whether to suppress warnings.
  433. */
  434. silent: false,
  435. /**
  436. * Whether to enable devtools
  437. */
  438. devtools: process.env.NODE_ENV !== 'production',
  439. /**
  440. * Error handler for watcher errors
  441. */
  442. errorHandler: null,
  443. /**
  444. * Ignore certain custom elements
  445. */
  446. ignoredElements: null,
  447. /**
  448. * Custom user key aliases for v-on
  449. */
  450. keyCodes: Object.create(null),
  451. /**
  452. * Check if a tag is reserved so that it cannot be registered as a
  453. * component. This is platform-dependent and may be overwritten.
  454. */
  455. isReservedTag: no,
  456. /**
  457. * Check if a tag is an unknown element.
  458. * Platform-dependent.
  459. */
  460. isUnknownElement: no,
  461. /**
  462. * Get the namespace of an element
  463. */
  464. getTagNamespace: noop,
  465. /**
  466. * Check if an attribute must be bound using property, e.g. value
  467. * Platform-dependent.
  468. */
  469. mustUseProp: no,
  470. /**
  471. * List of asset types that a component can own.
  472. */
  473. _assetTypes: [
  474. 'component',
  475. 'directive',
  476. 'filter'
  477. ],
  478. /**
  479. * List of lifecycle hooks.
  480. */
  481. _lifecycleHooks: [
  482. 'beforeCreate',
  483. 'created',
  484. 'beforeMount',
  485. 'mounted',
  486. 'beforeUpdate',
  487. 'updated',
  488. 'beforeDestroy',
  489. 'destroyed',
  490. 'activated',
  491. 'deactivated'
  492. ],
  493. /**
  494. * Max circular updates allowed in a scheduler flush cycle.
  495. */
  496. _maxUpdateCount: 100,
  497. /**
  498. * Server rendering?
  499. */
  500. _isServer: process.env.VUE_ENV === 'server'
  501. };
  502. var warn = noop;
  503. var formatComponentName;
  504. if (process.env.NODE_ENV !== 'production') {
  505. var hasConsole = typeof console !== 'undefined';
  506. warn = function (msg, vm$$1) {
  507. if (hasConsole && (!config.silent)) {
  508. console.error("[Vue warn]: " + msg + " " + (
  509. vm$$1 ? formatLocation(formatComponentName(vm$$1)) : ''
  510. ));
  511. }
  512. };
  513. formatComponentName = function (vm$$1) {
  514. if (vm$$1.$root === vm$$1) {
  515. return 'root instance'
  516. }
  517. var name = vm$$1._isVue
  518. ? vm$$1.$options.name || vm$$1.$options._componentTag
  519. : vm$$1.name;
  520. return (
  521. (name ? ("component <" + name + ">") : "anonymous component") +
  522. (vm$$1._isVue && vm$$1.$options.__file ? (" at " + (vm$$1.$options.__file)) : '')
  523. )
  524. };
  525. var formatLocation = function (str) {
  526. if (str === 'anonymous component') {
  527. str += " - use the \"name\" option for better debugging messages.";
  528. }
  529. return ("\n(found in " + str + ")")
  530. };
  531. }
  532. /* */
  533. /**
  534. * Check if a string starts with $ or _
  535. */
  536. function isReserved (str) {
  537. var c = (str + '').charCodeAt(0);
  538. return c === 0x24 || c === 0x5F
  539. }
  540. /**
  541. * Define a property.
  542. */
  543. function def (obj, key, val, enumerable) {
  544. Object.defineProperty(obj, key, {
  545. value: val,
  546. enumerable: !!enumerable,
  547. writable: true,
  548. configurable: true
  549. });
  550. }
  551. /**
  552. * Parse simple path.
  553. */
  554. var bailRE = /[^\w.$]/;
  555. function parsePath (path) {
  556. if (bailRE.test(path)) {
  557. return
  558. } else {
  559. var segments = path.split('.');
  560. return function (obj) {
  561. for (var i = 0; i < segments.length; i++) {
  562. if (!obj) { return }
  563. obj = obj[segments[i]];
  564. }
  565. return obj
  566. }
  567. }
  568. }
  569. /* not type checking this file because flow doesn't play well with Proxy */
  570. var hasProxy;
  571. var proxyHandlers;
  572. var initProxy;
  573. if (process.env.NODE_ENV !== 'production') {
  574. var allowedGlobals = makeMap(
  575. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  576. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  577. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  578. 'require' // for Webpack/Browserify
  579. );
  580. hasProxy =
  581. typeof Proxy !== 'undefined' &&
  582. Proxy.toString().match(/native code/);
  583. proxyHandlers = {
  584. has: function has (target, key) {
  585. var has = key in target;
  586. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  587. if (!has && !isAllowed) {
  588. warn(
  589. "Property or method \"" + key + "\" is not defined on the instance but " +
  590. "referenced during render. Make sure to declare reactive data " +
  591. "properties in the data option.",
  592. target
  593. );
  594. }
  595. return has || !isAllowed
  596. }
  597. };
  598. initProxy = function initProxy (vm$$1) {
  599. if (hasProxy) {
  600. vm$$1._renderProxy = new Proxy(vm$$1, proxyHandlers);
  601. } else {
  602. vm$$1._renderProxy = vm$$1;
  603. }
  604. };
  605. }
  606. /* */
  607. var uid$2 = 0;
  608. /**
  609. * A dep is an observable that can have multiple
  610. * directives subscribing to it.
  611. */
  612. var Dep = function Dep () {
  613. this.id = uid$2++;
  614. this.subs = [];
  615. };
  616. Dep.prototype.addSub = function addSub (sub) {
  617. this.subs.push(sub);
  618. };
  619. Dep.prototype.removeSub = function removeSub (sub) {
  620. remove(this.subs, sub);
  621. };
  622. Dep.prototype.depend = function depend () {
  623. if (Dep.target) {
  624. Dep.target.addDep(this);
  625. }
  626. };
  627. Dep.prototype.notify = function notify () {
  628. // stablize the subscriber list first
  629. var subs = this.subs.slice();
  630. for (var i = 0, l = subs.length; i < l; i++) {
  631. subs[i].update();
  632. }
  633. };
  634. // the current target watcher being evaluated.
  635. // this is globally unique because there could be only one
  636. // watcher being evaluated at any time.
  637. Dep.target = null;
  638. var targetStack = [];
  639. function pushTarget (_target) {
  640. if (Dep.target) { targetStack.push(Dep.target); }
  641. Dep.target = _target;
  642. }
  643. function popTarget () {
  644. Dep.target = targetStack.pop();
  645. }
  646. /* */
  647. var queue = [];
  648. var has$1 = {};
  649. var circular = {};
  650. var waiting = false;
  651. var flushing = false;
  652. var index = 0;
  653. /**
  654. * Reset the scheduler's state.
  655. */
  656. function resetSchedulerState () {
  657. queue.length = 0;
  658. has$1 = {};
  659. if (process.env.NODE_ENV !== 'production') {
  660. circular = {};
  661. }
  662. waiting = flushing = false;
  663. }
  664. /**
  665. * Flush both queues and run the watchers.
  666. */
  667. function flushSchedulerQueue () {
  668. flushing = true;
  669. // Sort queue before flush.
  670. // This ensures that:
  671. // 1. Components are updated from parent to child. (because parent is always
  672. // created before the child)
  673. // 2. A component's user watchers are run before its render watcher (because
  674. // user watchers are created before the render watcher)
  675. // 3. If a component is destroyed during a parent component's watcher run,
  676. // its watchers can be skipped.
  677. queue.sort(function (a, b) { return a.id - b.id; });
  678. // do not cache length because more watchers might be pushed
  679. // as we run existing watchers
  680. for (index = 0; index < queue.length; index++) {
  681. var watcher = queue[index];
  682. var id = watcher.id;
  683. has$1[id] = null;
  684. watcher.run();
  685. // in dev build, check and stop circular updates.
  686. if (process.env.NODE_ENV !== 'production' && has$1[id] != null) {
  687. circular[id] = (circular[id] || 0) + 1;
  688. if (circular[id] > config._maxUpdateCount) {
  689. warn(
  690. 'You may have an infinite update loop ' + (
  691. watcher.user
  692. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  693. : "in a component render function."
  694. ),
  695. watcher.vm
  696. );
  697. break
  698. }
  699. }
  700. }
  701. // devtool hook
  702. /* istanbul ignore if */
  703. if (devtools && config.devtools) {
  704. devtools.emit('flush');
  705. }
  706. resetSchedulerState();
  707. }
  708. /**
  709. * Push a watcher into the watcher queue.
  710. * Jobs with duplicate IDs will be skipped unless it's
  711. * pushed when the queue is being flushed.
  712. */
  713. function queueWatcher (watcher) {
  714. var id = watcher.id;
  715. if (has$1[id] == null) {
  716. has$1[id] = true;
  717. if (!flushing) {
  718. queue.push(watcher);
  719. } else {
  720. // if already flushing, splice the watcher based on its id
  721. // if already past its id, it will be run next immediately.
  722. var i = queue.length - 1;
  723. while (i >= 0 && queue[i].id > watcher.id) {
  724. i--;
  725. }
  726. queue.splice(Math.max(i, index) + 1, 0, watcher);
  727. }
  728. // queue the flush
  729. if (!waiting) {
  730. waiting = true;
  731. nextTick(flushSchedulerQueue);
  732. }
  733. }
  734. }
  735. /* */
  736. var uid$1 = 0;
  737. /**
  738. * A watcher parses an expression, collects dependencies,
  739. * and fires callback when the expression value changes.
  740. * This is used for both the $watch() api and directives.
  741. */
  742. var Watcher = function Watcher (
  743. vm$$1,
  744. expOrFn,
  745. cb,
  746. options
  747. ) {
  748. if ( options === void 0 ) options = {};
  749. this.vm = vm$$1;
  750. vm$$1._watchers.push(this);
  751. // options
  752. this.deep = !!options.deep;
  753. this.user = !!options.user;
  754. this.lazy = !!options.lazy;
  755. this.sync = !!options.sync;
  756. this.expression = expOrFn.toString();
  757. this.cb = cb;
  758. this.id = ++uid$1; // uid for batching
  759. this.active = true;
  760. this.dirty = this.lazy; // for lazy watchers
  761. this.deps = [];
  762. this.newDeps = [];
  763. this.depIds = new _Set();
  764. this.newDepIds = new _Set();
  765. // parse expression for getter
  766. if (typeof expOrFn === 'function') {
  767. this.getter = expOrFn;
  768. } else {
  769. this.getter = parsePath(expOrFn);
  770. if (!this.getter) {
  771. this.getter = function () {};
  772. process.env.NODE_ENV !== 'production' && warn(
  773. "Failed watching path: \"" + expOrFn + "\" " +
  774. 'Watcher only accepts simple dot-delimited paths. ' +
  775. 'For full control, use a function instead.',
  776. vm$$1
  777. );
  778. }
  779. }
  780. this.value = this.lazy
  781. ? undefined
  782. : this.get();
  783. };
  784. /**
  785. * Evaluate the getter, and re-collect dependencies.
  786. */
  787. Watcher.prototype.get = function get () {
  788. pushTarget(this);
  789. var value = this.getter.call(this.vm, this.vm);
  790. // "touch" every property so they are all tracked as
  791. // dependencies for deep watching
  792. if (this.deep) {
  793. traverse(value);
  794. }
  795. popTarget();
  796. this.cleanupDeps();
  797. return value
  798. };
  799. /**
  800. * Add a dependency to this directive.
  801. */
  802. Watcher.prototype.addDep = function addDep (dep) {
  803. var id = dep.id;
  804. if (!this.newDepIds.has(id)) {
  805. this.newDepIds.add(id);
  806. this.newDeps.push(dep);
  807. if (!this.depIds.has(id)) {
  808. dep.addSub(this);
  809. }
  810. }
  811. };
  812. /**
  813. * Clean up for dependency collection.
  814. */
  815. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  816. var this$1 = this;
  817. var i = this.deps.length;
  818. while (i--) {
  819. var dep = this$1.deps[i];
  820. if (!this$1.newDepIds.has(dep.id)) {
  821. dep.removeSub(this$1);
  822. }
  823. }
  824. var tmp = this.depIds;
  825. this.depIds = this.newDepIds;
  826. this.newDepIds = tmp;
  827. this.newDepIds.clear();
  828. tmp = this.deps;
  829. this.deps = this.newDeps;
  830. this.newDeps = tmp;
  831. this.newDeps.length = 0;
  832. };
  833. /**
  834. * Subscriber interface.
  835. * Will be called when a dependency changes.
  836. */
  837. Watcher.prototype.update = function update () {
  838. /* istanbul ignore else */
  839. if (this.lazy) {
  840. this.dirty = true;
  841. } else if (this.sync) {
  842. this.run();
  843. } else {
  844. queueWatcher(this);
  845. }
  846. };
  847. /**
  848. * Scheduler job interface.
  849. * Will be called by the scheduler.
  850. */
  851. Watcher.prototype.run = function run () {
  852. if (this.active) {
  853. var value = this.get();
  854. if (
  855. value !== this.value ||
  856. // Deep watchers and watchers on Object/Arrays should fire even
  857. // when the value is the same, because the value may
  858. // have mutated.
  859. isObject(value) ||
  860. this.deep
  861. ) {
  862. // set new value
  863. var oldValue = this.value;
  864. this.value = value;
  865. if (this.user) {
  866. try {
  867. this.cb.call(this.vm, value, oldValue);
  868. } catch (e) {
  869. process.env.NODE_ENV !== 'production' && warn(
  870. ("Error in watcher \"" + (this.expression) + "\""),
  871. this.vm
  872. );
  873. /* istanbul ignore else */
  874. if (config.errorHandler) {
  875. config.errorHandler.call(null, e, this.vm);
  876. } else {
  877. throw e
  878. }
  879. }
  880. } else {
  881. this.cb.call(this.vm, value, oldValue);
  882. }
  883. }
  884. }
  885. };
  886. /**
  887. * Evaluate the value of the watcher.
  888. * This only gets called for lazy watchers.
  889. */
  890. Watcher.prototype.evaluate = function evaluate () {
  891. this.value = this.get();
  892. this.dirty = false;
  893. };
  894. /**
  895. * Depend on all deps collected by this watcher.
  896. */
  897. Watcher.prototype.depend = function depend () {
  898. var this$1 = this;
  899. var i = this.deps.length;
  900. while (i--) {
  901. this$1.deps[i].depend();
  902. }
  903. };
  904. /**
  905. * Remove self from all dependencies' subscriber list.
  906. */
  907. Watcher.prototype.teardown = function teardown () {
  908. var this$1 = this;
  909. if (this.active) {
  910. // remove self from vm's watcher list
  911. // this is a somewhat expensive operation so we skip it
  912. // if the vm is being destroyed or is performing a v-for
  913. // re-render (the watcher list is then filtered by v-for).
  914. if (!this.vm._isBeingDestroyed && !this.vm._vForRemoving) {
  915. remove(this.vm._watchers, this);
  916. }
  917. var i = this.deps.length;
  918. while (i--) {
  919. this$1.deps[i].removeSub(this$1);
  920. }
  921. this.active = false;
  922. }
  923. };
  924. /**
  925. * Recursively traverse an object to evoke all converted
  926. * getters, so that every nested property inside the object
  927. * is collected as a "deep" dependency.
  928. */
  929. var seenObjects = new _Set();
  930. function traverse (val) {
  931. seenObjects.clear();
  932. _traverse(val, seenObjects);
  933. }
  934. function _traverse (val, seen) {
  935. var i, keys;
  936. var isA = Array.isArray(val);
  937. if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
  938. return
  939. }
  940. if (val.__ob__) {
  941. var depId = val.__ob__.dep.id;
  942. if (seen.has(depId)) {
  943. return
  944. }
  945. seen.add(depId);
  946. }
  947. if (isA) {
  948. i = val.length;
  949. while (i--) { _traverse(val[i], seen); }
  950. } else {
  951. keys = Object.keys(val);
  952. i = keys.length;
  953. while (i--) { _traverse(val[keys[i]], seen); }
  954. }
  955. }
  956. /*
  957. * not type checking this file because flow doesn't play well with
  958. * dynamically accessing methods on Array prototype
  959. */
  960. var arrayProto = Array.prototype;
  961. var arrayMethods = Object.create(arrayProto);[
  962. 'push',
  963. 'pop',
  964. 'shift',
  965. 'unshift',
  966. 'splice',
  967. 'sort',
  968. 'reverse'
  969. ]
  970. .forEach(function (method) {
  971. // cache original method
  972. var original = arrayProto[method];
  973. def(arrayMethods, method, function mutator () {
  974. var arguments$1 = arguments;
  975. // avoid leaking arguments:
  976. // http://jsperf.com/closure-with-arguments
  977. var i = arguments.length;
  978. var args = new Array(i);
  979. while (i--) {
  980. args[i] = arguments$1[i];
  981. }
  982. var result = original.apply(this, args);
  983. var ob = this.__ob__;
  984. var inserted;
  985. switch (method) {
  986. case 'push':
  987. inserted = args;
  988. break
  989. case 'unshift':
  990. inserted = args;
  991. break
  992. case 'splice':
  993. inserted = args.slice(2);
  994. break
  995. }
  996. if (inserted) { ob.observeArray(inserted); }
  997. // notify change
  998. ob.dep.notify();
  999. return result
  1000. });
  1001. });
  1002. /* */
  1003. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  1004. /**
  1005. * By default, when a reactive property is set, the new value is
  1006. * also converted to become reactive. However when passing down props,
  1007. * we don't want to force conversion because the value may be a nested value
  1008. * under a frozen data structure. Converting it would defeat the optimization.
  1009. */
  1010. var observerState = {
  1011. shouldConvert: true,
  1012. isSettingProps: false
  1013. };
  1014. /**
  1015. * Observer class that are attached to each observed
  1016. * object. Once attached, the observer converts target
  1017. * object's property keys into getter/setters that
  1018. * collect dependencies and dispatches updates.
  1019. */
  1020. var Observer = function Observer (value) {
  1021. this.value = value;
  1022. this.dep = new Dep();
  1023. this.vmCount = 0;
  1024. def(value, '__ob__', this);
  1025. if (Array.isArray(value)) {
  1026. var augment = hasProto
  1027. ? protoAugment
  1028. : copyAugment;
  1029. augment(value, arrayMethods, arrayKeys);
  1030. this.observeArray(value);
  1031. } else {
  1032. this.walk(value);
  1033. }
  1034. };
  1035. /**
  1036. * Walk through each property and convert them into
  1037. * getter/setters. This method should only be called when
  1038. * value type is Object.
  1039. */
  1040. Observer.prototype.walk = function walk (obj) {
  1041. var keys = Object.keys(obj);
  1042. for (var i = 0; i < keys.length; i++) {
  1043. defineReactive$$1(obj, keys[i], obj[keys[i]]);
  1044. }
  1045. };
  1046. /**
  1047. * Observe a list of Array items.
  1048. */
  1049. Observer.prototype.observeArray = function observeArray (items) {
  1050. for (var i = 0, l = items.length; i < l; i++) {
  1051. observe(items[i]);
  1052. }
  1053. };
  1054. // helpers
  1055. /**
  1056. * Augment an target Object or Array by intercepting
  1057. * the prototype chain using __proto__
  1058. */
  1059. function protoAugment (target, src) {
  1060. /* eslint-disable no-proto */
  1061. target.__proto__ = src;
  1062. /* eslint-enable no-proto */
  1063. }
  1064. /**
  1065. * Augment an target Object or Array by defining
  1066. * hidden properties.
  1067. *
  1068. * istanbul ignore next
  1069. */
  1070. function copyAugment (target, src, keys) {
  1071. for (var i = 0, l = keys.length; i < l; i++) {
  1072. var key = keys[i];
  1073. def(target, key, src[key]);
  1074. }
  1075. }
  1076. /**
  1077. * Attempt to create an observer instance for a value,
  1078. * returns the new observer if successfully observed,
  1079. * or the existing observer if the value already has one.
  1080. */
  1081. function observe (value) {
  1082. if (!isObject(value)) {
  1083. return
  1084. }
  1085. var ob;
  1086. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  1087. ob = value.__ob__;
  1088. } else if (
  1089. observerState.shouldConvert &&
  1090. !config._isServer &&
  1091. (Array.isArray(value) || isPlainObject(value)) &&
  1092. Object.isExtensible(value) &&
  1093. !value._isVue
  1094. ) {
  1095. ob = new Observer(value);
  1096. }
  1097. return ob
  1098. }
  1099. /**
  1100. * Define a reactive property on an Object.
  1101. */
  1102. function defineReactive$$1 (
  1103. obj,
  1104. key,
  1105. val,
  1106. customSetter
  1107. ) {
  1108. var dep = new Dep();
  1109. var property = Object.getOwnPropertyDescriptor(obj, key);
  1110. if (property && property.configurable === false) {
  1111. return
  1112. }
  1113. // cater for pre-defined getter/setters
  1114. var getter = property && property.get;
  1115. var setter = property && property.set;
  1116. var childOb = observe(val);
  1117. Object.defineProperty(obj, key, {
  1118. enumerable: true,
  1119. configurable: true,
  1120. get: function reactiveGetter () {
  1121. var value = getter ? getter.call(obj) : val;
  1122. if (Dep.target) {
  1123. dep.depend();
  1124. if (childOb) {
  1125. childOb.dep.depend();
  1126. }
  1127. if (Array.isArray(value)) {
  1128. dependArray(value);
  1129. }
  1130. }
  1131. return value
  1132. },
  1133. set: function reactiveSetter (newVal) {
  1134. var value = getter ? getter.call(obj) : val;
  1135. /* eslint-disable no-self-compare */
  1136. if (newVal === value || (newVal !== newVal && value !== value)) {
  1137. return
  1138. }
  1139. /* eslint-enable no-self-compare */
  1140. if (process.env.NODE_ENV !== 'production' && customSetter) {
  1141. customSetter();
  1142. }
  1143. if (setter) {
  1144. setter.call(obj, newVal);
  1145. } else {
  1146. val = newVal;
  1147. }
  1148. childOb = observe(newVal);
  1149. dep.notify();
  1150. }
  1151. });
  1152. }
  1153. /**
  1154. * Set a property on an object. Adds the new property and
  1155. * triggers change notification if the property doesn't
  1156. * already exist.
  1157. */
  1158. function set (obj, key, val) {
  1159. if (Array.isArray(obj)) {
  1160. obj.length = Math.max(obj.length, key);
  1161. obj.splice(key, 1, val);
  1162. return val
  1163. }
  1164. if (hasOwn(obj, key)) {
  1165. obj[key] = val;
  1166. return
  1167. }
  1168. var ob = obj.__ob__;
  1169. if (obj._isVue || (ob && ob.vmCount)) {
  1170. process.env.NODE_ENV !== 'production' && warn(
  1171. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  1172. 'at runtime - declare it upfront in the data option.'
  1173. );
  1174. return
  1175. }
  1176. if (!ob) {
  1177. obj[key] = val;
  1178. return
  1179. }
  1180. defineReactive$$1(ob.value, key, val);
  1181. ob.dep.notify();
  1182. return val
  1183. }
  1184. /**
  1185. * Delete a property and trigger change if necessary.
  1186. */
  1187. function del (obj, key) {
  1188. var ob = obj.__ob__;
  1189. if (obj._isVue || (ob && ob.vmCount)) {
  1190. process.env.NODE_ENV !== 'production' && warn(
  1191. 'Avoid deleting properties on a Vue instance or its root $data ' +
  1192. '- just set it to null.'
  1193. );
  1194. return
  1195. }
  1196. if (!hasOwn(obj, key)) {
  1197. return
  1198. }
  1199. delete obj[key];
  1200. if (!ob) {
  1201. return
  1202. }
  1203. ob.dep.notify();
  1204. }
  1205. /**
  1206. * Collect dependencies on array elements when the array is touched, since
  1207. * we cannot intercept array element access like property getters.
  1208. */
  1209. function dependArray (value) {
  1210. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1211. e = value[i];
  1212. e && e.__ob__ && e.__ob__.dep.depend();
  1213. if (Array.isArray(e)) {
  1214. dependArray(e);
  1215. }
  1216. }
  1217. }
  1218. /* */
  1219. function initState (vm$$1) {
  1220. vm$$1._watchers = [];
  1221. initProps(vm$$1);
  1222. initData(vm$$1);
  1223. initComputed(vm$$1);
  1224. initMethods(vm$$1);
  1225. initWatch(vm$$1);
  1226. }
  1227. var isReservedProp = makeMap('key,ref,slot');
  1228. function initProps (vm$$1) {
  1229. var props = vm$$1.$options.props;
  1230. if (props) {
  1231. var propsData = vm$$1.$options.propsData || {};
  1232. var keys = vm$$1.$options._propKeys = Object.keys(props);
  1233. var isRoot = !vm$$1.$parent;
  1234. // root instance props should be converted
  1235. observerState.shouldConvert = isRoot;
  1236. var loop = function ( i ) {
  1237. var key = keys[i];
  1238. /* istanbul ignore else */
  1239. if (process.env.NODE_ENV !== 'production') {
  1240. if (isReservedProp(key)) {
  1241. warn(
  1242. ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
  1243. vm$$1
  1244. );
  1245. }
  1246. defineReactive$$1(vm$$1, key, validateProp(key, props, propsData, vm$$1), function () {
  1247. if (vm$$1.$parent && !observerState.isSettingProps) {
  1248. warn(
  1249. "Avoid mutating a prop directly since the value will be " +
  1250. "overwritten whenever the parent component re-renders. " +
  1251. "Instead, use a data or computed property based on the prop's " +
  1252. "value. Prop being mutated: \"" + key + "\"",
  1253. vm$$1
  1254. );
  1255. }
  1256. });
  1257. } else {
  1258. defineReactive$$1(vm$$1, key, validateProp(key, props, propsData, vm$$1));
  1259. }
  1260. };
  1261. for (var i = 0; i < keys.length; i++) loop( i );
  1262. observerState.shouldConvert = true;
  1263. }
  1264. }
  1265. function initData (vm$$1) {
  1266. var data = vm$$1.$options.data;
  1267. data = vm$$1._data = typeof data === 'function'
  1268. ? data.call(vm$$1)
  1269. : data || {};
  1270. if (!isPlainObject(data)) {
  1271. data = {};
  1272. process.env.NODE_ENV !== 'production' && warn(
  1273. 'data functions should return an object.',
  1274. vm$$1
  1275. );
  1276. }
  1277. // proxy data on instance
  1278. var keys = Object.keys(data);
  1279. var props = vm$$1.$options.props;
  1280. var i = keys.length;
  1281. while (i--) {
  1282. if (props && hasOwn(props, keys[i])) {
  1283. process.env.NODE_ENV !== 'production' && warn(
  1284. "The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
  1285. "Use prop default value instead.",
  1286. vm$$1
  1287. );
  1288. } else {
  1289. proxy(vm$$1, keys[i]);
  1290. }
  1291. }
  1292. // observe data
  1293. observe(data);
  1294. data.__ob__ && data.__ob__.vmCount++;
  1295. }
  1296. var computedSharedDefinition = {
  1297. enumerable: true,
  1298. configurable: true,
  1299. get: noop,
  1300. set: noop
  1301. };
  1302. function initComputed (vm$$1) {
  1303. var computed = vm$$1.$options.computed;
  1304. if (computed) {
  1305. for (var key in computed) {
  1306. var userDef = computed[key];
  1307. if (typeof userDef === 'function') {
  1308. computedSharedDefinition.get = makeComputedGetter(userDef, vm$$1);
  1309. computedSharedDefinition.set = noop;
  1310. } else {
  1311. computedSharedDefinition.get = userDef.get
  1312. ? userDef.cache !== false
  1313. ? makeComputedGetter(userDef.get, vm$$1)
  1314. : bind(userDef.get, vm$$1)
  1315. : noop;
  1316. computedSharedDefinition.set = userDef.set
  1317. ? bind(userDef.set, vm$$1)
  1318. : noop;
  1319. }
  1320. Object.defineProperty(vm$$1, key, computedSharedDefinition);
  1321. }
  1322. }
  1323. }
  1324. function makeComputedGetter (getter, owner) {
  1325. var watcher = new Watcher(owner, getter, noop, {
  1326. lazy: true
  1327. });
  1328. return function computedGetter () {
  1329. if (watcher.dirty) {
  1330. watcher.evaluate();
  1331. }
  1332. if (Dep.target) {
  1333. watcher.depend();
  1334. }
  1335. return watcher.value
  1336. }
  1337. }
  1338. function initMethods (vm$$1) {
  1339. var methods = vm$$1.$options.methods;
  1340. if (methods) {
  1341. for (var key in methods) {
  1342. vm$$1[key] = methods[key] == null ? noop : bind(methods[key], vm$$1);
  1343. if (process.env.NODE_ENV !== 'production' && methods[key] == null) {
  1344. warn(
  1345. "method \"" + key + "\" has an undefined value in the component definition. " +
  1346. "Did you reference the function correctly?",
  1347. vm$$1
  1348. );
  1349. }
  1350. }
  1351. }
  1352. }
  1353. function initWatch (vm$$1) {
  1354. var watch = vm$$1.$options.watch;
  1355. if (watch) {
  1356. for (var key in watch) {
  1357. var handler = watch[key];
  1358. if (Array.isArray(handler)) {
  1359. for (var i = 0; i < handler.length; i++) {
  1360. createWatcher(vm$$1, key, handler[i]);
  1361. }
  1362. } else {
  1363. createWatcher(vm$$1, key, handler);
  1364. }
  1365. }
  1366. }
  1367. }
  1368. function createWatcher (vm$$1, key, handler) {
  1369. var options;
  1370. if (isPlainObject(handler)) {
  1371. options = handler;
  1372. handler = handler.handler;
  1373. }
  1374. if (typeof handler === 'string') {
  1375. handler = vm$$1[handler];
  1376. }
  1377. vm$$1.$watch(key, handler, options);
  1378. }
  1379. function stateMixin (Vue) {
  1380. // flow somehow has problems with directly declared definition object
  1381. // when using Object.defineProperty, so we have to procedurally build up
  1382. // the object here.
  1383. var dataDef = {};
  1384. dataDef.get = function () {
  1385. return this._data
  1386. };
  1387. if (process.env.NODE_ENV !== 'production') {
  1388. dataDef.set = function (newData) {
  1389. warn(
  1390. 'Avoid replacing instance root $data. ' +
  1391. 'Use nested data properties instead.',
  1392. this
  1393. );
  1394. };
  1395. }
  1396. Object.defineProperty(Vue.prototype, '$data', dataDef);
  1397. Vue.prototype.$set = set;
  1398. Vue.prototype.$delete = del;
  1399. Vue.prototype.$watch = function (
  1400. expOrFn,
  1401. cb,
  1402. options
  1403. ) {
  1404. var vm$$1 = this;
  1405. options = options || {};
  1406. options.user = true;
  1407. var watcher = new Watcher(vm$$1, expOrFn, cb, options);
  1408. if (options.immediate) {
  1409. cb.call(vm$$1, watcher.value);
  1410. }
  1411. return function unwatchFn () {
  1412. watcher.teardown();
  1413. }
  1414. };
  1415. }
  1416. function proxy (vm$$1, key) {
  1417. if (!isReserved(key)) {
  1418. Object.defineProperty(vm$$1, key, {
  1419. configurable: true,
  1420. enumerable: true,
  1421. get: function proxyGetter () {
  1422. return vm$$1._data[key]
  1423. },
  1424. set: function proxySetter (val) {
  1425. vm$$1._data[key] = val;
  1426. }
  1427. });
  1428. }
  1429. }
  1430. /* */
  1431. var VNode = function VNode (
  1432. tag,
  1433. data,
  1434. children,
  1435. text,
  1436. elm,
  1437. ns,
  1438. context,
  1439. componentOptions
  1440. ) {
  1441. this.tag = tag;
  1442. this.data = data;
  1443. this.children = children;
  1444. this.text = text;
  1445. this.elm = elm;
  1446. this.ns = ns;
  1447. this.context = context;
  1448. this.functionalContext = undefined;
  1449. this.key = data && data.key;
  1450. this.componentOptions = componentOptions;
  1451. this.child = undefined;
  1452. this.parent = undefined;
  1453. this.raw = false;
  1454. this.isStatic = false;
  1455. this.isRootInsert = true;
  1456. this.isComment = false;
  1457. this.isCloned = false;
  1458. this.isOnce = false;
  1459. };
  1460. var emptyVNode = function () {
  1461. var node = new VNode();
  1462. node.text = '';
  1463. node.isComment = true;
  1464. return node
  1465. };
  1466. // optimized shallow clone
  1467. // used for static nodes and slot nodes because they may be reused across
  1468. // multiple renders, cloning them avoids errors when DOM manipulations rely
  1469. // on their elm reference.
  1470. function cloneVNode (vnode) {
  1471. var cloned = new VNode(
  1472. vnode.tag,
  1473. vnode.data,
  1474. vnode.children,
  1475. vnode.text,
  1476. vnode.elm,
  1477. vnode.ns,
  1478. vnode.context,
  1479. vnode.componentOptions
  1480. );
  1481. cloned.isStatic = vnode.isStatic;
  1482. cloned.key = vnode.key;
  1483. cloned.isCloned = true;
  1484. return cloned
  1485. }
  1486. function cloneVNodes (vnodes) {
  1487. var res = new Array(vnodes.length);
  1488. for (var i = 0; i < vnodes.length; i++) {
  1489. res[i] = cloneVNode(vnodes[i]);
  1490. }
  1491. return res
  1492. }
  1493. /* */
  1494. /* */
  1495. function updateListeners (
  1496. on,
  1497. oldOn,
  1498. add,
  1499. remove$$1,
  1500. vm$$1
  1501. ) {
  1502. var name, cur, old, fn, event, capture;
  1503. for (name in on) {
  1504. cur = on[name];
  1505. old = oldOn[name];
  1506. if (!cur) {
  1507. process.env.NODE_ENV !== 'production' && warn(
  1508. "Invalid handler for event \"" + name + "\": got " + String(cur),
  1509. vm$$1
  1510. );
  1511. } else if (!old) {
  1512. capture = name.charAt(0) === '!';
  1513. event = capture ? name.slice(1) : name;
  1514. if (Array.isArray(cur)) {
  1515. add(event, (cur.invoker = arrInvoker(cur)), capture);
  1516. } else {
  1517. if (!cur.invoker) {
  1518. fn = cur;
  1519. cur = on[name] = {};
  1520. cur.fn = fn;
  1521. cur.invoker = fnInvoker(cur);
  1522. }
  1523. add(event, cur.invoker, capture);
  1524. }
  1525. } else if (cur !== old) {
  1526. if (Array.isArray(old)) {
  1527. old.length = cur.length;
  1528. for (var i = 0; i < old.length; i++) { old[i] = cur[i]; }
  1529. on[name] = old;
  1530. } else {
  1531. old.fn = cur;
  1532. on[name] = old;
  1533. }
  1534. }
  1535. }
  1536. for (name in oldOn) {
  1537. if (!on[name]) {
  1538. event = name.charAt(0) === '!' ? name.slice(1) : name;
  1539. remove$$1(event, oldOn[name].invoker);
  1540. }
  1541. }
  1542. }
  1543. function arrInvoker (arr) {
  1544. return function (ev) {
  1545. var arguments$1 = arguments;
  1546. var single = arguments.length === 1;
  1547. for (var i = 0; i < arr.length; i++) {
  1548. single ? arr[i](ev) : arr[i].apply(null, arguments$1);
  1549. }
  1550. }
  1551. }
  1552. function fnInvoker (o) {
  1553. return function (ev) {
  1554. var single = arguments.length === 1;
  1555. single ? o.fn(ev) : o.fn.apply(null, arguments);
  1556. }
  1557. }
  1558. /* */
  1559. function normalizeChildren (
  1560. children,
  1561. ns,
  1562. nestedIndex
  1563. ) {
  1564. if (isPrimitive(children)) {
  1565. return [createTextVNode(children)]
  1566. }
  1567. if (Array.isArray(children)) {
  1568. var res = [];
  1569. for (var i = 0, l = children.length; i < l; i++) {
  1570. var c = children[i];
  1571. var last = res[res.length - 1];
  1572. // nested
  1573. if (Array.isArray(c)) {
  1574. res.push.apply(res, normalizeChildren(c, ns, ((nestedIndex || '') + "_" + i)));
  1575. } else if (isPrimitive(c)) {
  1576. if (last && last.text) {
  1577. last.text += String(c);
  1578. } else if (c !== '') {
  1579. // convert primitive to vnode
  1580. res.push(createTextVNode(c));
  1581. }
  1582. } else if (c instanceof VNode) {
  1583. if (c.text && last && last.text) {
  1584. if (!last.isCloned) {
  1585. last.text += c.text;
  1586. }
  1587. } else {
  1588. // inherit parent namespace
  1589. if (ns) {
  1590. applyNS(c, ns);
  1591. }
  1592. // default key for nested array children (likely generated by v-for)
  1593. if (c.tag && c.key == null && nestedIndex != null) {
  1594. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  1595. }
  1596. res.push(c);
  1597. }
  1598. }
  1599. }
  1600. return res
  1601. }
  1602. }
  1603. function createTextVNode (val) {
  1604. return new VNode(undefined, undefined, undefined, String(val))
  1605. }
  1606. function applyNS (vnode, ns) {
  1607. if (vnode.tag && !vnode.ns) {
  1608. vnode.ns = ns;
  1609. if (vnode.children) {
  1610. for (var i = 0, l = vnode.children.length; i < l; i++) {
  1611. applyNS(vnode.children[i], ns);
  1612. }
  1613. }
  1614. }
  1615. }
  1616. /* */
  1617. /* */
  1618. var activeInstance = null;
  1619. function initLifecycle (vm$$1) {
  1620. var options = vm$$1.$options;
  1621. // locate first non-abstract parent
  1622. var parent = options.parent;
  1623. if (parent && !options.abstract) {
  1624. while (parent.$options.abstract && parent.$parent) {
  1625. parent = parent.$parent;
  1626. }
  1627. parent.$children.push(vm$$1);
  1628. }
  1629. vm$$1.$parent = parent;
  1630. vm$$1.$root = parent ? parent.$root : vm$$1;
  1631. vm$$1.$children = [];
  1632. vm$$1.$refs = {};
  1633. vm$$1._watcher = null;
  1634. vm$$1._inactive = false;
  1635. vm$$1._isMounted = false;
  1636. vm$$1._isDestroyed = false;
  1637. vm$$1._isBeingDestroyed = false;
  1638. }
  1639. function lifecycleMixin (Vue) {
  1640. Vue.prototype._mount = function (
  1641. el,
  1642. hydrating
  1643. ) {
  1644. var vm$$1 = this;
  1645. vm$$1.$el = el;
  1646. if (!vm$$1.$options.render) {
  1647. vm$$1.$options.render = emptyVNode;
  1648. if (process.env.NODE_ENV !== 'production') {
  1649. /* istanbul ignore if */
  1650. if (vm$$1.$options.template && vm$$1.$options.template.charAt(0) !== '#') {
  1651. warn(
  1652. 'You are using the runtime-only build of Vue where the template ' +
  1653. 'option is not available. Either pre-compile the templates into ' +
  1654. 'render functions, or use the compiler-included build.',
  1655. vm$$1
  1656. );
  1657. } else {
  1658. warn(
  1659. 'Failed to mount component: template or render function not defined.',
  1660. vm$$1
  1661. );
  1662. }
  1663. }
  1664. }
  1665. callHook(vm$$1, 'beforeMount');
  1666. vm$$1._watcher = new Watcher(vm$$1, function () {
  1667. vm$$1._update(vm$$1._render(), hydrating);
  1668. }, noop);
  1669. hydrating = false;
  1670. // manually mounted instance, call mounted on self
  1671. // mounted is called for render-created child components in its inserted hook
  1672. if (vm$$1.$vnode == null) {
  1673. vm$$1._isMounted = true;
  1674. callHook(vm$$1, 'mounted');
  1675. }
  1676. return vm$$1
  1677. };
  1678. Vue.prototype._update = function (vnode, hydrating) {
  1679. var vm$$1 = this;
  1680. if (vm$$1._isMounted) {
  1681. callHook(vm$$1, 'beforeUpdate');
  1682. }
  1683. var prevEl = vm$$1.$el;
  1684. var prevActiveInstance = activeInstance;
  1685. activeInstance = vm$$1;
  1686. var prevVnode = vm$$1._vnode;
  1687. vm$$1._vnode = vnode;
  1688. if (!prevVnode) {
  1689. // Vue.prototype.__patch__ is injected in entry points
  1690. // based on the rendering backend used.
  1691. vm$$1.$el = vm$$1.__patch__(vm$$1.$el, vnode, hydrating);
  1692. } else {
  1693. vm$$1.$el = vm$$1.__patch__(prevVnode, vnode);
  1694. }
  1695. activeInstance = prevActiveInstance;
  1696. // update __vue__ reference
  1697. if (prevEl) {
  1698. prevEl.__vue__ = null;
  1699. }
  1700. if (vm$$1.$el) {
  1701. vm$$1.$el.__vue__ = vm$$1;
  1702. }
  1703. // if parent is an HOC, update its $el as well
  1704. if (vm$$1.$vnode && vm$$1.$parent && vm$$1.$vnode === vm$$1.$parent._vnode) {
  1705. vm$$1.$parent.$el = vm$$1.$el;
  1706. }
  1707. if (vm$$1._isMounted) {
  1708. callHook(vm$$1, 'updated');
  1709. }
  1710. };
  1711. Vue.prototype._updateFromParent = function (
  1712. propsData,
  1713. listeners,
  1714. parentVnode,
  1715. renderChildren
  1716. ) {
  1717. var vm$$1 = this;
  1718. var hasChildren = !!(vm$$1.$options._renderChildren || renderChildren);
  1719. vm$$1.$options._parentVnode = parentVnode;
  1720. vm$$1.$options._renderChildren = renderChildren;
  1721. // update props
  1722. if (propsData && vm$$1.$options.props) {
  1723. observerState.shouldConvert = false;
  1724. if (process.env.NODE_ENV !== 'production') {
  1725. observerState.isSettingProps = true;
  1726. }
  1727. var propKeys = vm$$1.$options._propKeys || [];
  1728. for (var i = 0; i < propKeys.length; i++) {
  1729. var key = propKeys[i];
  1730. vm$$1[key] = validateProp(key, vm$$1.$options.props, propsData, vm$$1);
  1731. }
  1732. observerState.shouldConvert = true;
  1733. if (process.env.NODE_ENV !== 'production') {
  1734. observerState.isSettingProps = false;
  1735. }
  1736. vm$$1.$options.propsData = propsData;
  1737. }
  1738. // update listeners
  1739. if (listeners) {
  1740. var oldListeners = vm$$1.$options._parentListeners;
  1741. vm$$1.$options._parentListeners = listeners;
  1742. vm$$1._updateListeners(listeners, oldListeners);
  1743. }
  1744. // resolve slots + force update if has children
  1745. if (hasChildren) {
  1746. vm$$1.$slots = resolveSlots(renderChildren, vm$$1._renderContext);
  1747. vm$$1.$forceUpdate();
  1748. }
  1749. };
  1750. Vue.prototype.$forceUpdate = function () {
  1751. var vm$$1 = this;
  1752. if (vm$$1._watcher) {
  1753. vm$$1._watcher.update();
  1754. }
  1755. };
  1756. Vue.prototype.$destroy = function () {
  1757. var vm$$1 = this;
  1758. if (vm$$1._isBeingDestroyed) {
  1759. return
  1760. }
  1761. callHook(vm$$1, 'beforeDestroy');
  1762. vm$$1._isBeingDestroyed = true;
  1763. // remove self from parent
  1764. var parent = vm$$1.$parent;
  1765. if (parent && !parent._isBeingDestroyed && !vm$$1.$options.abstract) {
  1766. remove(parent.$children, vm$$1);
  1767. }
  1768. // teardown watchers
  1769. if (vm$$1._watcher) {
  1770. vm$$1._watcher.teardown();
  1771. }
  1772. var i = vm$$1._watchers.length;
  1773. while (i--) {
  1774. vm$$1._watchers[i].teardown();
  1775. }
  1776. // remove reference from data ob
  1777. // frozen object may not have observer.
  1778. if (vm$$1._data.__ob__) {
  1779. vm$$1._data.__ob__.vmCount--;
  1780. }
  1781. // call the last hook...
  1782. vm$$1._isDestroyed = true;
  1783. callHook(vm$$1, 'destroyed');
  1784. // turn off all instance listeners.
  1785. vm$$1.$off();
  1786. // remove __vue__ reference
  1787. if (vm$$1.$el) {
  1788. vm$$1.$el.__vue__ = null;
  1789. }
  1790. // invoke destroy hooks on current rendered tree
  1791. vm$$1.__patch__(vm$$1._vnode, null);
  1792. };
  1793. }
  1794. function callHook (vm$$1, hook) {
  1795. var handlers = vm$$1.$options[hook];
  1796. if (handlers) {
  1797. for (var i = 0, j = handlers.length; i < j; i++) {
  1798. handlers[i].call(vm$$1);
  1799. }
  1800. }
  1801. vm$$1.$emit('hook:' + hook);
  1802. }
  1803. /* */
  1804. var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy };
  1805. var hooksToMerge = Object.keys(hooks);
  1806. function createComponent (
  1807. Ctor,
  1808. data,
  1809. context,
  1810. children,
  1811. tag
  1812. ) {
  1813. if (!Ctor) {
  1814. return
  1815. }
  1816. var baseCtor = context.$options._base;
  1817. if (isObject(Ctor)) {
  1818. Ctor = baseCtor.extend(Ctor);
  1819. }
  1820. if (typeof Ctor !== 'function') {
  1821. if (process.env.NODE_ENV !== 'production') {
  1822. warn(("Invalid Component definition: " + (String(Ctor))), context);
  1823. }
  1824. return
  1825. }
  1826. // async component
  1827. if (!Ctor.cid) {
  1828. if (Ctor.resolved) {
  1829. Ctor = Ctor.resolved;
  1830. } else {
  1831. Ctor = resolveAsyncComponent(Ctor, baseCtor, function () {
  1832. // it's ok to queue this on every render because
  1833. // $forceUpdate is buffered by the scheduler.
  1834. context.$forceUpdate();
  1835. });
  1836. if (!Ctor) {
  1837. // return nothing if this is indeed an async component
  1838. // wait for the callback to trigger parent update.
  1839. return
  1840. }
  1841. }
  1842. }
  1843. // resolve constructor options in case global mixins are applied after
  1844. // component constructor creation
  1845. resolveConstructorOptions(Ctor);
  1846. data = data || {};
  1847. // extract props
  1848. var propsData = extractProps(data, Ctor);
  1849. // functional component
  1850. if (Ctor.options.functional) {
  1851. return createFunctionalComponent(Ctor, propsData, data, context, children)
  1852. }
  1853. // extract listeners, since these needs to be treated as
  1854. // child component listeners instead of DOM listeners
  1855. var listeners = data.on;
  1856. // replace with listeners with .native modifier
  1857. data.on = data.nativeOn;
  1858. if (Ctor.options.abstract) {
  1859. // abstract components do not keep anything
  1860. // other than props & listeners
  1861. data = {};
  1862. }
  1863. // merge component management hooks onto the placeholder node
  1864. mergeHooks(data);
  1865. // return a placeholder vnode
  1866. var name = Ctor.options.name || tag;
  1867. var vnode = new VNode(
  1868. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  1869. data, undefined, undefined, undefined, undefined, context,
  1870. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
  1871. );
  1872. return vnode
  1873. }
  1874. function createFunctionalComponent (
  1875. Ctor,
  1876. propsData,
  1877. data,
  1878. context,
  1879. children
  1880. ) {
  1881. var props = {};
  1882. var propOptions = Ctor.options.props;
  1883. if (propOptions) {
  1884. for (var key in propOptions) {
  1885. props[key] = validateProp(key, propOptions, propsData);
  1886. }
  1887. }
  1888. var vnode = Ctor.options.render.call(
  1889. null,
  1890. // ensure the createElement function in functional components
  1891. // gets a unique context - this is necessary for correct named slot check
  1892. bind(createElement, { _self: Object.create(context) }),
  1893. {
  1894. props: props,
  1895. data: data,
  1896. parent: context,
  1897. children: normalizeChildren(children),
  1898. slots: function () { return resolveSlots(children, context); }
  1899. }
  1900. );
  1901. if (vnode instanceof VNode) {
  1902. vnode.functionalContext = context;
  1903. if (data.slot) {
  1904. (vnode.data || (vnode.data = {})).slot = data.slot;
  1905. }
  1906. }
  1907. return vnode
  1908. }
  1909. function createComponentInstanceForVnode (
  1910. vnode, // we know it's MountedComponentVNode but flow doesn't
  1911. parent // activeInstance in lifecycle state
  1912. ) {
  1913. var vnodeComponentOptions = vnode.componentOptions;
  1914. var options = {
  1915. _isComponent: true,
  1916. parent: parent,
  1917. propsData: vnodeComponentOptions.propsData,
  1918. _componentTag: vnodeComponentOptions.tag,
  1919. _parentVnode: vnode,
  1920. _parentListeners: vnodeComponentOptions.listeners,
  1921. _renderChildren: vnodeComponentOptions.children
  1922. };
  1923. // check inline-template render functions
  1924. var inlineTemplate = vnode.data.inlineTemplate;
  1925. if (inlineTemplate) {
  1926. options.render = inlineTemplate.render;
  1927. options.staticRenderFns = inlineTemplate.staticRenderFns;
  1928. }
  1929. return new vnodeComponentOptions.Ctor(options)
  1930. }
  1931. function init (vnode, hydrating) {
  1932. if (!vnode.child || vnode.child._isDestroyed) {
  1933. var child = vnode.child = createComponentInstanceForVnode(vnode, activeInstance);
  1934. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  1935. } else if (vnode.data.keepAlive) {
  1936. // kept-alive components, treat as a patch
  1937. var mountedNode = vnode; // work around flow
  1938. prepatch(mountedNode, mountedNode);
  1939. }
  1940. }
  1941. function prepatch (
  1942. oldVnode,
  1943. vnode
  1944. ) {
  1945. var options = vnode.componentOptions;
  1946. var child = vnode.child = oldVnode.child;
  1947. child._updateFromParent(
  1948. options.propsData, // updated props
  1949. options.listeners, // updated listeners
  1950. vnode, // new parent vnode
  1951. options.children // new children
  1952. );
  1953. }
  1954. function insert (vnode) {
  1955. if (!vnode.child._isMounted) {
  1956. vnode.child._isMounted = true;
  1957. callHook(vnode.child, 'mounted');
  1958. }
  1959. if (vnode.data.keepAlive) {
  1960. vnode.child._inactive = false;
  1961. callHook(vnode.child, 'activated');
  1962. }
  1963. }
  1964. function destroy (vnode) {
  1965. if (!vnode.child._isDestroyed) {
  1966. if (!vnode.data.keepAlive) {
  1967. vnode.child.$destroy();
  1968. } else {
  1969. vnode.child._inactive = true;
  1970. callHook(vnode.child, 'deactivated');
  1971. }
  1972. }
  1973. }
  1974. function resolveAsyncComponent (
  1975. factory,
  1976. baseCtor,
  1977. cb
  1978. ) {
  1979. if (factory.requested) {
  1980. // pool callbacks
  1981. factory.pendingCallbacks.push(cb);
  1982. } else {
  1983. factory.requested = true;
  1984. var cbs = factory.pendingCallbacks = [cb];
  1985. var sync = true;
  1986. var resolve = function (res) {
  1987. if (isObject(res)) {
  1988. res = baseCtor.extend(res);
  1989. }
  1990. // cache resolved
  1991. factory.resolved = res;
  1992. // invoke callbacks only if this is not a synchronous resolve
  1993. // (async resolves are shimmed as synchronous during SSR)
  1994. if (!sync) {
  1995. for (var i = 0, l = cbs.length; i < l; i++) {
  1996. cbs[i](res);
  1997. }
  1998. }
  1999. };
  2000. var reject = function (reason) {
  2001. process.env.NODE_ENV !== 'production' && warn(
  2002. "Failed to resolve async component: " + (String(factory)) +
  2003. (reason ? ("\nReason: " + reason) : '')
  2004. );
  2005. };
  2006. var res = factory(resolve, reject);
  2007. // handle promise
  2008. if (res && typeof res.then === 'function' && !factory.resolved) {
  2009. res.then(resolve, reject);
  2010. }
  2011. sync = false;
  2012. // return in case resolved synchronously
  2013. return factory.resolved
  2014. }
  2015. }
  2016. function extractProps (data, Ctor) {
  2017. // we are only extracting raw values here.
  2018. // validation and default values are handled in the child
  2019. // component itself.
  2020. var propOptions = Ctor.options.props;
  2021. if (!propOptions) {
  2022. return
  2023. }
  2024. var res = {};
  2025. var attrs = data.attrs;
  2026. var props = data.props;
  2027. var domProps = data.domProps;
  2028. if (attrs || props || domProps) {
  2029. for (var key in propOptions) {
  2030. var altKey = hyphenate(key);
  2031. checkProp(res, props, key, altKey, true) ||
  2032. checkProp(res, attrs, key, altKey) ||
  2033. checkProp(res, domProps, key, altKey);
  2034. }
  2035. }
  2036. return res
  2037. }
  2038. function checkProp (
  2039. res,
  2040. hash,
  2041. key,
  2042. altKey,
  2043. preserve
  2044. ) {
  2045. if (hash) {
  2046. if (hasOwn(hash, key)) {
  2047. res[key] = hash[key];
  2048. if (!preserve) {
  2049. delete hash[key];
  2050. }
  2051. return true
  2052. } else if (hasOwn(hash, altKey)) {
  2053. res[key] = hash[altKey];
  2054. if (!preserve) {
  2055. delete hash[altKey];
  2056. }
  2057. return true
  2058. }
  2059. }
  2060. return false
  2061. }
  2062. function mergeHooks (data) {
  2063. if (!data.hook) {
  2064. data.hook = {};
  2065. }
  2066. for (var i = 0; i < hooksToMerge.length; i++) {
  2067. var key = hooksToMerge[i];
  2068. var fromParent = data.hook[key];
  2069. var ours = hooks[key];
  2070. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  2071. }
  2072. }
  2073. function mergeHook$1 (a, b) {
  2074. // since all hooks have at most two args, use fixed args
  2075. // to avoid having to use fn.apply().
  2076. return function (_, __) {
  2077. a(_, __);
  2078. b(_, __);
  2079. }
  2080. }
  2081. /* */
  2082. // wrapper function for providing a more flexible interface
  2083. // without getting yelled at by flow
  2084. function createElement (
  2085. tag,
  2086. data,
  2087. children
  2088. ) {
  2089. if (data && (Array.isArray(data) || typeof data !== 'object')) {
  2090. children = data;
  2091. data = undefined;
  2092. }
  2093. // make sure to use real instance instead of proxy as context
  2094. return _createElement(this._self, tag, data, children)
  2095. }
  2096. function _createElement (
  2097. context,
  2098. tag,
  2099. data,
  2100. children
  2101. ) {
  2102. if (data && data.__ob__) {
  2103. process.env.NODE_ENV !== 'production' && warn(
  2104. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  2105. 'Always create fresh vnode data objects in each render!',
  2106. context
  2107. );
  2108. return
  2109. }
  2110. if (!tag) {
  2111. // in case of component :is set to falsy value
  2112. return emptyVNode()
  2113. }
  2114. if (typeof tag === 'string') {
  2115. var Ctor;
  2116. var ns = config.getTagNamespace(tag);
  2117. if (config.isReservedTag(tag)) {
  2118. // platform built-in elements
  2119. return new VNode(
  2120. tag, data, normalizeChildren(children, ns),
  2121. undefined, undefined, ns, context
  2122. )
  2123. } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
  2124. // component
  2125. return createComponent(Ctor, data, context, children, tag)
  2126. } else {
  2127. // unknown or unlisted namespaced elements
  2128. // check at runtime because it may get assigned a namespace when its
  2129. // parent normalizes children
  2130. var childNs = tag === 'foreignObject' ? 'xhtml' : ns;
  2131. return new VNode(
  2132. tag, data, normalizeChildren(children, childNs),
  2133. undefined, undefined, ns, context
  2134. )
  2135. }
  2136. } else {
  2137. // direct component options / constructor
  2138. return createComponent(tag, data, context, children)
  2139. }
  2140. }
  2141. /* */
  2142. function initRender (vm$$1) {
  2143. vm$$1.$vnode = null; // the placeholder node in parent tree
  2144. vm$$1._vnode = null; // the root of the child tree
  2145. vm$$1._staticTrees = null;
  2146. vm$$1._renderContext = vm$$1.$options._parentVnode && vm$$1.$options._parentVnode.context;
  2147. vm$$1.$slots = resolveSlots(vm$$1.$options._renderChildren, vm$$1._renderContext);
  2148. // bind the public createElement fn to this instance
  2149. // so that we get proper render context inside it.
  2150. vm$$1.$createElement = bind(createElement, vm$$1);
  2151. if (vm$$1.$options.el) {
  2152. vm$$1.$mount(vm$$1.$options.el);
  2153. }
  2154. }
  2155. function renderMixin (Vue) {
  2156. Vue.prototype.$nextTick = function (fn) {
  2157. nextTick(fn, this);
  2158. };
  2159. Vue.prototype._render = function () {
  2160. var vm$$1 = this;
  2161. var ref = vm$$1.$options;
  2162. var render = ref.render;
  2163. var staticRenderFns = ref.staticRenderFns;
  2164. var _parentVnode = ref._parentVnode;
  2165. if (vm$$1._isMounted) {
  2166. // clone slot nodes on re-renders
  2167. for (var key in vm$$1.$slots) {
  2168. vm$$1.$slots[key] = cloneVNodes(vm$$1.$slots[key]);
  2169. }
  2170. }
  2171. if (staticRenderFns && !vm$$1._staticTrees) {
  2172. vm$$1._staticTrees = [];
  2173. }
  2174. // set parent vnode. this allows render functions to have access
  2175. // to the data on the placeholder node.
  2176. vm$$1.$vnode = _parentVnode;
  2177. // render self
  2178. var vnode;
  2179. try {
  2180. vnode = render.call(vm$$1._renderProxy, vm$$1.$createElement);
  2181. } catch (e) {
  2182. if (process.env.NODE_ENV !== 'production') {
  2183. warn(("Error when rendering " + (formatComponentName(vm$$1)) + ":"));
  2184. }
  2185. /* istanbul ignore else */
  2186. if (config.errorHandler) {
  2187. config.errorHandler.call(null, e, vm$$1);
  2188. } else {
  2189. if (config._isServer) {
  2190. throw e
  2191. } else {
  2192. console.error(e);
  2193. }
  2194. }
  2195. // return previous vnode to prevent render error causing blank component
  2196. vnode = vm$$1._vnode;
  2197. }
  2198. // return empty vnode in case the render function errored out
  2199. if (!(vnode instanceof VNode)) {
  2200. if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
  2201. warn(
  2202. 'Multiple root nodes returned from render function. Render function ' +
  2203. 'should return a single root node.',
  2204. vm$$1
  2205. );
  2206. }
  2207. vnode = emptyVNode();
  2208. }
  2209. // set parent
  2210. vnode.parent = _parentVnode;
  2211. return vnode
  2212. };
  2213. // shorthands used in render functions
  2214. Vue.prototype._h = createElement;
  2215. // toString for mustaches
  2216. Vue.prototype._s = _toString;
  2217. // number conversion
  2218. Vue.prototype._n = toNumber;
  2219. // empty vnode
  2220. Vue.prototype._e = emptyVNode;
  2221. // loose equal
  2222. Vue.prototype._q = looseEqual;
  2223. // loose indexOf
  2224. Vue.prototype._i = looseIndexOf;
  2225. // render static tree by index
  2226. Vue.prototype._m = function renderStatic (
  2227. index,
  2228. isInFor
  2229. ) {
  2230. var tree = this._staticTrees[index];
  2231. // if has already-rendered static tree and not inside v-for,
  2232. // we can reuse the same tree by doing a shallow clone.
  2233. if (tree && !isInFor) {
  2234. return Array.isArray(tree)
  2235. ? cloneVNodes(tree)
  2236. : cloneVNode(tree)
  2237. }
  2238. // otherwise, render a fresh tree.
  2239. tree = this._staticTrees[index] = this.$options.staticRenderFns[index].call(this._renderProxy);
  2240. markStatic(tree, ("__static__" + index), false);
  2241. return tree
  2242. };
  2243. // mark node as static (v-once)
  2244. Vue.prototype._o = function markOnce (
  2245. tree,
  2246. index,
  2247. key
  2248. ) {
  2249. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2250. return tree
  2251. };
  2252. function markStatic (tree, key, isOnce) {
  2253. if (Array.isArray(tree)) {
  2254. for (var i = 0; i < tree.length; i++) {
  2255. if (tree[i] && typeof tree[i] !== 'string') {
  2256. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2257. }
  2258. }
  2259. } else {
  2260. markStaticNode(tree, key, isOnce);
  2261. }
  2262. }
  2263. function markStaticNode (node, key, isOnce) {
  2264. node.isStatic = true;
  2265. node.key = key;
  2266. node.isOnce = isOnce;
  2267. }
  2268. // filter resolution helper
  2269. var identity = function (_) { return _; };
  2270. Vue.prototype._f = function resolveFilter (id) {
  2271. return resolveAsset(this.$options, 'filters', id, true) || identity
  2272. };
  2273. // render v-for
  2274. Vue.prototype._l = function renderList (
  2275. val,
  2276. render
  2277. ) {
  2278. var ret, i, l, keys, key;
  2279. if (Array.isArray(val)) {
  2280. ret = new Array(val.length);
  2281. for (i = 0, l = val.length; i < l; i++) {
  2282. ret[i] = render(val[i], i);
  2283. }
  2284. } else if (typeof val === 'number') {
  2285. ret = new Array(val);
  2286. for (i = 0; i < val; i++) {
  2287. ret[i] = render(i + 1, i);
  2288. }
  2289. } else if (isObject(val)) {
  2290. keys = Object.keys(val);
  2291. ret = new Array(keys.length);
  2292. for (i = 0, l = keys.length; i < l; i++) {
  2293. key = keys[i];
  2294. ret[i] = render(val[key], key, i);
  2295. }
  2296. }
  2297. return ret
  2298. };
  2299. // renderSlot
  2300. Vue.prototype._t = function (
  2301. name,
  2302. fallback
  2303. ) {
  2304. var slotNodes = this.$slots[name];
  2305. // warn duplicate slot usage
  2306. if (slotNodes && process.env.NODE_ENV !== 'production') {
  2307. slotNodes._rendered && warn(
  2308. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  2309. "- this will likely cause render errors.",
  2310. this
  2311. );
  2312. slotNodes._rendered = true;
  2313. }
  2314. return slotNodes || fallback
  2315. };
  2316. // apply v-bind object
  2317. Vue.prototype._b = function bindProps (
  2318. data,
  2319. tag,
  2320. value,
  2321. asProp
  2322. ) {
  2323. if (value) {
  2324. if (!isObject(value)) {
  2325. process.env.NODE_ENV !== 'production' && warn(
  2326. 'v-bind without argument expects an Object or Array value',
  2327. this
  2328. );
  2329. } else {
  2330. if (Array.isArray(value)) {
  2331. value = toObject(value);
  2332. }
  2333. for (var key in value) {
  2334. if (key === 'class' || key === 'style') {
  2335. data[key] = value[key];
  2336. } else {
  2337. var hash = asProp || config.mustUseProp(tag, key)
  2338. ? data.domProps || (data.domProps = {})
  2339. : data.attrs || (data.attrs = {});
  2340. hash[key] = value[key];
  2341. }
  2342. }
  2343. }
  2344. }
  2345. return data
  2346. };
  2347. // expose v-on keyCodes
  2348. Vue.prototype._k = function getKeyCodes (key) {
  2349. return config.keyCodes[key]
  2350. };
  2351. }
  2352. function resolveSlots (
  2353. renderChildren,
  2354. context
  2355. ) {
  2356. var slots = {};
  2357. if (!renderChildren) {
  2358. return slots
  2359. }
  2360. var children = normalizeChildren(renderChildren) || [];
  2361. var defaultSlot = [];
  2362. var name, child;
  2363. for (var i = 0, l = children.length; i < l; i++) {
  2364. child = children[i];
  2365. // named slots should only be respected if the vnode was rendered in the
  2366. // same context.
  2367. if ((child.context === context || child.functionalContext === context) &&
  2368. child.data && (name = child.data.slot)) {
  2369. var slot = (slots[name] || (slots[name] = []));
  2370. if (child.tag === 'template') {
  2371. slot.push.apply(slot, child.children);
  2372. } else {
  2373. slot.push(child);
  2374. }
  2375. } else {
  2376. defaultSlot.push(child);
  2377. }
  2378. }
  2379. // ignore single whitespace
  2380. if (defaultSlot.length && !(
  2381. defaultSlot.length === 1 &&
  2382. (defaultSlot[0].text === ' ' || defaultSlot[0].isComment)
  2383. )) {
  2384. slots.default = defaultSlot;
  2385. }
  2386. return slots
  2387. }
  2388. /* */
  2389. function initEvents (vm$$1) {
  2390. vm$$1._events = Object.create(null);
  2391. // init parent attached events
  2392. var listeners = vm$$1.$options._parentListeners;
  2393. var on = bind(vm$$1.$on, vm$$1);
  2394. var off = bind(vm$$1.$off, vm$$1);
  2395. vm$$1._updateListeners = function (listeners, oldListeners) {
  2396. updateListeners(listeners, oldListeners || {}, on, off, vm$$1);
  2397. };
  2398. if (listeners) {
  2399. vm$$1._updateListeners(listeners);
  2400. }
  2401. }
  2402. function eventsMixin (Vue) {
  2403. Vue.prototype.$on = function (event, fn) {
  2404. var vm$$1 = this;(vm$$1._events[event] || (vm$$1._events[event] = [])).push(fn);
  2405. return vm$$1
  2406. };
  2407. Vue.prototype.$once = function (event, fn) {
  2408. var vm$$1 = this;
  2409. function on () {
  2410. vm$$1.$off(event, on);
  2411. fn.apply(vm$$1, arguments);
  2412. }
  2413. on.fn = fn;
  2414. vm$$1.$on(event, on);
  2415. return vm$$1
  2416. };
  2417. Vue.prototype.$off = function (event, fn) {
  2418. var vm$$1 = this;
  2419. // all
  2420. if (!arguments.length) {
  2421. vm$$1._events = Object.create(null);
  2422. return vm$$1
  2423. }
  2424. // specific event
  2425. var cbs = vm$$1._events[event];
  2426. if (!cbs) {
  2427. return vm$$1
  2428. }
  2429. if (arguments.length === 1) {
  2430. vm$$1._events[event] = null;
  2431. return vm$$1
  2432. }
  2433. // specific handler
  2434. var cb;
  2435. var i = cbs.length;
  2436. while (i--) {
  2437. cb = cbs[i];
  2438. if (cb === fn || cb.fn === fn) {
  2439. cbs.splice(i, 1);
  2440. break
  2441. }
  2442. }
  2443. return vm$$1
  2444. };
  2445. Vue.prototype.$emit = function (event) {
  2446. var vm$$1 = this;
  2447. var cbs = vm$$1._events[event];
  2448. if (cbs) {
  2449. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2450. var args = toArray(arguments, 1);
  2451. for (var i = 0, l = cbs.length; i < l; i++) {
  2452. cbs[i].apply(vm$$1, args);
  2453. }
  2454. }
  2455. return vm$$1
  2456. };
  2457. }
  2458. /* */
  2459. var uid = 0;
  2460. function initMixin (Vue) {
  2461. Vue.prototype._init = function (options) {
  2462. var vm$$1 = this;
  2463. // a uid
  2464. vm$$1._uid = uid++;
  2465. // a flag to avoid this being observed
  2466. vm$$1._isVue = true;
  2467. // merge options
  2468. if (options && options._isComponent) {
  2469. // optimize internal component instantiation
  2470. // since dynamic options merging is pretty slow, and none of the
  2471. // internal component options needs special treatment.
  2472. initInternalComponent(vm$$1, options);
  2473. } else {
  2474. vm$$1.$options = mergeOptions(
  2475. resolveConstructorOptions(vm$$1.constructor),
  2476. options || {},
  2477. vm$$1
  2478. );
  2479. }
  2480. /* istanbul ignore else */
  2481. if (process.env.NODE_ENV !== 'production') {
  2482. initProxy(vm$$1);
  2483. } else {
  2484. vm$$1._renderProxy = vm$$1;
  2485. }
  2486. // expose real self
  2487. vm$$1._self = vm$$1;
  2488. initLifecycle(vm$$1);
  2489. initEvents(vm$$1);
  2490. callHook(vm$$1, 'beforeCreate');
  2491. initState(vm$$1);
  2492. callHook(vm$$1, 'created');
  2493. initRender(vm$$1);
  2494. };
  2495. }
  2496. function initInternalComponent (vm$$1, options) {
  2497. var opts = vm$$1.$options = Object.create(vm$$1.constructor.options);
  2498. // doing this because it's faster than dynamic enumeration.
  2499. opts.parent = options.parent;
  2500. opts.propsData = options.propsData;
  2501. opts._parentVnode = options._parentVnode;
  2502. opts._parentListeners = options._parentListeners;
  2503. opts._renderChildren = options._renderChildren;
  2504. opts._componentTag = options._componentTag;
  2505. if (options.render) {
  2506. opts.render = options.render;
  2507. opts.staticRenderFns = options.staticRenderFns;
  2508. }
  2509. }
  2510. function resolveConstructorOptions (Ctor) {
  2511. var options = Ctor.options;
  2512. if (Ctor.super) {
  2513. var superOptions = Ctor.super.options;
  2514. var cachedSuperOptions = Ctor.superOptions;
  2515. var extendOptions = Ctor.extendOptions;
  2516. if (superOptions !== cachedSuperOptions) {
  2517. // super option changed
  2518. Ctor.superOptions = superOptions;
  2519. extendOptions.render = options.render;
  2520. extendOptions.staticRenderFns = options.staticRenderFns;
  2521. options = Ctor.options = mergeOptions(superOptions, extendOptions);
  2522. if (options.name) {
  2523. options.components[options.name] = Ctor;
  2524. }
  2525. }
  2526. }
  2527. return options
  2528. }
  2529. function Vue (options) {
  2530. if (process.env.NODE_ENV !== 'production' &&
  2531. !(this instanceof Vue)) {
  2532. warn('Vue is a constructor and should be called with the `new` keyword');
  2533. }
  2534. this._init(options);
  2535. }
  2536. initMixin(Vue);
  2537. stateMixin(Vue);
  2538. eventsMixin(Vue);
  2539. lifecycleMixin(Vue);
  2540. renderMixin(Vue);
  2541. /* */
  2542. /**
  2543. * Option overwriting strategies are functions that handle
  2544. * how to merge a parent option value and a child option
  2545. * value into the final value.
  2546. */
  2547. var strats = config.optionMergeStrategies;
  2548. /**
  2549. * Options with restrictions
  2550. */
  2551. if (process.env.NODE_ENV !== 'production') {
  2552. strats.el = strats.propsData = function (parent, child, vm$$1, key) {
  2553. if (!vm$$1) {
  2554. warn(
  2555. "option \"" + key + "\" can only be used during instance " +
  2556. 'creation with the `new` keyword.'
  2557. );
  2558. }
  2559. return defaultStrat(parent, child)
  2560. };
  2561. }
  2562. /**
  2563. * Helper that recursively merges two data objects together.
  2564. */
  2565. function mergeData (to, from) {
  2566. if (!from) { return to }
  2567. var key, toVal, fromVal;
  2568. var keys = Object.keys(from);
  2569. for (var i = 0; i < keys.length; i++) {
  2570. key = keys[i];
  2571. toVal = to[key];
  2572. fromVal = from[key];
  2573. if (!hasOwn(to, key)) {
  2574. set(to, key, fromVal);
  2575. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  2576. mergeData(toVal, fromVal);
  2577. }
  2578. }
  2579. return to
  2580. }
  2581. /**
  2582. * Data
  2583. */
  2584. strats.data = function (
  2585. parentVal,
  2586. childVal,
  2587. vm$$1
  2588. ) {
  2589. if (!vm$$1) {
  2590. // in a Vue.extend merge, both should be functions
  2591. if (!childVal) {
  2592. return parentVal
  2593. }
  2594. if (typeof childVal !== 'function') {
  2595. process.env.NODE_ENV !== 'production' && warn(
  2596. 'The "data" option should be a function ' +
  2597. 'that returns a per-instance value in component ' +
  2598. 'definitions.',
  2599. vm$$1
  2600. );
  2601. return parentVal
  2602. }
  2603. if (!parentVal) {
  2604. return childVal
  2605. }
  2606. // when parentVal & childVal are both present,
  2607. // we need to return a function that returns the
  2608. // merged result of both functions... no need to
  2609. // check if parentVal is a function here because
  2610. // it has to be a function to pass previous merges.
  2611. return function mergedDataFn () {
  2612. return mergeData(
  2613. childVal.call(this),
  2614. parentVal.call(this)
  2615. )
  2616. }
  2617. } else if (parentVal || childVal) {
  2618. return function mergedInstanceDataFn () {
  2619. // instance merge
  2620. var instanceData = typeof childVal === 'function'
  2621. ? childVal.call(vm$$1)
  2622. : childVal;
  2623. var defaultData = typeof parentVal === 'function'
  2624. ? parentVal.call(vm$$1)
  2625. : undefined;
  2626. if (instanceData) {
  2627. return mergeData(instanceData, defaultData)
  2628. } else {
  2629. return defaultData
  2630. }
  2631. }
  2632. }
  2633. };
  2634. /**
  2635. * Hooks and param attributes are merged as arrays.
  2636. */
  2637. function mergeHook (
  2638. parentVal,
  2639. childVal
  2640. ) {
  2641. return childVal
  2642. ? parentVal
  2643. ? parentVal.concat(childVal)
  2644. : Array.isArray(childVal)
  2645. ? childVal
  2646. : [childVal]
  2647. : parentVal
  2648. }
  2649. config._lifecycleHooks.forEach(function (hook) {
  2650. strats[hook] = mergeHook;
  2651. });
  2652. /**
  2653. * Assets
  2654. *
  2655. * When a vm is present (instance creation), we need to do
  2656. * a three-way merge between constructor options, instance
  2657. * options and parent options.
  2658. */
  2659. function mergeAssets (parentVal, childVal) {
  2660. var res = Object.create(parentVal || null);
  2661. return childVal
  2662. ? extend(res, childVal)
  2663. : res
  2664. }
  2665. config._assetTypes.forEach(function (type) {
  2666. strats[type + 's'] = mergeAssets;
  2667. });
  2668. /**
  2669. * Watchers.
  2670. *
  2671. * Watchers hashes should not overwrite one
  2672. * another, so we merge them as arrays.
  2673. */
  2674. strats.watch = function (parentVal, childVal) {
  2675. /* istanbul ignore if */
  2676. if (!childVal) { return parentVal }
  2677. if (!parentVal) { return childVal }
  2678. var ret = {};
  2679. extend(ret, parentVal);
  2680. for (var key in childVal) {
  2681. var parent = ret[key];
  2682. var child = childVal[key];
  2683. if (parent && !Array.isArray(parent)) {
  2684. parent = [parent];
  2685. }
  2686. ret[key] = parent
  2687. ? parent.concat(child)
  2688. : [child];
  2689. }
  2690. return ret
  2691. };
  2692. /**
  2693. * Other object hashes.
  2694. */
  2695. strats.props =
  2696. strats.methods =
  2697. strats.computed = function (parentVal, childVal) {
  2698. if (!childVal) { return parentVal }
  2699. if (!parentVal) { return childVal }
  2700. var ret = Object.create(null);
  2701. extend(ret, parentVal);
  2702. extend(ret, childVal);
  2703. return ret
  2704. };
  2705. /**
  2706. * Default strategy.
  2707. */
  2708. var defaultStrat = function (parentVal, childVal) {
  2709. return childVal === undefined
  2710. ? parentVal
  2711. : childVal
  2712. };
  2713. /**
  2714. * Validate component names
  2715. */
  2716. function checkComponents (options) {
  2717. for (var key in options.components) {
  2718. var lower = key.toLowerCase();
  2719. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  2720. warn(
  2721. 'Do not use built-in or reserved HTML elements as component ' +
  2722. 'id: ' + key
  2723. );
  2724. }
  2725. }
  2726. }
  2727. /**
  2728. * Ensure all props option syntax are normalized into the
  2729. * Object-based format.
  2730. */
  2731. function normalizeProps (options) {
  2732. var props = options.props;
  2733. if (!props) { return }
  2734. var res = {};
  2735. var i, val, name;
  2736. if (Array.isArray(props)) {
  2737. i = props.length;
  2738. while (i--) {
  2739. val = props[i];
  2740. if (typeof val === 'string') {
  2741. name = camelize(val);
  2742. res[name] = { type: null };
  2743. } else if (process.env.NODE_ENV !== 'production') {
  2744. warn('props must be strings when using array syntax.');
  2745. }
  2746. }
  2747. } else if (isPlainObject(props)) {
  2748. for (var key in props) {
  2749. val = props[key];
  2750. name = camelize(key);
  2751. res[name] = isPlainObject(val)
  2752. ? val
  2753. : { type: val };
  2754. }
  2755. }
  2756. options.props = res;
  2757. }
  2758. /**
  2759. * Normalize raw function directives into object format.
  2760. */
  2761. function normalizeDirectives (options) {
  2762. var dirs = options.directives;
  2763. if (dirs) {
  2764. for (var key in dirs) {
  2765. var def = dirs[key];
  2766. if (typeof def === 'function') {
  2767. dirs[key] = { bind: def, update: def };
  2768. }
  2769. }
  2770. }
  2771. }
  2772. /**
  2773. * Merge two option objects into a new one.
  2774. * Core utility used in both instantiation and inheritance.
  2775. */
  2776. function mergeOptions (
  2777. parent,
  2778. child,
  2779. vm$$1
  2780. ) {
  2781. if (process.env.NODE_ENV !== 'production') {
  2782. checkComponents(child);
  2783. }
  2784. normalizeProps(child);
  2785. normalizeDirectives(child);
  2786. var extendsFrom = child.extends;
  2787. if (extendsFrom) {
  2788. parent = typeof extendsFrom === 'function'
  2789. ? mergeOptions(parent, extendsFrom.options, vm$$1)
  2790. : mergeOptions(parent, extendsFrom, vm$$1);
  2791. }
  2792. if (child.mixins) {
  2793. for (var i = 0, l = child.mixins.length; i < l; i++) {
  2794. var mixin = child.mixins[i];
  2795. if (mixin.prototype instanceof Vue) {
  2796. mixin = mixin.options;
  2797. }
  2798. parent = mergeOptions(parent, mixin, vm$$1);
  2799. }
  2800. }
  2801. var options = {};
  2802. var key;
  2803. for (key in parent) {
  2804. mergeField(key);
  2805. }
  2806. for (key in child) {
  2807. if (!hasOwn(parent, key)) {
  2808. mergeField(key);
  2809. }
  2810. }
  2811. function mergeField (key) {
  2812. var strat = strats[key] || defaultStrat;
  2813. options[key] = strat(parent[key], child[key], vm$$1, key);
  2814. }
  2815. return options
  2816. }
  2817. /**
  2818. * Resolve an asset.
  2819. * This function is used because child instances need access
  2820. * to assets defined in its ancestor chain.
  2821. */
  2822. function resolveAsset (
  2823. options,
  2824. type,
  2825. id,
  2826. warnMissing
  2827. ) {
  2828. /* istanbul ignore if */
  2829. if (typeof id !== 'string') {
  2830. return
  2831. }
  2832. var assets = options[type];
  2833. var res = assets[id] ||
  2834. // camelCase ID
  2835. assets[camelize(id)] ||
  2836. // Pascal Case ID
  2837. assets[capitalize(camelize(id))];
  2838. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  2839. warn(
  2840. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  2841. options
  2842. );
  2843. }
  2844. return res
  2845. }
  2846. /* */
  2847. function validateProp (
  2848. key,
  2849. propOptions,
  2850. propsData,
  2851. vm$$1
  2852. ) {
  2853. var prop = propOptions[key];
  2854. var absent = !hasOwn(propsData, key);
  2855. var value = propsData[key];
  2856. // handle boolean props
  2857. if (isBooleanType(prop.type)) {
  2858. if (absent && !hasOwn(prop, 'default')) {
  2859. value = false;
  2860. } else if (value === '' || value === hyphenate(key)) {
  2861. value = true;
  2862. }
  2863. }
  2864. // check default value
  2865. if (value === undefined) {
  2866. value = getPropDefaultValue(vm$$1, prop, key);
  2867. // since the default value is a fresh copy,
  2868. // make sure to observe it.
  2869. var prevShouldConvert = observerState.shouldConvert;
  2870. observerState.shouldConvert = true;
  2871. observe(value);
  2872. observerState.shouldConvert = prevShouldConvert;
  2873. }
  2874. if (process.env.NODE_ENV !== 'production') {
  2875. assertProp(prop, key, value, vm$$1, absent);
  2876. }
  2877. return value
  2878. }
  2879. /**
  2880. * Get the default value of a prop.
  2881. */
  2882. function getPropDefaultValue (vm$$1, prop, key) {
  2883. // no default, return undefined
  2884. if (!hasOwn(prop, 'default')) {
  2885. return undefined
  2886. }
  2887. var def = prop.default;
  2888. // warn against non-factory defaults for Object & Array
  2889. if (isObject(def)) {
  2890. process.env.NODE_ENV !== 'production' && warn(
  2891. 'Invalid default value for prop "' + key + '": ' +
  2892. 'Props with type Object/Array must use a factory function ' +
  2893. 'to return the default value.',
  2894. vm$$1
  2895. );
  2896. }
  2897. // the raw prop value was also undefined from previous render,
  2898. // return previous default value to avoid unnecessary watcher trigger
  2899. if (vm$$1 && vm$$1.$options.propsData &&
  2900. vm$$1.$options.propsData[key] === undefined &&
  2901. vm$$1[key] !== undefined) {
  2902. return vm$$1[key]
  2903. }
  2904. // call factory function for non-Function types
  2905. return typeof def === 'function' && prop.type !== Function
  2906. ? def.call(vm$$1)
  2907. : def
  2908. }
  2909. /**
  2910. * Assert whether a prop is valid.
  2911. */
  2912. function assertProp (
  2913. prop,
  2914. name,
  2915. value,
  2916. vm$$1,
  2917. absent
  2918. ) {
  2919. if (prop.required && absent) {
  2920. warn(
  2921. 'Missing required prop: "' + name + '"',
  2922. vm$$1
  2923. );
  2924. return
  2925. }
  2926. if (value == null && !prop.required) {
  2927. return
  2928. }
  2929. var type = prop.type;
  2930. var valid = !type || type === true;
  2931. var expectedTypes = [];
  2932. if (type) {
  2933. if (!Array.isArray(type)) {
  2934. type = [type];
  2935. }
  2936. for (var i = 0; i < type.length && !valid; i++) {
  2937. var assertedType = assertType(value, type[i]);
  2938. expectedTypes.push(assertedType.expectedType);
  2939. valid = assertedType.valid;
  2940. }
  2941. }
  2942. if (!valid) {
  2943. warn(
  2944. 'Invalid prop: type check failed for prop "' + name + '".' +
  2945. ' Expected ' + expectedTypes.map(capitalize).join(', ') +
  2946. ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
  2947. vm$$1
  2948. );
  2949. return
  2950. }
  2951. var validator = prop.validator;
  2952. if (validator) {
  2953. if (!validator(value)) {
  2954. warn(
  2955. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  2956. vm$$1
  2957. );
  2958. }
  2959. }
  2960. }
  2961. /**
  2962. * Assert the type of a value
  2963. */
  2964. function assertType (value, type) {
  2965. var valid;
  2966. var expectedType = getType(type);
  2967. if (expectedType === 'String') {
  2968. valid = typeof value === (expectedType = 'string');
  2969. } else if (expectedType === 'Number') {
  2970. valid = typeof value === (expectedType = 'number');
  2971. } else if (expectedType === 'Boolean') {
  2972. valid = typeof value === (expectedType = 'boolean');
  2973. } else if (expectedType === 'Function') {
  2974. valid = typeof value === (expectedType = 'function');
  2975. } else if (expectedType === 'Object') {
  2976. valid = isPlainObject(value);
  2977. } else if (expectedType === 'Array') {
  2978. valid = Array.isArray(value);
  2979. } else {
  2980. valid = value instanceof type;
  2981. }
  2982. return {
  2983. valid: valid,
  2984. expectedType: expectedType
  2985. }
  2986. }
  2987. /**
  2988. * Use function string name to check built-in types,
  2989. * because a simple equality check will fail when running
  2990. * across different vms / iframes.
  2991. */
  2992. function getType (fn) {
  2993. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  2994. return match && match[1]
  2995. }
  2996. function isBooleanType (fn) {
  2997. if (!Array.isArray(fn)) {
  2998. return getType(fn) === 'Boolean'
  2999. }
  3000. for (var i = 0, len = fn.length; i < len; i++) {
  3001. if (getType(fn[i]) === 'Boolean') {
  3002. return true
  3003. }
  3004. }
  3005. /* istanbul ignore next */
  3006. return false
  3007. }
  3008. /* */
  3009. // attributes that should be using props for binding
  3010. var mustUseProp = function (tag, attr) {
  3011. return (
  3012. (attr === 'value' && (tag === 'input' || tag === 'textarea' || tag === 'option')) ||
  3013. (attr === 'selected' && tag === 'option') ||
  3014. (attr === 'checked' && tag === 'input') ||
  3015. (attr === 'muted' && tag === 'video')
  3016. )
  3017. };
  3018. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  3019. var isBooleanAttr = makeMap(
  3020. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  3021. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  3022. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  3023. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  3024. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  3025. 'truespeed,typemustmatch,visible'
  3026. );
  3027. var isAttr = makeMap(
  3028. 'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
  3029. 'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
  3030. 'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,' +
  3031. 'name,contenteditable,contextmenu,controls,coords,data,datetime,default,' +
  3032. 'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,' +
  3033. 'form,formaction,headers,<th>,height,hidden,high,href,hreflang,http-equiv,' +
  3034. 'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' +
  3035. 'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' +
  3036. 'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,' +
  3037. 'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' +
  3038. 'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' +
  3039. 'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' +
  3040. 'target,title,type,usemap,value,width,wrap'
  3041. );
  3042. /* istanbul ignore next */
  3043. var isRenderableAttr = function (name) {
  3044. return (
  3045. isAttr(name) ||
  3046. name.indexOf('data-') === 0 ||
  3047. name.indexOf('aria-') === 0
  3048. )
  3049. };
  3050. var propsToAttrMap = {
  3051. acceptCharset: 'accept-charset',
  3052. className: 'class',
  3053. htmlFor: 'for',
  3054. httpEquiv: 'http-equiv'
  3055. };
  3056. var isXlink = function (name) {
  3057. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  3058. };
  3059. var isFalsyAttrValue = function (val) {
  3060. return val == null || val === false
  3061. };
  3062. /* */
  3063. function genClassForVnode (vnode) {
  3064. var data = vnode.data;
  3065. var parentNode = vnode;
  3066. var childNode = vnode;
  3067. while (childNode.child) {
  3068. childNode = childNode.child._vnode;
  3069. if (childNode.data) {
  3070. data = mergeClassData(childNode.data, data);
  3071. }
  3072. }
  3073. while ((parentNode = parentNode.parent)) {
  3074. if (parentNode.data) {
  3075. data = mergeClassData(data, parentNode.data);
  3076. }
  3077. }
  3078. return genClassFromData(data)
  3079. }
  3080. function mergeClassData (child, parent) {
  3081. return {
  3082. staticClass: concat(child.staticClass, parent.staticClass),
  3083. class: child.class
  3084. ? [child.class, parent.class]
  3085. : parent.class
  3086. }
  3087. }
  3088. function genClassFromData (data) {
  3089. var dynamicClass = data.class;
  3090. var staticClass = data.staticClass;
  3091. if (staticClass || dynamicClass) {
  3092. return concat(staticClass, stringifyClass(dynamicClass))
  3093. }
  3094. /* istanbul ignore next */
  3095. return ''
  3096. }
  3097. function concat (a, b) {
  3098. return a ? b ? (a + ' ' + b) : a : (b || '')
  3099. }
  3100. function stringifyClass (value) {
  3101. var res = '';
  3102. if (!value) {
  3103. return res
  3104. }
  3105. if (typeof value === 'string') {
  3106. return value
  3107. }
  3108. if (Array.isArray(value)) {
  3109. var stringified;
  3110. for (var i = 0, l = value.length; i < l; i++) {
  3111. if (value[i]) {
  3112. if ((stringified = stringifyClass(value[i]))) {
  3113. res += stringified + ' ';
  3114. }
  3115. }
  3116. }
  3117. return res.slice(0, -1)
  3118. }
  3119. if (isObject(value)) {
  3120. for (var key in value) {
  3121. if (value[key]) { res += key + ' '; }
  3122. }
  3123. return res.slice(0, -1)
  3124. }
  3125. /* istanbul ignore next */
  3126. return res
  3127. }
  3128. /* */
  3129. var isHTMLTag = makeMap(
  3130. 'html,body,base,head,link,meta,style,title,' +
  3131. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  3132. 'div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,' +
  3133. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  3134. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  3135. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  3136. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  3137. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  3138. 'output,progress,select,textarea,' +
  3139. 'details,dialog,menu,menuitem,summary,' +
  3140. 'content,element,shadow,template'
  3141. );
  3142. var isUnaryTag = makeMap(
  3143. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  3144. 'link,meta,param,source,track,wbr',
  3145. true
  3146. );
  3147. // Elements that you can, intentionally, leave open
  3148. // (and which close themselves)
  3149. var canBeLeftOpenTag = makeMap(
  3150. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source',
  3151. true
  3152. );
  3153. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  3154. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  3155. var isNonPhrasingTag = makeMap(
  3156. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  3157. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  3158. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  3159. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  3160. 'title,tr,track',
  3161. true
  3162. );
  3163. // this map is intentionally selective, only covering SVG elements that may
  3164. // contain child elements.
  3165. var isSVG = makeMap(
  3166. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font,' +
  3167. 'font-face,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  3168. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  3169. true
  3170. );
  3171. var isPreTag = function (tag) { return tag === 'pre'; };
  3172. var isReservedTag = function (tag) {
  3173. return isHTMLTag(tag) || isSVG(tag)
  3174. };
  3175. function getTagNamespace (tag) {
  3176. if (isSVG(tag)) {
  3177. return 'svg'
  3178. }
  3179. // basic support for MathML
  3180. // note it doesn't support other MathML elements being component roots
  3181. if (tag === 'math') {
  3182. return 'math'
  3183. }
  3184. }
  3185. var unknownElementCache = Object.create(null);
  3186. /* */
  3187. /**
  3188. * Query an element selector if it's not an element already.
  3189. */
  3190. /**
  3191. * Not type-checking this file because it's mostly vendor code.
  3192. */
  3193. /*!
  3194. * HTML Parser By John Resig (ejohn.org)
  3195. * Modified by Juriy "kangax" Zaytsev
  3196. * Original code by Erik Arvidsson, Mozilla Public License
  3197. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  3198. */
  3199. // Regular Expressions for parsing tags and attributes
  3200. var singleAttrIdentifier = /([^\s"'<>/=]+)/;
  3201. var singleAttrAssign = /(?:=)/;
  3202. var singleAttrValues = [
  3203. // attr value double quotes
  3204. /"([^"]*)"+/.source,
  3205. // attr value, single quotes
  3206. /'([^']*)'+/.source,
  3207. // attr value, no quotes
  3208. /([^\s"'=<>`]+)/.source
  3209. ];
  3210. var attribute = new RegExp(
  3211. '^\\s*' + singleAttrIdentifier.source +
  3212. '(?:\\s*(' + singleAttrAssign.source + ')' +
  3213. '\\s*(?:' + singleAttrValues.join('|') + '))?'
  3214. );
  3215. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  3216. // but for Vue templates we can enforce a simple charset
  3217. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  3218. var qnameCapture = '((?:' + ncname + '\\:)?' + ncname + ')';
  3219. var startTagOpen = new RegExp('^<' + qnameCapture);
  3220. var startTagClose = /^\s*(\/?)>/;
  3221. var endTag = new RegExp('^<\\/' + qnameCapture + '[^>]*>');
  3222. var doctype = /^<!DOCTYPE [^>]+>/i;
  3223. var comment = /^<!--/;
  3224. var conditionalComment = /^<!\[/;
  3225. var IS_REGEX_CAPTURING_BROKEN = false;
  3226. 'x'.replace(/x(.)?/g, function (m, g) {
  3227. IS_REGEX_CAPTURING_BROKEN = g === '';
  3228. });
  3229. // Special Elements (can contain anything)
  3230. var isScriptOrStyle = makeMap('script,style', true);
  3231. var hasLang = function (attr) { return attr.name === 'lang' && attr.value !== 'html'; };
  3232. var isSpecialTag = function (tag, isSFC, stack) {
  3233. if (isScriptOrStyle(tag)) {
  3234. return true
  3235. }
  3236. // top-level template that has a pre-processor
  3237. if (
  3238. isSFC &&
  3239. tag === 'template' &&
  3240. stack.length === 1 &&
  3241. stack[0].attrs.some(hasLang)
  3242. ) {
  3243. return true
  3244. }
  3245. return false
  3246. };
  3247. var reCache = {};
  3248. var ltRE = /&lt;/g;
  3249. var gtRE = /&gt;/g;
  3250. var nlRE = /&#10;/g;
  3251. var ampRE = /&amp;/g;
  3252. var quoteRE = /&quot;/g;
  3253. function decodeAttr (value, shouldDecodeNewlines) {
  3254. if (shouldDecodeNewlines) {
  3255. value = value.replace(nlRE, '\n');
  3256. }
  3257. return value
  3258. .replace(ltRE, '<')
  3259. .replace(gtRE, '>')
  3260. .replace(ampRE, '&')
  3261. .replace(quoteRE, '"')
  3262. }
  3263. function parseHTML (html, options) {
  3264. var stack = [];
  3265. var expectHTML = options.expectHTML;
  3266. var isUnaryTag$$1 = options.isUnaryTag || no;
  3267. var index = 0;
  3268. var last, lastTag;
  3269. while (html) {
  3270. last = html;
  3271. // Make sure we're not in a script or style element
  3272. if (!lastTag || !isSpecialTag(lastTag, options.sfc, stack)) {
  3273. var textEnd = html.indexOf('<');
  3274. if (textEnd === 0) {
  3275. // Comment:
  3276. if (comment.test(html)) {
  3277. var commentEnd = html.indexOf('-->');
  3278. if (commentEnd >= 0) {
  3279. advance(commentEnd + 3);
  3280. continue
  3281. }
  3282. }
  3283. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  3284. if (conditionalComment.test(html)) {
  3285. var conditionalEnd = html.indexOf(']>');
  3286. if (conditionalEnd >= 0) {
  3287. advance(conditionalEnd + 2);
  3288. continue
  3289. }
  3290. }
  3291. // Doctype:
  3292. var doctypeMatch = html.match(doctype);
  3293. if (doctypeMatch) {
  3294. advance(doctypeMatch[0].length);
  3295. continue
  3296. }
  3297. // End tag:
  3298. var endTagMatch = html.match(endTag);
  3299. if (endTagMatch) {
  3300. var curIndex = index;
  3301. advance(endTagMatch[0].length);
  3302. parseEndTag(endTagMatch[0], endTagMatch[1], curIndex, index);
  3303. continue
  3304. }
  3305. // Start tag:
  3306. var startTagMatch = parseStartTag();
  3307. if (startTagMatch) {
  3308. handleStartTag(startTagMatch);
  3309. continue
  3310. }
  3311. }
  3312. var text = (void 0), rest$1 = (void 0), next = (void 0);
  3313. if (textEnd > 0) {
  3314. rest$1 = html.slice(textEnd);
  3315. while (
  3316. !endTag.test(rest$1) &&
  3317. !startTagOpen.test(rest$1) &&
  3318. !comment.test(rest$1) &&
  3319. !conditionalComment.test(rest$1)
  3320. ) {
  3321. // < in plain text, be forgiving and treat it as text
  3322. next = rest$1.indexOf('<', 1);
  3323. if (next < 0) { break }
  3324. textEnd += next;
  3325. rest$1 = html.slice(textEnd);
  3326. }
  3327. text = html.substring(0, textEnd);
  3328. advance(textEnd);
  3329. }
  3330. if (textEnd < 0) {
  3331. text = html;
  3332. html = '';
  3333. }
  3334. if (options.chars && text) {
  3335. options.chars(text);
  3336. }
  3337. } else {
  3338. var stackedTag = lastTag.toLowerCase();
  3339. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  3340. var endTagLength = 0;
  3341. var rest = html.replace(reStackedTag, function (all, text, endTag) {
  3342. endTagLength = endTag.length;
  3343. if (stackedTag !== 'script' && stackedTag !== 'style' && stackedTag !== 'noscript') {
  3344. text = text
  3345. .replace(/<!--([\s\S]*?)-->/g, '$1')
  3346. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  3347. }
  3348. if (options.chars) {
  3349. options.chars(text);
  3350. }
  3351. return ''
  3352. });
  3353. index += html.length - rest.length;
  3354. html = rest;
  3355. parseEndTag('</' + stackedTag + '>', stackedTag, index - endTagLength, index);
  3356. }
  3357. if (html === last && options.chars) {
  3358. options.chars(html);
  3359. break
  3360. }
  3361. }
  3362. // Clean up any remaining tags
  3363. parseEndTag();
  3364. function advance (n) {
  3365. index += n;
  3366. html = html.substring(n);
  3367. }
  3368. function parseStartTag () {
  3369. var start = html.match(startTagOpen);
  3370. if (start) {
  3371. var match = {
  3372. tagName: start[1],
  3373. attrs: [],
  3374. start: index
  3375. };
  3376. advance(start[0].length);
  3377. var end, attr;
  3378. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  3379. advance(attr[0].length);
  3380. match.attrs.push(attr);
  3381. }
  3382. if (end) {
  3383. match.unarySlash = end[1];
  3384. advance(end[0].length);
  3385. match.end = index;
  3386. return match
  3387. }
  3388. }
  3389. }
  3390. function handleStartTag (match) {
  3391. var tagName = match.tagName;
  3392. var unarySlash = match.unarySlash;
  3393. if (expectHTML) {
  3394. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  3395. parseEndTag('', lastTag);
  3396. }
  3397. if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
  3398. parseEndTag('', tagName);
  3399. }
  3400. }
  3401. var unary = isUnaryTag$$1(tagName) || tagName === 'html' && lastTag === 'head' || !!unarySlash;
  3402. var l = match.attrs.length;
  3403. var attrs = new Array(l);
  3404. for (var i = 0; i < l; i++) {
  3405. var args = match.attrs[i];
  3406. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  3407. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  3408. if (args[3] === '') { delete args[3]; }
  3409. if (args[4] === '') { delete args[4]; }
  3410. if (args[5] === '') { delete args[5]; }
  3411. }
  3412. var value = args[3] || args[4] || args[5] || '';
  3413. attrs[i] = {
  3414. name: args[1],
  3415. value: decodeAttr(
  3416. value,
  3417. options.shouldDecodeNewlines
  3418. )
  3419. };
  3420. }
  3421. if (!unary) {
  3422. stack.push({ tag: tagName, attrs: attrs });
  3423. lastTag = tagName;
  3424. unarySlash = '';
  3425. }
  3426. if (options.start) {
  3427. options.start(tagName, attrs, unary, match.start, match.end);
  3428. }
  3429. }
  3430. function parseEndTag (tag, tagName, start, end) {
  3431. var pos;
  3432. if (start == null) { start = index; }
  3433. if (end == null) { end = index; }
  3434. // Find the closest opened tag of the same type
  3435. if (tagName) {
  3436. var needle = tagName.toLowerCase();
  3437. for (pos = stack.length - 1; pos >= 0; pos--) {
  3438. if (stack[pos].tag.toLowerCase() === needle) {
  3439. break
  3440. }
  3441. }
  3442. } else {
  3443. // If no tag name is provided, clean shop
  3444. pos = 0;
  3445. }
  3446. if (pos >= 0) {
  3447. // Close all the open elements, up the stack
  3448. for (var i = stack.length - 1; i >= pos; i--) {
  3449. if (options.end) {
  3450. options.end(stack[i].tag, start, end);
  3451. }
  3452. }
  3453. // Remove the open elements from the stack
  3454. stack.length = pos;
  3455. lastTag = pos && stack[pos - 1].tag;
  3456. } else if (tagName.toLowerCase() === 'br') {
  3457. if (options.start) {
  3458. options.start(tagName, [], true, start, end);
  3459. }
  3460. } else if (tagName.toLowerCase() === 'p') {
  3461. if (options.start) {
  3462. options.start(tagName, [], false, start, end);
  3463. }
  3464. if (options.end) {
  3465. options.end(tagName, start, end);
  3466. }
  3467. }
  3468. }
  3469. }
  3470. /* */
  3471. function parseFilters (exp) {
  3472. var inSingle = false;
  3473. var inDouble = false;
  3474. var curly = 0;
  3475. var square = 0;
  3476. var paren = 0;
  3477. var lastFilterIndex = 0;
  3478. var c, prev, i, expression, filters;
  3479. for (i = 0; i < exp.length; i++) {
  3480. prev = c;
  3481. c = exp.charCodeAt(i);
  3482. if (inSingle) {
  3483. // check single quote
  3484. if (c === 0x27 && prev !== 0x5C) { inSingle = !inSingle; }
  3485. } else if (inDouble) {
  3486. // check double quote
  3487. if (c === 0x22 && prev !== 0x5C) { inDouble = !inDouble; }
  3488. } else if (
  3489. c === 0x7C && // pipe
  3490. exp.charCodeAt(i + 1) !== 0x7C &&
  3491. exp.charCodeAt(i - 1) !== 0x7C &&
  3492. !curly && !square && !paren
  3493. ) {
  3494. if (expression === undefined) {
  3495. // first filter, end of expression
  3496. lastFilterIndex = i + 1;
  3497. expression = exp.slice(0, i).trim();
  3498. } else {
  3499. pushFilter();
  3500. }
  3501. } else {
  3502. switch (c) {
  3503. case 0x22: inDouble = true; break // "
  3504. case 0x27: inSingle = true; break // '
  3505. case 0x28: paren++; break // (
  3506. case 0x29: paren--; break // )
  3507. case 0x5B: square++; break // [
  3508. case 0x5D: square--; break // ]
  3509. case 0x7B: curly++; break // {
  3510. case 0x7D: curly--; break // }
  3511. }
  3512. }
  3513. }
  3514. if (expression === undefined) {
  3515. expression = exp.slice(0, i).trim();
  3516. } else if (lastFilterIndex !== 0) {
  3517. pushFilter();
  3518. }
  3519. function pushFilter () {
  3520. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  3521. lastFilterIndex = i + 1;
  3522. }
  3523. if (filters) {
  3524. for (i = 0; i < filters.length; i++) {
  3525. expression = wrapFilter(expression, filters[i]);
  3526. }
  3527. }
  3528. return expression
  3529. }
  3530. function wrapFilter (exp, filter) {
  3531. var i = filter.indexOf('(');
  3532. if (i < 0) {
  3533. // _f: resolveFilter
  3534. return ("_f(\"" + filter + "\")(" + exp + ")")
  3535. } else {
  3536. var name = filter.slice(0, i);
  3537. var args = filter.slice(i + 1);
  3538. return ("_f(\"" + name + "\")(" + exp + "," + args)
  3539. }
  3540. }
  3541. /* */
  3542. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  3543. var regexEscapeRE = /[-.*+?^${}()|[\]/\\]/g;
  3544. var buildRegex = cached(function (delimiters) {
  3545. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  3546. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  3547. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  3548. });
  3549. function parseText (
  3550. text,
  3551. delimiters
  3552. ) {
  3553. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  3554. if (!tagRE.test(text)) {
  3555. return
  3556. }
  3557. var tokens = [];
  3558. var lastIndex = tagRE.lastIndex = 0;
  3559. var match, index;
  3560. while ((match = tagRE.exec(text))) {
  3561. index = match.index;
  3562. // push text token
  3563. if (index > lastIndex) {
  3564. tokens.push(JSON.stringify(text.slice(lastIndex, index)));
  3565. }
  3566. // tag token
  3567. var exp = parseFilters(match[1].trim());
  3568. tokens.push(("_s(" + exp + ")"));
  3569. lastIndex = index + match[0].length;
  3570. }
  3571. if (lastIndex < text.length) {
  3572. tokens.push(JSON.stringify(text.slice(lastIndex)));
  3573. }
  3574. return tokens.join('+')
  3575. }
  3576. /* */
  3577. function baseWarn (msg) {
  3578. console.error(("[Vue parser]: " + msg));
  3579. }
  3580. function pluckModuleFunction (
  3581. modules,
  3582. key
  3583. ) {
  3584. return modules
  3585. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  3586. : []
  3587. }
  3588. function addProp (el, name, value) {
  3589. (el.props || (el.props = [])).push({ name: name, value: value });
  3590. }
  3591. function addAttr (el, name, value) {
  3592. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  3593. }
  3594. function addDirective (
  3595. el,
  3596. name,
  3597. rawName,
  3598. value,
  3599. arg,
  3600. modifiers
  3601. ) {
  3602. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  3603. }
  3604. function addHandler (
  3605. el,
  3606. name,
  3607. value,
  3608. modifiers,
  3609. important
  3610. ) {
  3611. // check capture modifier
  3612. if (modifiers && modifiers.capture) {
  3613. delete modifiers.capture;
  3614. name = '!' + name; // mark the event as captured
  3615. }
  3616. var events;
  3617. if (modifiers && modifiers.native) {
  3618. delete modifiers.native;
  3619. events = el.nativeEvents || (el.nativeEvents = {});
  3620. } else {
  3621. events = el.events || (el.events = {});
  3622. }
  3623. var newHandler = { value: value, modifiers: modifiers };
  3624. var handlers = events[name];
  3625. /* istanbul ignore if */
  3626. if (Array.isArray(handlers)) {
  3627. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  3628. } else if (handlers) {
  3629. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  3630. } else {
  3631. events[name] = newHandler;
  3632. }
  3633. }
  3634. function getBindingAttr (
  3635. el,
  3636. name,
  3637. getStatic
  3638. ) {
  3639. var dynamicValue =
  3640. getAndRemoveAttr(el, ':' + name) ||
  3641. getAndRemoveAttr(el, 'v-bind:' + name);
  3642. if (dynamicValue != null) {
  3643. return dynamicValue
  3644. } else if (getStatic !== false) {
  3645. var staticValue = getAndRemoveAttr(el, name);
  3646. if (staticValue != null) {
  3647. return JSON.stringify(staticValue)
  3648. }
  3649. }
  3650. }
  3651. function getAndRemoveAttr (el, name) {
  3652. var val;
  3653. if ((val = el.attrsMap[name]) != null) {
  3654. var list = el.attrsList;
  3655. for (var i = 0, l = list.length; i < l; i++) {
  3656. if (list[i].name === name) {
  3657. list.splice(i, 1);
  3658. break
  3659. }
  3660. }
  3661. }
  3662. return val
  3663. }
  3664. var len;
  3665. var str;
  3666. var chr;
  3667. var index$1;
  3668. var expressionPos;
  3669. var expressionEndPos;
  3670. /**
  3671. * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
  3672. *
  3673. * for loop possible cases:
  3674. *
  3675. * - test
  3676. * - test[idx]
  3677. * - test[test1[idx]]
  3678. * - test["a"][idx]
  3679. * - xxx.test[a[a].test1[idx]]
  3680. * - test.xxx.a["asa"][test1[idx]]
  3681. *
  3682. */
  3683. function parseModel (val) {
  3684. str = val;
  3685. len = str.length;
  3686. index$1 = expressionPos = expressionEndPos = 0;
  3687. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  3688. return {
  3689. exp: val,
  3690. idx: null
  3691. }
  3692. }
  3693. while (!eof()) {
  3694. chr = next$1();
  3695. /* istanbul ignore if */
  3696. if (isStringStart(chr)) {
  3697. parseString(chr);
  3698. } else if (chr === 0x5B) {
  3699. parseBracket(chr);
  3700. }
  3701. }
  3702. return {
  3703. exp: val.substring(0, expressionPos),
  3704. idx: val.substring(expressionPos + 1, expressionEndPos)
  3705. }
  3706. }
  3707. function next$1 () {
  3708. return str.charCodeAt(++index$1)
  3709. }
  3710. function eof () {
  3711. return index$1 >= len
  3712. }
  3713. function isStringStart (chr) {
  3714. return chr === 0x22 || chr === 0x27
  3715. }
  3716. function parseBracket (chr) {
  3717. var inBracket = 1;
  3718. expressionPos = index$1;
  3719. while (!eof()) {
  3720. chr = next$1();
  3721. if (isStringStart(chr)) {
  3722. parseString(chr);
  3723. continue
  3724. }
  3725. if (chr === 0x5B) { inBracket++; }
  3726. if (chr === 0x5D) { inBracket--; }
  3727. if (inBracket === 0) {
  3728. expressionEndPos = index$1;
  3729. break
  3730. }
  3731. }
  3732. }
  3733. function parseString (chr) {
  3734. var stringQuote = chr;
  3735. while (!eof()) {
  3736. chr = next$1();
  3737. if (chr === stringQuote) {
  3738. break
  3739. }
  3740. }
  3741. }
  3742. /* */
  3743. var dirRE = /^v-|^@|^:/;
  3744. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  3745. var forIteratorRE = /\(([^,]*),([^,]*)(?:,([^,]*))?\)/;
  3746. var bindRE = /^:|^v-bind:/;
  3747. var onRE = /^@|^v-on:/;
  3748. var argRE = /:(.*)$/;
  3749. var modifierRE = /\.[^.]+/g;
  3750. var specialNewlineRE = /\u2028|\u2029/g;
  3751. var decodeHTMLCached = cached(he.decode);
  3752. // configurable state
  3753. var warn$1;
  3754. var platformGetTagNamespace;
  3755. var platformMustUseProp;
  3756. var platformIsPreTag;
  3757. var preTransforms;
  3758. var transforms;
  3759. var postTransforms;
  3760. var delimiters;
  3761. /**
  3762. * Convert HTML string to AST.
  3763. */
  3764. function parse (
  3765. template,
  3766. options
  3767. ) {
  3768. warn$1 = options.warn || baseWarn;
  3769. platformGetTagNamespace = options.getTagNamespace || no;
  3770. platformMustUseProp = options.mustUseProp || no;
  3771. platformIsPreTag = options.isPreTag || no;
  3772. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  3773. transforms = pluckModuleFunction(options.modules, 'transformNode');
  3774. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  3775. delimiters = options.delimiters;
  3776. var stack = [];
  3777. var preserveWhitespace = options.preserveWhitespace !== false;
  3778. var root;
  3779. var currentParent;
  3780. var inVPre = false;
  3781. var inPre = false;
  3782. var warned = false;
  3783. parseHTML(template, {
  3784. expectHTML: options.expectHTML,
  3785. isUnaryTag: options.isUnaryTag,
  3786. shouldDecodeNewlines: options.shouldDecodeNewlines,
  3787. start: function start (tag, attrs, unary) {
  3788. // check namespace.
  3789. // inherit parent ns if there is one
  3790. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  3791. // handle IE svg bug
  3792. /* istanbul ignore if */
  3793. if (options.isIE && ns === 'svg') {
  3794. attrs = guardIESVGBug(attrs);
  3795. }
  3796. var element = {
  3797. type: 1,
  3798. tag: tag,
  3799. attrsList: attrs,
  3800. attrsMap: makeAttrsMap(attrs, options.isIE),
  3801. parent: currentParent,
  3802. children: []
  3803. };
  3804. if (ns) {
  3805. element.ns = ns;
  3806. }
  3807. if (process.env.VUE_ENV !== 'server' && isForbiddenTag(element)) {
  3808. element.forbidden = true;
  3809. process.env.NODE_ENV !== 'production' && warn$1(
  3810. 'Templates should only be responsible for mapping the state to the ' +
  3811. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  3812. "<" + tag + ">."
  3813. );
  3814. }
  3815. // apply pre-transforms
  3816. for (var i = 0; i < preTransforms.length; i++) {
  3817. preTransforms[i](element, options);
  3818. }
  3819. if (!inVPre) {
  3820. processPre(element);
  3821. if (element.pre) {
  3822. inVPre = true;
  3823. }
  3824. }
  3825. if (platformIsPreTag(element.tag)) {
  3826. inPre = true;
  3827. }
  3828. if (inVPre) {
  3829. processRawAttrs(element);
  3830. } else {
  3831. processFor(element);
  3832. processIf(element);
  3833. processOnce(element);
  3834. processKey(element);
  3835. // determine whether this is a plain element after
  3836. // removing structural attributes
  3837. element.plain = !element.key && !attrs.length;
  3838. processRef(element);
  3839. processSlot(element);
  3840. processComponent(element);
  3841. for (var i$1 = 0; i$1 < transforms.length; i$1++) {
  3842. transforms[i$1](element, options);
  3843. }
  3844. processAttrs(element);
  3845. }
  3846. function checkRootConstraints (el) {
  3847. if (process.env.NODE_ENV !== 'production' && !warned) {
  3848. if (el.tag === 'slot' || el.tag === 'template') {
  3849. warned = true;
  3850. warn$1(
  3851. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  3852. 'contain multiple nodes:\n' + template
  3853. );
  3854. }
  3855. if (el.attrsMap.hasOwnProperty('v-for')) {
  3856. warned = true;
  3857. warn$1(
  3858. 'Cannot use v-for on stateful component root element because ' +
  3859. 'it renders multiple elements:\n' + template
  3860. );
  3861. }
  3862. }
  3863. }
  3864. // tree management
  3865. if (!root) {
  3866. root = element;
  3867. checkRootConstraints(root);
  3868. } else if (!stack.length) {
  3869. // allow 2 root elements with v-if and v-else
  3870. if (root.if && element.else) {
  3871. checkRootConstraints(element);
  3872. root.elseBlock = element;
  3873. } else if (process.env.NODE_ENV !== 'production' && !warned) {
  3874. warned = true;
  3875. warn$1(
  3876. ("Component template should contain exactly one root element:\n\n" + template)
  3877. );
  3878. }
  3879. }
  3880. if (currentParent && !element.forbidden) {
  3881. if (element.else) {
  3882. processElse(element, currentParent);
  3883. } else {
  3884. currentParent.children.push(element);
  3885. element.parent = currentParent;
  3886. }
  3887. }
  3888. if (!unary) {
  3889. currentParent = element;
  3890. stack.push(element);
  3891. }
  3892. // apply post-transforms
  3893. for (var i$2 = 0; i$2 < postTransforms.length; i$2++) {
  3894. postTransforms[i$2](element, options);
  3895. }
  3896. },
  3897. end: function end () {
  3898. // remove trailing whitespace
  3899. var element = stack[stack.length - 1];
  3900. var lastNode = element.children[element.children.length - 1];
  3901. if (lastNode && lastNode.type === 3 && lastNode.text === ' ') {
  3902. element.children.pop();
  3903. }
  3904. // pop stack
  3905. stack.length -= 1;
  3906. currentParent = stack[stack.length - 1];
  3907. // check pre state
  3908. if (element.pre) {
  3909. inVPre = false;
  3910. }
  3911. if (platformIsPreTag(element.tag)) {
  3912. inPre = false;
  3913. }
  3914. },
  3915. chars: function chars (text) {
  3916. if (!currentParent) {
  3917. if (process.env.NODE_ENV !== 'production' && !warned && text === template) {
  3918. warned = true;
  3919. warn$1(
  3920. 'Component template requires a root element, rather than just text:\n\n' + template
  3921. );
  3922. }
  3923. return
  3924. }
  3925. // IE textarea placeholder bug
  3926. /* istanbul ignore if */
  3927. if (options.isIE &&
  3928. currentParent.tag === 'textarea' &&
  3929. currentParent.attrsMap.placeholder === text) {
  3930. return
  3931. }
  3932. text = inPre || text.trim()
  3933. ? decodeHTMLCached(text)
  3934. // only preserve whitespace if its not right after a starting tag
  3935. : preserveWhitespace && currentParent.children.length ? ' ' : '';
  3936. if (text) {
  3937. var expression;
  3938. if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
  3939. currentParent.children.push({
  3940. type: 2,
  3941. expression: expression,
  3942. text: text
  3943. });
  3944. } else {
  3945. // #3895 special character
  3946. text = text.replace(specialNewlineRE, '');
  3947. currentParent.children.push({
  3948. type: 3,
  3949. text: text
  3950. });
  3951. }
  3952. }
  3953. }
  3954. });
  3955. return root
  3956. }
  3957. function processPre (el) {
  3958. if (getAndRemoveAttr(el, 'v-pre') != null) {
  3959. el.pre = true;
  3960. }
  3961. }
  3962. function processRawAttrs (el) {
  3963. var l = el.attrsList.length;
  3964. if (l) {
  3965. var attrs = el.attrs = new Array(l);
  3966. for (var i = 0; i < l; i++) {
  3967. attrs[i] = {
  3968. name: el.attrsList[i].name,
  3969. value: JSON.stringify(el.attrsList[i].value)
  3970. };
  3971. }
  3972. } else if (!el.pre) {
  3973. // non root node in pre blocks with no attributes
  3974. el.plain = true;
  3975. }
  3976. }
  3977. function processKey (el) {
  3978. var exp = getBindingAttr(el, 'key');
  3979. if (exp) {
  3980. if (process.env.NODE_ENV !== 'production' && el.tag === 'template') {
  3981. warn$1("<template> cannot be keyed. Place the key on real elements instead.");
  3982. }
  3983. el.key = exp;
  3984. }
  3985. }
  3986. function processRef (el) {
  3987. var ref = getBindingAttr(el, 'ref');
  3988. if (ref) {
  3989. el.ref = ref;
  3990. el.refInFor = checkInFor(el);
  3991. }
  3992. }
  3993. function processFor (el) {
  3994. var exp;
  3995. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  3996. var inMatch = exp.match(forAliasRE);
  3997. if (!inMatch) {
  3998. process.env.NODE_ENV !== 'production' && warn$1(
  3999. ("Invalid v-for expression: " + exp)
  4000. );
  4001. return
  4002. }
  4003. el.for = inMatch[2].trim();
  4004. var alias = inMatch[1].trim();
  4005. var iteratorMatch = alias.match(forIteratorRE);
  4006. if (iteratorMatch) {
  4007. el.alias = iteratorMatch[1].trim();
  4008. el.iterator1 = iteratorMatch[2].trim();
  4009. if (iteratorMatch[3]) {
  4010. el.iterator2 = iteratorMatch[3].trim();
  4011. }
  4012. } else {
  4013. el.alias = alias;
  4014. }
  4015. }
  4016. }
  4017. function processIf (el) {
  4018. var exp = getAndRemoveAttr(el, 'v-if');
  4019. if (exp) {
  4020. el.if = exp;
  4021. }
  4022. if (getAndRemoveAttr(el, 'v-else') != null) {
  4023. el.else = true;
  4024. }
  4025. }
  4026. function processElse (el, parent) {
  4027. var prev = findPrevElement(parent.children);
  4028. if (prev && prev.if) {
  4029. prev.elseBlock = el;
  4030. } else if (process.env.NODE_ENV !== 'production') {
  4031. warn$1(
  4032. ("v-else used on element <" + (el.tag) + "> without corresponding v-if.")
  4033. );
  4034. }
  4035. }
  4036. function processOnce (el) {
  4037. var once = getAndRemoveAttr(el, 'v-once');
  4038. if (once != null) {
  4039. el.once = true;
  4040. }
  4041. }
  4042. function processSlot (el) {
  4043. if (el.tag === 'slot') {
  4044. el.slotName = getBindingAttr(el, 'name');
  4045. } else {
  4046. var slotTarget = getBindingAttr(el, 'slot');
  4047. if (slotTarget) {
  4048. el.slotTarget = slotTarget;
  4049. }
  4050. }
  4051. }
  4052. function processComponent (el) {
  4053. var binding;
  4054. if ((binding = getBindingAttr(el, 'is'))) {
  4055. el.component = binding;
  4056. }
  4057. if (getAndRemoveAttr(el, 'inline-template') != null) {
  4058. el.inlineTemplate = true;
  4059. }
  4060. }
  4061. function processAttrs (el) {
  4062. var list = el.attrsList;
  4063. var i, l, name, rawName, value, arg, modifiers, isProp;
  4064. for (i = 0, l = list.length; i < l; i++) {
  4065. name = rawName = list[i].name;
  4066. value = list[i].value;
  4067. if (dirRE.test(name)) {
  4068. // mark element as dynamic
  4069. el.hasBindings = true;
  4070. // modifiers
  4071. modifiers = parseModifiers(name);
  4072. if (modifiers) {
  4073. name = name.replace(modifierRE, '');
  4074. }
  4075. if (bindRE.test(name)) { // v-bind
  4076. name = name.replace(bindRE, '');
  4077. if (modifiers && modifiers.prop) {
  4078. isProp = true;
  4079. name = camelize(name);
  4080. if (name === 'innerHtml') { name = 'innerHTML'; }
  4081. }
  4082. if (isProp || platformMustUseProp(el.tag, name)) {
  4083. addProp(el, name, value);
  4084. } else {
  4085. addAttr(el, name, value);
  4086. }
  4087. } else if (onRE.test(name)) { // v-on
  4088. name = name.replace(onRE, '');
  4089. addHandler(el, name, value, modifiers);
  4090. } else { // normal directives
  4091. name = name.replace(dirRE, '');
  4092. // parse arg
  4093. var argMatch = name.match(argRE);
  4094. if (argMatch && (arg = argMatch[1])) {
  4095. name = name.slice(0, -(arg.length + 1));
  4096. }
  4097. addDirective(el, name, rawName, value, arg, modifiers);
  4098. if (process.env.NODE_ENV !== 'production' && name === 'model') {
  4099. checkForAliasModel(el, value);
  4100. }
  4101. }
  4102. } else {
  4103. // literal attribute
  4104. if (process.env.NODE_ENV !== 'production') {
  4105. var expression = parseText(value, delimiters);
  4106. if (expression) {
  4107. warn$1(
  4108. name + "=\"" + value + "\": " +
  4109. 'Interpolation inside attributes has been removed. ' +
  4110. 'Use v-bind or the colon shorthand instead. For example, ' +
  4111. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  4112. );
  4113. }
  4114. }
  4115. addAttr(el, name, JSON.stringify(value));
  4116. }
  4117. }
  4118. }
  4119. function checkInFor (el) {
  4120. var parent = el;
  4121. while (parent) {
  4122. if (parent.for !== undefined) {
  4123. return true
  4124. }
  4125. parent = parent.parent;
  4126. }
  4127. return false
  4128. }
  4129. function parseModifiers (name) {
  4130. var match = name.match(modifierRE);
  4131. if (match) {
  4132. var ret = {};
  4133. match.forEach(function (m) { ret[m.slice(1)] = true; });
  4134. return ret
  4135. }
  4136. }
  4137. function makeAttrsMap (attrs, isIE) {
  4138. var map = {};
  4139. for (var i = 0, l = attrs.length; i < l; i++) {
  4140. if (process.env.NODE_ENV !== 'production' && map[attrs[i].name] && !isIE) {
  4141. warn$1('duplicate attribute: ' + attrs[i].name);
  4142. }
  4143. map[attrs[i].name] = attrs[i].value;
  4144. }
  4145. return map
  4146. }
  4147. function findPrevElement (children) {
  4148. var i = children.length;
  4149. while (i--) {
  4150. if (children[i].tag) { return children[i] }
  4151. }
  4152. }
  4153. function isForbiddenTag (el) {
  4154. return (
  4155. el.tag === 'style' ||
  4156. (el.tag === 'script' && (
  4157. !el.attrsMap.type ||
  4158. el.attrsMap.type === 'text/javascript'
  4159. ))
  4160. )
  4161. }
  4162. var ieNSBug = /^xmlns:NS\d+/;
  4163. var ieNSPrefix = /^NS\d+:/;
  4164. /* istanbul ignore next */
  4165. function guardIESVGBug (attrs) {
  4166. var res = [];
  4167. for (var i = 0; i < attrs.length; i++) {
  4168. var attr = attrs[i];
  4169. if (!ieNSBug.test(attr.name)) {
  4170. attr.name = attr.name.replace(ieNSPrefix, '');
  4171. res.push(attr);
  4172. }
  4173. }
  4174. return res
  4175. }
  4176. function checkForAliasModel (el, value) {
  4177. var _el = el;
  4178. while (_el) {
  4179. if (_el.for && _el.alias === value) {
  4180. warn$1(
  4181. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  4182. "You are binding v-model directly to a v-for iteration alias. " +
  4183. "This will not be able to modify the v-for source array because " +
  4184. "writing to the alias is like modifying a function local variable. " +
  4185. "Consider using an array of objects and use v-model on an object property instead."
  4186. );
  4187. }
  4188. _el = _el.parent;
  4189. }
  4190. }
  4191. /* */
  4192. var isStaticKey;
  4193. var isPlatformReservedTag;
  4194. var genStaticKeysCached = cached(genStaticKeys$1);
  4195. /**
  4196. * Goal of the optimizer: walk the generated template AST tree
  4197. * and detect sub-trees that are purely static, i.e. parts of
  4198. * the DOM that never needs to change.
  4199. *
  4200. * Once we detect these sub-trees, we can:
  4201. *
  4202. * 1. Hoist them into constants, so that we no longer need to
  4203. * create fresh nodes for them on each re-render;
  4204. * 2. Completely skip them in the patching process.
  4205. */
  4206. function optimize (root, options) {
  4207. if (!root) { return }
  4208. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  4209. isPlatformReservedTag = options.isReservedTag || (function () { return false; });
  4210. // first pass: mark all non-static nodes.
  4211. markStatic(root);
  4212. // second pass: mark static roots.
  4213. markStaticRoots(root, false);
  4214. }
  4215. function genStaticKeys$1 (keys) {
  4216. return makeMap(
  4217. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  4218. (keys ? ',' + keys : '')
  4219. )
  4220. }
  4221. function markStatic (node) {
  4222. node.static = isStatic(node);
  4223. if (node.type === 1) {
  4224. // do not make component slot content static. this avoids
  4225. // 1. components not able to mutate slot nodes
  4226. // 2. static slot content fails for hot-reloading
  4227. if (
  4228. !isPlatformReservedTag(node.tag) &&
  4229. node.tag !== 'slot' &&
  4230. node.attrsMap['inline-template'] == null
  4231. ) {
  4232. return
  4233. }
  4234. for (var i = 0, l = node.children.length; i < l; i++) {
  4235. var child = node.children[i];
  4236. markStatic(child);
  4237. if (!child.static) {
  4238. node.static = false;
  4239. }
  4240. }
  4241. }
  4242. }
  4243. function markStaticRoots (node, isInFor) {
  4244. if (node.type === 1) {
  4245. if (node.static || node.once) {
  4246. node.staticInFor = isInFor;
  4247. }
  4248. // For a node to qualify as a static root, it should have children that
  4249. // are not just static text. Otherwise the cost of hoisting out will
  4250. // outweigh the benefits and it's better off to just always render it fresh.
  4251. if (node.static && node.children.length && !(
  4252. node.children.length === 1 &&
  4253. node.children[0].type === 3
  4254. )) {
  4255. node.staticRoot = true;
  4256. return
  4257. } else {
  4258. node.staticRoot = false;
  4259. }
  4260. if (node.children) {
  4261. for (var i = 0, l = node.children.length; i < l; i++) {
  4262. var child = node.children[i];
  4263. isInFor = isInFor || !!node.for;
  4264. markStaticRoots(child, isInFor);
  4265. if (child.type === 1 && child.elseBlock) {
  4266. markStaticRoots(child.elseBlock, isInFor);
  4267. }
  4268. }
  4269. }
  4270. }
  4271. }
  4272. function isStatic (node) {
  4273. if (node.type === 2) { // expression
  4274. return false
  4275. }
  4276. if (node.type === 3) { // text
  4277. return true
  4278. }
  4279. return !!(node.pre || (
  4280. !node.hasBindings && // no dynamic bindings
  4281. !node.if && !node.for && // not v-if or v-for or v-else
  4282. !isBuiltInTag(node.tag) && // not a built-in
  4283. isPlatformReservedTag(node.tag) && // not a component
  4284. !isDirectChildOfTemplateFor(node) &&
  4285. Object.keys(node).every(isStaticKey)
  4286. ))
  4287. }
  4288. function isDirectChildOfTemplateFor (node) {
  4289. while (node.parent) {
  4290. node = node.parent;
  4291. if (node.tag !== 'template') {
  4292. return false
  4293. }
  4294. if (node.for) {
  4295. return true
  4296. }
  4297. }
  4298. return false
  4299. }
  4300. /* */
  4301. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  4302. // keyCode aliases
  4303. var keyCodes = {
  4304. esc: 27,
  4305. tab: 9,
  4306. enter: 13,
  4307. space: 32,
  4308. up: 38,
  4309. left: 37,
  4310. right: 39,
  4311. down: 40,
  4312. 'delete': [8, 46]
  4313. };
  4314. var modifierCode = {
  4315. stop: '$event.stopPropagation();',
  4316. prevent: '$event.preventDefault();',
  4317. self: 'if($event.target !== $event.currentTarget)return;'
  4318. };
  4319. function genHandlers (events, native) {
  4320. var res = native ? 'nativeOn:{' : 'on:{';
  4321. for (var name in events) {
  4322. res += "\"" + name + "\":" + (genHandler(events[name])) + ",";
  4323. }
  4324. return res.slice(0, -1) + '}'
  4325. }
  4326. function genHandler (
  4327. handler
  4328. ) {
  4329. if (!handler) {
  4330. return 'function(){}'
  4331. } else if (Array.isArray(handler)) {
  4332. return ("[" + (handler.map(genHandler).join(',')) + "]")
  4333. } else if (!handler.modifiers) {
  4334. return simplePathRE.test(handler.value)
  4335. ? handler.value
  4336. : ("function($event){" + (handler.value) + "}")
  4337. } else {
  4338. var code = '';
  4339. var keys = [];
  4340. for (var key in handler.modifiers) {
  4341. if (modifierCode[key]) {
  4342. code += modifierCode[key];
  4343. } else {
  4344. keys.push(key);
  4345. }
  4346. }
  4347. if (keys.length) {
  4348. code = genKeyFilter(keys) + code;
  4349. }
  4350. var handlerCode = simplePathRE.test(handler.value)
  4351. ? handler.value + '($event)'
  4352. : handler.value;
  4353. return 'function($event){' + code + handlerCode + '}'
  4354. }
  4355. }
  4356. function genKeyFilter (keys) {
  4357. var code = keys.length === 1
  4358. ? normalizeKeyCode(keys[0])
  4359. : Array.prototype.concat.apply([], keys.map(normalizeKeyCode));
  4360. if (Array.isArray(code)) {
  4361. return ("if(" + (code.map(function (c) { return ("$event.keyCode!==" + c); }).join('&&')) + ")return;")
  4362. } else {
  4363. return ("if($event.keyCode!==" + code + ")return;")
  4364. }
  4365. }
  4366. function normalizeKeyCode (key) {
  4367. return (
  4368. parseInt(key, 10) || // number keyCode
  4369. keyCodes[key] || // built-in alias
  4370. ("_k(" + (JSON.stringify(key)) + ")") // custom alias
  4371. )
  4372. }
  4373. /* */
  4374. function bind$1 (el, dir) {
  4375. el.wrapData = function (code) {
  4376. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + (dir.modifiers && dir.modifiers.prop ? ',true' : '') + ")")
  4377. };
  4378. }
  4379. var baseDirectives = {
  4380. bind: bind$1,
  4381. cloak: noop
  4382. };
  4383. /* */
  4384. // configurable state
  4385. var warn$2;
  4386. var transforms$1;
  4387. var dataGenFns;
  4388. var platformDirectives;
  4389. var staticRenderFns;
  4390. var onceCount;
  4391. var currentOptions;
  4392. function generate (
  4393. ast,
  4394. options
  4395. ) {
  4396. // save previous staticRenderFns so generate calls can be nested
  4397. var prevStaticRenderFns = staticRenderFns;
  4398. var currentStaticRenderFns = staticRenderFns = [];
  4399. var prevOnceCount = onceCount;
  4400. onceCount = 0;
  4401. currentOptions = options;
  4402. warn$2 = options.warn || baseWarn;
  4403. transforms$1 = pluckModuleFunction(options.modules, 'transformCode');
  4404. dataGenFns = pluckModuleFunction(options.modules, 'genData');
  4405. platformDirectives = options.directives || {};
  4406. var code = ast ? genElement(ast) : '_h("div")';
  4407. staticRenderFns = prevStaticRenderFns;
  4408. onceCount = prevOnceCount;
  4409. return {
  4410. render: ("with(this){return " + code + "}"),
  4411. staticRenderFns: currentStaticRenderFns
  4412. }
  4413. }
  4414. function genElement (el) {
  4415. if (el.staticRoot && !el.staticProcessed) {
  4416. return genStatic(el)
  4417. } else if (el.once && !el.onceProcessed) {
  4418. return genOnce(el)
  4419. } else if (el.for && !el.forProcessed) {
  4420. return genFor(el)
  4421. } else if (el.if && !el.ifProcessed) {
  4422. return genIf(el)
  4423. } else if (el.tag === 'template' && !el.slotTarget) {
  4424. return genChildren(el) || 'void 0'
  4425. } else if (el.tag === 'slot') {
  4426. return genSlot(el)
  4427. } else {
  4428. // component or element
  4429. var code;
  4430. if (el.component) {
  4431. code = genComponent(el.component, el);
  4432. } else {
  4433. var data = el.plain ? undefined : genData(el);
  4434. var children = el.inlineTemplate ? null : genChildren(el);
  4435. code = "_h('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  4436. }
  4437. // module transforms
  4438. for (var i = 0; i < transforms$1.length; i++) {
  4439. code = transforms$1[i](el, code);
  4440. }
  4441. return code
  4442. }
  4443. }
  4444. // hoist static sub-trees out
  4445. function genStatic (el) {
  4446. el.staticProcessed = true;
  4447. staticRenderFns.push(("with(this){return " + (genElement(el)) + "}"));
  4448. return ("_m(" + (staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  4449. }
  4450. // v-once
  4451. function genOnce (el) {
  4452. el.onceProcessed = true;
  4453. if (el.if && !el.ifProcessed) {
  4454. return genIf(el)
  4455. } else if (el.staticInFor) {
  4456. var key = '';
  4457. var parent = el.parent;
  4458. while (parent) {
  4459. if (parent.for) {
  4460. key = parent.key;
  4461. break
  4462. }
  4463. parent = parent.parent;
  4464. }
  4465. if (!key) {
  4466. process.env.NODE_ENV !== 'production' && warn$2(
  4467. "v-once can only be used inside v-for that is keyed. "
  4468. );
  4469. return genElement(el)
  4470. }
  4471. return ("_o(" + (genElement(el)) + "," + (onceCount++) + (key ? ("," + key) : "") + ")")
  4472. } else {
  4473. return genStatic(el)
  4474. }
  4475. }
  4476. // v-if with v-once shuold generate code like (a)?_m(0):_m(1)
  4477. function genIf (el) {
  4478. var exp = el.if;
  4479. el.ifProcessed = true; // avoid recursion
  4480. return ("(" + exp + ")?" + (el.once ? genOnce(el) : genElement(el)) + ":" + (genElse(el)))
  4481. }
  4482. function genElse (el) {
  4483. return el.elseBlock
  4484. ? genElement(el.elseBlock)
  4485. : '_e()'
  4486. }
  4487. function genFor (el) {
  4488. var exp = el.for;
  4489. var alias = el.alias;
  4490. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  4491. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  4492. el.forProcessed = true; // avoid recursion
  4493. return "_l((" + exp + ")," +
  4494. "function(" + alias + iterator1 + iterator2 + "){" +
  4495. "return " + (genElement(el)) +
  4496. '})'
  4497. }
  4498. function genData (el) {
  4499. var data = '{';
  4500. // directives first.
  4501. // directives may mutate the el's other properties before they are generated.
  4502. var dirs = genDirectives(el);
  4503. if (dirs) { data += dirs + ','; }
  4504. // key
  4505. if (el.key) {
  4506. data += "key:" + (el.key) + ",";
  4507. }
  4508. // ref
  4509. if (el.ref) {
  4510. data += "ref:" + (el.ref) + ",";
  4511. }
  4512. if (el.refInFor) {
  4513. data += "refInFor:true,";
  4514. }
  4515. // record original tag name for components using "is" attribute
  4516. if (el.component) {
  4517. data += "tag:\"" + (el.tag) + "\",";
  4518. }
  4519. // slot target
  4520. if (el.slotTarget) {
  4521. data += "slot:" + (el.slotTarget) + ",";
  4522. }
  4523. // module data generation functions
  4524. for (var i = 0; i < dataGenFns.length; i++) {
  4525. data += dataGenFns[i](el);
  4526. }
  4527. // attributes
  4528. if (el.attrs) {
  4529. data += "attrs:{" + (genProps(el.attrs)) + "},";
  4530. }
  4531. // DOM props
  4532. if (el.props) {
  4533. data += "domProps:{" + (genProps(el.props)) + "},";
  4534. }
  4535. // event handlers
  4536. if (el.events) {
  4537. data += (genHandlers(el.events)) + ",";
  4538. }
  4539. if (el.nativeEvents) {
  4540. data += (genHandlers(el.nativeEvents, true)) + ",";
  4541. }
  4542. // inline-template
  4543. if (el.inlineTemplate) {
  4544. var ast = el.children[0];
  4545. if (process.env.NODE_ENV !== 'production' && (
  4546. el.children.length > 1 || ast.type !== 1
  4547. )) {
  4548. warn$2('Inline-template components must have exactly one child element.');
  4549. }
  4550. if (ast.type === 1) {
  4551. var inlineRenderFns = generate(ast, currentOptions);
  4552. data += "inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}";
  4553. }
  4554. }
  4555. data = data.replace(/,$/, '') + '}';
  4556. // v-bind data wrap
  4557. if (el.wrapData) {
  4558. data = el.wrapData(data);
  4559. }
  4560. return data
  4561. }
  4562. function genDirectives (el) {
  4563. var dirs = el.directives;
  4564. if (!dirs) { return }
  4565. var res = 'directives:[';
  4566. var hasRuntime = false;
  4567. var i, l, dir, needRuntime;
  4568. for (i = 0, l = dirs.length; i < l; i++) {
  4569. dir = dirs[i];
  4570. needRuntime = true;
  4571. var gen = platformDirectives[dir.name] || baseDirectives[dir.name];
  4572. if (gen) {
  4573. // compile-time directive that manipulates AST.
  4574. // returns true if it also needs a runtime counterpart.
  4575. needRuntime = !!gen(el, dir, warn$2);
  4576. }
  4577. if (needRuntime) {
  4578. hasRuntime = true;
  4579. 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))) : '') + "},";
  4580. }
  4581. }
  4582. if (hasRuntime) {
  4583. return res.slice(0, -1) + ']'
  4584. }
  4585. }
  4586. function genChildren (el) {
  4587. if (el.children.length) {
  4588. return '[' + el.children.map(genNode).join(',') + ']'
  4589. }
  4590. }
  4591. function genNode (node) {
  4592. if (node.type === 1) {
  4593. return genElement(node)
  4594. } else {
  4595. return genText(node)
  4596. }
  4597. }
  4598. function genText (text) {
  4599. return text.type === 2
  4600. ? text.expression // no need for () because already wrapped in _s()
  4601. : JSON.stringify(text.text)
  4602. }
  4603. function genSlot (el) {
  4604. var slotName = el.slotName || '"default"';
  4605. var children = genChildren(el);
  4606. return ("_t(" + slotName + (children ? ("," + children) : '') + ")")
  4607. }
  4608. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  4609. function genComponent (componentName, el) {
  4610. var children = el.inlineTemplate ? null : genChildren(el);
  4611. return ("_h(" + componentName + "," + (genData(el)) + (children ? ("," + children) : '') + ")")
  4612. }
  4613. function genProps (props) {
  4614. var res = '';
  4615. for (var i = 0; i < props.length; i++) {
  4616. var prop = props[i];
  4617. res += "\"" + (prop.name) + "\":" + (prop.value) + ",";
  4618. }
  4619. return res.slice(0, -1)
  4620. }
  4621. /* */
  4622. /**
  4623. * Compile a template.
  4624. */
  4625. function compile$1 (
  4626. template,
  4627. options
  4628. ) {
  4629. var ast = parse(template.trim(), options);
  4630. optimize(ast, options);
  4631. var code = generate(ast, options);
  4632. return {
  4633. ast: ast,
  4634. render: code.render,
  4635. staticRenderFns: code.staticRenderFns
  4636. }
  4637. }
  4638. /* */
  4639. // operators like typeof, instanceof and in are allowed
  4640. var prohibitedKeywordRE = new RegExp('\\b' + (
  4641. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  4642. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  4643. 'extends,finally,continue,debugger,function,arguments'
  4644. ).split(',').join('\\b|\\b') + '\\b');
  4645. // check valid identifier for v-for
  4646. var identRE = /[A-Za-z_$][\w$]*/;
  4647. // strip strings in expressions
  4648. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  4649. // detect problematic expressions in a template
  4650. function detectErrors (ast) {
  4651. var errors = [];
  4652. if (ast) {
  4653. checkNode(ast, errors);
  4654. }
  4655. return errors
  4656. }
  4657. function checkNode (node, errors) {
  4658. if (node.type === 1) {
  4659. for (var name in node.attrsMap) {
  4660. if (dirRE.test(name)) {
  4661. var value = node.attrsMap[name];
  4662. if (value) {
  4663. if (name === 'v-for') {
  4664. checkFor(node, ("v-for=\"" + value + "\""), errors);
  4665. } else {
  4666. checkExpression(value, (name + "=\"" + value + "\""), errors);
  4667. }
  4668. }
  4669. }
  4670. }
  4671. if (node.children) {
  4672. for (var i = 0; i < node.children.length; i++) {
  4673. checkNode(node.children[i], errors);
  4674. }
  4675. }
  4676. } else if (node.type === 2) {
  4677. checkExpression(node.expression, node.text, errors);
  4678. }
  4679. }
  4680. function checkFor (node, text, errors) {
  4681. checkExpression(node.for || '', text, errors);
  4682. checkIdentifier(node.alias, 'v-for alias', text, errors);
  4683. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  4684. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  4685. }
  4686. function checkIdentifier (ident, type, text, errors) {
  4687. if (typeof ident === 'string' && !identRE.test(ident)) {
  4688. errors.push(("- invalid " + type + " \"" + ident + "\" in expression: " + text));
  4689. }
  4690. }
  4691. function checkExpression (exp, text, errors) {
  4692. try {
  4693. new Function(("return " + exp));
  4694. } catch (e) {
  4695. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  4696. if (keywordMatch) {
  4697. errors.push(
  4698. "- avoid using JavaScript keyword as property name: " +
  4699. "\"" + (keywordMatch[0]) + "\" in expression " + text
  4700. );
  4701. } else {
  4702. errors.push(("- invalid expression: " + text));
  4703. }
  4704. }
  4705. }
  4706. /* */
  4707. function transformNode (el, options) {
  4708. var warn = options.warn || baseWarn;
  4709. var staticClass = getAndRemoveAttr(el, 'class');
  4710. if (process.env.NODE_ENV !== 'production' && staticClass) {
  4711. var expression = parseText(staticClass, options.delimiters);
  4712. if (expression) {
  4713. warn(
  4714. "class=\"" + staticClass + "\": " +
  4715. 'Interpolation inside attributes has been removed. ' +
  4716. 'Use v-bind or the colon shorthand instead. For example, ' +
  4717. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  4718. );
  4719. }
  4720. }
  4721. if (staticClass) {
  4722. el.staticClass = JSON.stringify(staticClass);
  4723. }
  4724. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  4725. if (classBinding) {
  4726. el.classBinding = classBinding;
  4727. }
  4728. }
  4729. function genData$1 (el) {
  4730. var data = '';
  4731. if (el.staticClass) {
  4732. data += "staticClass:" + (el.staticClass) + ",";
  4733. }
  4734. if (el.classBinding) {
  4735. data += "class:" + (el.classBinding) + ",";
  4736. }
  4737. return data
  4738. }
  4739. var klass = {
  4740. staticKeys: ['staticClass'],
  4741. transformNode: transformNode,
  4742. genData: genData$1
  4743. };
  4744. /* */
  4745. var parseStyleText = cached(function (cssText) {
  4746. var res = {};
  4747. var hasBackground = cssText.indexOf('background') >= 0;
  4748. // maybe with background-image: url(http://xxx) or base64 img
  4749. var listDelimiter = hasBackground ? /;(?![^(]*\))/g : ';';
  4750. var propertyDelimiter = hasBackground ? /:(.+)/ : ':';
  4751. cssText.split(listDelimiter).forEach(function (item) {
  4752. if (item) {
  4753. var tmp = item.split(propertyDelimiter);
  4754. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  4755. }
  4756. });
  4757. return res
  4758. });
  4759. // merge static and dynamic style data on the same vnode
  4760. function normalizeStyleData (data) {
  4761. var style = normalizeStyleBinding(data.style);
  4762. // static style is pre-processed into an object during compilation
  4763. // and is always a fresh object, so it's safe to merge into it
  4764. return data.staticStyle
  4765. ? extend(data.staticStyle, style)
  4766. : style
  4767. }
  4768. // normalize possible array / string values into Object
  4769. function normalizeStyleBinding (bindingStyle) {
  4770. if (Array.isArray(bindingStyle)) {
  4771. return toObject(bindingStyle)
  4772. }
  4773. if (typeof bindingStyle === 'string') {
  4774. return parseStyleText(bindingStyle)
  4775. }
  4776. return bindingStyle
  4777. }
  4778. /**
  4779. * parent component style should be after child's
  4780. * so that parent component's style could override it
  4781. */
  4782. function getStyle (vnode, checkChild) {
  4783. var res = {};
  4784. var styleData;
  4785. if (checkChild) {
  4786. var childNode = vnode;
  4787. while (childNode.child) {
  4788. childNode = childNode.child._vnode;
  4789. if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
  4790. extend(res, styleData);
  4791. }
  4792. }
  4793. }
  4794. if ((styleData = normalizeStyleData(vnode.data))) {
  4795. extend(res, styleData);
  4796. }
  4797. var parentNode = vnode;
  4798. while ((parentNode = parentNode.parent)) {
  4799. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  4800. extend(res, styleData);
  4801. }
  4802. }
  4803. return res
  4804. }
  4805. /* */
  4806. function transformNode$1 (el, options) {
  4807. var warn = options.warn || baseWarn;
  4808. var staticStyle = getAndRemoveAttr(el, 'style');
  4809. if (staticStyle) {
  4810. /* istanbul ignore if */
  4811. if (process.env.NODE_ENV !== 'production') {
  4812. var expression = parseText(staticStyle, options.delimiters);
  4813. if (expression) {
  4814. warn(
  4815. "style=\"" + staticStyle + "\": " +
  4816. 'Interpolation inside attributes has been removed. ' +
  4817. 'Use v-bind or the colon shorthand instead. For example, ' +
  4818. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  4819. );
  4820. }
  4821. }
  4822. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  4823. }
  4824. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  4825. if (styleBinding) {
  4826. el.styleBinding = styleBinding;
  4827. }
  4828. }
  4829. function genData$2 (el) {
  4830. var data = '';
  4831. if (el.staticStyle) {
  4832. data += "staticStyle:" + (el.staticStyle) + ",";
  4833. }
  4834. if (el.styleBinding) {
  4835. data += "style:(" + (el.styleBinding) + "),";
  4836. }
  4837. return data
  4838. }
  4839. var style = {
  4840. staticKeys: ['staticStyle'],
  4841. transformNode: transformNode$1,
  4842. genData: genData$2
  4843. };
  4844. var modules = [
  4845. klass,
  4846. style
  4847. ];
  4848. /* */
  4849. var warn$3;
  4850. function model (
  4851. el,
  4852. dir,
  4853. _warn
  4854. ) {
  4855. warn$3 = _warn;
  4856. var value = dir.value;
  4857. var modifiers = dir.modifiers;
  4858. var tag = el.tag;
  4859. var type = el.attrsMap.type;
  4860. if (process.env.NODE_ENV !== 'production') {
  4861. var dynamicType = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  4862. if (tag === 'input' && dynamicType) {
  4863. warn$3(
  4864. "<input :type=\"" + dynamicType + "\" v-model=\"" + value + "\">:\n" +
  4865. "v-model does not support dynamic input types. Use v-if branches instead."
  4866. );
  4867. }
  4868. }
  4869. if (tag === 'select') {
  4870. genSelect(el, value, modifiers);
  4871. } else if (tag === 'input' && type === 'checkbox') {
  4872. genCheckboxModel(el, value, modifiers);
  4873. } else if (tag === 'input' && type === 'radio') {
  4874. genRadioModel(el, value, modifiers);
  4875. } else {
  4876. genDefaultModel(el, value, modifiers);
  4877. }
  4878. // ensure runtime directive metadata
  4879. return true
  4880. }
  4881. function genCheckboxModel (
  4882. el,
  4883. value,
  4884. modifiers
  4885. ) {
  4886. if (process.env.NODE_ENV !== 'production' &&
  4887. el.attrsMap.checked != null) {
  4888. warn$3(
  4889. "<" + (el.tag) + " v-model=\"" + value + "\" checked>:\n" +
  4890. "inline checked attributes will be ignored when using v-model. " +
  4891. 'Declare initial values in the component\'s data option instead.'
  4892. );
  4893. }
  4894. var number = modifiers && modifiers.number;
  4895. var valueBinding = getBindingAttr(el, 'value') || 'null';
  4896. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  4897. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  4898. addProp(el, 'checked',
  4899. "Array.isArray(" + value + ")" +
  4900. "?_i(" + value + "," + valueBinding + ")>-1" +
  4901. ":_q(" + value + "," + trueValueBinding + ")"
  4902. );
  4903. addHandler(el, 'change',
  4904. "var $$a=" + value + "," +
  4905. '$$el=$event.target,' +
  4906. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  4907. 'if(Array.isArray($$a)){' +
  4908. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  4909. '$$i=_i($$a,$$v);' +
  4910. "if($$c){$$i<0&&(" + value + "=$$a.concat($$v))}" +
  4911. "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
  4912. "}else{" + value + "=$$c}",
  4913. null, true
  4914. );
  4915. }
  4916. function genRadioModel (
  4917. el,
  4918. value,
  4919. modifiers
  4920. ) {
  4921. if (process.env.NODE_ENV !== 'production' &&
  4922. el.attrsMap.checked != null) {
  4923. warn$3(
  4924. "<" + (el.tag) + " v-model=\"" + value + "\" checked>:\n" +
  4925. "inline checked attributes will be ignored when using v-model. " +
  4926. 'Declare initial values in the component\'s data option instead.'
  4927. );
  4928. }
  4929. var number = modifiers && modifiers.number;
  4930. var valueBinding = getBindingAttr(el, 'value') || 'null';
  4931. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  4932. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  4933. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  4934. }
  4935. function genDefaultModel (
  4936. el,
  4937. value,
  4938. modifiers
  4939. ) {
  4940. if (process.env.NODE_ENV !== 'production') {
  4941. if (el.tag === 'input' && el.attrsMap.value) {
  4942. warn$3(
  4943. "<" + (el.tag) + " v-model=\"" + value + "\" value=\"" + (el.attrsMap.value) + "\">:\n" +
  4944. 'inline value attributes will be ignored when using v-model. ' +
  4945. 'Declare initial values in the component\'s data option instead.'
  4946. );
  4947. }
  4948. if (el.tag === 'textarea' && el.children.length) {
  4949. warn$3(
  4950. "<textarea v-model=\"" + value + "\">:\n" +
  4951. 'inline content inside <textarea> will be ignored when using v-model. ' +
  4952. 'Declare initial values in the component\'s data option instead.'
  4953. );
  4954. }
  4955. }
  4956. var type = el.attrsMap.type;
  4957. var ref = modifiers || {};
  4958. var lazy = ref.lazy;
  4959. var number = ref.number;
  4960. var trim = ref.trim;
  4961. var event = lazy || (isIE && type === 'range') ? 'change' : 'input';
  4962. var needCompositionGuard = !lazy && type !== 'range';
  4963. var isNative = el.tag === 'input' || el.tag === 'textarea';
  4964. var valueExpression = isNative
  4965. ? ("$event.target.value" + (trim ? '.trim()' : ''))
  4966. : trim ? "(typeof $event === 'string' ? $event.trim() : $event)" : "$event";
  4967. valueExpression = number || type === 'number'
  4968. ? ("_n(" + valueExpression + ")")
  4969. : valueExpression;
  4970. var code = genAssignmentCode(value, valueExpression);
  4971. if (isNative && needCompositionGuard) {
  4972. code = "if($event.target.composing)return;" + code;
  4973. }
  4974. // inputs with type="file" are read only and setting the input's
  4975. // value will throw an error.
  4976. if (process.env.NODE_ENV !== 'production' &&
  4977. type === 'file') {
  4978. warn$3(
  4979. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  4980. "File inputs are read only. Use a v-on:change listener instead."
  4981. );
  4982. }
  4983. addProp(el, 'value', isNative ? ("_s(" + value + ")") : ("(" + value + ")"));
  4984. addHandler(el, event, code, null, true);
  4985. }
  4986. function genSelect (
  4987. el,
  4988. value,
  4989. modifiers
  4990. ) {
  4991. if (process.env.NODE_ENV !== 'production') {
  4992. el.children.some(checkOptionWarning);
  4993. }
  4994. var number = modifiers && modifiers.number;
  4995. var assignment = "Array.prototype.filter" +
  4996. ".call($event.target.options,function(o){return o.selected})" +
  4997. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  4998. "return " + (number ? '_n(val)' : 'val') + "})" +
  4999. (el.attrsMap.multiple == null ? '[0]' : '');
  5000. var code = genAssignmentCode(value, assignment);
  5001. addHandler(el, 'change', code, null, true);
  5002. }
  5003. function checkOptionWarning (option) {
  5004. if (option.type === 1 &&
  5005. option.tag === 'option' &&
  5006. option.attrsMap.selected != null) {
  5007. warn$3(
  5008. "<select v-model=\"" + (option.parent.attrsMap['v-model']) + "\">:\n" +
  5009. 'inline selected attributes on <option> will be ignored when using v-model. ' +
  5010. 'Declare initial values in the component\'s data option instead.'
  5011. );
  5012. return true
  5013. }
  5014. return false
  5015. }
  5016. function genAssignmentCode (value, assignment) {
  5017. var modelRs = parseModel(value);
  5018. if (modelRs.idx === null) {
  5019. return (value + "=" + assignment)
  5020. } else {
  5021. return "var $$exp = " + (modelRs.exp) + ", $$idx = " + (modelRs.idx) + ";" +
  5022. "if (!Array.isArray($$exp)){" +
  5023. value + "=" + assignment + "}" +
  5024. "else{$$exp.splice($$idx, 1, " + assignment + ")}"
  5025. }
  5026. }
  5027. /* */
  5028. function text (el, dir) {
  5029. if (dir.value) {
  5030. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  5031. }
  5032. }
  5033. /* */
  5034. function html (el, dir) {
  5035. if (dir.value) {
  5036. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  5037. }
  5038. }
  5039. var directives = {
  5040. model: model,
  5041. text: text,
  5042. html: html
  5043. };
  5044. /* */
  5045. var cache = Object.create(null);
  5046. var baseOptions = {
  5047. isIE: isIE,
  5048. expectHTML: true,
  5049. modules: modules,
  5050. staticKeys: genStaticKeys(modules),
  5051. directives: directives,
  5052. isReservedTag: isReservedTag,
  5053. isUnaryTag: isUnaryTag,
  5054. mustUseProp: mustUseProp,
  5055. getTagNamespace: getTagNamespace,
  5056. isPreTag: isPreTag
  5057. };
  5058. function compile$$1 (
  5059. template,
  5060. options
  5061. ) {
  5062. options = options
  5063. ? extend(extend({}, baseOptions), options)
  5064. : baseOptions;
  5065. return compile$1(template, options)
  5066. }
  5067. function compileToFunctions (
  5068. template,
  5069. options,
  5070. vm$$1
  5071. ) {
  5072. var _warn = (options && options.warn) || warn;
  5073. // detect possible CSP restriction
  5074. /* istanbul ignore if */
  5075. if (process.env.NODE_ENV !== 'production') {
  5076. try {
  5077. new Function('return 1');
  5078. } catch (e) {
  5079. if (e.toString().match(/unsafe-eval|CSP/)) {
  5080. _warn(
  5081. 'It seems you are using the standalone build of Vue.js in an ' +
  5082. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  5083. 'The template compiler cannot work in this environment. Consider ' +
  5084. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  5085. 'templates into render functions.'
  5086. );
  5087. }
  5088. }
  5089. }
  5090. var key = options && options.delimiters
  5091. ? String(options.delimiters) + template
  5092. : template;
  5093. if (cache[key]) {
  5094. return cache[key]
  5095. }
  5096. var res = {};
  5097. var compiled = compile$$1(template, options);
  5098. res.render = makeFunction(compiled.render);
  5099. var l = compiled.staticRenderFns.length;
  5100. res.staticRenderFns = new Array(l);
  5101. for (var i = 0; i < l; i++) {
  5102. res.staticRenderFns[i] = makeFunction(compiled.staticRenderFns[i]);
  5103. }
  5104. if (process.env.NODE_ENV !== 'production') {
  5105. if (res.render === noop || res.staticRenderFns.some(function (fn) { return fn === noop; })) {
  5106. _warn(
  5107. "failed to compile template:\n\n" + template + "\n\n" +
  5108. detectErrors(compiled.ast).join('\n') +
  5109. '\n\n',
  5110. vm$$1
  5111. );
  5112. }
  5113. }
  5114. return (cache[key] = res)
  5115. }
  5116. function makeFunction (code) {
  5117. try {
  5118. return new Function(code)
  5119. } catch (e) {
  5120. return noop
  5121. }
  5122. }
  5123. /* */
  5124. var warned = Object.create(null);
  5125. var warnOnce = function (msg) {
  5126. if (!warned[msg]) {
  5127. warned[msg] = true;
  5128. console.warn(("\n\u001b[31m" + msg + "\u001b[39m\n"));
  5129. }
  5130. };
  5131. var normalizeAsync = function (cache, method) {
  5132. var fn = cache[method];
  5133. if (!fn) {
  5134. return
  5135. } else if (fn.length > 1) {
  5136. return function (key, cb) { return fn.call(cache, key, cb); }
  5137. } else {
  5138. return function (key, cb) { return cb(fn.call(cache, key)); }
  5139. }
  5140. };
  5141. var compilationCache = Object.create(null);
  5142. var normalizeRender = function (vm$$1) {
  5143. var ref = vm$$1.$options;
  5144. var render = ref.render;
  5145. var template = ref.template;
  5146. if (!render) {
  5147. if (template) {
  5148. var renderFns = (
  5149. compilationCache[template] ||
  5150. (compilationCache[template] = compileToFunctions(template))
  5151. );
  5152. Object.assign(vm$$1.$options, renderFns);
  5153. } else {
  5154. throw new Error(
  5155. ("render function or template not defined in component: " + (vm$$1.$options.name || vm$$1.$options._componentTag || 'anonymous'))
  5156. )
  5157. }
  5158. }
  5159. };
  5160. function renderNode (node, isRoot, context) {
  5161. var write = context.write;
  5162. var next = context.next;
  5163. if (node.componentOptions) {
  5164. // check cache hit
  5165. var Ctor = node.componentOptions.Ctor;
  5166. var getKey = Ctor.options.serverCacheKey;
  5167. var name = Ctor.options.name;
  5168. var cache = context.cache;
  5169. if (getKey && cache && name) {
  5170. var key = name + '::' + getKey(node.componentOptions.propsData);
  5171. var has = context.has;
  5172. var get = context.get;
  5173. if (has) {
  5174. has(key, function (hit) {
  5175. if (hit && get) {
  5176. get(key, function (res) { return write(res, next); });
  5177. } else {
  5178. renderComponentWithCache(node, isRoot, key, context);
  5179. }
  5180. });
  5181. } else if (get) {
  5182. get(key, function (res) {
  5183. if (res) {
  5184. write(res, next);
  5185. } else {
  5186. renderComponentWithCache(node, isRoot, key, context);
  5187. }
  5188. });
  5189. }
  5190. } else {
  5191. if (getKey && !cache) {
  5192. warnOnce(
  5193. "[vue-server-renderer] Component " + (Ctor.options.name || '(anonymous)') + " implemented serverCacheKey, " +
  5194. 'but no cache was provided to the renderer.'
  5195. );
  5196. }
  5197. if (getKey && !name) {
  5198. warnOnce(
  5199. "[vue-server-renderer] Components that implement \"serverCacheKey\" " +
  5200. "must also define a unique \"name\" option."
  5201. );
  5202. }
  5203. renderComponent(node, isRoot, context);
  5204. }
  5205. } else {
  5206. if (node.tag) {
  5207. renderElement(node, isRoot, context);
  5208. } else if (node.isComment) {
  5209. write(("<!--" + (node.text) + "-->"), next);
  5210. } else {
  5211. write(node.raw ? node.text : he.escape(String(node.text)), next);
  5212. }
  5213. }
  5214. }
  5215. function renderComponent (node, isRoot, context) {
  5216. var prevActive = context.activeInstance;
  5217. var child = context.activeInstance = createComponentInstanceForVnode(node, context.activeInstance);
  5218. normalizeRender(child);
  5219. var childNode = child._render();
  5220. childNode.parent = node;
  5221. context.renderStates.push({
  5222. type: 'Component',
  5223. prevActive: prevActive
  5224. });
  5225. renderNode(childNode, isRoot, context);
  5226. }
  5227. function renderComponentWithCache (node, isRoot, key, context) {
  5228. var write = context.write;
  5229. write.caching = true;
  5230. var buffer = write.cacheBuffer;
  5231. var bufferIndex = buffer.push('') - 1;
  5232. context.renderStates.push({
  5233. type: 'ComponentWithCache',
  5234. buffer: buffer, bufferIndex: bufferIndex, key: key
  5235. });
  5236. renderComponent(node, isRoot, context);
  5237. }
  5238. function renderElement (el, isRoot, context) {
  5239. if (isRoot) {
  5240. if (!el.data) { el.data = {}; }
  5241. if (!el.data.attrs) { el.data.attrs = {}; }
  5242. el.data.attrs['server-rendered'] = 'true';
  5243. }
  5244. var startTag = renderStartingTag(el, context);
  5245. var endTag = "</" + (el.tag) + ">";
  5246. var write = context.write;
  5247. var next = context.next;
  5248. if (context.isUnaryTag(el.tag)) {
  5249. write(startTag, next);
  5250. } else if (!el.children || !el.children.length) {
  5251. write(startTag + endTag, next);
  5252. } else {
  5253. var children = el.children;
  5254. context.renderStates.push({
  5255. type: 'Element',
  5256. rendered: 0,
  5257. total: children.length,
  5258. endTag: endTag, children: children
  5259. });
  5260. write(startTag, next);
  5261. }
  5262. }
  5263. function hasAncestorData (node) {
  5264. var parentNode = node.parent;
  5265. return parentNode && (parentNode.data || hasAncestorData(parentNode))
  5266. }
  5267. function renderStartingTag (node, context) {
  5268. var markup = "<" + (node.tag);
  5269. var directives = context.directives;
  5270. var modules = context.modules;
  5271. // construct synthetic data for module processing
  5272. // because modules like style also produce code by parent VNode data
  5273. if (!node.data && hasAncestorData(node)) {
  5274. node.data = {};
  5275. }
  5276. if (node.data) {
  5277. // check directives
  5278. var dirs = node.data.directives;
  5279. if (dirs) {
  5280. for (var i = 0; i < dirs.length; i++) {
  5281. var dirRenderer = directives[dirs[i].name];
  5282. if (dirRenderer) {
  5283. // directives mutate the node's data
  5284. // which then gets rendered by modules
  5285. dirRenderer(node, dirs[i]);
  5286. }
  5287. }
  5288. }
  5289. // apply other modules
  5290. for (var i$1 = 0; i$1 < modules.length; i$1++) {
  5291. var res = modules[i$1](node);
  5292. if (res) {
  5293. markup += res;
  5294. }
  5295. }
  5296. }
  5297. // attach scoped CSS ID
  5298. var scopeId;
  5299. var activeInstance = context.activeInstance;
  5300. if (activeInstance &&
  5301. activeInstance !== node.context &&
  5302. (scopeId = activeInstance.$options._scopeId)) {
  5303. markup += " " + scopeId;
  5304. }
  5305. while (node) {
  5306. if ((scopeId = node.context.$options._scopeId)) {
  5307. markup += " " + scopeId;
  5308. }
  5309. node = node.parent;
  5310. }
  5311. return markup + '>'
  5312. }
  5313. var nextFactory = function (context) { return function next () {
  5314. var lastState = context.renderStates.pop();
  5315. if (!lastState) {
  5316. context.done();
  5317. // cleanup context, avoid leakage
  5318. context = (null);
  5319. return
  5320. }
  5321. switch (lastState.type) {
  5322. case 'Component':
  5323. context.activeInstance = lastState.prevActive;
  5324. next();
  5325. break
  5326. case 'Element':
  5327. var children = lastState.children;
  5328. var total = lastState.total;
  5329. var rendered = lastState.rendered++;
  5330. if (rendered < total) {
  5331. context.renderStates.push(lastState);
  5332. renderNode(children[rendered], false, context);
  5333. } else {
  5334. context.write(lastState.endTag, next);
  5335. }
  5336. break
  5337. case 'ComponentWithCache':
  5338. var buffer = lastState.buffer;
  5339. var bufferIndex = lastState.bufferIndex;
  5340. var key = lastState.key;
  5341. var result = buffer[bufferIndex];
  5342. context.cache.set(key, result);
  5343. if (bufferIndex === 0) {
  5344. // this is a top-level cached component,
  5345. // exit caching mode.
  5346. context.write.caching = false;
  5347. } else {
  5348. // parent component is also being cached,
  5349. // merge self into parent's result
  5350. buffer[bufferIndex - 1] += result;
  5351. }
  5352. buffer.length = bufferIndex;
  5353. next();
  5354. break
  5355. }
  5356. }; };
  5357. function createRenderFunction (
  5358. modules,
  5359. directives,
  5360. isUnaryTag,
  5361. cache
  5362. ) {
  5363. if (cache && (!cache.get || !cache.set)) {
  5364. throw new Error('renderer cache must implement at least get & set.')
  5365. }
  5366. var get = cache && normalizeAsync(cache, 'get');
  5367. var has = cache && normalizeAsync(cache, 'has');
  5368. return function render (
  5369. component,
  5370. write,
  5371. done
  5372. ) {
  5373. warned = Object.create(null);
  5374. var context = {
  5375. activeInstance: component,
  5376. renderStates: [],
  5377. next: noop, // for flow
  5378. write: write, done: done,
  5379. isUnaryTag: isUnaryTag, modules: modules, directives: directives,
  5380. cache: cache, get: get, has: has
  5381. };
  5382. context.next = nextFactory(context);
  5383. normalizeRender(component);
  5384. renderNode(component._render(), true, context);
  5385. }
  5386. }
  5387. /* */
  5388. function createRenderer$1 (ref) {
  5389. if ( ref === void 0 ) ref = {};
  5390. var modules = ref.modules; if ( modules === void 0 ) modules = [];
  5391. var directives = ref.directives; if ( directives === void 0 ) directives = {};
  5392. var isUnaryTag = ref.isUnaryTag; if ( isUnaryTag === void 0 ) isUnaryTag = (function () { return false; });
  5393. var cache = ref.cache;
  5394. if (process.env.VUE_ENV !== 'server') {
  5395. warn(
  5396. 'You are using createRenderer without setting VUE_ENV environment variable to "server". ' +
  5397. 'It is recommended to set VUE_ENV=server this will help rendering performance, ' +
  5398. 'by turning data observation off.'
  5399. );
  5400. }
  5401. var render = createRenderFunction(modules, directives, isUnaryTag, cache);
  5402. return {
  5403. renderToString: function renderToString (
  5404. component,
  5405. done
  5406. ) {
  5407. var result = '';
  5408. var write = createWriteFunction(function (text) {
  5409. result += text;
  5410. }, done);
  5411. try {
  5412. render(component, write, function () {
  5413. done(null, result);
  5414. });
  5415. } catch (e) {
  5416. done(e);
  5417. }
  5418. },
  5419. renderToStream: function renderToStream (component) {
  5420. return new RenderStream(function (write, done) {
  5421. render(component, write, done);
  5422. })
  5423. }
  5424. }
  5425. }
  5426. function createContext (context) {
  5427. var sandbox = {
  5428. Buffer: Buffer,
  5429. clearImmediate: clearImmediate,
  5430. clearInterval: clearInterval,
  5431. clearTimeout: clearTimeout,
  5432. setImmediate: setImmediate,
  5433. setInterval: setInterval,
  5434. setTimeout: setTimeout,
  5435. console: console,
  5436. process: process,
  5437. __VUE_SSR_CONTEXT__: context
  5438. };
  5439. sandbox.global = sandbox;
  5440. return sandbox
  5441. }
  5442. function runInVm (code, _context) {
  5443. if ( _context === void 0 ) _context = {};
  5444. return new Promise(function (resolve, reject) {
  5445. var wrapper = NativeModule.wrap(code);
  5446. var context = createContext(_context);
  5447. var compiledWrapper = vm.runInNewContext(wrapper, context, {
  5448. filename: '__vue_ssr_bundle__',
  5449. displayErrors: true
  5450. });
  5451. var m = { exports: {}};
  5452. compiledWrapper.call(m.exports, m.exports, require, m);
  5453. var res = Object.prototype.hasOwnProperty.call(m.exports, 'default')
  5454. ? m.exports.default
  5455. : m.exports;
  5456. resolve(typeof res === 'function' ? res(_context) : res);
  5457. })
  5458. }
  5459. function createBundleRendererCreator (createRenderer) {
  5460. return function (code, rendererOptions) {
  5461. var renderer = createRenderer(rendererOptions);
  5462. return {
  5463. renderToString: function (context, cb) {
  5464. if (typeof context === 'function') {
  5465. cb = context;
  5466. context = {};
  5467. }
  5468. runInVm(code, context).then(function (app) {
  5469. renderer.renderToString(app, cb);
  5470. }).catch(cb);
  5471. },
  5472. renderToStream: function (context) {
  5473. var res = new stream.PassThrough();
  5474. runInVm(code, context).then(function (app) {
  5475. var renderStream = renderer.renderToStream(app);
  5476. renderStream.on('error', function (err) {
  5477. res.emit('error', err);
  5478. });
  5479. renderStream.pipe(res);
  5480. }).catch(function (err) {
  5481. process.nextTick(function () {
  5482. res.emit('error', err);
  5483. });
  5484. });
  5485. return res
  5486. }
  5487. }
  5488. }
  5489. }
  5490. /* */
  5491. function renderAttrs (node) {
  5492. var attrs = node.data.attrs;
  5493. var res = '';
  5494. var parent = node.parent;
  5495. while (parent) {
  5496. if (parent.data && parent.data.attrs) {
  5497. attrs = Object.assign({}, attrs, parent.data.attrs);
  5498. }
  5499. parent = parent.parent;
  5500. }
  5501. if (!attrs) {
  5502. return res
  5503. }
  5504. for (var key in attrs) {
  5505. if (key === 'style') {
  5506. // leave it to the style module
  5507. continue
  5508. }
  5509. res += renderAttr(key, attrs[key]);
  5510. }
  5511. return res
  5512. }
  5513. function renderAttr (key, value) {
  5514. if (isBooleanAttr(key)) {
  5515. if (!isFalsyAttrValue(value)) {
  5516. return (" " + key + "=\"" + key + "\"")
  5517. }
  5518. } else if (isEnumeratedAttr(key)) {
  5519. return (" " + key + "=\"" + (isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true') + "\"")
  5520. } else if (!isFalsyAttrValue(value)) {
  5521. return (" " + key + "=\"" + value + "\"")
  5522. }
  5523. return ''
  5524. }
  5525. /* */
  5526. function renderDOMProps (node) {
  5527. var props = node.data.domProps;
  5528. var res = '';
  5529. var parent = node.parent;
  5530. while (parent) {
  5531. if (parent.data && parent.data.domProps) {
  5532. props = Object.assign({}, props, parent.data.domProps);
  5533. }
  5534. parent = parent.parent;
  5535. }
  5536. if (!props) {
  5537. return res
  5538. }
  5539. for (var key in props) {
  5540. if (key === 'innerHTML') {
  5541. setText(node, props[key], true);
  5542. } else if (key === 'textContent') {
  5543. setText(node, props[key]);
  5544. } else {
  5545. var attr = propsToAttrMap[key] || key.toLowerCase();
  5546. if (isRenderableAttr(attr)) {
  5547. res += renderAttr(attr, props[key]);
  5548. }
  5549. }
  5550. }
  5551. return res
  5552. }
  5553. function setText (node, text, raw) {
  5554. var child = new VNode(undefined, undefined, undefined, text);
  5555. child.raw = raw;
  5556. node.children = [child];
  5557. }
  5558. /* */
  5559. function renderClass (node) {
  5560. var classList = genClassForVnode(node);
  5561. if (classList) {
  5562. return (" class=\"" + classList + "\"")
  5563. }
  5564. }
  5565. /* */
  5566. function genStyleText (vnode) {
  5567. var styleText = '';
  5568. var style = getStyle(vnode, false);
  5569. for (var key in style) {
  5570. styleText += (hyphenate(key)) + ":" + (style[key]) + ";";
  5571. }
  5572. return styleText.slice(0, -1)
  5573. }
  5574. function renderStyle (vnode) {
  5575. var styleText = genStyleText(vnode);
  5576. if (styleText) {
  5577. return (" style=" + (JSON.stringify(styleText)))
  5578. }
  5579. }
  5580. var modules$1 = [
  5581. renderAttrs,
  5582. renderDOMProps,
  5583. renderClass,
  5584. renderStyle
  5585. ];
  5586. /* */
  5587. function show (node, dir) {
  5588. if (!dir.value) {
  5589. var style = node.data.style || (node.data.style = {});
  5590. style.display = 'none';
  5591. }
  5592. }
  5593. var baseDirectives$1 = {
  5594. show: show
  5595. };
  5596. /* */
  5597. function createRenderer$$1 (options) {
  5598. if ( options === void 0 ) options = {};
  5599. // user can provide server-side implementations for custom directives
  5600. // when creating the renderer.
  5601. var directives = Object.assign(baseDirectives$1, options.directives);
  5602. return createRenderer$1({
  5603. isUnaryTag: isUnaryTag,
  5604. modules: modules$1,
  5605. directives: directives,
  5606. cache: options.cache
  5607. })
  5608. }
  5609. var createBundleRenderer = createBundleRendererCreator(createRenderer$$1);
  5610. exports.createRenderer = createRenderer$$1;
  5611. exports.createBundleRenderer = createBundleRenderer;