vue.runtime.esm.js 194 KB

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