vue.runtime.js 168 KB

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