vue.runtime.esm.js 190 KB

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