vue.runtime.common.js 210 KB

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