Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vue.runtime.common.js 207KB

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