vue.runtime.js 181 KB

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