vue.js 279 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798
  1. /*!
  2. * Vue.js v2.5.13
  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. var emptyObject = Object.freeze({});
  13. // these helpers produces better vm code in JS engines due to their
  14. // explicitness and function inlining
  15. function isUndef (v) {
  16. return v === undefined || v === null
  17. }
  18. function isDef (v) {
  19. return v !== undefined && v !== null
  20. }
  21. function isTrue (v) {
  22. return v === true
  23. }
  24. function isFalse (v) {
  25. return v === false
  26. }
  27. /**
  28. * Check if value is primitive
  29. */
  30. function isPrimitive (value) {
  31. return (
  32. typeof value === 'string' ||
  33. typeof value === 'number' ||
  34. // $flow-disable-line
  35. typeof value === 'symbol' ||
  36. typeof value === 'boolean'
  37. )
  38. }
  39. /**
  40. * Quick object check - this is primarily used to tell
  41. * Objects from primitive values when we know the value
  42. * is a JSON-compliant type.
  43. */
  44. function isObject (obj) {
  45. return obj !== null && typeof obj === 'object'
  46. }
  47. /**
  48. * Get the raw type string of a value e.g. [object Object]
  49. */
  50. var _toString = Object.prototype.toString;
  51. function toRawType (value) {
  52. return _toString.call(value).slice(8, -1)
  53. }
  54. /**
  55. * Strict object type check. Only returns true
  56. * for plain JavaScript objects.
  57. */
  58. function isPlainObject (obj) {
  59. return _toString.call(obj) === '[object Object]'
  60. }
  61. function isRegExp (v) {
  62. return _toString.call(v) === '[object RegExp]'
  63. }
  64. /**
  65. * Check if val is a valid array index.
  66. */
  67. function isValidArrayIndex (val) {
  68. var n = parseFloat(String(val));
  69. return n >= 0 && Math.floor(n) === n && isFinite(val)
  70. }
  71. /**
  72. * Convert a value to a string that is actually rendered.
  73. */
  74. function toString (val) {
  75. return val == null
  76. ? ''
  77. : typeof val === 'object'
  78. ? JSON.stringify(val, null, 2)
  79. : String(val)
  80. }
  81. /**
  82. * Convert a input value to a number for persistence.
  83. * If the conversion fails, return original string.
  84. */
  85. function toNumber (val) {
  86. var n = parseFloat(val);
  87. return isNaN(n) ? val : n
  88. }
  89. /**
  90. * Make a map and return a function for checking if a key
  91. * is in that map.
  92. */
  93. function makeMap (
  94. str,
  95. expectsLowerCase
  96. ) {
  97. var map = Object.create(null);
  98. var list = str.split(',');
  99. for (var i = 0; i < list.length; i++) {
  100. map[list[i]] = true;
  101. }
  102. return expectsLowerCase
  103. ? function (val) { return map[val.toLowerCase()]; }
  104. : function (val) { return map[val]; }
  105. }
  106. /**
  107. * Check if a tag is a built-in tag.
  108. */
  109. var isBuiltInTag = makeMap('slot,component', true);
  110. /**
  111. * Check if a attribute is a reserved attribute.
  112. */
  113. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  114. /**
  115. * Remove an item from an array
  116. */
  117. function remove (arr, item) {
  118. if (arr.length) {
  119. var index = arr.indexOf(item);
  120. if (index > -1) {
  121. return arr.splice(index, 1)
  122. }
  123. }
  124. }
  125. /**
  126. * Check whether the object has the property.
  127. */
  128. var hasOwnProperty = Object.prototype.hasOwnProperty;
  129. function hasOwn (obj, key) {
  130. return hasOwnProperty.call(obj, key)
  131. }
  132. /**
  133. * Create a cached version of a pure function.
  134. */
  135. function cached (fn) {
  136. var cache = Object.create(null);
  137. return (function cachedFn (str) {
  138. var hit = cache[str];
  139. return hit || (cache[str] = fn(str))
  140. })
  141. }
  142. /**
  143. * Camelize a hyphen-delimited string.
  144. */
  145. var camelizeRE = /-(\w)/g;
  146. var camelize = cached(function (str) {
  147. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  148. });
  149. /**
  150. * Capitalize a string.
  151. */
  152. var capitalize = cached(function (str) {
  153. return str.charAt(0).toUpperCase() + str.slice(1)
  154. });
  155. /**
  156. * Hyphenate a camelCase string.
  157. */
  158. var hyphenateRE = /\B([A-Z])/g;
  159. var hyphenate = cached(function (str) {
  160. return str.replace(hyphenateRE, '-$1').toLowerCase()
  161. });
  162. /**
  163. * Simple bind, faster than native
  164. */
  165. function bind (fn, ctx) {
  166. function boundFn (a) {
  167. var l = arguments.length;
  168. return l
  169. ? l > 1
  170. ? fn.apply(ctx, arguments)
  171. : fn.call(ctx, a)
  172. : fn.call(ctx)
  173. }
  174. // record original fn length
  175. boundFn._length = fn.length;
  176. return boundFn
  177. }
  178. /**
  179. * Convert an Array-like object to a real Array.
  180. */
  181. function toArray (list, start) {
  182. start = start || 0;
  183. var i = list.length - start;
  184. var ret = new Array(i);
  185. while (i--) {
  186. ret[i] = list[i + start];
  187. }
  188. return ret
  189. }
  190. /**
  191. * Mix properties into target object.
  192. */
  193. function extend (to, _from) {
  194. for (var key in _from) {
  195. to[key] = _from[key];
  196. }
  197. return to
  198. }
  199. /**
  200. * Merge an Array of Objects into a single Object.
  201. */
  202. function toObject (arr) {
  203. var res = {};
  204. for (var i = 0; i < arr.length; i++) {
  205. if (arr[i]) {
  206. extend(res, arr[i]);
  207. }
  208. }
  209. return res
  210. }
  211. /**
  212. * Perform no operation.
  213. * Stubbing args to make Flow happy without leaving useless transpiled code
  214. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
  215. */
  216. function noop (a, b, c) {}
  217. /**
  218. * Always return false.
  219. */
  220. var no = function (a, b, c) { return false; };
  221. /**
  222. * Return same value
  223. */
  224. var identity = function (_) { return _; };
  225. /**
  226. * Generate a static keys string from compiler modules.
  227. */
  228. function genStaticKeys (modules) {
  229. return modules.reduce(function (keys, m) {
  230. return keys.concat(m.staticKeys || [])
  231. }, []).join(',')
  232. }
  233. /**
  234. * Check if two values are loosely equal - that is,
  235. * if they are plain objects, do they have the same shape?
  236. */
  237. function looseEqual (a, b) {
  238. if (a === b) { return true }
  239. var isObjectA = isObject(a);
  240. var isObjectB = isObject(b);
  241. if (isObjectA && isObjectB) {
  242. try {
  243. var isArrayA = Array.isArray(a);
  244. var isArrayB = Array.isArray(b);
  245. if (isArrayA && isArrayB) {
  246. return a.length === b.length && a.every(function (e, i) {
  247. return looseEqual(e, b[i])
  248. })
  249. } else if (!isArrayA && !isArrayB) {
  250. var keysA = Object.keys(a);
  251. var keysB = Object.keys(b);
  252. return keysA.length === keysB.length && keysA.every(function (key) {
  253. return looseEqual(a[key], b[key])
  254. })
  255. } else {
  256. /* istanbul ignore next */
  257. return false
  258. }
  259. } catch (e) {
  260. /* istanbul ignore next */
  261. return false
  262. }
  263. } else if (!isObjectA && !isObjectB) {
  264. return String(a) === String(b)
  265. } else {
  266. return false
  267. }
  268. }
  269. function looseIndexOf (arr, val) {
  270. for (var i = 0; i < arr.length; i++) {
  271. if (looseEqual(arr[i], val)) { return i }
  272. }
  273. return -1
  274. }
  275. /**
  276. * Ensure a function is called only once.
  277. */
  278. function once (fn) {
  279. var called = false;
  280. return function () {
  281. if (!called) {
  282. called = true;
  283. fn.apply(this, arguments);
  284. }
  285. }
  286. }
  287. var SSR_ATTR = 'data-server-rendered';
  288. var ASSET_TYPES = [
  289. 'component',
  290. 'directive',
  291. 'filter'
  292. ];
  293. var LIFECYCLE_HOOKS = [
  294. 'beforeCreate',
  295. 'created',
  296. 'beforeMount',
  297. 'mounted',
  298. 'beforeUpdate',
  299. 'updated',
  300. 'beforeDestroy',
  301. 'destroyed',
  302. 'activated',
  303. 'deactivated',
  304. 'errorCaptured'
  305. ];
  306. /* */
  307. var config = ({
  308. /**
  309. * Option merge strategies (used in core/util/options)
  310. */
  311. // $flow-disable-line
  312. optionMergeStrategies: Object.create(null),
  313. /**
  314. * Whether to suppress warnings.
  315. */
  316. silent: false,
  317. /**
  318. * Show production mode tip message on boot?
  319. */
  320. productionTip: "development" !== 'production',
  321. /**
  322. * Whether to enable devtools
  323. */
  324. devtools: "development" !== 'production',
  325. /**
  326. * Whether to record perf
  327. */
  328. performance: false,
  329. /**
  330. * Error handler for watcher errors
  331. */
  332. errorHandler: null,
  333. /**
  334. * Warn handler for watcher warns
  335. */
  336. warnHandler: null,
  337. /**
  338. * Ignore certain custom elements
  339. */
  340. ignoredElements: [],
  341. /**
  342. * Custom user key aliases for v-on
  343. */
  344. // $flow-disable-line
  345. keyCodes: Object.create(null),
  346. /**
  347. * Check if a tag is reserved so that it cannot be registered as a
  348. * component. This is platform-dependent and may be overwritten.
  349. */
  350. isReservedTag: no,
  351. /**
  352. * Check if an attribute is reserved so that it cannot be used as a component
  353. * prop. This is platform-dependent and may be overwritten.
  354. */
  355. isReservedAttr: no,
  356. /**
  357. * Check if a tag is an unknown element.
  358. * Platform-dependent.
  359. */
  360. isUnknownElement: no,
  361. /**
  362. * Get the namespace of an element
  363. */
  364. getTagNamespace: noop,
  365. /**
  366. * Parse the real tag name for the specific platform.
  367. */
  368. parsePlatformTagName: identity,
  369. /**
  370. * Check if an attribute must be bound using property, e.g. value
  371. * Platform-dependent.
  372. */
  373. mustUseProp: no,
  374. /**
  375. * Exposed for legacy reasons
  376. */
  377. _lifecycleHooks: LIFECYCLE_HOOKS
  378. });
  379. /* */
  380. /**
  381. * Check if a string starts with $ or _
  382. */
  383. function isReserved (str) {
  384. var c = (str + '').charCodeAt(0);
  385. return c === 0x24 || c === 0x5F
  386. }
  387. /**
  388. * Define a property.
  389. */
  390. function def (obj, key, val, enumerable) {
  391. Object.defineProperty(obj, key, {
  392. value: val,
  393. enumerable: !!enumerable,
  394. writable: true,
  395. configurable: true
  396. });
  397. }
  398. /**
  399. * Parse simple path.
  400. */
  401. var bailRE = /[^\w.$]/;
  402. function parsePath (path) {
  403. if (bailRE.test(path)) {
  404. return
  405. }
  406. var segments = path.split('.');
  407. return function (obj) {
  408. for (var i = 0; i < segments.length; i++) {
  409. if (!obj) { return }
  410. obj = obj[segments[i]];
  411. }
  412. return obj
  413. }
  414. }
  415. /* */
  416. // can we use __proto__?
  417. var hasProto = '__proto__' in {};
  418. // Browser environment sniffing
  419. var inBrowser = typeof window !== 'undefined';
  420. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  421. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  422. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  423. var isIE = UA && /msie|trident/.test(UA);
  424. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  425. var isEdge = UA && UA.indexOf('edge/') > 0;
  426. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  427. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  428. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  429. // Firefox has a "watch" function on Object.prototype...
  430. var nativeWatch = ({}).watch;
  431. var supportsPassive = false;
  432. if (inBrowser) {
  433. try {
  434. var opts = {};
  435. Object.defineProperty(opts, 'passive', ({
  436. get: function get () {
  437. /* istanbul ignore next */
  438. supportsPassive = true;
  439. }
  440. })); // https://github.com/facebook/flow/issues/285
  441. window.addEventListener('test-passive', null, opts);
  442. } catch (e) {}
  443. }
  444. // this needs to be lazy-evaled because vue may be required before
  445. // vue-server-renderer can set VUE_ENV
  446. var _isServer;
  447. var isServerRendering = function () {
  448. if (_isServer === undefined) {
  449. /* istanbul ignore if */
  450. if (!inBrowser && typeof global !== 'undefined') {
  451. // detect presence of vue-server-renderer and avoid
  452. // Webpack shimming the process
  453. _isServer = global['process'].env.VUE_ENV === 'server';
  454. } else {
  455. _isServer = false;
  456. }
  457. }
  458. return _isServer
  459. };
  460. // detect devtools
  461. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  462. /* istanbul ignore next */
  463. function isNative (Ctor) {
  464. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  465. }
  466. var hasSymbol =
  467. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  468. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  469. var _Set;
  470. /* istanbul ignore if */ // $flow-disable-line
  471. if (typeof Set !== 'undefined' && isNative(Set)) {
  472. // use native Set when available.
  473. _Set = Set;
  474. } else {
  475. // a non-standard Set polyfill that only works with primitive keys.
  476. _Set = (function () {
  477. function Set () {
  478. this.set = Object.create(null);
  479. }
  480. Set.prototype.has = function has (key) {
  481. return this.set[key] === true
  482. };
  483. Set.prototype.add = function add (key) {
  484. this.set[key] = true;
  485. };
  486. Set.prototype.clear = function clear () {
  487. this.set = Object.create(null);
  488. };
  489. return Set;
  490. }());
  491. }
  492. /* */
  493. var warn = noop;
  494. var tip = noop;
  495. var generateComponentTrace = (noop); // work around flow check
  496. var formatComponentName = (noop);
  497. {
  498. var hasConsole = typeof console !== 'undefined';
  499. var classifyRE = /(?:^|[-_])(\w)/g;
  500. var classify = function (str) { return str
  501. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  502. .replace(/[-_]/g, ''); };
  503. warn = function (msg, vm) {
  504. var trace = vm ? generateComponentTrace(vm) : '';
  505. if (config.warnHandler) {
  506. config.warnHandler.call(null, msg, vm, trace);
  507. } else if (hasConsole && (!config.silent)) {
  508. console.error(("[Vue warn]: " + msg + trace));
  509. }
  510. };
  511. tip = function (msg, vm) {
  512. if (hasConsole && (!config.silent)) {
  513. console.warn("[Vue tip]: " + msg + (
  514. vm ? generateComponentTrace(vm) : ''
  515. ));
  516. }
  517. };
  518. formatComponentName = function (vm, includeFile) {
  519. if (vm.$root === vm) {
  520. return '<Root>'
  521. }
  522. var options = typeof vm === 'function' && vm.cid != null
  523. ? vm.options
  524. : vm._isVue
  525. ? vm.$options || vm.constructor.options
  526. : vm || {};
  527. var name = options.name || options._componentTag;
  528. var file = options.__file;
  529. if (!name && file) {
  530. var match = file.match(/([^/\\]+)\.vue$/);
  531. name = match && match[1];
  532. }
  533. return (
  534. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  535. (file && includeFile !== false ? (" at " + file) : '')
  536. )
  537. };
  538. var repeat = function (str, n) {
  539. var res = '';
  540. while (n) {
  541. if (n % 2 === 1) { res += str; }
  542. if (n > 1) { str += str; }
  543. n >>= 1;
  544. }
  545. return res
  546. };
  547. generateComponentTrace = function (vm) {
  548. if (vm._isVue && vm.$parent) {
  549. var tree = [];
  550. var currentRecursiveSequence = 0;
  551. while (vm) {
  552. if (tree.length > 0) {
  553. var last = tree[tree.length - 1];
  554. if (last.constructor === vm.constructor) {
  555. currentRecursiveSequence++;
  556. vm = vm.$parent;
  557. continue
  558. } else if (currentRecursiveSequence > 0) {
  559. tree[tree.length - 1] = [last, currentRecursiveSequence];
  560. currentRecursiveSequence = 0;
  561. }
  562. }
  563. tree.push(vm);
  564. vm = vm.$parent;
  565. }
  566. return '\n\nfound in\n\n' + tree
  567. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  568. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  569. : formatComponentName(vm))); })
  570. .join('\n')
  571. } else {
  572. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  573. }
  574. };
  575. }
  576. /* */
  577. var uid = 0;
  578. /**
  579. * A dep is an observable that can have multiple
  580. * directives subscribing to it.
  581. */
  582. var Dep = function Dep () {
  583. this.id = uid++;
  584. this.subs = [];
  585. };
  586. Dep.prototype.addSub = function addSub (sub) {
  587. this.subs.push(sub);
  588. };
  589. Dep.prototype.removeSub = function removeSub (sub) {
  590. remove(this.subs, sub);
  591. };
  592. Dep.prototype.depend = function depend () {
  593. if (Dep.target) {
  594. Dep.target.addDep(this);
  595. }
  596. };
  597. Dep.prototype.notify = function notify () {
  598. // stabilize the subscriber list first
  599. var subs = this.subs.slice();
  600. for (var i = 0, l = subs.length; i < l; i++) {
  601. subs[i].update();
  602. }
  603. };
  604. // the current target watcher being evaluated.
  605. // this is globally unique because there could be only one
  606. // watcher being evaluated at any time.
  607. Dep.target = null;
  608. var targetStack = [];
  609. function pushTarget (_target) {
  610. if (Dep.target) { targetStack.push(Dep.target); }
  611. Dep.target = _target;
  612. }
  613. function popTarget () {
  614. Dep.target = targetStack.pop();
  615. }
  616. /* */
  617. var VNode = function VNode (
  618. tag,
  619. data,
  620. children,
  621. text,
  622. elm,
  623. context,
  624. componentOptions,
  625. asyncFactory
  626. ) {
  627. this.tag = tag;
  628. this.data = data;
  629. this.children = children;
  630. this.text = text;
  631. this.elm = elm;
  632. this.ns = undefined;
  633. this.context = context;
  634. this.fnContext = undefined;
  635. this.fnOptions = undefined;
  636. this.fnScopeId = undefined;
  637. this.key = data && data.key;
  638. this.componentOptions = componentOptions;
  639. this.componentInstance = undefined;
  640. this.parent = undefined;
  641. this.raw = false;
  642. this.isStatic = false;
  643. this.isRootInsert = true;
  644. this.isComment = false;
  645. this.isCloned = false;
  646. this.isOnce = false;
  647. this.asyncFactory = asyncFactory;
  648. this.asyncMeta = undefined;
  649. this.isAsyncPlaceholder = false;
  650. };
  651. var prototypeAccessors = { child: { configurable: true } };
  652. // DEPRECATED: alias for componentInstance for backwards compat.
  653. /* istanbul ignore next */
  654. prototypeAccessors.child.get = function () {
  655. return this.componentInstance
  656. };
  657. Object.defineProperties( VNode.prototype, prototypeAccessors );
  658. var createEmptyVNode = function (text) {
  659. if ( text === void 0 ) text = '';
  660. var node = new VNode();
  661. node.text = text;
  662. node.isComment = true;
  663. return node
  664. };
  665. function createTextVNode (val) {
  666. return new VNode(undefined, undefined, undefined, String(val))
  667. }
  668. // optimized shallow clone
  669. // used for static nodes and slot nodes because they may be reused across
  670. // multiple renders, cloning them avoids errors when DOM manipulations rely
  671. // on their elm reference.
  672. function cloneVNode (vnode, deep) {
  673. var componentOptions = vnode.componentOptions;
  674. var cloned = new VNode(
  675. vnode.tag,
  676. vnode.data,
  677. vnode.children,
  678. vnode.text,
  679. vnode.elm,
  680. vnode.context,
  681. componentOptions,
  682. vnode.asyncFactory
  683. );
  684. cloned.ns = vnode.ns;
  685. cloned.isStatic = vnode.isStatic;
  686. cloned.key = vnode.key;
  687. cloned.isComment = vnode.isComment;
  688. cloned.fnContext = vnode.fnContext;
  689. cloned.fnOptions = vnode.fnOptions;
  690. cloned.fnScopeId = vnode.fnScopeId;
  691. cloned.isCloned = true;
  692. if (deep) {
  693. if (vnode.children) {
  694. cloned.children = cloneVNodes(vnode.children, true);
  695. }
  696. if (componentOptions && componentOptions.children) {
  697. componentOptions.children = cloneVNodes(componentOptions.children, true);
  698. }
  699. }
  700. return cloned
  701. }
  702. function cloneVNodes (vnodes, deep) {
  703. var len = vnodes.length;
  704. var res = new Array(len);
  705. for (var i = 0; i < len; i++) {
  706. res[i] = cloneVNode(vnodes[i], deep);
  707. }
  708. return res
  709. }
  710. /*
  711. * not type checking this file because flow doesn't play well with
  712. * dynamically accessing methods on Array prototype
  713. */
  714. var arrayProto = Array.prototype;
  715. var arrayMethods = Object.create(arrayProto);[
  716. 'push',
  717. 'pop',
  718. 'shift',
  719. 'unshift',
  720. 'splice',
  721. 'sort',
  722. 'reverse'
  723. ].forEach(function (method) {
  724. // cache original method
  725. var original = arrayProto[method];
  726. def(arrayMethods, method, function mutator () {
  727. var args = [], len = arguments.length;
  728. while ( len-- ) args[ len ] = arguments[ len ];
  729. var result = original.apply(this, args);
  730. var ob = this.__ob__;
  731. var inserted;
  732. switch (method) {
  733. case 'push':
  734. case 'unshift':
  735. inserted = args;
  736. break
  737. case 'splice':
  738. inserted = args.slice(2);
  739. break
  740. }
  741. if (inserted) { ob.observeArray(inserted); }
  742. // notify change
  743. ob.dep.notify();
  744. return result
  745. });
  746. });
  747. /* */
  748. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  749. /**
  750. * By default, when a reactive property is set, the new value is
  751. * also converted to become reactive. However when passing down props,
  752. * we don't want to force conversion because the value may be a nested value
  753. * under a frozen data structure. Converting it would defeat the optimization.
  754. */
  755. var observerState = {
  756. shouldConvert: true
  757. };
  758. /**
  759. * Observer class that are attached to each observed
  760. * object. Once attached, the observer converts target
  761. * object's property keys into getter/setters that
  762. * collect dependencies and dispatches updates.
  763. */
  764. var Observer = function Observer (value) {
  765. this.value = value;
  766. this.dep = new Dep();
  767. this.vmCount = 0;
  768. def(value, '__ob__', this);
  769. if (Array.isArray(value)) {
  770. var augment = hasProto
  771. ? protoAugment
  772. : copyAugment;
  773. augment(value, arrayMethods, arrayKeys);
  774. this.observeArray(value);
  775. } else {
  776. this.walk(value);
  777. }
  778. };
  779. /**
  780. * Walk through each property and convert them into
  781. * getter/setters. This method should only be called when
  782. * value type is Object.
  783. */
  784. Observer.prototype.walk = function walk (obj) {
  785. var keys = Object.keys(obj);
  786. for (var i = 0; i < keys.length; i++) {
  787. defineReactive(obj, keys[i], obj[keys[i]]);
  788. }
  789. };
  790. /**
  791. * Observe a list of Array items.
  792. */
  793. Observer.prototype.observeArray = function observeArray (items) {
  794. for (var i = 0, l = items.length; i < l; i++) {
  795. observe(items[i]);
  796. }
  797. };
  798. // helpers
  799. /**
  800. * Augment an target Object or Array by intercepting
  801. * the prototype chain using __proto__
  802. */
  803. function protoAugment (target, src, keys) {
  804. /* eslint-disable no-proto */
  805. target.__proto__ = src;
  806. /* eslint-enable no-proto */
  807. }
  808. /**
  809. * Augment an target Object or Array by defining
  810. * hidden properties.
  811. */
  812. /* istanbul ignore next */
  813. function copyAugment (target, src, keys) {
  814. for (var i = 0, l = keys.length; i < l; i++) {
  815. var key = keys[i];
  816. def(target, key, src[key]);
  817. }
  818. }
  819. /**
  820. * Attempt to create an observer instance for a value,
  821. * returns the new observer if successfully observed,
  822. * or the existing observer if the value already has one.
  823. */
  824. function observe (value, asRootData) {
  825. if (!isObject(value) || value instanceof VNode) {
  826. return
  827. }
  828. var ob;
  829. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  830. ob = value.__ob__;
  831. } else if (
  832. observerState.shouldConvert &&
  833. !isServerRendering() &&
  834. (Array.isArray(value) || isPlainObject(value)) &&
  835. Object.isExtensible(value) &&
  836. !value._isVue
  837. ) {
  838. ob = new Observer(value);
  839. }
  840. if (asRootData && ob) {
  841. ob.vmCount++;
  842. }
  843. return ob
  844. }
  845. /**
  846. * Define a reactive property on an Object.
  847. */
  848. function defineReactive (
  849. obj,
  850. key,
  851. val,
  852. customSetter,
  853. shallow
  854. ) {
  855. var dep = new Dep();
  856. var property = Object.getOwnPropertyDescriptor(obj, key);
  857. if (property && property.configurable === false) {
  858. return
  859. }
  860. // cater for pre-defined getter/setters
  861. var getter = property && property.get;
  862. var setter = property && property.set;
  863. var childOb = !shallow && observe(val);
  864. Object.defineProperty(obj, key, {
  865. enumerable: true,
  866. configurable: true,
  867. get: function reactiveGetter () {
  868. var value = getter ? getter.call(obj) : val;
  869. if (Dep.target) {
  870. dep.depend();
  871. if (childOb) {
  872. childOb.dep.depend();
  873. if (Array.isArray(value)) {
  874. dependArray(value);
  875. }
  876. }
  877. }
  878. return value
  879. },
  880. set: function reactiveSetter (newVal) {
  881. var value = getter ? getter.call(obj) : val;
  882. /* eslint-disable no-self-compare */
  883. if (newVal === value || (newVal !== newVal && value !== value)) {
  884. return
  885. }
  886. /* eslint-enable no-self-compare */
  887. if ("development" !== 'production' && customSetter) {
  888. customSetter();
  889. }
  890. if (setter) {
  891. setter.call(obj, newVal);
  892. } else {
  893. val = newVal;
  894. }
  895. childOb = !shallow && observe(newVal);
  896. dep.notify();
  897. }
  898. });
  899. }
  900. /**
  901. * Set a property on an object. Adds the new property and
  902. * triggers change notification if the property doesn't
  903. * already exist.
  904. */
  905. function set (target, key, val) {
  906. if (Array.isArray(target) && isValidArrayIndex(key)) {
  907. target.length = Math.max(target.length, key);
  908. target.splice(key, 1, val);
  909. return val
  910. }
  911. if (key in target && !(key in Object.prototype)) {
  912. target[key] = val;
  913. return val
  914. }
  915. var ob = (target).__ob__;
  916. if (target._isVue || (ob && ob.vmCount)) {
  917. "development" !== 'production' && warn(
  918. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  919. 'at runtime - declare it upfront in the data option.'
  920. );
  921. return val
  922. }
  923. if (!ob) {
  924. target[key] = val;
  925. return val
  926. }
  927. defineReactive(ob.value, key, val);
  928. ob.dep.notify();
  929. return val
  930. }
  931. /**
  932. * Delete a property and trigger change if necessary.
  933. */
  934. function del (target, key) {
  935. if (Array.isArray(target) && isValidArrayIndex(key)) {
  936. target.splice(key, 1);
  937. return
  938. }
  939. var ob = (target).__ob__;
  940. if (target._isVue || (ob && ob.vmCount)) {
  941. "development" !== 'production' && warn(
  942. 'Avoid deleting properties on a Vue instance or its root $data ' +
  943. '- just set it to null.'
  944. );
  945. return
  946. }
  947. if (!hasOwn(target, key)) {
  948. return
  949. }
  950. delete target[key];
  951. if (!ob) {
  952. return
  953. }
  954. ob.dep.notify();
  955. }
  956. /**
  957. * Collect dependencies on array elements when the array is touched, since
  958. * we cannot intercept array element access like property getters.
  959. */
  960. function dependArray (value) {
  961. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  962. e = value[i];
  963. e && e.__ob__ && e.__ob__.dep.depend();
  964. if (Array.isArray(e)) {
  965. dependArray(e);
  966. }
  967. }
  968. }
  969. /* */
  970. /**
  971. * Option overwriting strategies are functions that handle
  972. * how to merge a parent option value and a child option
  973. * value into the final value.
  974. */
  975. var strats = config.optionMergeStrategies;
  976. /**
  977. * Options with restrictions
  978. */
  979. {
  980. strats.el = strats.propsData = function (parent, child, vm, key) {
  981. if (!vm) {
  982. warn(
  983. "option \"" + key + "\" can only be used during instance " +
  984. 'creation with the `new` keyword.'
  985. );
  986. }
  987. return defaultStrat(parent, child)
  988. };
  989. }
  990. /**
  991. * Helper that recursively merges two data objects together.
  992. */
  993. function mergeData (to, from) {
  994. if (!from) { return to }
  995. var key, toVal, fromVal;
  996. var keys = Object.keys(from);
  997. for (var i = 0; i < keys.length; i++) {
  998. key = keys[i];
  999. toVal = to[key];
  1000. fromVal = from[key];
  1001. if (!hasOwn(to, key)) {
  1002. set(to, key, fromVal);
  1003. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  1004. mergeData(toVal, fromVal);
  1005. }
  1006. }
  1007. return to
  1008. }
  1009. /**
  1010. * Data
  1011. */
  1012. function mergeDataOrFn (
  1013. parentVal,
  1014. childVal,
  1015. vm
  1016. ) {
  1017. if (!vm) {
  1018. // in a Vue.extend merge, both should be functions
  1019. if (!childVal) {
  1020. return parentVal
  1021. }
  1022. if (!parentVal) {
  1023. return childVal
  1024. }
  1025. // when parentVal & childVal are both present,
  1026. // we need to return a function that returns the
  1027. // merged result of both functions... no need to
  1028. // check if parentVal is a function here because
  1029. // it has to be a function to pass previous merges.
  1030. return function mergedDataFn () {
  1031. return mergeData(
  1032. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1033. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1034. )
  1035. }
  1036. } else {
  1037. return function mergedInstanceDataFn () {
  1038. // instance merge
  1039. var instanceData = typeof childVal === 'function'
  1040. ? childVal.call(vm, vm)
  1041. : childVal;
  1042. var defaultData = typeof parentVal === 'function'
  1043. ? parentVal.call(vm, vm)
  1044. : parentVal;
  1045. if (instanceData) {
  1046. return mergeData(instanceData, defaultData)
  1047. } else {
  1048. return defaultData
  1049. }
  1050. }
  1051. }
  1052. }
  1053. strats.data = function (
  1054. parentVal,
  1055. childVal,
  1056. vm
  1057. ) {
  1058. if (!vm) {
  1059. if (childVal && typeof childVal !== 'function') {
  1060. "development" !== 'production' && warn(
  1061. 'The "data" option should be a function ' +
  1062. 'that returns a per-instance value in component ' +
  1063. 'definitions.',
  1064. vm
  1065. );
  1066. return parentVal
  1067. }
  1068. return mergeDataOrFn(parentVal, childVal)
  1069. }
  1070. return mergeDataOrFn(parentVal, childVal, vm)
  1071. };
  1072. /**
  1073. * Hooks and props are merged as arrays.
  1074. */
  1075. function mergeHook (
  1076. parentVal,
  1077. childVal
  1078. ) {
  1079. return childVal
  1080. ? parentVal
  1081. ? parentVal.concat(childVal)
  1082. : Array.isArray(childVal)
  1083. ? childVal
  1084. : [childVal]
  1085. : parentVal
  1086. }
  1087. LIFECYCLE_HOOKS.forEach(function (hook) {
  1088. strats[hook] = mergeHook;
  1089. });
  1090. /**
  1091. * Assets
  1092. *
  1093. * When a vm is present (instance creation), we need to do
  1094. * a three-way merge between constructor options, instance
  1095. * options and parent options.
  1096. */
  1097. function mergeAssets (
  1098. parentVal,
  1099. childVal,
  1100. vm,
  1101. key
  1102. ) {
  1103. var res = Object.create(parentVal || null);
  1104. if (childVal) {
  1105. "development" !== 'production' && assertObjectType(key, childVal, vm);
  1106. return extend(res, childVal)
  1107. } else {
  1108. return res
  1109. }
  1110. }
  1111. ASSET_TYPES.forEach(function (type) {
  1112. strats[type + 's'] = mergeAssets;
  1113. });
  1114. /**
  1115. * Watchers.
  1116. *
  1117. * Watchers hashes should not overwrite one
  1118. * another, so we merge them as arrays.
  1119. */
  1120. strats.watch = function (
  1121. parentVal,
  1122. childVal,
  1123. vm,
  1124. key
  1125. ) {
  1126. // work around Firefox's Object.prototype.watch...
  1127. if (parentVal === nativeWatch) { parentVal = undefined; }
  1128. if (childVal === nativeWatch) { childVal = undefined; }
  1129. /* istanbul ignore if */
  1130. if (!childVal) { return Object.create(parentVal || null) }
  1131. {
  1132. assertObjectType(key, childVal, vm);
  1133. }
  1134. if (!parentVal) { return childVal }
  1135. var ret = {};
  1136. extend(ret, parentVal);
  1137. for (var key$1 in childVal) {
  1138. var parent = ret[key$1];
  1139. var child = childVal[key$1];
  1140. if (parent && !Array.isArray(parent)) {
  1141. parent = [parent];
  1142. }
  1143. ret[key$1] = parent
  1144. ? parent.concat(child)
  1145. : Array.isArray(child) ? child : [child];
  1146. }
  1147. return ret
  1148. };
  1149. /**
  1150. * Other object hashes.
  1151. */
  1152. strats.props =
  1153. strats.methods =
  1154. strats.inject =
  1155. strats.computed = function (
  1156. parentVal,
  1157. childVal,
  1158. vm,
  1159. key
  1160. ) {
  1161. if (childVal && "development" !== 'production') {
  1162. assertObjectType(key, childVal, vm);
  1163. }
  1164. if (!parentVal) { return childVal }
  1165. var ret = Object.create(null);
  1166. extend(ret, parentVal);
  1167. if (childVal) { extend(ret, childVal); }
  1168. return ret
  1169. };
  1170. strats.provide = mergeDataOrFn;
  1171. /**
  1172. * Default strategy.
  1173. */
  1174. var defaultStrat = function (parentVal, childVal) {
  1175. return childVal === undefined
  1176. ? parentVal
  1177. : childVal
  1178. };
  1179. /**
  1180. * Validate component names
  1181. */
  1182. function checkComponents (options) {
  1183. for (var key in options.components) {
  1184. validateComponentName(key);
  1185. }
  1186. }
  1187. function validateComponentName (name) {
  1188. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  1189. warn(
  1190. 'Invalid component name: "' + name + '". Component names ' +
  1191. 'can only contain alphanumeric characters and the hyphen, ' +
  1192. 'and must start with a letter.'
  1193. );
  1194. }
  1195. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1196. warn(
  1197. 'Do not use built-in or reserved HTML elements as component ' +
  1198. 'id: ' + name
  1199. );
  1200. }
  1201. }
  1202. /**
  1203. * Ensure all props option syntax are normalized into the
  1204. * Object-based format.
  1205. */
  1206. function normalizeProps (options, vm) {
  1207. var props = options.props;
  1208. if (!props) { return }
  1209. var res = {};
  1210. var i, val, name;
  1211. if (Array.isArray(props)) {
  1212. i = props.length;
  1213. while (i--) {
  1214. val = props[i];
  1215. if (typeof val === 'string') {
  1216. name = camelize(val);
  1217. res[name] = { type: null };
  1218. } else {
  1219. warn('props must be strings when using array syntax.');
  1220. }
  1221. }
  1222. } else if (isPlainObject(props)) {
  1223. for (var key in props) {
  1224. val = props[key];
  1225. name = camelize(key);
  1226. res[name] = isPlainObject(val)
  1227. ? val
  1228. : { type: val };
  1229. }
  1230. } else {
  1231. warn(
  1232. "Invalid value for option \"props\": expected an Array or an Object, " +
  1233. "but got " + (toRawType(props)) + ".",
  1234. vm
  1235. );
  1236. }
  1237. options.props = res;
  1238. }
  1239. /**
  1240. * Normalize all injections into Object-based format
  1241. */
  1242. function normalizeInject (options, vm) {
  1243. var inject = options.inject;
  1244. if (!inject) { return }
  1245. var normalized = options.inject = {};
  1246. if (Array.isArray(inject)) {
  1247. for (var i = 0; i < inject.length; i++) {
  1248. normalized[inject[i]] = { from: inject[i] };
  1249. }
  1250. } else if (isPlainObject(inject)) {
  1251. for (var key in inject) {
  1252. var val = inject[key];
  1253. normalized[key] = isPlainObject(val)
  1254. ? extend({ from: key }, val)
  1255. : { from: val };
  1256. }
  1257. } else {
  1258. warn(
  1259. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1260. "but got " + (toRawType(inject)) + ".",
  1261. vm
  1262. );
  1263. }
  1264. }
  1265. /**
  1266. * Normalize raw function directives into object format.
  1267. */
  1268. function normalizeDirectives (options) {
  1269. var dirs = options.directives;
  1270. if (dirs) {
  1271. for (var key in dirs) {
  1272. var def = dirs[key];
  1273. if (typeof def === 'function') {
  1274. dirs[key] = { bind: def, update: def };
  1275. }
  1276. }
  1277. }
  1278. }
  1279. function assertObjectType (name, value, vm) {
  1280. if (!isPlainObject(value)) {
  1281. warn(
  1282. "Invalid value for option \"" + name + "\": expected an Object, " +
  1283. "but got " + (toRawType(value)) + ".",
  1284. vm
  1285. );
  1286. }
  1287. }
  1288. /**
  1289. * Merge two option objects into a new one.
  1290. * Core utility used in both instantiation and inheritance.
  1291. */
  1292. function mergeOptions (
  1293. parent,
  1294. child,
  1295. vm
  1296. ) {
  1297. {
  1298. checkComponents(child);
  1299. }
  1300. if (typeof child === 'function') {
  1301. child = child.options;
  1302. }
  1303. normalizeProps(child, vm);
  1304. normalizeInject(child, vm);
  1305. normalizeDirectives(child);
  1306. var extendsFrom = child.extends;
  1307. if (extendsFrom) {
  1308. parent = mergeOptions(parent, extendsFrom, vm);
  1309. }
  1310. if (child.mixins) {
  1311. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1312. parent = mergeOptions(parent, child.mixins[i], vm);
  1313. }
  1314. }
  1315. var options = {};
  1316. var key;
  1317. for (key in parent) {
  1318. mergeField(key);
  1319. }
  1320. for (key in child) {
  1321. if (!hasOwn(parent, key)) {
  1322. mergeField(key);
  1323. }
  1324. }
  1325. function mergeField (key) {
  1326. var strat = strats[key] || defaultStrat;
  1327. options[key] = strat(parent[key], child[key], vm, key);
  1328. }
  1329. return options
  1330. }
  1331. /**
  1332. * Resolve an asset.
  1333. * This function is used because child instances need access
  1334. * to assets defined in its ancestor chain.
  1335. */
  1336. function resolveAsset (
  1337. options,
  1338. type,
  1339. id,
  1340. warnMissing
  1341. ) {
  1342. /* istanbul ignore if */
  1343. if (typeof id !== 'string') {
  1344. return
  1345. }
  1346. var assets = options[type];
  1347. // check local registration variations first
  1348. if (hasOwn(assets, id)) { return assets[id] }
  1349. var camelizedId = camelize(id);
  1350. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1351. var PascalCaseId = capitalize(camelizedId);
  1352. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1353. // fallback to prototype chain
  1354. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1355. if ("development" !== 'production' && warnMissing && !res) {
  1356. warn(
  1357. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1358. options
  1359. );
  1360. }
  1361. return res
  1362. }
  1363. /* */
  1364. function validateProp (
  1365. key,
  1366. propOptions,
  1367. propsData,
  1368. vm
  1369. ) {
  1370. var prop = propOptions[key];
  1371. var absent = !hasOwn(propsData, key);
  1372. var value = propsData[key];
  1373. // handle boolean props
  1374. if (isType(Boolean, prop.type)) {
  1375. if (absent && !hasOwn(prop, 'default')) {
  1376. value = false;
  1377. } else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
  1378. value = true;
  1379. }
  1380. }
  1381. // check default value
  1382. if (value === undefined) {
  1383. value = getPropDefaultValue(vm, prop, key);
  1384. // since the default value is a fresh copy,
  1385. // make sure to observe it.
  1386. var prevShouldConvert = observerState.shouldConvert;
  1387. observerState.shouldConvert = true;
  1388. observe(value);
  1389. observerState.shouldConvert = prevShouldConvert;
  1390. }
  1391. {
  1392. assertProp(prop, key, value, vm, absent);
  1393. }
  1394. return value
  1395. }
  1396. /**
  1397. * Get the default value of a prop.
  1398. */
  1399. function getPropDefaultValue (vm, prop, key) {
  1400. // no default, return undefined
  1401. if (!hasOwn(prop, 'default')) {
  1402. return undefined
  1403. }
  1404. var def = prop.default;
  1405. // warn against non-factory defaults for Object & Array
  1406. if ("development" !== 'production' && isObject(def)) {
  1407. warn(
  1408. 'Invalid default value for prop "' + key + '": ' +
  1409. 'Props with type Object/Array must use a factory function ' +
  1410. 'to return the default value.',
  1411. vm
  1412. );
  1413. }
  1414. // the raw prop value was also undefined from previous render,
  1415. // return previous default value to avoid unnecessary watcher trigger
  1416. if (vm && vm.$options.propsData &&
  1417. vm.$options.propsData[key] === undefined &&
  1418. vm._props[key] !== undefined
  1419. ) {
  1420. return vm._props[key]
  1421. }
  1422. // call factory function for non-Function types
  1423. // a value is Function if its prototype is function even across different execution context
  1424. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1425. ? def.call(vm)
  1426. : def
  1427. }
  1428. /**
  1429. * Assert whether a prop is valid.
  1430. */
  1431. function assertProp (
  1432. prop,
  1433. name,
  1434. value,
  1435. vm,
  1436. absent
  1437. ) {
  1438. if (prop.required && absent) {
  1439. warn(
  1440. 'Missing required prop: "' + name + '"',
  1441. vm
  1442. );
  1443. return
  1444. }
  1445. if (value == null && !prop.required) {
  1446. return
  1447. }
  1448. var type = prop.type;
  1449. var valid = !type || type === true;
  1450. var expectedTypes = [];
  1451. if (type) {
  1452. if (!Array.isArray(type)) {
  1453. type = [type];
  1454. }
  1455. for (var i = 0; i < type.length && !valid; i++) {
  1456. var assertedType = assertType(value, type[i]);
  1457. expectedTypes.push(assertedType.expectedType || '');
  1458. valid = assertedType.valid;
  1459. }
  1460. }
  1461. if (!valid) {
  1462. warn(
  1463. "Invalid prop: type check failed for prop \"" + name + "\"." +
  1464. " Expected " + (expectedTypes.map(capitalize).join(', ')) +
  1465. ", got " + (toRawType(value)) + ".",
  1466. vm
  1467. );
  1468. return
  1469. }
  1470. var validator = prop.validator;
  1471. if (validator) {
  1472. if (!validator(value)) {
  1473. warn(
  1474. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1475. vm
  1476. );
  1477. }
  1478. }
  1479. }
  1480. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1481. function assertType (value, type) {
  1482. var valid;
  1483. var expectedType = getType(type);
  1484. if (simpleCheckRE.test(expectedType)) {
  1485. var t = typeof value;
  1486. valid = t === expectedType.toLowerCase();
  1487. // for primitive wrapper objects
  1488. if (!valid && t === 'object') {
  1489. valid = value instanceof type;
  1490. }
  1491. } else if (expectedType === 'Object') {
  1492. valid = isPlainObject(value);
  1493. } else if (expectedType === 'Array') {
  1494. valid = Array.isArray(value);
  1495. } else {
  1496. valid = value instanceof type;
  1497. }
  1498. return {
  1499. valid: valid,
  1500. expectedType: expectedType
  1501. }
  1502. }
  1503. /**
  1504. * Use function string name to check built-in types,
  1505. * because a simple equality check will fail when running
  1506. * across different vms / iframes.
  1507. */
  1508. function getType (fn) {
  1509. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1510. return match ? match[1] : ''
  1511. }
  1512. function isType (type, fn) {
  1513. if (!Array.isArray(fn)) {
  1514. return getType(fn) === getType(type)
  1515. }
  1516. for (var i = 0, len = fn.length; i < len; i++) {
  1517. if (getType(fn[i]) === getType(type)) {
  1518. return true
  1519. }
  1520. }
  1521. /* istanbul ignore next */
  1522. return false
  1523. }
  1524. /* */
  1525. function handleError (err, vm, info) {
  1526. if (vm) {
  1527. var cur = vm;
  1528. while ((cur = cur.$parent)) {
  1529. var hooks = cur.$options.errorCaptured;
  1530. if (hooks) {
  1531. for (var i = 0; i < hooks.length; i++) {
  1532. try {
  1533. var capture = hooks[i].call(cur, err, vm, info) === false;
  1534. if (capture) { return }
  1535. } catch (e) {
  1536. globalHandleError(e, cur, 'errorCaptured hook');
  1537. }
  1538. }
  1539. }
  1540. }
  1541. }
  1542. globalHandleError(err, vm, info);
  1543. }
  1544. function globalHandleError (err, vm, info) {
  1545. if (config.errorHandler) {
  1546. try {
  1547. return config.errorHandler.call(null, err, vm, info)
  1548. } catch (e) {
  1549. logError(e, null, 'config.errorHandler');
  1550. }
  1551. }
  1552. logError(err, vm, info);
  1553. }
  1554. function logError (err, vm, info) {
  1555. {
  1556. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1557. }
  1558. /* istanbul ignore else */
  1559. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1560. console.error(err);
  1561. } else {
  1562. throw err
  1563. }
  1564. }
  1565. /* */
  1566. /* globals MessageChannel */
  1567. var callbacks = [];
  1568. var pending = false;
  1569. function flushCallbacks () {
  1570. pending = false;
  1571. var copies = callbacks.slice(0);
  1572. callbacks.length = 0;
  1573. for (var i = 0; i < copies.length; i++) {
  1574. copies[i]();
  1575. }
  1576. }
  1577. // Here we have async deferring wrappers using both micro and macro tasks.
  1578. // In < 2.4 we used micro tasks everywhere, but there are some scenarios where
  1579. // micro tasks have too high a priority and fires in between supposedly
  1580. // sequential events (e.g. #4521, #6690) or even between bubbling of the same
  1581. // event (#6566). However, using macro tasks everywhere also has subtle problems
  1582. // when state is changed right before repaint (e.g. #6813, out-in transitions).
  1583. // Here we use micro task by default, but expose a way to force macro task when
  1584. // needed (e.g. in event handlers attached by v-on).
  1585. var microTimerFunc;
  1586. var macroTimerFunc;
  1587. var useMacroTask = false;
  1588. // Determine (macro) Task defer implementation.
  1589. // Technically setImmediate should be the ideal choice, but it's only available
  1590. // in IE. The only polyfill that consistently queues the callback after all DOM
  1591. // events triggered in the same loop is by using MessageChannel.
  1592. /* istanbul ignore if */
  1593. if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1594. macroTimerFunc = function () {
  1595. setImmediate(flushCallbacks);
  1596. };
  1597. } else if (typeof MessageChannel !== 'undefined' && (
  1598. isNative(MessageChannel) ||
  1599. // PhantomJS
  1600. MessageChannel.toString() === '[object MessageChannelConstructor]'
  1601. )) {
  1602. var channel = new MessageChannel();
  1603. var port = channel.port2;
  1604. channel.port1.onmessage = flushCallbacks;
  1605. macroTimerFunc = function () {
  1606. port.postMessage(1);
  1607. };
  1608. } else {
  1609. /* istanbul ignore next */
  1610. macroTimerFunc = function () {
  1611. setTimeout(flushCallbacks, 0);
  1612. };
  1613. }
  1614. // Determine MicroTask defer implementation.
  1615. /* istanbul ignore next, $flow-disable-line */
  1616. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1617. var p = Promise.resolve();
  1618. microTimerFunc = function () {
  1619. p.then(flushCallbacks);
  1620. // in problematic UIWebViews, Promise.then doesn't completely break, but
  1621. // it can get stuck in a weird state where callbacks are pushed into the
  1622. // microtask queue but the queue isn't being flushed, until the browser
  1623. // needs to do some other work, e.g. handle a timer. Therefore we can
  1624. // "force" the microtask queue to be flushed by adding an empty timer.
  1625. if (isIOS) { setTimeout(noop); }
  1626. };
  1627. } else {
  1628. // fallback to macro
  1629. microTimerFunc = macroTimerFunc;
  1630. }
  1631. /**
  1632. * Wrap a function so that if any code inside triggers state change,
  1633. * the changes are queued using a Task instead of a MicroTask.
  1634. */
  1635. function withMacroTask (fn) {
  1636. return fn._withTask || (fn._withTask = function () {
  1637. useMacroTask = true;
  1638. var res = fn.apply(null, arguments);
  1639. useMacroTask = false;
  1640. return res
  1641. })
  1642. }
  1643. function nextTick (cb, ctx) {
  1644. var _resolve;
  1645. callbacks.push(function () {
  1646. if (cb) {
  1647. try {
  1648. cb.call(ctx);
  1649. } catch (e) {
  1650. handleError(e, ctx, 'nextTick');
  1651. }
  1652. } else if (_resolve) {
  1653. _resolve(ctx);
  1654. }
  1655. });
  1656. if (!pending) {
  1657. pending = true;
  1658. if (useMacroTask) {
  1659. macroTimerFunc();
  1660. } else {
  1661. microTimerFunc();
  1662. }
  1663. }
  1664. // $flow-disable-line
  1665. if (!cb && typeof Promise !== 'undefined') {
  1666. return new Promise(function (resolve) {
  1667. _resolve = resolve;
  1668. })
  1669. }
  1670. }
  1671. /* */
  1672. var mark;
  1673. var measure;
  1674. {
  1675. var perf = inBrowser && window.performance;
  1676. /* istanbul ignore if */
  1677. if (
  1678. perf &&
  1679. perf.mark &&
  1680. perf.measure &&
  1681. perf.clearMarks &&
  1682. perf.clearMeasures
  1683. ) {
  1684. mark = function (tag) { return perf.mark(tag); };
  1685. measure = function (name, startTag, endTag) {
  1686. perf.measure(name, startTag, endTag);
  1687. perf.clearMarks(startTag);
  1688. perf.clearMarks(endTag);
  1689. perf.clearMeasures(name);
  1690. };
  1691. }
  1692. }
  1693. /* not type checking this file because flow doesn't play well with Proxy */
  1694. var initProxy;
  1695. {
  1696. var allowedGlobals = makeMap(
  1697. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1698. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1699. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1700. 'require' // for Webpack/Browserify
  1701. );
  1702. var warnNonPresent = function (target, key) {
  1703. warn(
  1704. "Property or method \"" + key + "\" is not defined on the instance but " +
  1705. 'referenced during render. Make sure that this property is reactive, ' +
  1706. 'either in the data option, or for class-based components, by ' +
  1707. 'initializing the property. ' +
  1708. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1709. target
  1710. );
  1711. };
  1712. var hasProxy =
  1713. typeof Proxy !== 'undefined' &&
  1714. Proxy.toString().match(/native code/);
  1715. if (hasProxy) {
  1716. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1717. config.keyCodes = new Proxy(config.keyCodes, {
  1718. set: function set (target, key, value) {
  1719. if (isBuiltInModifier(key)) {
  1720. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1721. return false
  1722. } else {
  1723. target[key] = value;
  1724. return true
  1725. }
  1726. }
  1727. });
  1728. }
  1729. var hasHandler = {
  1730. has: function has (target, key) {
  1731. var has = key in target;
  1732. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  1733. if (!has && !isAllowed) {
  1734. warnNonPresent(target, key);
  1735. }
  1736. return has || !isAllowed
  1737. }
  1738. };
  1739. var getHandler = {
  1740. get: function get (target, key) {
  1741. if (typeof key === 'string' && !(key in target)) {
  1742. warnNonPresent(target, key);
  1743. }
  1744. return target[key]
  1745. }
  1746. };
  1747. initProxy = function initProxy (vm) {
  1748. if (hasProxy) {
  1749. // determine which proxy handler to use
  1750. var options = vm.$options;
  1751. var handlers = options.render && options.render._withStripped
  1752. ? getHandler
  1753. : hasHandler;
  1754. vm._renderProxy = new Proxy(vm, handlers);
  1755. } else {
  1756. vm._renderProxy = vm;
  1757. }
  1758. };
  1759. }
  1760. /* */
  1761. var seenObjects = new _Set();
  1762. /**
  1763. * Recursively traverse an object to evoke all converted
  1764. * getters, so that every nested property inside the object
  1765. * is collected as a "deep" dependency.
  1766. */
  1767. function traverse (val) {
  1768. _traverse(val, seenObjects);
  1769. seenObjects.clear();
  1770. }
  1771. function _traverse (val, seen) {
  1772. var i, keys;
  1773. var isA = Array.isArray(val);
  1774. if ((!isA && !isObject(val)) || Object.isFrozen(val)) {
  1775. return
  1776. }
  1777. if (val.__ob__) {
  1778. var depId = val.__ob__.dep.id;
  1779. if (seen.has(depId)) {
  1780. return
  1781. }
  1782. seen.add(depId);
  1783. }
  1784. if (isA) {
  1785. i = val.length;
  1786. while (i--) { _traverse(val[i], seen); }
  1787. } else {
  1788. keys = Object.keys(val);
  1789. i = keys.length;
  1790. while (i--) { _traverse(val[keys[i]], seen); }
  1791. }
  1792. }
  1793. /* */
  1794. var normalizeEvent = cached(function (name) {
  1795. var passive = name.charAt(0) === '&';
  1796. name = passive ? name.slice(1) : name;
  1797. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1798. name = once$$1 ? name.slice(1) : name;
  1799. var capture = name.charAt(0) === '!';
  1800. name = capture ? name.slice(1) : name;
  1801. return {
  1802. name: name,
  1803. once: once$$1,
  1804. capture: capture,
  1805. passive: passive
  1806. }
  1807. });
  1808. function createFnInvoker (fns) {
  1809. function invoker () {
  1810. var arguments$1 = arguments;
  1811. var fns = invoker.fns;
  1812. if (Array.isArray(fns)) {
  1813. var cloned = fns.slice();
  1814. for (var i = 0; i < cloned.length; i++) {
  1815. cloned[i].apply(null, arguments$1);
  1816. }
  1817. } else {
  1818. // return handler return value for single handlers
  1819. return fns.apply(null, arguments)
  1820. }
  1821. }
  1822. invoker.fns = fns;
  1823. return invoker
  1824. }
  1825. function updateListeners (
  1826. on,
  1827. oldOn,
  1828. add,
  1829. remove$$1,
  1830. vm
  1831. ) {
  1832. var name, def, cur, old, event;
  1833. for (name in on) {
  1834. def = cur = on[name];
  1835. old = oldOn[name];
  1836. event = normalizeEvent(name);
  1837. /* istanbul ignore if */
  1838. if (isUndef(cur)) {
  1839. "development" !== 'production' && warn(
  1840. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1841. vm
  1842. );
  1843. } else if (isUndef(old)) {
  1844. if (isUndef(cur.fns)) {
  1845. cur = on[name] = createFnInvoker(cur);
  1846. }
  1847. add(event.name, cur, event.once, event.capture, event.passive, event.params);
  1848. } else if (cur !== old) {
  1849. old.fns = cur;
  1850. on[name] = old;
  1851. }
  1852. }
  1853. for (name in oldOn) {
  1854. if (isUndef(on[name])) {
  1855. event = normalizeEvent(name);
  1856. remove$$1(event.name, oldOn[name], event.capture);
  1857. }
  1858. }
  1859. }
  1860. /* */
  1861. function mergeVNodeHook (def, hookKey, hook) {
  1862. if (def instanceof VNode) {
  1863. def = def.data.hook || (def.data.hook = {});
  1864. }
  1865. var invoker;
  1866. var oldHook = def[hookKey];
  1867. function wrappedHook () {
  1868. hook.apply(this, arguments);
  1869. // important: remove merged hook to ensure it's called only once
  1870. // and prevent memory leak
  1871. remove(invoker.fns, wrappedHook);
  1872. }
  1873. if (isUndef(oldHook)) {
  1874. // no existing hook
  1875. invoker = createFnInvoker([wrappedHook]);
  1876. } else {
  1877. /* istanbul ignore if */
  1878. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  1879. // already a merged invoker
  1880. invoker = oldHook;
  1881. invoker.fns.push(wrappedHook);
  1882. } else {
  1883. // existing plain hook
  1884. invoker = createFnInvoker([oldHook, wrappedHook]);
  1885. }
  1886. }
  1887. invoker.merged = true;
  1888. def[hookKey] = invoker;
  1889. }
  1890. /* */
  1891. function extractPropsFromVNodeData (
  1892. data,
  1893. Ctor,
  1894. tag
  1895. ) {
  1896. // we are only extracting raw values here.
  1897. // validation and default values are handled in the child
  1898. // component itself.
  1899. var propOptions = Ctor.options.props;
  1900. if (isUndef(propOptions)) {
  1901. return
  1902. }
  1903. var res = {};
  1904. var attrs = data.attrs;
  1905. var props = data.props;
  1906. if (isDef(attrs) || isDef(props)) {
  1907. for (var key in propOptions) {
  1908. var altKey = hyphenate(key);
  1909. {
  1910. var keyInLowerCase = key.toLowerCase();
  1911. if (
  1912. key !== keyInLowerCase &&
  1913. attrs && hasOwn(attrs, keyInLowerCase)
  1914. ) {
  1915. tip(
  1916. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  1917. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  1918. " \"" + key + "\". " +
  1919. "Note that HTML attributes are case-insensitive and camelCased " +
  1920. "props need to use their kebab-case equivalents when using in-DOM " +
  1921. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  1922. );
  1923. }
  1924. }
  1925. checkProp(res, props, key, altKey, true) ||
  1926. checkProp(res, attrs, key, altKey, false);
  1927. }
  1928. }
  1929. return res
  1930. }
  1931. function checkProp (
  1932. res,
  1933. hash,
  1934. key,
  1935. altKey,
  1936. preserve
  1937. ) {
  1938. if (isDef(hash)) {
  1939. if (hasOwn(hash, key)) {
  1940. res[key] = hash[key];
  1941. if (!preserve) {
  1942. delete hash[key];
  1943. }
  1944. return true
  1945. } else if (hasOwn(hash, altKey)) {
  1946. res[key] = hash[altKey];
  1947. if (!preserve) {
  1948. delete hash[altKey];
  1949. }
  1950. return true
  1951. }
  1952. }
  1953. return false
  1954. }
  1955. /* */
  1956. // The template compiler attempts to minimize the need for normalization by
  1957. // statically analyzing the template at compile time.
  1958. //
  1959. // For plain HTML markup, normalization can be completely skipped because the
  1960. // generated render function is guaranteed to return Array<VNode>. There are
  1961. // two cases where extra normalization is needed:
  1962. // 1. When the children contains components - because a functional component
  1963. // may return an Array instead of a single root. In this case, just a simple
  1964. // normalization is needed - if any child is an Array, we flatten the whole
  1965. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  1966. // because functional components already normalize their own children.
  1967. function simpleNormalizeChildren (children) {
  1968. for (var i = 0; i < children.length; i++) {
  1969. if (Array.isArray(children[i])) {
  1970. return Array.prototype.concat.apply([], children)
  1971. }
  1972. }
  1973. return children
  1974. }
  1975. // 2. When the children contains constructs that always generated nested Arrays,
  1976. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  1977. // with hand-written render functions / JSX. In such cases a full normalization
  1978. // is needed to cater to all possible types of children values.
  1979. function normalizeChildren (children) {
  1980. return isPrimitive(children)
  1981. ? [createTextVNode(children)]
  1982. : Array.isArray(children)
  1983. ? normalizeArrayChildren(children)
  1984. : undefined
  1985. }
  1986. function isTextNode (node) {
  1987. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  1988. }
  1989. function normalizeArrayChildren (children, nestedIndex) {
  1990. var res = [];
  1991. var i, c, lastIndex, last;
  1992. for (i = 0; i < children.length; i++) {
  1993. c = children[i];
  1994. if (isUndef(c) || typeof c === 'boolean') { continue }
  1995. lastIndex = res.length - 1;
  1996. last = res[lastIndex];
  1997. // nested
  1998. if (Array.isArray(c)) {
  1999. if (c.length > 0) {
  2000. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2001. // merge adjacent text nodes
  2002. if (isTextNode(c[0]) && isTextNode(last)) {
  2003. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2004. c.shift();
  2005. }
  2006. res.push.apply(res, c);
  2007. }
  2008. } else if (isPrimitive(c)) {
  2009. if (isTextNode(last)) {
  2010. // merge adjacent text nodes
  2011. // this is necessary for SSR hydration because text nodes are
  2012. // essentially merged when rendered to HTML strings
  2013. res[lastIndex] = createTextVNode(last.text + c);
  2014. } else if (c !== '') {
  2015. // convert primitive to vnode
  2016. res.push(createTextVNode(c));
  2017. }
  2018. } else {
  2019. if (isTextNode(c) && isTextNode(last)) {
  2020. // merge adjacent text nodes
  2021. res[lastIndex] = createTextVNode(last.text + c.text);
  2022. } else {
  2023. // default key for nested array children (likely generated by v-for)
  2024. if (isTrue(children._isVList) &&
  2025. isDef(c.tag) &&
  2026. isUndef(c.key) &&
  2027. isDef(nestedIndex)) {
  2028. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2029. }
  2030. res.push(c);
  2031. }
  2032. }
  2033. }
  2034. return res
  2035. }
  2036. /* */
  2037. function ensureCtor (comp, base) {
  2038. if (
  2039. comp.__esModule ||
  2040. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  2041. ) {
  2042. comp = comp.default;
  2043. }
  2044. return isObject(comp)
  2045. ? base.extend(comp)
  2046. : comp
  2047. }
  2048. function createAsyncPlaceholder (
  2049. factory,
  2050. data,
  2051. context,
  2052. children,
  2053. tag
  2054. ) {
  2055. var node = createEmptyVNode();
  2056. node.asyncFactory = factory;
  2057. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  2058. return node
  2059. }
  2060. function resolveAsyncComponent (
  2061. factory,
  2062. baseCtor,
  2063. context
  2064. ) {
  2065. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  2066. return factory.errorComp
  2067. }
  2068. if (isDef(factory.resolved)) {
  2069. return factory.resolved
  2070. }
  2071. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  2072. return factory.loadingComp
  2073. }
  2074. if (isDef(factory.contexts)) {
  2075. // already pending
  2076. factory.contexts.push(context);
  2077. } else {
  2078. var contexts = factory.contexts = [context];
  2079. var sync = true;
  2080. var forceRender = function () {
  2081. for (var i = 0, l = contexts.length; i < l; i++) {
  2082. contexts[i].$forceUpdate();
  2083. }
  2084. };
  2085. var resolve = once(function (res) {
  2086. // cache resolved
  2087. factory.resolved = ensureCtor(res, baseCtor);
  2088. // invoke callbacks only if this is not a synchronous resolve
  2089. // (async resolves are shimmed as synchronous during SSR)
  2090. if (!sync) {
  2091. forceRender();
  2092. }
  2093. });
  2094. var reject = once(function (reason) {
  2095. "development" !== 'production' && warn(
  2096. "Failed to resolve async component: " + (String(factory)) +
  2097. (reason ? ("\nReason: " + reason) : '')
  2098. );
  2099. if (isDef(factory.errorComp)) {
  2100. factory.error = true;
  2101. forceRender();
  2102. }
  2103. });
  2104. var res = factory(resolve, reject);
  2105. if (isObject(res)) {
  2106. if (typeof res.then === 'function') {
  2107. // () => Promise
  2108. if (isUndef(factory.resolved)) {
  2109. res.then(resolve, reject);
  2110. }
  2111. } else if (isDef(res.component) && typeof res.component.then === 'function') {
  2112. res.component.then(resolve, reject);
  2113. if (isDef(res.error)) {
  2114. factory.errorComp = ensureCtor(res.error, baseCtor);
  2115. }
  2116. if (isDef(res.loading)) {
  2117. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  2118. if (res.delay === 0) {
  2119. factory.loading = true;
  2120. } else {
  2121. setTimeout(function () {
  2122. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  2123. factory.loading = true;
  2124. forceRender();
  2125. }
  2126. }, res.delay || 200);
  2127. }
  2128. }
  2129. if (isDef(res.timeout)) {
  2130. setTimeout(function () {
  2131. if (isUndef(factory.resolved)) {
  2132. reject(
  2133. "timeout (" + (res.timeout) + "ms)"
  2134. );
  2135. }
  2136. }, res.timeout);
  2137. }
  2138. }
  2139. }
  2140. sync = false;
  2141. // return in case resolved synchronously
  2142. return factory.loading
  2143. ? factory.loadingComp
  2144. : factory.resolved
  2145. }
  2146. }
  2147. /* */
  2148. function isAsyncPlaceholder (node) {
  2149. return node.isComment && node.asyncFactory
  2150. }
  2151. /* */
  2152. function getFirstComponentChild (children) {
  2153. if (Array.isArray(children)) {
  2154. for (var i = 0; i < children.length; i++) {
  2155. var c = children[i];
  2156. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  2157. return c
  2158. }
  2159. }
  2160. }
  2161. }
  2162. /* */
  2163. /* */
  2164. function initEvents (vm) {
  2165. vm._events = Object.create(null);
  2166. vm._hasHookEvent = false;
  2167. // init parent attached events
  2168. var listeners = vm.$options._parentListeners;
  2169. if (listeners) {
  2170. updateComponentListeners(vm, listeners);
  2171. }
  2172. }
  2173. var target;
  2174. function add (event, fn, once) {
  2175. if (once) {
  2176. target.$once(event, fn);
  2177. } else {
  2178. target.$on(event, fn);
  2179. }
  2180. }
  2181. function remove$1 (event, fn) {
  2182. target.$off(event, fn);
  2183. }
  2184. function updateComponentListeners (
  2185. vm,
  2186. listeners,
  2187. oldListeners
  2188. ) {
  2189. target = vm;
  2190. updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
  2191. target = undefined;
  2192. }
  2193. function eventsMixin (Vue) {
  2194. var hookRE = /^hook:/;
  2195. Vue.prototype.$on = function (event, fn) {
  2196. var this$1 = this;
  2197. var vm = this;
  2198. if (Array.isArray(event)) {
  2199. for (var i = 0, l = event.length; i < l; i++) {
  2200. this$1.$on(event[i], fn);
  2201. }
  2202. } else {
  2203. (vm._events[event] || (vm._events[event] = [])).push(fn);
  2204. // optimize hook:event cost by using a boolean flag marked at registration
  2205. // instead of a hash lookup
  2206. if (hookRE.test(event)) {
  2207. vm._hasHookEvent = true;
  2208. }
  2209. }
  2210. return vm
  2211. };
  2212. Vue.prototype.$once = function (event, fn) {
  2213. var vm = this;
  2214. function on () {
  2215. vm.$off(event, on);
  2216. fn.apply(vm, arguments);
  2217. }
  2218. on.fn = fn;
  2219. vm.$on(event, on);
  2220. return vm
  2221. };
  2222. Vue.prototype.$off = function (event, fn) {
  2223. var this$1 = this;
  2224. var vm = this;
  2225. // all
  2226. if (!arguments.length) {
  2227. vm._events = Object.create(null);
  2228. return vm
  2229. }
  2230. // array of events
  2231. if (Array.isArray(event)) {
  2232. for (var i = 0, l = event.length; i < l; i++) {
  2233. this$1.$off(event[i], fn);
  2234. }
  2235. return vm
  2236. }
  2237. // specific event
  2238. var cbs = vm._events[event];
  2239. if (!cbs) {
  2240. return vm
  2241. }
  2242. if (!fn) {
  2243. vm._events[event] = null;
  2244. return vm
  2245. }
  2246. if (fn) {
  2247. // specific handler
  2248. var cb;
  2249. var i$1 = cbs.length;
  2250. while (i$1--) {
  2251. cb = cbs[i$1];
  2252. if (cb === fn || cb.fn === fn) {
  2253. cbs.splice(i$1, 1);
  2254. break
  2255. }
  2256. }
  2257. }
  2258. return vm
  2259. };
  2260. Vue.prototype.$emit = function (event) {
  2261. var vm = this;
  2262. {
  2263. var lowerCaseEvent = event.toLowerCase();
  2264. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  2265. tip(
  2266. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  2267. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  2268. "Note that HTML attributes are case-insensitive and you cannot use " +
  2269. "v-on to listen to camelCase events when using in-DOM templates. " +
  2270. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  2271. );
  2272. }
  2273. }
  2274. var cbs = vm._events[event];
  2275. if (cbs) {
  2276. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2277. var args = toArray(arguments, 1);
  2278. for (var i = 0, l = cbs.length; i < l; i++) {
  2279. try {
  2280. cbs[i].apply(vm, args);
  2281. } catch (e) {
  2282. handleError(e, vm, ("event handler for \"" + event + "\""));
  2283. }
  2284. }
  2285. }
  2286. return vm
  2287. };
  2288. }
  2289. /* */
  2290. /**
  2291. * Runtime helper for resolving raw children VNodes into a slot object.
  2292. */
  2293. function resolveSlots (
  2294. children,
  2295. context
  2296. ) {
  2297. var slots = {};
  2298. if (!children) {
  2299. return slots
  2300. }
  2301. for (var i = 0, l = children.length; i < l; i++) {
  2302. var child = children[i];
  2303. var data = child.data;
  2304. // remove slot attribute if the node is resolved as a Vue slot node
  2305. if (data && data.attrs && data.attrs.slot) {
  2306. delete data.attrs.slot;
  2307. }
  2308. // named slots should only be respected if the vnode was rendered in the
  2309. // same context.
  2310. if ((child.context === context || child.fnContext === context) &&
  2311. data && data.slot != null
  2312. ) {
  2313. var name = data.slot;
  2314. var slot = (slots[name] || (slots[name] = []));
  2315. if (child.tag === 'template') {
  2316. slot.push.apply(slot, child.children || []);
  2317. } else {
  2318. slot.push(child);
  2319. }
  2320. } else {
  2321. (slots.default || (slots.default = [])).push(child);
  2322. }
  2323. }
  2324. // ignore slots that contains only whitespace
  2325. for (var name$1 in slots) {
  2326. if (slots[name$1].every(isWhitespace)) {
  2327. delete slots[name$1];
  2328. }
  2329. }
  2330. return slots
  2331. }
  2332. function isWhitespace (node) {
  2333. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2334. }
  2335. function resolveScopedSlots (
  2336. fns, // see flow/vnode
  2337. res
  2338. ) {
  2339. res = res || {};
  2340. for (var i = 0; i < fns.length; i++) {
  2341. if (Array.isArray(fns[i])) {
  2342. resolveScopedSlots(fns[i], res);
  2343. } else {
  2344. res[fns[i].key] = fns[i].fn;
  2345. }
  2346. }
  2347. return res
  2348. }
  2349. /* */
  2350. var activeInstance = null;
  2351. var isUpdatingChildComponent = false;
  2352. function initLifecycle (vm) {
  2353. var options = vm.$options;
  2354. // locate first non-abstract parent
  2355. var parent = options.parent;
  2356. if (parent && !options.abstract) {
  2357. while (parent.$options.abstract && parent.$parent) {
  2358. parent = parent.$parent;
  2359. }
  2360. parent.$children.push(vm);
  2361. }
  2362. vm.$parent = parent;
  2363. vm.$root = parent ? parent.$root : vm;
  2364. vm.$children = [];
  2365. vm.$refs = {};
  2366. vm._watcher = null;
  2367. vm._inactive = null;
  2368. vm._directInactive = false;
  2369. vm._isMounted = false;
  2370. vm._isDestroyed = false;
  2371. vm._isBeingDestroyed = false;
  2372. }
  2373. function lifecycleMixin (Vue) {
  2374. Vue.prototype._update = function (vnode, hydrating) {
  2375. var vm = this;
  2376. if (vm._isMounted) {
  2377. callHook(vm, 'beforeUpdate');
  2378. }
  2379. var prevEl = vm.$el;
  2380. var prevVnode = vm._vnode;
  2381. var prevActiveInstance = activeInstance;
  2382. activeInstance = vm;
  2383. vm._vnode = vnode;
  2384. // Vue.prototype.__patch__ is injected in entry points
  2385. // based on the rendering backend used.
  2386. if (!prevVnode) {
  2387. // initial render
  2388. vm.$el = vm.__patch__(
  2389. vm.$el, vnode, hydrating, false /* removeOnly */,
  2390. vm.$options._parentElm,
  2391. vm.$options._refElm
  2392. );
  2393. // no need for the ref nodes after initial patch
  2394. // this prevents keeping a detached DOM tree in memory (#5851)
  2395. vm.$options._parentElm = vm.$options._refElm = null;
  2396. } else {
  2397. // updates
  2398. vm.$el = vm.__patch__(prevVnode, vnode);
  2399. }
  2400. activeInstance = prevActiveInstance;
  2401. // update __vue__ reference
  2402. if (prevEl) {
  2403. prevEl.__vue__ = null;
  2404. }
  2405. if (vm.$el) {
  2406. vm.$el.__vue__ = vm;
  2407. }
  2408. // if parent is an HOC, update its $el as well
  2409. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  2410. vm.$parent.$el = vm.$el;
  2411. }
  2412. // updated hook is called by the scheduler to ensure that children are
  2413. // updated in a parent's updated hook.
  2414. };
  2415. Vue.prototype.$forceUpdate = function () {
  2416. var vm = this;
  2417. if (vm._watcher) {
  2418. vm._watcher.update();
  2419. }
  2420. };
  2421. Vue.prototype.$destroy = function () {
  2422. var vm = this;
  2423. if (vm._isBeingDestroyed) {
  2424. return
  2425. }
  2426. callHook(vm, 'beforeDestroy');
  2427. vm._isBeingDestroyed = true;
  2428. // remove self from parent
  2429. var parent = vm.$parent;
  2430. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  2431. remove(parent.$children, vm);
  2432. }
  2433. // teardown watchers
  2434. if (vm._watcher) {
  2435. vm._watcher.teardown();
  2436. }
  2437. var i = vm._watchers.length;
  2438. while (i--) {
  2439. vm._watchers[i].teardown();
  2440. }
  2441. // remove reference from data ob
  2442. // frozen object may not have observer.
  2443. if (vm._data.__ob__) {
  2444. vm._data.__ob__.vmCount--;
  2445. }
  2446. // call the last hook...
  2447. vm._isDestroyed = true;
  2448. // invoke destroy hooks on current rendered tree
  2449. vm.__patch__(vm._vnode, null);
  2450. // fire destroyed hook
  2451. callHook(vm, 'destroyed');
  2452. // turn off all instance listeners.
  2453. vm.$off();
  2454. // remove __vue__ reference
  2455. if (vm.$el) {
  2456. vm.$el.__vue__ = null;
  2457. }
  2458. // release circular reference (#6759)
  2459. if (vm.$vnode) {
  2460. vm.$vnode.parent = null;
  2461. }
  2462. };
  2463. }
  2464. function mountComponent (
  2465. vm,
  2466. el,
  2467. hydrating
  2468. ) {
  2469. vm.$el = el;
  2470. if (!vm.$options.render) {
  2471. vm.$options.render = createEmptyVNode;
  2472. {
  2473. /* istanbul ignore if */
  2474. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  2475. vm.$options.el || el) {
  2476. warn(
  2477. 'You are using the runtime-only build of Vue where the template ' +
  2478. 'compiler is not available. Either pre-compile the templates into ' +
  2479. 'render functions, or use the compiler-included build.',
  2480. vm
  2481. );
  2482. } else {
  2483. warn(
  2484. 'Failed to mount component: template or render function not defined.',
  2485. vm
  2486. );
  2487. }
  2488. }
  2489. }
  2490. callHook(vm, 'beforeMount');
  2491. var updateComponent;
  2492. /* istanbul ignore if */
  2493. if ("development" !== 'production' && config.performance && mark) {
  2494. updateComponent = function () {
  2495. var name = vm._name;
  2496. var id = vm._uid;
  2497. var startTag = "vue-perf-start:" + id;
  2498. var endTag = "vue-perf-end:" + id;
  2499. mark(startTag);
  2500. var vnode = vm._render();
  2501. mark(endTag);
  2502. measure(("vue " + name + " render"), startTag, endTag);
  2503. mark(startTag);
  2504. vm._update(vnode, hydrating);
  2505. mark(endTag);
  2506. measure(("vue " + name + " patch"), startTag, endTag);
  2507. };
  2508. } else {
  2509. updateComponent = function () {
  2510. vm._update(vm._render(), hydrating);
  2511. };
  2512. }
  2513. // we set this to vm._watcher inside the watcher's constructor
  2514. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  2515. // component's mounted hook), which relies on vm._watcher being already defined
  2516. new Watcher(vm, updateComponent, noop, null, true /* isRenderWatcher */);
  2517. hydrating = false;
  2518. // manually mounted instance, call mounted on self
  2519. // mounted is called for render-created child components in its inserted hook
  2520. if (vm.$vnode == null) {
  2521. vm._isMounted = true;
  2522. callHook(vm, 'mounted');
  2523. }
  2524. return vm
  2525. }
  2526. function updateChildComponent (
  2527. vm,
  2528. propsData,
  2529. listeners,
  2530. parentVnode,
  2531. renderChildren
  2532. ) {
  2533. {
  2534. isUpdatingChildComponent = true;
  2535. }
  2536. // determine whether component has slot children
  2537. // we need to do this before overwriting $options._renderChildren
  2538. var hasChildren = !!(
  2539. renderChildren || // has new static slots
  2540. vm.$options._renderChildren || // has old static slots
  2541. parentVnode.data.scopedSlots || // has new scoped slots
  2542. vm.$scopedSlots !== emptyObject // has old scoped slots
  2543. );
  2544. vm.$options._parentVnode = parentVnode;
  2545. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  2546. if (vm._vnode) { // update child tree's parent
  2547. vm._vnode.parent = parentVnode;
  2548. }
  2549. vm.$options._renderChildren = renderChildren;
  2550. // update $attrs and $listeners hash
  2551. // these are also reactive so they may trigger child update if the child
  2552. // used them during render
  2553. vm.$attrs = (parentVnode.data && parentVnode.data.attrs) || emptyObject;
  2554. vm.$listeners = listeners || emptyObject;
  2555. // update props
  2556. if (propsData && vm.$options.props) {
  2557. observerState.shouldConvert = false;
  2558. var props = vm._props;
  2559. var propKeys = vm.$options._propKeys || [];
  2560. for (var i = 0; i < propKeys.length; i++) {
  2561. var key = propKeys[i];
  2562. props[key] = validateProp(key, vm.$options.props, propsData, vm);
  2563. }
  2564. observerState.shouldConvert = true;
  2565. // keep a copy of raw propsData
  2566. vm.$options.propsData = propsData;
  2567. }
  2568. // update listeners
  2569. if (listeners) {
  2570. var oldListeners = vm.$options._parentListeners;
  2571. vm.$options._parentListeners = listeners;
  2572. updateComponentListeners(vm, listeners, oldListeners);
  2573. }
  2574. // resolve slots + force update if has children
  2575. if (hasChildren) {
  2576. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  2577. vm.$forceUpdate();
  2578. }
  2579. {
  2580. isUpdatingChildComponent = false;
  2581. }
  2582. }
  2583. function isInInactiveTree (vm) {
  2584. while (vm && (vm = vm.$parent)) {
  2585. if (vm._inactive) { return true }
  2586. }
  2587. return false
  2588. }
  2589. function activateChildComponent (vm, direct) {
  2590. if (direct) {
  2591. vm._directInactive = false;
  2592. if (isInInactiveTree(vm)) {
  2593. return
  2594. }
  2595. } else if (vm._directInactive) {
  2596. return
  2597. }
  2598. if (vm._inactive || vm._inactive === null) {
  2599. vm._inactive = false;
  2600. for (var i = 0; i < vm.$children.length; i++) {
  2601. activateChildComponent(vm.$children[i]);
  2602. }
  2603. callHook(vm, 'activated');
  2604. }
  2605. }
  2606. function deactivateChildComponent (vm, direct) {
  2607. if (direct) {
  2608. vm._directInactive = true;
  2609. if (isInInactiveTree(vm)) {
  2610. return
  2611. }
  2612. }
  2613. if (!vm._inactive) {
  2614. vm._inactive = true;
  2615. for (var i = 0; i < vm.$children.length; i++) {
  2616. deactivateChildComponent(vm.$children[i]);
  2617. }
  2618. callHook(vm, 'deactivated');
  2619. }
  2620. }
  2621. function callHook (vm, hook) {
  2622. var handlers = vm.$options[hook];
  2623. if (handlers) {
  2624. for (var i = 0, j = handlers.length; i < j; i++) {
  2625. try {
  2626. handlers[i].call(vm);
  2627. } catch (e) {
  2628. handleError(e, vm, (hook + " hook"));
  2629. }
  2630. }
  2631. }
  2632. if (vm._hasHookEvent) {
  2633. vm.$emit('hook:' + hook);
  2634. }
  2635. }
  2636. /* */
  2637. var MAX_UPDATE_COUNT = 100;
  2638. var queue = [];
  2639. var activatedChildren = [];
  2640. var has = {};
  2641. var circular = {};
  2642. var waiting = false;
  2643. var flushing = false;
  2644. var index = 0;
  2645. /**
  2646. * Reset the scheduler's state.
  2647. */
  2648. function resetSchedulerState () {
  2649. index = queue.length = activatedChildren.length = 0;
  2650. has = {};
  2651. {
  2652. circular = {};
  2653. }
  2654. waiting = flushing = false;
  2655. }
  2656. /**
  2657. * Flush both queues and run the watchers.
  2658. */
  2659. function flushSchedulerQueue () {
  2660. flushing = true;
  2661. var watcher, id;
  2662. // Sort queue before flush.
  2663. // This ensures that:
  2664. // 1. Components are updated from parent to child. (because parent is always
  2665. // created before the child)
  2666. // 2. A component's user watchers are run before its render watcher (because
  2667. // user watchers are created before the render watcher)
  2668. // 3. If a component is destroyed during a parent component's watcher run,
  2669. // its watchers can be skipped.
  2670. queue.sort(function (a, b) { return a.id - b.id; });
  2671. // do not cache length because more watchers might be pushed
  2672. // as we run existing watchers
  2673. for (index = 0; index < queue.length; index++) {
  2674. watcher = queue[index];
  2675. id = watcher.id;
  2676. has[id] = null;
  2677. watcher.run();
  2678. // in dev build, check and stop circular updates.
  2679. if ("development" !== 'production' && has[id] != null) {
  2680. circular[id] = (circular[id] || 0) + 1;
  2681. if (circular[id] > MAX_UPDATE_COUNT) {
  2682. warn(
  2683. 'You may have an infinite update loop ' + (
  2684. watcher.user
  2685. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  2686. : "in a component render function."
  2687. ),
  2688. watcher.vm
  2689. );
  2690. break
  2691. }
  2692. }
  2693. }
  2694. // keep copies of post queues before resetting state
  2695. var activatedQueue = activatedChildren.slice();
  2696. var updatedQueue = queue.slice();
  2697. resetSchedulerState();
  2698. // call component updated and activated hooks
  2699. callActivatedHooks(activatedQueue);
  2700. callUpdatedHooks(updatedQueue);
  2701. // devtool hook
  2702. /* istanbul ignore if */
  2703. if (devtools && config.devtools) {
  2704. devtools.emit('flush');
  2705. }
  2706. }
  2707. function callUpdatedHooks (queue) {
  2708. var i = queue.length;
  2709. while (i--) {
  2710. var watcher = queue[i];
  2711. var vm = watcher.vm;
  2712. if (vm._watcher === watcher && vm._isMounted) {
  2713. callHook(vm, 'updated');
  2714. }
  2715. }
  2716. }
  2717. /**
  2718. * Queue a kept-alive component that was activated during patch.
  2719. * The queue will be processed after the entire tree has been patched.
  2720. */
  2721. function queueActivatedComponent (vm) {
  2722. // setting _inactive to false here so that a render function can
  2723. // rely on checking whether it's in an inactive tree (e.g. router-view)
  2724. vm._inactive = false;
  2725. activatedChildren.push(vm);
  2726. }
  2727. function callActivatedHooks (queue) {
  2728. for (var i = 0; i < queue.length; i++) {
  2729. queue[i]._inactive = true;
  2730. activateChildComponent(queue[i], true /* true */);
  2731. }
  2732. }
  2733. /**
  2734. * Push a watcher into the watcher queue.
  2735. * Jobs with duplicate IDs will be skipped unless it's
  2736. * pushed when the queue is being flushed.
  2737. */
  2738. function queueWatcher (watcher) {
  2739. var id = watcher.id;
  2740. if (has[id] == null) {
  2741. has[id] = true;
  2742. if (!flushing) {
  2743. queue.push(watcher);
  2744. } else {
  2745. // if already flushing, splice the watcher based on its id
  2746. // if already past its id, it will be run next immediately.
  2747. var i = queue.length - 1;
  2748. while (i > index && queue[i].id > watcher.id) {
  2749. i--;
  2750. }
  2751. queue.splice(i + 1, 0, watcher);
  2752. }
  2753. // queue the flush
  2754. if (!waiting) {
  2755. waiting = true;
  2756. nextTick(flushSchedulerQueue);
  2757. }
  2758. }
  2759. }
  2760. /* */
  2761. var uid$2 = 0;
  2762. /**
  2763. * A watcher parses an expression, collects dependencies,
  2764. * and fires callback when the expression value changes.
  2765. * This is used for both the $watch() api and directives.
  2766. */
  2767. var Watcher = function Watcher (
  2768. vm,
  2769. expOrFn,
  2770. cb,
  2771. options,
  2772. isRenderWatcher
  2773. ) {
  2774. this.vm = vm;
  2775. if (isRenderWatcher) {
  2776. vm._watcher = this;
  2777. }
  2778. vm._watchers.push(this);
  2779. // options
  2780. if (options) {
  2781. this.deep = !!options.deep;
  2782. this.user = !!options.user;
  2783. this.lazy = !!options.lazy;
  2784. this.sync = !!options.sync;
  2785. } else {
  2786. this.deep = this.user = this.lazy = this.sync = false;
  2787. }
  2788. this.cb = cb;
  2789. this.id = ++uid$2; // uid for batching
  2790. this.active = true;
  2791. this.dirty = this.lazy; // for lazy watchers
  2792. this.deps = [];
  2793. this.newDeps = [];
  2794. this.depIds = new _Set();
  2795. this.newDepIds = new _Set();
  2796. this.expression = expOrFn.toString();
  2797. // parse expression for getter
  2798. if (typeof expOrFn === 'function') {
  2799. this.getter = expOrFn;
  2800. } else {
  2801. this.getter = parsePath(expOrFn);
  2802. if (!this.getter) {
  2803. this.getter = function () {};
  2804. "development" !== 'production' && warn(
  2805. "Failed watching path: \"" + expOrFn + "\" " +
  2806. 'Watcher only accepts simple dot-delimited paths. ' +
  2807. 'For full control, use a function instead.',
  2808. vm
  2809. );
  2810. }
  2811. }
  2812. this.value = this.lazy
  2813. ? undefined
  2814. : this.get();
  2815. };
  2816. /**
  2817. * Evaluate the getter, and re-collect dependencies.
  2818. */
  2819. Watcher.prototype.get = function get () {
  2820. pushTarget(this);
  2821. var value;
  2822. var vm = this.vm;
  2823. try {
  2824. value = this.getter.call(vm, vm);
  2825. } catch (e) {
  2826. if (this.user) {
  2827. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  2828. } else {
  2829. throw e
  2830. }
  2831. } finally {
  2832. // "touch" every property so they are all tracked as
  2833. // dependencies for deep watching
  2834. if (this.deep) {
  2835. traverse(value);
  2836. }
  2837. popTarget();
  2838. this.cleanupDeps();
  2839. }
  2840. return value
  2841. };
  2842. /**
  2843. * Add a dependency to this directive.
  2844. */
  2845. Watcher.prototype.addDep = function addDep (dep) {
  2846. var id = dep.id;
  2847. if (!this.newDepIds.has(id)) {
  2848. this.newDepIds.add(id);
  2849. this.newDeps.push(dep);
  2850. if (!this.depIds.has(id)) {
  2851. dep.addSub(this);
  2852. }
  2853. }
  2854. };
  2855. /**
  2856. * Clean up for dependency collection.
  2857. */
  2858. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  2859. var this$1 = this;
  2860. var i = this.deps.length;
  2861. while (i--) {
  2862. var dep = this$1.deps[i];
  2863. if (!this$1.newDepIds.has(dep.id)) {
  2864. dep.removeSub(this$1);
  2865. }
  2866. }
  2867. var tmp = this.depIds;
  2868. this.depIds = this.newDepIds;
  2869. this.newDepIds = tmp;
  2870. this.newDepIds.clear();
  2871. tmp = this.deps;
  2872. this.deps = this.newDeps;
  2873. this.newDeps = tmp;
  2874. this.newDeps.length = 0;
  2875. };
  2876. /**
  2877. * Subscriber interface.
  2878. * Will be called when a dependency changes.
  2879. */
  2880. Watcher.prototype.update = function update () {
  2881. /* istanbul ignore else */
  2882. if (this.lazy) {
  2883. this.dirty = true;
  2884. } else if (this.sync) {
  2885. this.run();
  2886. } else {
  2887. queueWatcher(this);
  2888. }
  2889. };
  2890. /**
  2891. * Scheduler job interface.
  2892. * Will be called by the scheduler.
  2893. */
  2894. Watcher.prototype.run = function run () {
  2895. if (this.active) {
  2896. var value = this.get();
  2897. if (
  2898. value !== this.value ||
  2899. // Deep watchers and watchers on Object/Arrays should fire even
  2900. // when the value is the same, because the value may
  2901. // have mutated.
  2902. isObject(value) ||
  2903. this.deep
  2904. ) {
  2905. // set new value
  2906. var oldValue = this.value;
  2907. this.value = value;
  2908. if (this.user) {
  2909. try {
  2910. this.cb.call(this.vm, value, oldValue);
  2911. } catch (e) {
  2912. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  2913. }
  2914. } else {
  2915. this.cb.call(this.vm, value, oldValue);
  2916. }
  2917. }
  2918. }
  2919. };
  2920. /**
  2921. * Evaluate the value of the watcher.
  2922. * This only gets called for lazy watchers.
  2923. */
  2924. Watcher.prototype.evaluate = function evaluate () {
  2925. this.value = this.get();
  2926. this.dirty = false;
  2927. };
  2928. /**
  2929. * Depend on all deps collected by this watcher.
  2930. */
  2931. Watcher.prototype.depend = function depend () {
  2932. var this$1 = this;
  2933. var i = this.deps.length;
  2934. while (i--) {
  2935. this$1.deps[i].depend();
  2936. }
  2937. };
  2938. /**
  2939. * Remove self from all dependencies' subscriber list.
  2940. */
  2941. Watcher.prototype.teardown = function teardown () {
  2942. var this$1 = this;
  2943. if (this.active) {
  2944. // remove self from vm's watcher list
  2945. // this is a somewhat expensive operation so we skip it
  2946. // if the vm is being destroyed.
  2947. if (!this.vm._isBeingDestroyed) {
  2948. remove(this.vm._watchers, this);
  2949. }
  2950. var i = this.deps.length;
  2951. while (i--) {
  2952. this$1.deps[i].removeSub(this$1);
  2953. }
  2954. this.active = false;
  2955. }
  2956. };
  2957. /* */
  2958. var sharedPropertyDefinition = {
  2959. enumerable: true,
  2960. configurable: true,
  2961. get: noop,
  2962. set: noop
  2963. };
  2964. function proxy (target, sourceKey, key) {
  2965. sharedPropertyDefinition.get = function proxyGetter () {
  2966. return this[sourceKey][key]
  2967. };
  2968. sharedPropertyDefinition.set = function proxySetter (val) {
  2969. this[sourceKey][key] = val;
  2970. };
  2971. Object.defineProperty(target, key, sharedPropertyDefinition);
  2972. }
  2973. function initState (vm) {
  2974. vm._watchers = [];
  2975. var opts = vm.$options;
  2976. if (opts.props) { initProps(vm, opts.props); }
  2977. if (opts.methods) { initMethods(vm, opts.methods); }
  2978. if (opts.data) {
  2979. initData(vm);
  2980. } else {
  2981. observe(vm._data = {}, true /* asRootData */);
  2982. }
  2983. if (opts.computed) { initComputed(vm, opts.computed); }
  2984. if (opts.watch && opts.watch !== nativeWatch) {
  2985. initWatch(vm, opts.watch);
  2986. }
  2987. }
  2988. function initProps (vm, propsOptions) {
  2989. var propsData = vm.$options.propsData || {};
  2990. var props = vm._props = {};
  2991. // cache prop keys so that future props updates can iterate using Array
  2992. // instead of dynamic object key enumeration.
  2993. var keys = vm.$options._propKeys = [];
  2994. var isRoot = !vm.$parent;
  2995. // root instance props should be converted
  2996. observerState.shouldConvert = isRoot;
  2997. var loop = function ( key ) {
  2998. keys.push(key);
  2999. var value = validateProp(key, propsOptions, propsData, vm);
  3000. /* istanbul ignore else */
  3001. {
  3002. var hyphenatedKey = hyphenate(key);
  3003. if (isReservedAttribute(hyphenatedKey) ||
  3004. config.isReservedAttr(hyphenatedKey)) {
  3005. warn(
  3006. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  3007. vm
  3008. );
  3009. }
  3010. defineReactive(props, key, value, function () {
  3011. if (vm.$parent && !isUpdatingChildComponent) {
  3012. warn(
  3013. "Avoid mutating a prop directly since the value will be " +
  3014. "overwritten whenever the parent component re-renders. " +
  3015. "Instead, use a data or computed property based on the prop's " +
  3016. "value. Prop being mutated: \"" + key + "\"",
  3017. vm
  3018. );
  3019. }
  3020. });
  3021. }
  3022. // static props are already proxied on the component's prototype
  3023. // during Vue.extend(). We only need to proxy props defined at
  3024. // instantiation here.
  3025. if (!(key in vm)) {
  3026. proxy(vm, "_props", key);
  3027. }
  3028. };
  3029. for (var key in propsOptions) loop( key );
  3030. observerState.shouldConvert = true;
  3031. }
  3032. function initData (vm) {
  3033. var data = vm.$options.data;
  3034. data = vm._data = typeof data === 'function'
  3035. ? getData(data, vm)
  3036. : data || {};
  3037. if (!isPlainObject(data)) {
  3038. data = {};
  3039. "development" !== 'production' && warn(
  3040. 'data functions should return an object:\n' +
  3041. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  3042. vm
  3043. );
  3044. }
  3045. // proxy data on instance
  3046. var keys = Object.keys(data);
  3047. var props = vm.$options.props;
  3048. var methods = vm.$options.methods;
  3049. var i = keys.length;
  3050. while (i--) {
  3051. var key = keys[i];
  3052. {
  3053. if (methods && hasOwn(methods, key)) {
  3054. warn(
  3055. ("Method \"" + key + "\" has already been defined as a data property."),
  3056. vm
  3057. );
  3058. }
  3059. }
  3060. if (props && hasOwn(props, key)) {
  3061. "development" !== 'production' && warn(
  3062. "The data property \"" + key + "\" is already declared as a prop. " +
  3063. "Use prop default value instead.",
  3064. vm
  3065. );
  3066. } else if (!isReserved(key)) {
  3067. proxy(vm, "_data", key);
  3068. }
  3069. }
  3070. // observe data
  3071. observe(data, true /* asRootData */);
  3072. }
  3073. function getData (data, vm) {
  3074. try {
  3075. return data.call(vm, vm)
  3076. } catch (e) {
  3077. handleError(e, vm, "data()");
  3078. return {}
  3079. }
  3080. }
  3081. var computedWatcherOptions = { lazy: true };
  3082. function initComputed (vm, computed) {
  3083. // $flow-disable-line
  3084. var watchers = vm._computedWatchers = Object.create(null);
  3085. // computed properties are just getters during SSR
  3086. var isSSR = isServerRendering();
  3087. for (var key in computed) {
  3088. var userDef = computed[key];
  3089. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  3090. if ("development" !== 'production' && getter == null) {
  3091. warn(
  3092. ("Getter is missing for computed property \"" + key + "\"."),
  3093. vm
  3094. );
  3095. }
  3096. if (!isSSR) {
  3097. // create internal watcher for the computed property.
  3098. watchers[key] = new Watcher(
  3099. vm,
  3100. getter || noop,
  3101. noop,
  3102. computedWatcherOptions
  3103. );
  3104. }
  3105. // component-defined computed properties are already defined on the
  3106. // component prototype. We only need to define computed properties defined
  3107. // at instantiation here.
  3108. if (!(key in vm)) {
  3109. defineComputed(vm, key, userDef);
  3110. } else {
  3111. if (key in vm.$data) {
  3112. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  3113. } else if (vm.$options.props && key in vm.$options.props) {
  3114. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  3115. }
  3116. }
  3117. }
  3118. }
  3119. function defineComputed (
  3120. target,
  3121. key,
  3122. userDef
  3123. ) {
  3124. var shouldCache = !isServerRendering();
  3125. if (typeof userDef === 'function') {
  3126. sharedPropertyDefinition.get = shouldCache
  3127. ? createComputedGetter(key)
  3128. : userDef;
  3129. sharedPropertyDefinition.set = noop;
  3130. } else {
  3131. sharedPropertyDefinition.get = userDef.get
  3132. ? shouldCache && userDef.cache !== false
  3133. ? createComputedGetter(key)
  3134. : userDef.get
  3135. : noop;
  3136. sharedPropertyDefinition.set = userDef.set
  3137. ? userDef.set
  3138. : noop;
  3139. }
  3140. if ("development" !== 'production' &&
  3141. sharedPropertyDefinition.set === noop) {
  3142. sharedPropertyDefinition.set = function () {
  3143. warn(
  3144. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  3145. this
  3146. );
  3147. };
  3148. }
  3149. Object.defineProperty(target, key, sharedPropertyDefinition);
  3150. }
  3151. function createComputedGetter (key) {
  3152. return function computedGetter () {
  3153. var watcher = this._computedWatchers && this._computedWatchers[key];
  3154. if (watcher) {
  3155. if (watcher.dirty) {
  3156. watcher.evaluate();
  3157. }
  3158. if (Dep.target) {
  3159. watcher.depend();
  3160. }
  3161. return watcher.value
  3162. }
  3163. }
  3164. }
  3165. function initMethods (vm, methods) {
  3166. var props = vm.$options.props;
  3167. for (var key in methods) {
  3168. {
  3169. if (methods[key] == null) {
  3170. warn(
  3171. "Method \"" + key + "\" has an undefined value in the component definition. " +
  3172. "Did you reference the function correctly?",
  3173. vm
  3174. );
  3175. }
  3176. if (props && hasOwn(props, key)) {
  3177. warn(
  3178. ("Method \"" + key + "\" has already been defined as a prop."),
  3179. vm
  3180. );
  3181. }
  3182. if ((key in vm) && isReserved(key)) {
  3183. warn(
  3184. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  3185. "Avoid defining component methods that start with _ or $."
  3186. );
  3187. }
  3188. }
  3189. vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
  3190. }
  3191. }
  3192. function initWatch (vm, watch) {
  3193. for (var key in watch) {
  3194. var handler = watch[key];
  3195. if (Array.isArray(handler)) {
  3196. for (var i = 0; i < handler.length; i++) {
  3197. createWatcher(vm, key, handler[i]);
  3198. }
  3199. } else {
  3200. createWatcher(vm, key, handler);
  3201. }
  3202. }
  3203. }
  3204. function createWatcher (
  3205. vm,
  3206. keyOrFn,
  3207. handler,
  3208. options
  3209. ) {
  3210. if (isPlainObject(handler)) {
  3211. options = handler;
  3212. handler = handler.handler;
  3213. }
  3214. if (typeof handler === 'string') {
  3215. handler = vm[handler];
  3216. }
  3217. return vm.$watch(keyOrFn, handler, options)
  3218. }
  3219. function stateMixin (Vue) {
  3220. // flow somehow has problems with directly declared definition object
  3221. // when using Object.defineProperty, so we have to procedurally build up
  3222. // the object here.
  3223. var dataDef = {};
  3224. dataDef.get = function () { return this._data };
  3225. var propsDef = {};
  3226. propsDef.get = function () { return this._props };
  3227. {
  3228. dataDef.set = function (newData) {
  3229. warn(
  3230. 'Avoid replacing instance root $data. ' +
  3231. 'Use nested data properties instead.',
  3232. this
  3233. );
  3234. };
  3235. propsDef.set = function () {
  3236. warn("$props is readonly.", this);
  3237. };
  3238. }
  3239. Object.defineProperty(Vue.prototype, '$data', dataDef);
  3240. Object.defineProperty(Vue.prototype, '$props', propsDef);
  3241. Vue.prototype.$set = set;
  3242. Vue.prototype.$delete = del;
  3243. Vue.prototype.$watch = function (
  3244. expOrFn,
  3245. cb,
  3246. options
  3247. ) {
  3248. var vm = this;
  3249. if (isPlainObject(cb)) {
  3250. return createWatcher(vm, expOrFn, cb, options)
  3251. }
  3252. options = options || {};
  3253. options.user = true;
  3254. var watcher = new Watcher(vm, expOrFn, cb, options);
  3255. if (options.immediate) {
  3256. cb.call(vm, watcher.value);
  3257. }
  3258. return function unwatchFn () {
  3259. watcher.teardown();
  3260. }
  3261. };
  3262. }
  3263. /* */
  3264. function initProvide (vm) {
  3265. var provide = vm.$options.provide;
  3266. if (provide) {
  3267. vm._provided = typeof provide === 'function'
  3268. ? provide.call(vm)
  3269. : provide;
  3270. }
  3271. }
  3272. function initInjections (vm) {
  3273. var result = resolveInject(vm.$options.inject, vm);
  3274. if (result) {
  3275. observerState.shouldConvert = false;
  3276. Object.keys(result).forEach(function (key) {
  3277. /* istanbul ignore else */
  3278. {
  3279. defineReactive(vm, key, result[key], function () {
  3280. warn(
  3281. "Avoid mutating an injected value directly since the changes will be " +
  3282. "overwritten whenever the provided component re-renders. " +
  3283. "injection being mutated: \"" + key + "\"",
  3284. vm
  3285. );
  3286. });
  3287. }
  3288. });
  3289. observerState.shouldConvert = true;
  3290. }
  3291. }
  3292. function resolveInject (inject, vm) {
  3293. if (inject) {
  3294. // inject is :any because flow is not smart enough to figure out cached
  3295. var result = Object.create(null);
  3296. var keys = hasSymbol
  3297. ? Reflect.ownKeys(inject).filter(function (key) {
  3298. /* istanbul ignore next */
  3299. return Object.getOwnPropertyDescriptor(inject, key).enumerable
  3300. })
  3301. : Object.keys(inject);
  3302. for (var i = 0; i < keys.length; i++) {
  3303. var key = keys[i];
  3304. var provideKey = inject[key].from;
  3305. var source = vm;
  3306. while (source) {
  3307. if (source._provided && provideKey in source._provided) {
  3308. result[key] = source._provided[provideKey];
  3309. break
  3310. }
  3311. source = source.$parent;
  3312. }
  3313. if (!source) {
  3314. if ('default' in inject[key]) {
  3315. var provideDefault = inject[key].default;
  3316. result[key] = typeof provideDefault === 'function'
  3317. ? provideDefault.call(vm)
  3318. : provideDefault;
  3319. } else {
  3320. warn(("Injection \"" + key + "\" not found"), vm);
  3321. }
  3322. }
  3323. }
  3324. return result
  3325. }
  3326. }
  3327. /* */
  3328. /**
  3329. * Runtime helper for rendering v-for lists.
  3330. */
  3331. function renderList (
  3332. val,
  3333. render
  3334. ) {
  3335. var ret, i, l, keys, key;
  3336. if (Array.isArray(val) || typeof val === 'string') {
  3337. ret = new Array(val.length);
  3338. for (i = 0, l = val.length; i < l; i++) {
  3339. ret[i] = render(val[i], i);
  3340. }
  3341. } else if (typeof val === 'number') {
  3342. ret = new Array(val);
  3343. for (i = 0; i < val; i++) {
  3344. ret[i] = render(i + 1, i);
  3345. }
  3346. } else if (isObject(val)) {
  3347. keys = Object.keys(val);
  3348. ret = new Array(keys.length);
  3349. for (i = 0, l = keys.length; i < l; i++) {
  3350. key = keys[i];
  3351. ret[i] = render(val[key], key, i);
  3352. }
  3353. }
  3354. if (isDef(ret)) {
  3355. (ret)._isVList = true;
  3356. }
  3357. return ret
  3358. }
  3359. /* */
  3360. /**
  3361. * Runtime helper for rendering <slot>
  3362. */
  3363. function renderSlot (
  3364. name,
  3365. fallback,
  3366. props,
  3367. bindObject
  3368. ) {
  3369. var scopedSlotFn = this.$scopedSlots[name];
  3370. var nodes;
  3371. if (scopedSlotFn) { // scoped slot
  3372. props = props || {};
  3373. if (bindObject) {
  3374. if ("development" !== 'production' && !isObject(bindObject)) {
  3375. warn(
  3376. 'slot v-bind without argument expects an Object',
  3377. this
  3378. );
  3379. }
  3380. props = extend(extend({}, bindObject), props);
  3381. }
  3382. nodes = scopedSlotFn(props) || fallback;
  3383. } else {
  3384. var slotNodes = this.$slots[name];
  3385. // warn duplicate slot usage
  3386. if (slotNodes) {
  3387. if ("development" !== 'production' && slotNodes._rendered) {
  3388. warn(
  3389. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  3390. "- this will likely cause render errors.",
  3391. this
  3392. );
  3393. }
  3394. slotNodes._rendered = true;
  3395. }
  3396. nodes = slotNodes || fallback;
  3397. }
  3398. var target = props && props.slot;
  3399. if (target) {
  3400. return this.$createElement('template', { slot: target }, nodes)
  3401. } else {
  3402. return nodes
  3403. }
  3404. }
  3405. /* */
  3406. /**
  3407. * Runtime helper for resolving filters
  3408. */
  3409. function resolveFilter (id) {
  3410. return resolveAsset(this.$options, 'filters', id, true) || identity
  3411. }
  3412. /* */
  3413. /**
  3414. * Runtime helper for checking keyCodes from config.
  3415. * exposed as Vue.prototype._k
  3416. * passing in eventKeyName as last argument separately for backwards compat
  3417. */
  3418. function checkKeyCodes (
  3419. eventKeyCode,
  3420. key,
  3421. builtInAlias,
  3422. eventKeyName
  3423. ) {
  3424. var keyCodes = config.keyCodes[key] || builtInAlias;
  3425. if (keyCodes) {
  3426. if (Array.isArray(keyCodes)) {
  3427. return keyCodes.indexOf(eventKeyCode) === -1
  3428. } else {
  3429. return keyCodes !== eventKeyCode
  3430. }
  3431. } else if (eventKeyName) {
  3432. return hyphenate(eventKeyName) !== key
  3433. }
  3434. }
  3435. /* */
  3436. /**
  3437. * Runtime helper for merging v-bind="object" into a VNode's data.
  3438. */
  3439. function bindObjectProps (
  3440. data,
  3441. tag,
  3442. value,
  3443. asProp,
  3444. isSync
  3445. ) {
  3446. if (value) {
  3447. if (!isObject(value)) {
  3448. "development" !== 'production' && warn(
  3449. 'v-bind without argument expects an Object or Array value',
  3450. this
  3451. );
  3452. } else {
  3453. if (Array.isArray(value)) {
  3454. value = toObject(value);
  3455. }
  3456. var hash;
  3457. var loop = function ( key ) {
  3458. if (
  3459. key === 'class' ||
  3460. key === 'style' ||
  3461. isReservedAttribute(key)
  3462. ) {
  3463. hash = data;
  3464. } else {
  3465. var type = data.attrs && data.attrs.type;
  3466. hash = asProp || config.mustUseProp(tag, type, key)
  3467. ? data.domProps || (data.domProps = {})
  3468. : data.attrs || (data.attrs = {});
  3469. }
  3470. if (!(key in hash)) {
  3471. hash[key] = value[key];
  3472. if (isSync) {
  3473. var on = data.on || (data.on = {});
  3474. on[("update:" + key)] = function ($event) {
  3475. value[key] = $event;
  3476. };
  3477. }
  3478. }
  3479. };
  3480. for (var key in value) loop( key );
  3481. }
  3482. }
  3483. return data
  3484. }
  3485. /* */
  3486. /**
  3487. * Runtime helper for rendering static trees.
  3488. */
  3489. function renderStatic (
  3490. index,
  3491. isInFor
  3492. ) {
  3493. var cached = this._staticTrees || (this._staticTrees = []);
  3494. var tree = cached[index];
  3495. // if has already-rendered static tree and not inside v-for,
  3496. // we can reuse the same tree by doing a shallow clone.
  3497. if (tree && !isInFor) {
  3498. return Array.isArray(tree)
  3499. ? cloneVNodes(tree)
  3500. : cloneVNode(tree)
  3501. }
  3502. // otherwise, render a fresh tree.
  3503. tree = cached[index] = this.$options.staticRenderFns[index].call(
  3504. this._renderProxy,
  3505. null,
  3506. this // for render fns generated for functional component templates
  3507. );
  3508. markStatic(tree, ("__static__" + index), false);
  3509. return tree
  3510. }
  3511. /**
  3512. * Runtime helper for v-once.
  3513. * Effectively it means marking the node as static with a unique key.
  3514. */
  3515. function markOnce (
  3516. tree,
  3517. index,
  3518. key
  3519. ) {
  3520. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  3521. return tree
  3522. }
  3523. function markStatic (
  3524. tree,
  3525. key,
  3526. isOnce
  3527. ) {
  3528. if (Array.isArray(tree)) {
  3529. for (var i = 0; i < tree.length; i++) {
  3530. if (tree[i] && typeof tree[i] !== 'string') {
  3531. markStaticNode(tree[i], (key + "_" + i), isOnce);
  3532. }
  3533. }
  3534. } else {
  3535. markStaticNode(tree, key, isOnce);
  3536. }
  3537. }
  3538. function markStaticNode (node, key, isOnce) {
  3539. node.isStatic = true;
  3540. node.key = key;
  3541. node.isOnce = isOnce;
  3542. }
  3543. /* */
  3544. function bindObjectListeners (data, value) {
  3545. if (value) {
  3546. if (!isPlainObject(value)) {
  3547. "development" !== 'production' && warn(
  3548. 'v-on without argument expects an Object value',
  3549. this
  3550. );
  3551. } else {
  3552. var on = data.on = data.on ? extend({}, data.on) : {};
  3553. for (var key in value) {
  3554. var existing = on[key];
  3555. var ours = value[key];
  3556. on[key] = existing ? [].concat(existing, ours) : ours;
  3557. }
  3558. }
  3559. }
  3560. return data
  3561. }
  3562. /* */
  3563. function installRenderHelpers (target) {
  3564. target._o = markOnce;
  3565. target._n = toNumber;
  3566. target._s = toString;
  3567. target._l = renderList;
  3568. target._t = renderSlot;
  3569. target._q = looseEqual;
  3570. target._i = looseIndexOf;
  3571. target._m = renderStatic;
  3572. target._f = resolveFilter;
  3573. target._k = checkKeyCodes;
  3574. target._b = bindObjectProps;
  3575. target._v = createTextVNode;
  3576. target._e = createEmptyVNode;
  3577. target._u = resolveScopedSlots;
  3578. target._g = bindObjectListeners;
  3579. }
  3580. /* */
  3581. function FunctionalRenderContext (
  3582. data,
  3583. props,
  3584. children,
  3585. parent,
  3586. Ctor
  3587. ) {
  3588. var options = Ctor.options;
  3589. this.data = data;
  3590. this.props = props;
  3591. this.children = children;
  3592. this.parent = parent;
  3593. this.listeners = data.on || emptyObject;
  3594. this.injections = resolveInject(options.inject, parent);
  3595. this.slots = function () { return resolveSlots(children, parent); };
  3596. // ensure the createElement function in functional components
  3597. // gets a unique context - this is necessary for correct named slot check
  3598. var contextVm = Object.create(parent);
  3599. var isCompiled = isTrue(options._compiled);
  3600. var needNormalization = !isCompiled;
  3601. // support for compiled functional template
  3602. if (isCompiled) {
  3603. // exposing $options for renderStatic()
  3604. this.$options = options;
  3605. // pre-resolve slots for renderSlot()
  3606. this.$slots = this.slots();
  3607. this.$scopedSlots = data.scopedSlots || emptyObject;
  3608. }
  3609. if (options._scopeId) {
  3610. this._c = function (a, b, c, d) {
  3611. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  3612. if (vnode) {
  3613. vnode.fnScopeId = options._scopeId;
  3614. vnode.fnContext = parent;
  3615. }
  3616. return vnode
  3617. };
  3618. } else {
  3619. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  3620. }
  3621. }
  3622. installRenderHelpers(FunctionalRenderContext.prototype);
  3623. function createFunctionalComponent (
  3624. Ctor,
  3625. propsData,
  3626. data,
  3627. contextVm,
  3628. children
  3629. ) {
  3630. var options = Ctor.options;
  3631. var props = {};
  3632. var propOptions = options.props;
  3633. if (isDef(propOptions)) {
  3634. for (var key in propOptions) {
  3635. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  3636. }
  3637. } else {
  3638. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  3639. if (isDef(data.props)) { mergeProps(props, data.props); }
  3640. }
  3641. var renderContext = new FunctionalRenderContext(
  3642. data,
  3643. props,
  3644. children,
  3645. contextVm,
  3646. Ctor
  3647. );
  3648. var vnode = options.render.call(null, renderContext._c, renderContext);
  3649. if (vnode instanceof VNode) {
  3650. vnode.fnContext = contextVm;
  3651. vnode.fnOptions = options;
  3652. if (data.slot) {
  3653. (vnode.data || (vnode.data = {})).slot = data.slot;
  3654. }
  3655. }
  3656. return vnode
  3657. }
  3658. function mergeProps (to, from) {
  3659. for (var key in from) {
  3660. to[camelize(key)] = from[key];
  3661. }
  3662. }
  3663. /* */
  3664. // Register the component hook to weex native render engine.
  3665. // The hook will be triggered by native, not javascript.
  3666. // Updates the state of the component to weex native render engine.
  3667. /* */
  3668. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  3669. // listening on native callback
  3670. /* */
  3671. /* */
  3672. // hooks to be invoked on component VNodes during patch
  3673. var componentVNodeHooks = {
  3674. init: function init (
  3675. vnode,
  3676. hydrating,
  3677. parentElm,
  3678. refElm
  3679. ) {
  3680. if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
  3681. var child = vnode.componentInstance = createComponentInstanceForVnode(
  3682. vnode,
  3683. activeInstance,
  3684. parentElm,
  3685. refElm
  3686. );
  3687. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  3688. } else if (vnode.data.keepAlive) {
  3689. // kept-alive components, treat as a patch
  3690. var mountedNode = vnode; // work around flow
  3691. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  3692. }
  3693. },
  3694. prepatch: function prepatch (oldVnode, vnode) {
  3695. var options = vnode.componentOptions;
  3696. var child = vnode.componentInstance = oldVnode.componentInstance;
  3697. updateChildComponent(
  3698. child,
  3699. options.propsData, // updated props
  3700. options.listeners, // updated listeners
  3701. vnode, // new parent vnode
  3702. options.children // new children
  3703. );
  3704. },
  3705. insert: function insert (vnode) {
  3706. var context = vnode.context;
  3707. var componentInstance = vnode.componentInstance;
  3708. if (!componentInstance._isMounted) {
  3709. componentInstance._isMounted = true;
  3710. callHook(componentInstance, 'mounted');
  3711. }
  3712. if (vnode.data.keepAlive) {
  3713. if (context._isMounted) {
  3714. // vue-router#1212
  3715. // During updates, a kept-alive component's child components may
  3716. // change, so directly walking the tree here may call activated hooks
  3717. // on incorrect children. Instead we push them into a queue which will
  3718. // be processed after the whole patch process ended.
  3719. queueActivatedComponent(componentInstance);
  3720. } else {
  3721. activateChildComponent(componentInstance, true /* direct */);
  3722. }
  3723. }
  3724. },
  3725. destroy: function destroy (vnode) {
  3726. var componentInstance = vnode.componentInstance;
  3727. if (!componentInstance._isDestroyed) {
  3728. if (!vnode.data.keepAlive) {
  3729. componentInstance.$destroy();
  3730. } else {
  3731. deactivateChildComponent(componentInstance, true /* direct */);
  3732. }
  3733. }
  3734. }
  3735. };
  3736. var hooksToMerge = Object.keys(componentVNodeHooks);
  3737. function createComponent (
  3738. Ctor,
  3739. data,
  3740. context,
  3741. children,
  3742. tag
  3743. ) {
  3744. if (isUndef(Ctor)) {
  3745. return
  3746. }
  3747. var baseCtor = context.$options._base;
  3748. // plain options object: turn it into a constructor
  3749. if (isObject(Ctor)) {
  3750. Ctor = baseCtor.extend(Ctor);
  3751. }
  3752. // if at this stage it's not a constructor or an async component factory,
  3753. // reject.
  3754. if (typeof Ctor !== 'function') {
  3755. {
  3756. warn(("Invalid Component definition: " + (String(Ctor))), context);
  3757. }
  3758. return
  3759. }
  3760. // async component
  3761. var asyncFactory;
  3762. if (isUndef(Ctor.cid)) {
  3763. asyncFactory = Ctor;
  3764. Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
  3765. if (Ctor === undefined) {
  3766. // return a placeholder node for async component, which is rendered
  3767. // as a comment node but preserves all the raw information for the node.
  3768. // the information will be used for async server-rendering and hydration.
  3769. return createAsyncPlaceholder(
  3770. asyncFactory,
  3771. data,
  3772. context,
  3773. children,
  3774. tag
  3775. )
  3776. }
  3777. }
  3778. data = data || {};
  3779. // resolve constructor options in case global mixins are applied after
  3780. // component constructor creation
  3781. resolveConstructorOptions(Ctor);
  3782. // transform component v-model data into props & events
  3783. if (isDef(data.model)) {
  3784. transformModel(Ctor.options, data);
  3785. }
  3786. // extract props
  3787. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  3788. // functional component
  3789. if (isTrue(Ctor.options.functional)) {
  3790. return createFunctionalComponent(Ctor, propsData, data, context, children)
  3791. }
  3792. // extract listeners, since these needs to be treated as
  3793. // child component listeners instead of DOM listeners
  3794. var listeners = data.on;
  3795. // replace with listeners with .native modifier
  3796. // so it gets processed during parent component patch.
  3797. data.on = data.nativeOn;
  3798. if (isTrue(Ctor.options.abstract)) {
  3799. // abstract components do not keep anything
  3800. // other than props & listeners & slot
  3801. // work around flow
  3802. var slot = data.slot;
  3803. data = {};
  3804. if (slot) {
  3805. data.slot = slot;
  3806. }
  3807. }
  3808. // merge component management hooks onto the placeholder node
  3809. mergeHooks(data);
  3810. // return a placeholder vnode
  3811. var name = Ctor.options.name || tag;
  3812. var vnode = new VNode(
  3813. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  3814. data, undefined, undefined, undefined, context,
  3815. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  3816. asyncFactory
  3817. );
  3818. // Weex specific: invoke recycle-list optimized @render function for
  3819. // extracting cell-slot template.
  3820. // https://github.com/Hanks10100/weex-native-directive/tree/master/component
  3821. /* istanbul ignore if */
  3822. return vnode
  3823. }
  3824. function createComponentInstanceForVnode (
  3825. vnode, // we know it's MountedComponentVNode but flow doesn't
  3826. parent, // activeInstance in lifecycle state
  3827. parentElm,
  3828. refElm
  3829. ) {
  3830. var options = {
  3831. _isComponent: true,
  3832. parent: parent,
  3833. _parentVnode: vnode,
  3834. _parentElm: parentElm || null,
  3835. _refElm: refElm || null
  3836. };
  3837. // check inline-template render functions
  3838. var inlineTemplate = vnode.data.inlineTemplate;
  3839. if (isDef(inlineTemplate)) {
  3840. options.render = inlineTemplate.render;
  3841. options.staticRenderFns = inlineTemplate.staticRenderFns;
  3842. }
  3843. return new vnode.componentOptions.Ctor(options)
  3844. }
  3845. function mergeHooks (data) {
  3846. if (!data.hook) {
  3847. data.hook = {};
  3848. }
  3849. for (var i = 0; i < hooksToMerge.length; i++) {
  3850. var key = hooksToMerge[i];
  3851. var fromParent = data.hook[key];
  3852. var ours = componentVNodeHooks[key];
  3853. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  3854. }
  3855. }
  3856. function mergeHook$1 (one, two) {
  3857. return function (a, b, c, d) {
  3858. one(a, b, c, d);
  3859. two(a, b, c, d);
  3860. }
  3861. }
  3862. // transform component v-model info (value and callback) into
  3863. // prop and event handler respectively.
  3864. function transformModel (options, data) {
  3865. var prop = (options.model && options.model.prop) || 'value';
  3866. var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
  3867. var on = data.on || (data.on = {});
  3868. if (isDef(on[event])) {
  3869. on[event] = [data.model.callback].concat(on[event]);
  3870. } else {
  3871. on[event] = data.model.callback;
  3872. }
  3873. }
  3874. /* */
  3875. var SIMPLE_NORMALIZE = 1;
  3876. var ALWAYS_NORMALIZE = 2;
  3877. // wrapper function for providing a more flexible interface
  3878. // without getting yelled at by flow
  3879. function createElement (
  3880. context,
  3881. tag,
  3882. data,
  3883. children,
  3884. normalizationType,
  3885. alwaysNormalize
  3886. ) {
  3887. if (Array.isArray(data) || isPrimitive(data)) {
  3888. normalizationType = children;
  3889. children = data;
  3890. data = undefined;
  3891. }
  3892. if (isTrue(alwaysNormalize)) {
  3893. normalizationType = ALWAYS_NORMALIZE;
  3894. }
  3895. return _createElement(context, tag, data, children, normalizationType)
  3896. }
  3897. function _createElement (
  3898. context,
  3899. tag,
  3900. data,
  3901. children,
  3902. normalizationType
  3903. ) {
  3904. if (isDef(data) && isDef((data).__ob__)) {
  3905. "development" !== 'production' && warn(
  3906. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3907. 'Always create fresh vnode data objects in each render!',
  3908. context
  3909. );
  3910. return createEmptyVNode()
  3911. }
  3912. // object syntax in v-bind
  3913. if (isDef(data) && isDef(data.is)) {
  3914. tag = data.is;
  3915. }
  3916. if (!tag) {
  3917. // in case of component :is set to falsy value
  3918. return createEmptyVNode()
  3919. }
  3920. // warn against non-primitive key
  3921. if ("development" !== 'production' &&
  3922. isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3923. ) {
  3924. {
  3925. warn(
  3926. 'Avoid using non-primitive value as key, ' +
  3927. 'use string/number value instead.',
  3928. context
  3929. );
  3930. }
  3931. }
  3932. // support single function children as default scoped slot
  3933. if (Array.isArray(children) &&
  3934. typeof children[0] === 'function'
  3935. ) {
  3936. data = data || {};
  3937. data.scopedSlots = { default: children[0] };
  3938. children.length = 0;
  3939. }
  3940. if (normalizationType === ALWAYS_NORMALIZE) {
  3941. children = normalizeChildren(children);
  3942. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3943. children = simpleNormalizeChildren(children);
  3944. }
  3945. var vnode, ns;
  3946. if (typeof tag === 'string') {
  3947. var Ctor;
  3948. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3949. if (config.isReservedTag(tag)) {
  3950. // platform built-in elements
  3951. vnode = new VNode(
  3952. config.parsePlatformTagName(tag), data, children,
  3953. undefined, undefined, context
  3954. );
  3955. } else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3956. // component
  3957. vnode = createComponent(Ctor, data, context, children, tag);
  3958. } else {
  3959. // unknown or unlisted namespaced elements
  3960. // check at runtime because it may get assigned a namespace when its
  3961. // parent normalizes children
  3962. vnode = new VNode(
  3963. tag, data, children,
  3964. undefined, undefined, context
  3965. );
  3966. }
  3967. } else {
  3968. // direct component options / constructor
  3969. vnode = createComponent(tag, data, context, children);
  3970. }
  3971. if (isDef(vnode)) {
  3972. if (ns) { applyNS(vnode, ns); }
  3973. return vnode
  3974. } else {
  3975. return createEmptyVNode()
  3976. }
  3977. }
  3978. function applyNS (vnode, ns, force) {
  3979. vnode.ns = ns;
  3980. if (vnode.tag === 'foreignObject') {
  3981. // use default namespace inside foreignObject
  3982. ns = undefined;
  3983. force = true;
  3984. }
  3985. if (isDef(vnode.children)) {
  3986. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3987. var child = vnode.children[i];
  3988. if (isDef(child.tag) && (isUndef(child.ns) || isTrue(force))) {
  3989. applyNS(child, ns, force);
  3990. }
  3991. }
  3992. }
  3993. }
  3994. /* */
  3995. function initRender (vm) {
  3996. vm._vnode = null; // the root of the child tree
  3997. vm._staticTrees = null; // v-once cached trees
  3998. var options = vm.$options;
  3999. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  4000. var renderContext = parentVnode && parentVnode.context;
  4001. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  4002. vm.$scopedSlots = emptyObject;
  4003. // bind the createElement fn to this instance
  4004. // so that we get proper render context inside it.
  4005. // args order: tag, data, children, normalizationType, alwaysNormalize
  4006. // internal version is used by render functions compiled from templates
  4007. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  4008. // normalization is always applied for the public version, used in
  4009. // user-written render functions.
  4010. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  4011. // $attrs & $listeners are exposed for easier HOC creation.
  4012. // they need to be reactive so that HOCs using them are always updated
  4013. var parentData = parentVnode && parentVnode.data;
  4014. /* istanbul ignore else */
  4015. {
  4016. defineReactive(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  4017. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  4018. }, true);
  4019. defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
  4020. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  4021. }, true);
  4022. }
  4023. }
  4024. function renderMixin (Vue) {
  4025. // install runtime convenience helpers
  4026. installRenderHelpers(Vue.prototype);
  4027. Vue.prototype.$nextTick = function (fn) {
  4028. return nextTick(fn, this)
  4029. };
  4030. Vue.prototype._render = function () {
  4031. var vm = this;
  4032. var ref = vm.$options;
  4033. var render = ref.render;
  4034. var _parentVnode = ref._parentVnode;
  4035. if (vm._isMounted) {
  4036. // if the parent didn't update, the slot nodes will be the ones from
  4037. // last render. They need to be cloned to ensure "freshness" for this render.
  4038. for (var key in vm.$slots) {
  4039. var slot = vm.$slots[key];
  4040. // _rendered is a flag added by renderSlot, but may not be present
  4041. // if the slot is passed from manually written render functions
  4042. if (slot._rendered || (slot[0] && slot[0].elm)) {
  4043. vm.$slots[key] = cloneVNodes(slot, true /* deep */);
  4044. }
  4045. }
  4046. }
  4047. vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
  4048. // set parent vnode. this allows render functions to have access
  4049. // to the data on the placeholder node.
  4050. vm.$vnode = _parentVnode;
  4051. // render self
  4052. var vnode;
  4053. try {
  4054. vnode = render.call(vm._renderProxy, vm.$createElement);
  4055. } catch (e) {
  4056. handleError(e, vm, "render");
  4057. // return error render result,
  4058. // or previous vnode to prevent render error causing blank component
  4059. /* istanbul ignore else */
  4060. {
  4061. if (vm.$options.renderError) {
  4062. try {
  4063. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  4064. } catch (e) {
  4065. handleError(e, vm, "renderError");
  4066. vnode = vm._vnode;
  4067. }
  4068. } else {
  4069. vnode = vm._vnode;
  4070. }
  4071. }
  4072. }
  4073. // return empty vnode in case the render function errored out
  4074. if (!(vnode instanceof VNode)) {
  4075. if ("development" !== 'production' && Array.isArray(vnode)) {
  4076. warn(
  4077. 'Multiple root nodes returned from render function. Render function ' +
  4078. 'should return a single root node.',
  4079. vm
  4080. );
  4081. }
  4082. vnode = createEmptyVNode();
  4083. }
  4084. // set parent
  4085. vnode.parent = _parentVnode;
  4086. return vnode
  4087. };
  4088. }
  4089. /* */
  4090. var uid$1 = 0;
  4091. function initMixin (Vue) {
  4092. Vue.prototype._init = function (options) {
  4093. var vm = this;
  4094. // a uid
  4095. vm._uid = uid$1++;
  4096. var startTag, endTag;
  4097. /* istanbul ignore if */
  4098. if ("development" !== 'production' && config.performance && mark) {
  4099. startTag = "vue-perf-start:" + (vm._uid);
  4100. endTag = "vue-perf-end:" + (vm._uid);
  4101. mark(startTag);
  4102. }
  4103. // a flag to avoid this being observed
  4104. vm._isVue = true;
  4105. // merge options
  4106. if (options && options._isComponent) {
  4107. // optimize internal component instantiation
  4108. // since dynamic options merging is pretty slow, and none of the
  4109. // internal component options needs special treatment.
  4110. initInternalComponent(vm, options);
  4111. } else {
  4112. vm.$options = mergeOptions(
  4113. resolveConstructorOptions(vm.constructor),
  4114. options || {},
  4115. vm
  4116. );
  4117. }
  4118. /* istanbul ignore else */
  4119. {
  4120. initProxy(vm);
  4121. }
  4122. // expose real self
  4123. vm._self = vm;
  4124. initLifecycle(vm);
  4125. initEvents(vm);
  4126. initRender(vm);
  4127. callHook(vm, 'beforeCreate');
  4128. initInjections(vm); // resolve injections before data/props
  4129. initState(vm);
  4130. initProvide(vm); // resolve provide after data/props
  4131. callHook(vm, 'created');
  4132. /* istanbul ignore if */
  4133. if ("development" !== 'production' && config.performance && mark) {
  4134. vm._name = formatComponentName(vm, false);
  4135. mark(endTag);
  4136. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4137. }
  4138. if (vm.$options.el) {
  4139. vm.$mount(vm.$options.el);
  4140. }
  4141. };
  4142. }
  4143. function initInternalComponent (vm, options) {
  4144. var opts = vm.$options = Object.create(vm.constructor.options);
  4145. // doing this because it's faster than dynamic enumeration.
  4146. var parentVnode = options._parentVnode;
  4147. opts.parent = options.parent;
  4148. opts._parentVnode = parentVnode;
  4149. opts._parentElm = options._parentElm;
  4150. opts._refElm = options._refElm;
  4151. var vnodeComponentOptions = parentVnode.componentOptions;
  4152. opts.propsData = vnodeComponentOptions.propsData;
  4153. opts._parentListeners = vnodeComponentOptions.listeners;
  4154. opts._renderChildren = vnodeComponentOptions.children;
  4155. opts._componentTag = vnodeComponentOptions.tag;
  4156. if (options.render) {
  4157. opts.render = options.render;
  4158. opts.staticRenderFns = options.staticRenderFns;
  4159. }
  4160. }
  4161. function resolveConstructorOptions (Ctor) {
  4162. var options = Ctor.options;
  4163. if (Ctor.super) {
  4164. var superOptions = resolveConstructorOptions(Ctor.super);
  4165. var cachedSuperOptions = Ctor.superOptions;
  4166. if (superOptions !== cachedSuperOptions) {
  4167. // super option changed,
  4168. // need to resolve new options.
  4169. Ctor.superOptions = superOptions;
  4170. // check if there are any late-modified/attached options (#4976)
  4171. var modifiedOptions = resolveModifiedOptions(Ctor);
  4172. // update base extend options
  4173. if (modifiedOptions) {
  4174. extend(Ctor.extendOptions, modifiedOptions);
  4175. }
  4176. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4177. if (options.name) {
  4178. options.components[options.name] = Ctor;
  4179. }
  4180. }
  4181. }
  4182. return options
  4183. }
  4184. function resolveModifiedOptions (Ctor) {
  4185. var modified;
  4186. var latest = Ctor.options;
  4187. var extended = Ctor.extendOptions;
  4188. var sealed = Ctor.sealedOptions;
  4189. for (var key in latest) {
  4190. if (latest[key] !== sealed[key]) {
  4191. if (!modified) { modified = {}; }
  4192. modified[key] = dedupe(latest[key], extended[key], sealed[key]);
  4193. }
  4194. }
  4195. return modified
  4196. }
  4197. function dedupe (latest, extended, sealed) {
  4198. // compare latest and sealed to ensure lifecycle hooks won't be duplicated
  4199. // between merges
  4200. if (Array.isArray(latest)) {
  4201. var res = [];
  4202. sealed = Array.isArray(sealed) ? sealed : [sealed];
  4203. extended = Array.isArray(extended) ? extended : [extended];
  4204. for (var i = 0; i < latest.length; i++) {
  4205. // push original options and not sealed options to exclude duplicated options
  4206. if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
  4207. res.push(latest[i]);
  4208. }
  4209. }
  4210. return res
  4211. } else {
  4212. return latest
  4213. }
  4214. }
  4215. function Vue$3 (options) {
  4216. if ("development" !== 'production' &&
  4217. !(this instanceof Vue$3)
  4218. ) {
  4219. warn('Vue is a constructor and should be called with the `new` keyword');
  4220. }
  4221. this._init(options);
  4222. }
  4223. initMixin(Vue$3);
  4224. stateMixin(Vue$3);
  4225. eventsMixin(Vue$3);
  4226. lifecycleMixin(Vue$3);
  4227. renderMixin(Vue$3);
  4228. /* */
  4229. function initUse (Vue) {
  4230. Vue.use = function (plugin) {
  4231. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4232. if (installedPlugins.indexOf(plugin) > -1) {
  4233. return this
  4234. }
  4235. // additional parameters
  4236. var args = toArray(arguments, 1);
  4237. args.unshift(this);
  4238. if (typeof plugin.install === 'function') {
  4239. plugin.install.apply(plugin, args);
  4240. } else if (typeof plugin === 'function') {
  4241. plugin.apply(null, args);
  4242. }
  4243. installedPlugins.push(plugin);
  4244. return this
  4245. };
  4246. }
  4247. /* */
  4248. function initMixin$1 (Vue) {
  4249. Vue.mixin = function (mixin) {
  4250. this.options = mergeOptions(this.options, mixin);
  4251. return this
  4252. };
  4253. }
  4254. /* */
  4255. function initExtend (Vue) {
  4256. /**
  4257. * Each instance constructor, including Vue, has a unique
  4258. * cid. This enables us to create wrapped "child
  4259. * constructors" for prototypal inheritance and cache them.
  4260. */
  4261. Vue.cid = 0;
  4262. var cid = 1;
  4263. /**
  4264. * Class inheritance
  4265. */
  4266. Vue.extend = function (extendOptions) {
  4267. extendOptions = extendOptions || {};
  4268. var Super = this;
  4269. var SuperId = Super.cid;
  4270. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4271. if (cachedCtors[SuperId]) {
  4272. return cachedCtors[SuperId]
  4273. }
  4274. var name = extendOptions.name || Super.options.name;
  4275. if ("development" !== 'production' && name) {
  4276. validateComponentName(name);
  4277. }
  4278. var Sub = function VueComponent (options) {
  4279. this._init(options);
  4280. };
  4281. Sub.prototype = Object.create(Super.prototype);
  4282. Sub.prototype.constructor = Sub;
  4283. Sub.cid = cid++;
  4284. Sub.options = mergeOptions(
  4285. Super.options,
  4286. extendOptions
  4287. );
  4288. Sub['super'] = Super;
  4289. // For props and computed properties, we define the proxy getters on
  4290. // the Vue instances at extension time, on the extended prototype. This
  4291. // avoids Object.defineProperty calls for each instance created.
  4292. if (Sub.options.props) {
  4293. initProps$1(Sub);
  4294. }
  4295. if (Sub.options.computed) {
  4296. initComputed$1(Sub);
  4297. }
  4298. // allow further extension/mixin/plugin usage
  4299. Sub.extend = Super.extend;
  4300. Sub.mixin = Super.mixin;
  4301. Sub.use = Super.use;
  4302. // create asset registers, so extended classes
  4303. // can have their private assets too.
  4304. ASSET_TYPES.forEach(function (type) {
  4305. Sub[type] = Super[type];
  4306. });
  4307. // enable recursive self-lookup
  4308. if (name) {
  4309. Sub.options.components[name] = Sub;
  4310. }
  4311. // keep a reference to the super options at extension time.
  4312. // later at instantiation we can check if Super's options have
  4313. // been updated.
  4314. Sub.superOptions = Super.options;
  4315. Sub.extendOptions = extendOptions;
  4316. Sub.sealedOptions = extend({}, Sub.options);
  4317. // cache constructor
  4318. cachedCtors[SuperId] = Sub;
  4319. return Sub
  4320. };
  4321. }
  4322. function initProps$1 (Comp) {
  4323. var props = Comp.options.props;
  4324. for (var key in props) {
  4325. proxy(Comp.prototype, "_props", key);
  4326. }
  4327. }
  4328. function initComputed$1 (Comp) {
  4329. var computed = Comp.options.computed;
  4330. for (var key in computed) {
  4331. defineComputed(Comp.prototype, key, computed[key]);
  4332. }
  4333. }
  4334. /* */
  4335. function initAssetRegisters (Vue) {
  4336. /**
  4337. * Create asset registration methods.
  4338. */
  4339. ASSET_TYPES.forEach(function (type) {
  4340. Vue[type] = function (
  4341. id,
  4342. definition
  4343. ) {
  4344. if (!definition) {
  4345. return this.options[type + 's'][id]
  4346. } else {
  4347. /* istanbul ignore if */
  4348. if ("development" !== 'production' && type === 'component') {
  4349. validateComponentName(id);
  4350. }
  4351. if (type === 'component' && isPlainObject(definition)) {
  4352. definition.name = definition.name || id;
  4353. definition = this.options._base.extend(definition);
  4354. }
  4355. if (type === 'directive' && typeof definition === 'function') {
  4356. definition = { bind: definition, update: definition };
  4357. }
  4358. this.options[type + 's'][id] = definition;
  4359. return definition
  4360. }
  4361. };
  4362. });
  4363. }
  4364. /* */
  4365. function getComponentName (opts) {
  4366. return opts && (opts.Ctor.options.name || opts.tag)
  4367. }
  4368. function matches (pattern, name) {
  4369. if (Array.isArray(pattern)) {
  4370. return pattern.indexOf(name) > -1
  4371. } else if (typeof pattern === 'string') {
  4372. return pattern.split(',').indexOf(name) > -1
  4373. } else if (isRegExp(pattern)) {
  4374. return pattern.test(name)
  4375. }
  4376. /* istanbul ignore next */
  4377. return false
  4378. }
  4379. function pruneCache (keepAliveInstance, filter) {
  4380. var cache = keepAliveInstance.cache;
  4381. var keys = keepAliveInstance.keys;
  4382. var _vnode = keepAliveInstance._vnode;
  4383. for (var key in cache) {
  4384. var cachedNode = cache[key];
  4385. if (cachedNode) {
  4386. var name = getComponentName(cachedNode.componentOptions);
  4387. if (name && !filter(name)) {
  4388. pruneCacheEntry(cache, key, keys, _vnode);
  4389. }
  4390. }
  4391. }
  4392. }
  4393. function pruneCacheEntry (
  4394. cache,
  4395. key,
  4396. keys,
  4397. current
  4398. ) {
  4399. var cached$$1 = cache[key];
  4400. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4401. cached$$1.componentInstance.$destroy();
  4402. }
  4403. cache[key] = null;
  4404. remove(keys, key);
  4405. }
  4406. var patternTypes = [String, RegExp, Array];
  4407. var KeepAlive = {
  4408. name: 'keep-alive',
  4409. abstract: true,
  4410. props: {
  4411. include: patternTypes,
  4412. exclude: patternTypes,
  4413. max: [String, Number]
  4414. },
  4415. created: function created () {
  4416. this.cache = Object.create(null);
  4417. this.keys = [];
  4418. },
  4419. destroyed: function destroyed () {
  4420. var this$1 = this;
  4421. for (var key in this$1.cache) {
  4422. pruneCacheEntry(this$1.cache, key, this$1.keys);
  4423. }
  4424. },
  4425. watch: {
  4426. include: function include (val) {
  4427. pruneCache(this, function (name) { return matches(val, name); });
  4428. },
  4429. exclude: function exclude (val) {
  4430. pruneCache(this, function (name) { return !matches(val, name); });
  4431. }
  4432. },
  4433. render: function render () {
  4434. var slot = this.$slots.default;
  4435. var vnode = getFirstComponentChild(slot);
  4436. var componentOptions = vnode && vnode.componentOptions;
  4437. if (componentOptions) {
  4438. // check pattern
  4439. var name = getComponentName(componentOptions);
  4440. var ref = this;
  4441. var include = ref.include;
  4442. var exclude = ref.exclude;
  4443. if (
  4444. // not included
  4445. (include && (!name || !matches(include, name))) ||
  4446. // excluded
  4447. (exclude && name && matches(exclude, name))
  4448. ) {
  4449. return vnode
  4450. }
  4451. var ref$1 = this;
  4452. var cache = ref$1.cache;
  4453. var keys = ref$1.keys;
  4454. var key = vnode.key == null
  4455. // same constructor may get registered as different local components
  4456. // so cid alone is not enough (#3269)
  4457. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4458. : vnode.key;
  4459. if (cache[key]) {
  4460. vnode.componentInstance = cache[key].componentInstance;
  4461. // make current key freshest
  4462. remove(keys, key);
  4463. keys.push(key);
  4464. } else {
  4465. cache[key] = vnode;
  4466. keys.push(key);
  4467. // prune oldest entry
  4468. if (this.max && keys.length > parseInt(this.max)) {
  4469. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4470. }
  4471. }
  4472. vnode.data.keepAlive = true;
  4473. }
  4474. return vnode || (slot && slot[0])
  4475. }
  4476. };
  4477. var builtInComponents = {
  4478. KeepAlive: KeepAlive
  4479. };
  4480. /* */
  4481. function initGlobalAPI (Vue) {
  4482. // config
  4483. var configDef = {};
  4484. configDef.get = function () { return config; };
  4485. {
  4486. configDef.set = function () {
  4487. warn(
  4488. 'Do not replace the Vue.config object, set individual fields instead.'
  4489. );
  4490. };
  4491. }
  4492. Object.defineProperty(Vue, 'config', configDef);
  4493. // exposed util methods.
  4494. // NOTE: these are not considered part of the public API - avoid relying on
  4495. // them unless you are aware of the risk.
  4496. Vue.util = {
  4497. warn: warn,
  4498. extend: extend,
  4499. mergeOptions: mergeOptions,
  4500. defineReactive: defineReactive
  4501. };
  4502. Vue.set = set;
  4503. Vue.delete = del;
  4504. Vue.nextTick = nextTick;
  4505. Vue.options = Object.create(null);
  4506. ASSET_TYPES.forEach(function (type) {
  4507. Vue.options[type + 's'] = Object.create(null);
  4508. });
  4509. // this is used to identify the "base" constructor to extend all plain-object
  4510. // components with in Weex's multi-instance scenarios.
  4511. Vue.options._base = Vue;
  4512. extend(Vue.options.components, builtInComponents);
  4513. initUse(Vue);
  4514. initMixin$1(Vue);
  4515. initExtend(Vue);
  4516. initAssetRegisters(Vue);
  4517. }
  4518. initGlobalAPI(Vue$3);
  4519. Object.defineProperty(Vue$3.prototype, '$isServer', {
  4520. get: isServerRendering
  4521. });
  4522. Object.defineProperty(Vue$3.prototype, '$ssrContext', {
  4523. get: function get () {
  4524. /* istanbul ignore next */
  4525. return this.$vnode && this.$vnode.ssrContext
  4526. }
  4527. });
  4528. Vue$3.version = '2.5.13';
  4529. /* */
  4530. // these are reserved for web because they are directly compiled away
  4531. // during template compilation
  4532. var isReservedAttr = makeMap('style,class');
  4533. // attributes that should be using props for binding
  4534. var acceptValue = makeMap('input,textarea,option,select,progress');
  4535. var mustUseProp = function (tag, type, attr) {
  4536. return (
  4537. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4538. (attr === 'selected' && tag === 'option') ||
  4539. (attr === 'checked' && tag === 'input') ||
  4540. (attr === 'muted' && tag === 'video')
  4541. )
  4542. };
  4543. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4544. var isBooleanAttr = makeMap(
  4545. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4546. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4547. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4548. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4549. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4550. 'truespeed,typemustmatch,visible'
  4551. );
  4552. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4553. var isXlink = function (name) {
  4554. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4555. };
  4556. var getXlinkProp = function (name) {
  4557. return isXlink(name) ? name.slice(6, name.length) : ''
  4558. };
  4559. var isFalsyAttrValue = function (val) {
  4560. return val == null || val === false
  4561. };
  4562. /* */
  4563. function genClassForVnode (vnode) {
  4564. var data = vnode.data;
  4565. var parentNode = vnode;
  4566. var childNode = vnode;
  4567. while (isDef(childNode.componentInstance)) {
  4568. childNode = childNode.componentInstance._vnode;
  4569. if (childNode && childNode.data) {
  4570. data = mergeClassData(childNode.data, data);
  4571. }
  4572. }
  4573. while (isDef(parentNode = parentNode.parent)) {
  4574. if (parentNode && parentNode.data) {
  4575. data = mergeClassData(data, parentNode.data);
  4576. }
  4577. }
  4578. return renderClass(data.staticClass, data.class)
  4579. }
  4580. function mergeClassData (child, parent) {
  4581. return {
  4582. staticClass: concat(child.staticClass, parent.staticClass),
  4583. class: isDef(child.class)
  4584. ? [child.class, parent.class]
  4585. : parent.class
  4586. }
  4587. }
  4588. function renderClass (
  4589. staticClass,
  4590. dynamicClass
  4591. ) {
  4592. if (isDef(staticClass) || isDef(dynamicClass)) {
  4593. return concat(staticClass, stringifyClass(dynamicClass))
  4594. }
  4595. /* istanbul ignore next */
  4596. return ''
  4597. }
  4598. function concat (a, b) {
  4599. return a ? b ? (a + ' ' + b) : a : (b || '')
  4600. }
  4601. function stringifyClass (value) {
  4602. if (Array.isArray(value)) {
  4603. return stringifyArray(value)
  4604. }
  4605. if (isObject(value)) {
  4606. return stringifyObject(value)
  4607. }
  4608. if (typeof value === 'string') {
  4609. return value
  4610. }
  4611. /* istanbul ignore next */
  4612. return ''
  4613. }
  4614. function stringifyArray (value) {
  4615. var res = '';
  4616. var stringified;
  4617. for (var i = 0, l = value.length; i < l; i++) {
  4618. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  4619. if (res) { res += ' '; }
  4620. res += stringified;
  4621. }
  4622. }
  4623. return res
  4624. }
  4625. function stringifyObject (value) {
  4626. var res = '';
  4627. for (var key in value) {
  4628. if (value[key]) {
  4629. if (res) { res += ' '; }
  4630. res += key;
  4631. }
  4632. }
  4633. return res
  4634. }
  4635. /* */
  4636. var namespaceMap = {
  4637. svg: 'http://www.w3.org/2000/svg',
  4638. math: 'http://www.w3.org/1998/Math/MathML'
  4639. };
  4640. var isHTMLTag = makeMap(
  4641. 'html,body,base,head,link,meta,style,title,' +
  4642. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  4643. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  4644. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  4645. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  4646. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  4647. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  4648. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  4649. 'output,progress,select,textarea,' +
  4650. 'details,dialog,menu,menuitem,summary,' +
  4651. 'content,element,shadow,template,blockquote,iframe,tfoot'
  4652. );
  4653. // this map is intentionally selective, only covering SVG elements that may
  4654. // contain child elements.
  4655. var isSVG = makeMap(
  4656. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  4657. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  4658. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  4659. true
  4660. );
  4661. var isPreTag = function (tag) { return tag === 'pre'; };
  4662. var isReservedTag = function (tag) {
  4663. return isHTMLTag(tag) || isSVG(tag)
  4664. };
  4665. function getTagNamespace (tag) {
  4666. if (isSVG(tag)) {
  4667. return 'svg'
  4668. }
  4669. // basic support for MathML
  4670. // note it doesn't support other MathML elements being component roots
  4671. if (tag === 'math') {
  4672. return 'math'
  4673. }
  4674. }
  4675. var unknownElementCache = Object.create(null);
  4676. function isUnknownElement (tag) {
  4677. /* istanbul ignore if */
  4678. if (!inBrowser) {
  4679. return true
  4680. }
  4681. if (isReservedTag(tag)) {
  4682. return false
  4683. }
  4684. tag = tag.toLowerCase();
  4685. /* istanbul ignore if */
  4686. if (unknownElementCache[tag] != null) {
  4687. return unknownElementCache[tag]
  4688. }
  4689. var el = document.createElement(tag);
  4690. if (tag.indexOf('-') > -1) {
  4691. // http://stackoverflow.com/a/28210364/1070244
  4692. return (unknownElementCache[tag] = (
  4693. el.constructor === window.HTMLUnknownElement ||
  4694. el.constructor === window.HTMLElement
  4695. ))
  4696. } else {
  4697. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  4698. }
  4699. }
  4700. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  4701. /* */
  4702. /**
  4703. * Query an element selector if it's not an element already.
  4704. */
  4705. function query (el) {
  4706. if (typeof el === 'string') {
  4707. var selected = document.querySelector(el);
  4708. if (!selected) {
  4709. "development" !== 'production' && warn(
  4710. 'Cannot find element: ' + el
  4711. );
  4712. return document.createElement('div')
  4713. }
  4714. return selected
  4715. } else {
  4716. return el
  4717. }
  4718. }
  4719. /* */
  4720. function createElement$1 (tagName, vnode) {
  4721. var elm = document.createElement(tagName);
  4722. if (tagName !== 'select') {
  4723. return elm
  4724. }
  4725. // false or null will remove the attribute but undefined will not
  4726. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  4727. elm.setAttribute('multiple', 'multiple');
  4728. }
  4729. return elm
  4730. }
  4731. function createElementNS (namespace, tagName) {
  4732. return document.createElementNS(namespaceMap[namespace], tagName)
  4733. }
  4734. function createTextNode (text) {
  4735. return document.createTextNode(text)
  4736. }
  4737. function createComment (text) {
  4738. return document.createComment(text)
  4739. }
  4740. function insertBefore (parentNode, newNode, referenceNode) {
  4741. parentNode.insertBefore(newNode, referenceNode);
  4742. }
  4743. function removeChild (node, child) {
  4744. node.removeChild(child);
  4745. }
  4746. function appendChild (node, child) {
  4747. node.appendChild(child);
  4748. }
  4749. function parentNode (node) {
  4750. return node.parentNode
  4751. }
  4752. function nextSibling (node) {
  4753. return node.nextSibling
  4754. }
  4755. function tagName (node) {
  4756. return node.tagName
  4757. }
  4758. function setTextContent (node, text) {
  4759. node.textContent = text;
  4760. }
  4761. function setAttribute (node, key, val) {
  4762. node.setAttribute(key, val);
  4763. }
  4764. var nodeOps = Object.freeze({
  4765. createElement: createElement$1,
  4766. createElementNS: createElementNS,
  4767. createTextNode: createTextNode,
  4768. createComment: createComment,
  4769. insertBefore: insertBefore,
  4770. removeChild: removeChild,
  4771. appendChild: appendChild,
  4772. parentNode: parentNode,
  4773. nextSibling: nextSibling,
  4774. tagName: tagName,
  4775. setTextContent: setTextContent,
  4776. setAttribute: setAttribute
  4777. });
  4778. /* */
  4779. var ref = {
  4780. create: function create (_, vnode) {
  4781. registerRef(vnode);
  4782. },
  4783. update: function update (oldVnode, vnode) {
  4784. if (oldVnode.data.ref !== vnode.data.ref) {
  4785. registerRef(oldVnode, true);
  4786. registerRef(vnode);
  4787. }
  4788. },
  4789. destroy: function destroy (vnode) {
  4790. registerRef(vnode, true);
  4791. }
  4792. };
  4793. function registerRef (vnode, isRemoval) {
  4794. var key = vnode.data.ref;
  4795. if (!key) { return }
  4796. var vm = vnode.context;
  4797. var ref = vnode.componentInstance || vnode.elm;
  4798. var refs = vm.$refs;
  4799. if (isRemoval) {
  4800. if (Array.isArray(refs[key])) {
  4801. remove(refs[key], ref);
  4802. } else if (refs[key] === ref) {
  4803. refs[key] = undefined;
  4804. }
  4805. } else {
  4806. if (vnode.data.refInFor) {
  4807. if (!Array.isArray(refs[key])) {
  4808. refs[key] = [ref];
  4809. } else if (refs[key].indexOf(ref) < 0) {
  4810. // $flow-disable-line
  4811. refs[key].push(ref);
  4812. }
  4813. } else {
  4814. refs[key] = ref;
  4815. }
  4816. }
  4817. }
  4818. /**
  4819. * Virtual DOM patching algorithm based on Snabbdom by
  4820. * Simon Friis Vindum (@paldepind)
  4821. * Licensed under the MIT License
  4822. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  4823. *
  4824. * modified by Evan You (@yyx990803)
  4825. *
  4826. * Not type-checking this because this file is perf-critical and the cost
  4827. * of making flow understand it is not worth it.
  4828. */
  4829. var emptyNode = new VNode('', {}, []);
  4830. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  4831. function sameVnode (a, b) {
  4832. return (
  4833. a.key === b.key && (
  4834. (
  4835. a.tag === b.tag &&
  4836. a.isComment === b.isComment &&
  4837. isDef(a.data) === isDef(b.data) &&
  4838. sameInputType(a, b)
  4839. ) || (
  4840. isTrue(a.isAsyncPlaceholder) &&
  4841. a.asyncFactory === b.asyncFactory &&
  4842. isUndef(b.asyncFactory.error)
  4843. )
  4844. )
  4845. )
  4846. }
  4847. function sameInputType (a, b) {
  4848. if (a.tag !== 'input') { return true }
  4849. var i;
  4850. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  4851. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  4852. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  4853. }
  4854. function createKeyToOldIdx (children, beginIdx, endIdx) {
  4855. var i, key;
  4856. var map = {};
  4857. for (i = beginIdx; i <= endIdx; ++i) {
  4858. key = children[i].key;
  4859. if (isDef(key)) { map[key] = i; }
  4860. }
  4861. return map
  4862. }
  4863. function createPatchFunction (backend) {
  4864. var i, j;
  4865. var cbs = {};
  4866. var modules = backend.modules;
  4867. var nodeOps = backend.nodeOps;
  4868. for (i = 0; i < hooks.length; ++i) {
  4869. cbs[hooks[i]] = [];
  4870. for (j = 0; j < modules.length; ++j) {
  4871. if (isDef(modules[j][hooks[i]])) {
  4872. cbs[hooks[i]].push(modules[j][hooks[i]]);
  4873. }
  4874. }
  4875. }
  4876. function emptyNodeAt (elm) {
  4877. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  4878. }
  4879. function createRmCb (childElm, listeners) {
  4880. function remove () {
  4881. if (--remove.listeners === 0) {
  4882. removeNode(childElm);
  4883. }
  4884. }
  4885. remove.listeners = listeners;
  4886. return remove
  4887. }
  4888. function removeNode (el) {
  4889. var parent = nodeOps.parentNode(el);
  4890. // element may have already been removed due to v-html / v-text
  4891. if (isDef(parent)) {
  4892. nodeOps.removeChild(parent, el);
  4893. }
  4894. }
  4895. function isUnknownElement$$1 (vnode, inVPre) {
  4896. return (
  4897. !inVPre &&
  4898. !vnode.ns &&
  4899. !(
  4900. config.ignoredElements.length &&
  4901. config.ignoredElements.some(function (ignore) {
  4902. return isRegExp(ignore)
  4903. ? ignore.test(vnode.tag)
  4904. : ignore === vnode.tag
  4905. })
  4906. ) &&
  4907. config.isUnknownElement(vnode.tag)
  4908. )
  4909. }
  4910. var creatingElmInVPre = 0;
  4911. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  4912. vnode.isRootInsert = !nested; // for transition enter check
  4913. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  4914. return
  4915. }
  4916. var data = vnode.data;
  4917. var children = vnode.children;
  4918. var tag = vnode.tag;
  4919. if (isDef(tag)) {
  4920. {
  4921. if (data && data.pre) {
  4922. creatingElmInVPre++;
  4923. }
  4924. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  4925. warn(
  4926. 'Unknown custom element: <' + tag + '> - did you ' +
  4927. 'register the component correctly? For recursive components, ' +
  4928. 'make sure to provide the "name" option.',
  4929. vnode.context
  4930. );
  4931. }
  4932. }
  4933. vnode.elm = vnode.ns
  4934. ? nodeOps.createElementNS(vnode.ns, tag)
  4935. : nodeOps.createElement(tag, vnode);
  4936. setScope(vnode);
  4937. /* istanbul ignore if */
  4938. {
  4939. createChildren(vnode, children, insertedVnodeQueue);
  4940. if (isDef(data)) {
  4941. invokeCreateHooks(vnode, insertedVnodeQueue);
  4942. }
  4943. insert(parentElm, vnode.elm, refElm);
  4944. }
  4945. if ("development" !== 'production' && data && data.pre) {
  4946. creatingElmInVPre--;
  4947. }
  4948. } else if (isTrue(vnode.isComment)) {
  4949. vnode.elm = nodeOps.createComment(vnode.text);
  4950. insert(parentElm, vnode.elm, refElm);
  4951. } else {
  4952. vnode.elm = nodeOps.createTextNode(vnode.text);
  4953. insert(parentElm, vnode.elm, refElm);
  4954. }
  4955. }
  4956. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  4957. var i = vnode.data;
  4958. if (isDef(i)) {
  4959. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  4960. if (isDef(i = i.hook) && isDef(i = i.init)) {
  4961. i(vnode, false /* hydrating */, parentElm, refElm);
  4962. }
  4963. // after calling the init hook, if the vnode is a child component
  4964. // it should've created a child instance and mounted it. the child
  4965. // component also has set the placeholder vnode's elm.
  4966. // in that case we can just return the element and be done.
  4967. if (isDef(vnode.componentInstance)) {
  4968. initComponent(vnode, insertedVnodeQueue);
  4969. if (isTrue(isReactivated)) {
  4970. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  4971. }
  4972. return true
  4973. }
  4974. }
  4975. }
  4976. function initComponent (vnode, insertedVnodeQueue) {
  4977. if (isDef(vnode.data.pendingInsert)) {
  4978. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  4979. vnode.data.pendingInsert = null;
  4980. }
  4981. vnode.elm = vnode.componentInstance.$el;
  4982. if (isPatchable(vnode)) {
  4983. invokeCreateHooks(vnode, insertedVnodeQueue);
  4984. setScope(vnode);
  4985. } else {
  4986. // empty component root.
  4987. // skip all element-related modules except for ref (#3455)
  4988. registerRef(vnode);
  4989. // make sure to invoke the insert hook
  4990. insertedVnodeQueue.push(vnode);
  4991. }
  4992. }
  4993. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  4994. var i;
  4995. // hack for #4339: a reactivated component with inner transition
  4996. // does not trigger because the inner node's created hooks are not called
  4997. // again. It's not ideal to involve module-specific logic in here but
  4998. // there doesn't seem to be a better way to do it.
  4999. var innerNode = vnode;
  5000. while (innerNode.componentInstance) {
  5001. innerNode = innerNode.componentInstance._vnode;
  5002. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5003. for (i = 0; i < cbs.activate.length; ++i) {
  5004. cbs.activate[i](emptyNode, innerNode);
  5005. }
  5006. insertedVnodeQueue.push(innerNode);
  5007. break
  5008. }
  5009. }
  5010. // unlike a newly created component,
  5011. // a reactivated keep-alive component doesn't insert itself
  5012. insert(parentElm, vnode.elm, refElm);
  5013. }
  5014. function insert (parent, elm, ref$$1) {
  5015. if (isDef(parent)) {
  5016. if (isDef(ref$$1)) {
  5017. if (ref$$1.parentNode === parent) {
  5018. nodeOps.insertBefore(parent, elm, ref$$1);
  5019. }
  5020. } else {
  5021. nodeOps.appendChild(parent, elm);
  5022. }
  5023. }
  5024. }
  5025. function createChildren (vnode, children, insertedVnodeQueue) {
  5026. if (Array.isArray(children)) {
  5027. {
  5028. checkDuplicateKeys(children);
  5029. }
  5030. for (var i = 0; i < children.length; ++i) {
  5031. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  5032. }
  5033. } else if (isPrimitive(vnode.text)) {
  5034. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5035. }
  5036. }
  5037. function isPatchable (vnode) {
  5038. while (vnode.componentInstance) {
  5039. vnode = vnode.componentInstance._vnode;
  5040. }
  5041. return isDef(vnode.tag)
  5042. }
  5043. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5044. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5045. cbs.create[i$1](emptyNode, vnode);
  5046. }
  5047. i = vnode.data.hook; // Reuse variable
  5048. if (isDef(i)) {
  5049. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5050. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5051. }
  5052. }
  5053. // set scope id attribute for scoped CSS.
  5054. // this is implemented as a special case to avoid the overhead
  5055. // of going through the normal attribute patching process.
  5056. function setScope (vnode) {
  5057. var i;
  5058. if (isDef(i = vnode.fnScopeId)) {
  5059. nodeOps.setAttribute(vnode.elm, i, '');
  5060. } else {
  5061. var ancestor = vnode;
  5062. while (ancestor) {
  5063. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5064. nodeOps.setAttribute(vnode.elm, i, '');
  5065. }
  5066. ancestor = ancestor.parent;
  5067. }
  5068. }
  5069. // for slot content they should also get the scopeId from the host instance.
  5070. if (isDef(i = activeInstance) &&
  5071. i !== vnode.context &&
  5072. i !== vnode.fnContext &&
  5073. isDef(i = i.$options._scopeId)
  5074. ) {
  5075. nodeOps.setAttribute(vnode.elm, i, '');
  5076. }
  5077. }
  5078. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5079. for (; startIdx <= endIdx; ++startIdx) {
  5080. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  5081. }
  5082. }
  5083. function invokeDestroyHook (vnode) {
  5084. var i, j;
  5085. var data = vnode.data;
  5086. if (isDef(data)) {
  5087. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5088. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5089. }
  5090. if (isDef(i = vnode.children)) {
  5091. for (j = 0; j < vnode.children.length; ++j) {
  5092. invokeDestroyHook(vnode.children[j]);
  5093. }
  5094. }
  5095. }
  5096. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5097. for (; startIdx <= endIdx; ++startIdx) {
  5098. var ch = vnodes[startIdx];
  5099. if (isDef(ch)) {
  5100. if (isDef(ch.tag)) {
  5101. removeAndInvokeRemoveHook(ch);
  5102. invokeDestroyHook(ch);
  5103. } else { // Text node
  5104. removeNode(ch.elm);
  5105. }
  5106. }
  5107. }
  5108. }
  5109. function removeAndInvokeRemoveHook (vnode, rm) {
  5110. if (isDef(rm) || isDef(vnode.data)) {
  5111. var i;
  5112. var listeners = cbs.remove.length + 1;
  5113. if (isDef(rm)) {
  5114. // we have a recursively passed down rm callback
  5115. // increase the listeners count
  5116. rm.listeners += listeners;
  5117. } else {
  5118. // directly removing
  5119. rm = createRmCb(vnode.elm, listeners);
  5120. }
  5121. // recursively invoke hooks on child component root node
  5122. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5123. removeAndInvokeRemoveHook(i, rm);
  5124. }
  5125. for (i = 0; i < cbs.remove.length; ++i) {
  5126. cbs.remove[i](vnode, rm);
  5127. }
  5128. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5129. i(vnode, rm);
  5130. } else {
  5131. rm();
  5132. }
  5133. } else {
  5134. removeNode(vnode.elm);
  5135. }
  5136. }
  5137. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5138. var oldStartIdx = 0;
  5139. var newStartIdx = 0;
  5140. var oldEndIdx = oldCh.length - 1;
  5141. var oldStartVnode = oldCh[0];
  5142. var oldEndVnode = oldCh[oldEndIdx];
  5143. var newEndIdx = newCh.length - 1;
  5144. var newStartVnode = newCh[0];
  5145. var newEndVnode = newCh[newEndIdx];
  5146. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5147. // removeOnly is a special flag used only by <transition-group>
  5148. // to ensure removed elements stay in correct relative positions
  5149. // during leaving transitions
  5150. var canMove = !removeOnly;
  5151. {
  5152. checkDuplicateKeys(newCh);
  5153. }
  5154. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5155. if (isUndef(oldStartVnode)) {
  5156. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5157. } else if (isUndef(oldEndVnode)) {
  5158. oldEndVnode = oldCh[--oldEndIdx];
  5159. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5160. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  5161. oldStartVnode = oldCh[++oldStartIdx];
  5162. newStartVnode = newCh[++newStartIdx];
  5163. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5164. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  5165. oldEndVnode = oldCh[--oldEndIdx];
  5166. newEndVnode = newCh[--newEndIdx];
  5167. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5168. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  5169. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5170. oldStartVnode = oldCh[++oldStartIdx];
  5171. newEndVnode = newCh[--newEndIdx];
  5172. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5173. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  5174. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5175. oldEndVnode = oldCh[--oldEndIdx];
  5176. newStartVnode = newCh[++newStartIdx];
  5177. } else {
  5178. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5179. idxInOld = isDef(newStartVnode.key)
  5180. ? oldKeyToIdx[newStartVnode.key]
  5181. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5182. if (isUndef(idxInOld)) { // New element
  5183. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  5184. } else {
  5185. vnodeToMove = oldCh[idxInOld];
  5186. if (sameVnode(vnodeToMove, newStartVnode)) {
  5187. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue);
  5188. oldCh[idxInOld] = undefined;
  5189. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5190. } else {
  5191. // same key but different element. treat as new element
  5192. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  5193. }
  5194. }
  5195. newStartVnode = newCh[++newStartIdx];
  5196. }
  5197. }
  5198. if (oldStartIdx > oldEndIdx) {
  5199. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5200. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5201. } else if (newStartIdx > newEndIdx) {
  5202. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5203. }
  5204. }
  5205. function checkDuplicateKeys (children) {
  5206. var seenKeys = {};
  5207. for (var i = 0; i < children.length; i++) {
  5208. var vnode = children[i];
  5209. var key = vnode.key;
  5210. if (isDef(key)) {
  5211. if (seenKeys[key]) {
  5212. warn(
  5213. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5214. vnode.context
  5215. );
  5216. } else {
  5217. seenKeys[key] = true;
  5218. }
  5219. }
  5220. }
  5221. }
  5222. function findIdxInOld (node, oldCh, start, end) {
  5223. for (var i = start; i < end; i++) {
  5224. var c = oldCh[i];
  5225. if (isDef(c) && sameVnode(node, c)) { return i }
  5226. }
  5227. }
  5228. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  5229. if (oldVnode === vnode) {
  5230. return
  5231. }
  5232. var elm = vnode.elm = oldVnode.elm;
  5233. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5234. if (isDef(vnode.asyncFactory.resolved)) {
  5235. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5236. } else {
  5237. vnode.isAsyncPlaceholder = true;
  5238. }
  5239. return
  5240. }
  5241. // reuse element for static trees.
  5242. // note we only do this if the vnode is cloned -
  5243. // if the new node is not cloned it means the render functions have been
  5244. // reset by the hot-reload-api and we need to do a proper re-render.
  5245. if (isTrue(vnode.isStatic) &&
  5246. isTrue(oldVnode.isStatic) &&
  5247. vnode.key === oldVnode.key &&
  5248. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5249. ) {
  5250. vnode.componentInstance = oldVnode.componentInstance;
  5251. return
  5252. }
  5253. var i;
  5254. var data = vnode.data;
  5255. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5256. i(oldVnode, vnode);
  5257. }
  5258. var oldCh = oldVnode.children;
  5259. var ch = vnode.children;
  5260. if (isDef(data) && isPatchable(vnode)) {
  5261. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5262. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5263. }
  5264. if (isUndef(vnode.text)) {
  5265. if (isDef(oldCh) && isDef(ch)) {
  5266. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5267. } else if (isDef(ch)) {
  5268. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5269. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5270. } else if (isDef(oldCh)) {
  5271. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5272. } else if (isDef(oldVnode.text)) {
  5273. nodeOps.setTextContent(elm, '');
  5274. }
  5275. } else if (oldVnode.text !== vnode.text) {
  5276. nodeOps.setTextContent(elm, vnode.text);
  5277. }
  5278. if (isDef(data)) {
  5279. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5280. }
  5281. }
  5282. function invokeInsertHook (vnode, queue, initial) {
  5283. // delay insert hooks for component root nodes, invoke them after the
  5284. // element is really inserted
  5285. if (isTrue(initial) && isDef(vnode.parent)) {
  5286. vnode.parent.data.pendingInsert = queue;
  5287. } else {
  5288. for (var i = 0; i < queue.length; ++i) {
  5289. queue[i].data.hook.insert(queue[i]);
  5290. }
  5291. }
  5292. }
  5293. var hydrationBailed = false;
  5294. // list of modules that can skip create hook during hydration because they
  5295. // are already rendered on the client or has no need for initialization
  5296. // Note: style is excluded because it relies on initial clone for future
  5297. // deep updates (#7063).
  5298. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5299. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5300. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5301. var i;
  5302. var tag = vnode.tag;
  5303. var data = vnode.data;
  5304. var children = vnode.children;
  5305. inVPre = inVPre || (data && data.pre);
  5306. vnode.elm = elm;
  5307. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5308. vnode.isAsyncPlaceholder = true;
  5309. return true
  5310. }
  5311. // assert node match
  5312. {
  5313. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5314. return false
  5315. }
  5316. }
  5317. if (isDef(data)) {
  5318. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5319. if (isDef(i = vnode.componentInstance)) {
  5320. // child component. it should have hydrated its own tree.
  5321. initComponent(vnode, insertedVnodeQueue);
  5322. return true
  5323. }
  5324. }
  5325. if (isDef(tag)) {
  5326. if (isDef(children)) {
  5327. // empty element, allow client to pick up and populate children
  5328. if (!elm.hasChildNodes()) {
  5329. createChildren(vnode, children, insertedVnodeQueue);
  5330. } else {
  5331. // v-html and domProps: innerHTML
  5332. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5333. if (i !== elm.innerHTML) {
  5334. /* istanbul ignore if */
  5335. if ("development" !== 'production' &&
  5336. typeof console !== 'undefined' &&
  5337. !hydrationBailed
  5338. ) {
  5339. hydrationBailed = true;
  5340. console.warn('Parent: ', elm);
  5341. console.warn('server innerHTML: ', i);
  5342. console.warn('client innerHTML: ', elm.innerHTML);
  5343. }
  5344. return false
  5345. }
  5346. } else {
  5347. // iterate and compare children lists
  5348. var childrenMatch = true;
  5349. var childNode = elm.firstChild;
  5350. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5351. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5352. childrenMatch = false;
  5353. break
  5354. }
  5355. childNode = childNode.nextSibling;
  5356. }
  5357. // if childNode is not null, it means the actual childNodes list is
  5358. // longer than the virtual children list.
  5359. if (!childrenMatch || childNode) {
  5360. /* istanbul ignore if */
  5361. if ("development" !== 'production' &&
  5362. typeof console !== 'undefined' &&
  5363. !hydrationBailed
  5364. ) {
  5365. hydrationBailed = true;
  5366. console.warn('Parent: ', elm);
  5367. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5368. }
  5369. return false
  5370. }
  5371. }
  5372. }
  5373. }
  5374. if (isDef(data)) {
  5375. var fullInvoke = false;
  5376. for (var key in data) {
  5377. if (!isRenderedModule(key)) {
  5378. fullInvoke = true;
  5379. invokeCreateHooks(vnode, insertedVnodeQueue);
  5380. break
  5381. }
  5382. }
  5383. if (!fullInvoke && data['class']) {
  5384. // ensure collecting deps for deep class bindings for future updates
  5385. traverse(data['class']);
  5386. }
  5387. }
  5388. } else if (elm.data !== vnode.text) {
  5389. elm.data = vnode.text;
  5390. }
  5391. return true
  5392. }
  5393. function assertNodeMatch (node, vnode, inVPre) {
  5394. if (isDef(vnode.tag)) {
  5395. return vnode.tag.indexOf('vue-component') === 0 || (
  5396. !isUnknownElement$$1(vnode, inVPre) &&
  5397. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5398. )
  5399. } else {
  5400. return node.nodeType === (vnode.isComment ? 8 : 3)
  5401. }
  5402. }
  5403. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  5404. if (isUndef(vnode)) {
  5405. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5406. return
  5407. }
  5408. var isInitialPatch = false;
  5409. var insertedVnodeQueue = [];
  5410. if (isUndef(oldVnode)) {
  5411. // empty mount (likely as component), create new root element
  5412. isInitialPatch = true;
  5413. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  5414. } else {
  5415. var isRealElement = isDef(oldVnode.nodeType);
  5416. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5417. // patch existing root node
  5418. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  5419. } else {
  5420. if (isRealElement) {
  5421. // mounting to a real element
  5422. // check if this is server-rendered content and if we can perform
  5423. // a successful hydration.
  5424. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5425. oldVnode.removeAttribute(SSR_ATTR);
  5426. hydrating = true;
  5427. }
  5428. if (isTrue(hydrating)) {
  5429. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5430. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5431. return oldVnode
  5432. } else {
  5433. warn(
  5434. 'The client-side rendered virtual DOM tree is not matching ' +
  5435. 'server-rendered content. This is likely caused by incorrect ' +
  5436. 'HTML markup, for example nesting block-level elements inside ' +
  5437. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5438. 'full client-side render.'
  5439. );
  5440. }
  5441. }
  5442. // either not server-rendered, or hydration failed.
  5443. // create an empty node and replace it
  5444. oldVnode = emptyNodeAt(oldVnode);
  5445. }
  5446. // replacing existing element
  5447. var oldElm = oldVnode.elm;
  5448. var parentElm$1 = nodeOps.parentNode(oldElm);
  5449. // create new node
  5450. createElm(
  5451. vnode,
  5452. insertedVnodeQueue,
  5453. // extremely rare edge case: do not insert if old element is in a
  5454. // leaving transition. Only happens when combining transition +
  5455. // keep-alive + HOCs. (#4590)
  5456. oldElm._leaveCb ? null : parentElm$1,
  5457. nodeOps.nextSibling(oldElm)
  5458. );
  5459. // update parent placeholder node element, recursively
  5460. if (isDef(vnode.parent)) {
  5461. var ancestor = vnode.parent;
  5462. var patchable = isPatchable(vnode);
  5463. while (ancestor) {
  5464. for (var i = 0; i < cbs.destroy.length; ++i) {
  5465. cbs.destroy[i](ancestor);
  5466. }
  5467. ancestor.elm = vnode.elm;
  5468. if (patchable) {
  5469. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5470. cbs.create[i$1](emptyNode, ancestor);
  5471. }
  5472. // #6513
  5473. // invoke insert hooks that may have been merged by create hooks.
  5474. // e.g. for directives that uses the "inserted" hook.
  5475. var insert = ancestor.data.hook.insert;
  5476. if (insert.merged) {
  5477. // start at index 1 to avoid re-invoking component mounted hook
  5478. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5479. insert.fns[i$2]();
  5480. }
  5481. }
  5482. } else {
  5483. registerRef(ancestor);
  5484. }
  5485. ancestor = ancestor.parent;
  5486. }
  5487. }
  5488. // destroy old node
  5489. if (isDef(parentElm$1)) {
  5490. removeVnodes(parentElm$1, [oldVnode], 0, 0);
  5491. } else if (isDef(oldVnode.tag)) {
  5492. invokeDestroyHook(oldVnode);
  5493. }
  5494. }
  5495. }
  5496. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5497. return vnode.elm
  5498. }
  5499. }
  5500. /* */
  5501. var directives = {
  5502. create: updateDirectives,
  5503. update: updateDirectives,
  5504. destroy: function unbindDirectives (vnode) {
  5505. updateDirectives(vnode, emptyNode);
  5506. }
  5507. };
  5508. function updateDirectives (oldVnode, vnode) {
  5509. if (oldVnode.data.directives || vnode.data.directives) {
  5510. _update(oldVnode, vnode);
  5511. }
  5512. }
  5513. function _update (oldVnode, vnode) {
  5514. var isCreate = oldVnode === emptyNode;
  5515. var isDestroy = vnode === emptyNode;
  5516. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5517. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5518. var dirsWithInsert = [];
  5519. var dirsWithPostpatch = [];
  5520. var key, oldDir, dir;
  5521. for (key in newDirs) {
  5522. oldDir = oldDirs[key];
  5523. dir = newDirs[key];
  5524. if (!oldDir) {
  5525. // new directive, bind
  5526. callHook$1(dir, 'bind', vnode, oldVnode);
  5527. if (dir.def && dir.def.inserted) {
  5528. dirsWithInsert.push(dir);
  5529. }
  5530. } else {
  5531. // existing directive, update
  5532. dir.oldValue = oldDir.value;
  5533. callHook$1(dir, 'update', vnode, oldVnode);
  5534. if (dir.def && dir.def.componentUpdated) {
  5535. dirsWithPostpatch.push(dir);
  5536. }
  5537. }
  5538. }
  5539. if (dirsWithInsert.length) {
  5540. var callInsert = function () {
  5541. for (var i = 0; i < dirsWithInsert.length; i++) {
  5542. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5543. }
  5544. };
  5545. if (isCreate) {
  5546. mergeVNodeHook(vnode, 'insert', callInsert);
  5547. } else {
  5548. callInsert();
  5549. }
  5550. }
  5551. if (dirsWithPostpatch.length) {
  5552. mergeVNodeHook(vnode, 'postpatch', function () {
  5553. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5554. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5555. }
  5556. });
  5557. }
  5558. if (!isCreate) {
  5559. for (key in oldDirs) {
  5560. if (!newDirs[key]) {
  5561. // no longer present, unbind
  5562. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  5563. }
  5564. }
  5565. }
  5566. }
  5567. var emptyModifiers = Object.create(null);
  5568. function normalizeDirectives$1 (
  5569. dirs,
  5570. vm
  5571. ) {
  5572. var res = Object.create(null);
  5573. if (!dirs) {
  5574. // $flow-disable-line
  5575. return res
  5576. }
  5577. var i, dir;
  5578. for (i = 0; i < dirs.length; i++) {
  5579. dir = dirs[i];
  5580. if (!dir.modifiers) {
  5581. // $flow-disable-line
  5582. dir.modifiers = emptyModifiers;
  5583. }
  5584. res[getRawDirName(dir)] = dir;
  5585. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  5586. }
  5587. // $flow-disable-line
  5588. return res
  5589. }
  5590. function getRawDirName (dir) {
  5591. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  5592. }
  5593. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  5594. var fn = dir.def && dir.def[hook];
  5595. if (fn) {
  5596. try {
  5597. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  5598. } catch (e) {
  5599. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  5600. }
  5601. }
  5602. }
  5603. var baseModules = [
  5604. ref,
  5605. directives
  5606. ];
  5607. /* */
  5608. function updateAttrs (oldVnode, vnode) {
  5609. var opts = vnode.componentOptions;
  5610. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  5611. return
  5612. }
  5613. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  5614. return
  5615. }
  5616. var key, cur, old;
  5617. var elm = vnode.elm;
  5618. var oldAttrs = oldVnode.data.attrs || {};
  5619. var attrs = vnode.data.attrs || {};
  5620. // clone observed objects, as the user probably wants to mutate it
  5621. if (isDef(attrs.__ob__)) {
  5622. attrs = vnode.data.attrs = extend({}, attrs);
  5623. }
  5624. for (key in attrs) {
  5625. cur = attrs[key];
  5626. old = oldAttrs[key];
  5627. if (old !== cur) {
  5628. setAttr(elm, key, cur);
  5629. }
  5630. }
  5631. // #4391: in IE9, setting type can reset value for input[type=radio]
  5632. // #6666: IE/Edge forces progress value down to 1 before setting a max
  5633. /* istanbul ignore if */
  5634. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  5635. setAttr(elm, 'value', attrs.value);
  5636. }
  5637. for (key in oldAttrs) {
  5638. if (isUndef(attrs[key])) {
  5639. if (isXlink(key)) {
  5640. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  5641. } else if (!isEnumeratedAttr(key)) {
  5642. elm.removeAttribute(key);
  5643. }
  5644. }
  5645. }
  5646. }
  5647. function setAttr (el, key, value) {
  5648. if (isBooleanAttr(key)) {
  5649. // set attribute for blank value
  5650. // e.g. <option disabled>Select one</option>
  5651. if (isFalsyAttrValue(value)) {
  5652. el.removeAttribute(key);
  5653. } else {
  5654. // technically allowfullscreen is a boolean attribute for <iframe>,
  5655. // but Flash expects a value of "true" when used on <embed> tag
  5656. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  5657. ? 'true'
  5658. : key;
  5659. el.setAttribute(key, value);
  5660. }
  5661. } else if (isEnumeratedAttr(key)) {
  5662. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  5663. } else if (isXlink(key)) {
  5664. if (isFalsyAttrValue(value)) {
  5665. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  5666. } else {
  5667. el.setAttributeNS(xlinkNS, key, value);
  5668. }
  5669. } else {
  5670. if (isFalsyAttrValue(value)) {
  5671. el.removeAttribute(key);
  5672. } else {
  5673. // #7138: IE10 & 11 fires input event when setting placeholder on
  5674. // <textarea>... block the first input event and remove the blocker
  5675. // immediately.
  5676. /* istanbul ignore if */
  5677. if (
  5678. isIE && !isIE9 &&
  5679. el.tagName === 'TEXTAREA' &&
  5680. key === 'placeholder' && !el.__ieph
  5681. ) {
  5682. var blocker = function (e) {
  5683. e.stopImmediatePropagation();
  5684. el.removeEventListener('input', blocker);
  5685. };
  5686. el.addEventListener('input', blocker);
  5687. // $flow-disable-line
  5688. el.__ieph = true; /* IE placeholder patched */
  5689. }
  5690. el.setAttribute(key, value);
  5691. }
  5692. }
  5693. }
  5694. var attrs = {
  5695. create: updateAttrs,
  5696. update: updateAttrs
  5697. };
  5698. /* */
  5699. function updateClass (oldVnode, vnode) {
  5700. var el = vnode.elm;
  5701. var data = vnode.data;
  5702. var oldData = oldVnode.data;
  5703. if (
  5704. isUndef(data.staticClass) &&
  5705. isUndef(data.class) && (
  5706. isUndef(oldData) || (
  5707. isUndef(oldData.staticClass) &&
  5708. isUndef(oldData.class)
  5709. )
  5710. )
  5711. ) {
  5712. return
  5713. }
  5714. var cls = genClassForVnode(vnode);
  5715. // handle transition classes
  5716. var transitionClass = el._transitionClasses;
  5717. if (isDef(transitionClass)) {
  5718. cls = concat(cls, stringifyClass(transitionClass));
  5719. }
  5720. // set the class
  5721. if (cls !== el._prevClass) {
  5722. el.setAttribute('class', cls);
  5723. el._prevClass = cls;
  5724. }
  5725. }
  5726. var klass = {
  5727. create: updateClass,
  5728. update: updateClass
  5729. };
  5730. /* */
  5731. var validDivisionCharRE = /[\w).+\-_$\]]/;
  5732. function parseFilters (exp) {
  5733. var inSingle = false;
  5734. var inDouble = false;
  5735. var inTemplateString = false;
  5736. var inRegex = false;
  5737. var curly = 0;
  5738. var square = 0;
  5739. var paren = 0;
  5740. var lastFilterIndex = 0;
  5741. var c, prev, i, expression, filters;
  5742. for (i = 0; i < exp.length; i++) {
  5743. prev = c;
  5744. c = exp.charCodeAt(i);
  5745. if (inSingle) {
  5746. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  5747. } else if (inDouble) {
  5748. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  5749. } else if (inTemplateString) {
  5750. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  5751. } else if (inRegex) {
  5752. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  5753. } else if (
  5754. c === 0x7C && // pipe
  5755. exp.charCodeAt(i + 1) !== 0x7C &&
  5756. exp.charCodeAt(i - 1) !== 0x7C &&
  5757. !curly && !square && !paren
  5758. ) {
  5759. if (expression === undefined) {
  5760. // first filter, end of expression
  5761. lastFilterIndex = i + 1;
  5762. expression = exp.slice(0, i).trim();
  5763. } else {
  5764. pushFilter();
  5765. }
  5766. } else {
  5767. switch (c) {
  5768. case 0x22: inDouble = true; break // "
  5769. case 0x27: inSingle = true; break // '
  5770. case 0x60: inTemplateString = true; break // `
  5771. case 0x28: paren++; break // (
  5772. case 0x29: paren--; break // )
  5773. case 0x5B: square++; break // [
  5774. case 0x5D: square--; break // ]
  5775. case 0x7B: curly++; break // {
  5776. case 0x7D: curly--; break // }
  5777. }
  5778. if (c === 0x2f) { // /
  5779. var j = i - 1;
  5780. var p = (void 0);
  5781. // find first non-whitespace prev char
  5782. for (; j >= 0; j--) {
  5783. p = exp.charAt(j);
  5784. if (p !== ' ') { break }
  5785. }
  5786. if (!p || !validDivisionCharRE.test(p)) {
  5787. inRegex = true;
  5788. }
  5789. }
  5790. }
  5791. }
  5792. if (expression === undefined) {
  5793. expression = exp.slice(0, i).trim();
  5794. } else if (lastFilterIndex !== 0) {
  5795. pushFilter();
  5796. }
  5797. function pushFilter () {
  5798. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  5799. lastFilterIndex = i + 1;
  5800. }
  5801. if (filters) {
  5802. for (i = 0; i < filters.length; i++) {
  5803. expression = wrapFilter(expression, filters[i]);
  5804. }
  5805. }
  5806. return expression
  5807. }
  5808. function wrapFilter (exp, filter) {
  5809. var i = filter.indexOf('(');
  5810. if (i < 0) {
  5811. // _f: resolveFilter
  5812. return ("_f(\"" + filter + "\")(" + exp + ")")
  5813. } else {
  5814. var name = filter.slice(0, i);
  5815. var args = filter.slice(i + 1);
  5816. return ("_f(\"" + name + "\")(" + exp + "," + args)
  5817. }
  5818. }
  5819. /* */
  5820. function baseWarn (msg) {
  5821. console.error(("[Vue compiler]: " + msg));
  5822. }
  5823. function pluckModuleFunction (
  5824. modules,
  5825. key
  5826. ) {
  5827. return modules
  5828. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  5829. : []
  5830. }
  5831. function addProp (el, name, value) {
  5832. (el.props || (el.props = [])).push({ name: name, value: value });
  5833. el.plain = false;
  5834. }
  5835. function addAttr (el, name, value) {
  5836. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  5837. el.plain = false;
  5838. }
  5839. // add a raw attr (use this in preTransforms)
  5840. function addRawAttr (el, name, value) {
  5841. el.attrsMap[name] = value;
  5842. el.attrsList.push({ name: name, value: value });
  5843. }
  5844. function addDirective (
  5845. el,
  5846. name,
  5847. rawName,
  5848. value,
  5849. arg,
  5850. modifiers
  5851. ) {
  5852. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  5853. el.plain = false;
  5854. }
  5855. function addHandler (
  5856. el,
  5857. name,
  5858. value,
  5859. modifiers,
  5860. important,
  5861. warn
  5862. ) {
  5863. modifiers = modifiers || emptyObject;
  5864. // warn prevent and passive modifier
  5865. /* istanbul ignore if */
  5866. if (
  5867. "development" !== 'production' && warn &&
  5868. modifiers.prevent && modifiers.passive
  5869. ) {
  5870. warn(
  5871. 'passive and prevent can\'t be used together. ' +
  5872. 'Passive handler can\'t prevent default event.'
  5873. );
  5874. }
  5875. // check capture modifier
  5876. if (modifiers.capture) {
  5877. delete modifiers.capture;
  5878. name = '!' + name; // mark the event as captured
  5879. }
  5880. if (modifiers.once) {
  5881. delete modifiers.once;
  5882. name = '~' + name; // mark the event as once
  5883. }
  5884. /* istanbul ignore if */
  5885. if (modifiers.passive) {
  5886. delete modifiers.passive;
  5887. name = '&' + name; // mark the event as passive
  5888. }
  5889. // normalize click.right and click.middle since they don't actually fire
  5890. // this is technically browser-specific, but at least for now browsers are
  5891. // the only target envs that have right/middle clicks.
  5892. if (name === 'click') {
  5893. if (modifiers.right) {
  5894. name = 'contextmenu';
  5895. delete modifiers.right;
  5896. } else if (modifiers.middle) {
  5897. name = 'mouseup';
  5898. }
  5899. }
  5900. var events;
  5901. if (modifiers.native) {
  5902. delete modifiers.native;
  5903. events = el.nativeEvents || (el.nativeEvents = {});
  5904. } else {
  5905. events = el.events || (el.events = {});
  5906. }
  5907. var newHandler = { value: value };
  5908. if (modifiers !== emptyObject) {
  5909. newHandler.modifiers = modifiers;
  5910. }
  5911. var handlers = events[name];
  5912. /* istanbul ignore if */
  5913. if (Array.isArray(handlers)) {
  5914. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  5915. } else if (handlers) {
  5916. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  5917. } else {
  5918. events[name] = newHandler;
  5919. }
  5920. el.plain = false;
  5921. }
  5922. function getBindingAttr (
  5923. el,
  5924. name,
  5925. getStatic
  5926. ) {
  5927. var dynamicValue =
  5928. getAndRemoveAttr(el, ':' + name) ||
  5929. getAndRemoveAttr(el, 'v-bind:' + name);
  5930. if (dynamicValue != null) {
  5931. return parseFilters(dynamicValue)
  5932. } else if (getStatic !== false) {
  5933. var staticValue = getAndRemoveAttr(el, name);
  5934. if (staticValue != null) {
  5935. return JSON.stringify(staticValue)
  5936. }
  5937. }
  5938. }
  5939. // note: this only removes the attr from the Array (attrsList) so that it
  5940. // doesn't get processed by processAttrs.
  5941. // By default it does NOT remove it from the map (attrsMap) because the map is
  5942. // needed during codegen.
  5943. function getAndRemoveAttr (
  5944. el,
  5945. name,
  5946. removeFromMap
  5947. ) {
  5948. var val;
  5949. if ((val = el.attrsMap[name]) != null) {
  5950. var list = el.attrsList;
  5951. for (var i = 0, l = list.length; i < l; i++) {
  5952. if (list[i].name === name) {
  5953. list.splice(i, 1);
  5954. break
  5955. }
  5956. }
  5957. }
  5958. if (removeFromMap) {
  5959. delete el.attrsMap[name];
  5960. }
  5961. return val
  5962. }
  5963. /* */
  5964. /**
  5965. * Cross-platform code generation for component v-model
  5966. */
  5967. function genComponentModel (
  5968. el,
  5969. value,
  5970. modifiers
  5971. ) {
  5972. var ref = modifiers || {};
  5973. var number = ref.number;
  5974. var trim = ref.trim;
  5975. var baseValueExpression = '$$v';
  5976. var valueExpression = baseValueExpression;
  5977. if (trim) {
  5978. valueExpression =
  5979. "(typeof " + baseValueExpression + " === 'string'" +
  5980. "? " + baseValueExpression + ".trim()" +
  5981. ": " + baseValueExpression + ")";
  5982. }
  5983. if (number) {
  5984. valueExpression = "_n(" + valueExpression + ")";
  5985. }
  5986. var assignment = genAssignmentCode(value, valueExpression);
  5987. el.model = {
  5988. value: ("(" + value + ")"),
  5989. expression: ("\"" + value + "\""),
  5990. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  5991. };
  5992. }
  5993. /**
  5994. * Cross-platform codegen helper for generating v-model value assignment code.
  5995. */
  5996. function genAssignmentCode (
  5997. value,
  5998. assignment
  5999. ) {
  6000. var res = parseModel(value);
  6001. if (res.key === null) {
  6002. return (value + "=" + assignment)
  6003. } else {
  6004. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6005. }
  6006. }
  6007. /**
  6008. * Parse a v-model expression into a base path and a final key segment.
  6009. * Handles both dot-path and possible square brackets.
  6010. *
  6011. * Possible cases:
  6012. *
  6013. * - test
  6014. * - test[key]
  6015. * - test[test1[key]]
  6016. * - test["a"][key]
  6017. * - xxx.test[a[a].test1[key]]
  6018. * - test.xxx.a["asa"][test1[key]]
  6019. *
  6020. */
  6021. var len;
  6022. var str;
  6023. var chr;
  6024. var index$1;
  6025. var expressionPos;
  6026. var expressionEndPos;
  6027. function parseModel (val) {
  6028. len = val.length;
  6029. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6030. index$1 = val.lastIndexOf('.');
  6031. if (index$1 > -1) {
  6032. return {
  6033. exp: val.slice(0, index$1),
  6034. key: '"' + val.slice(index$1 + 1) + '"'
  6035. }
  6036. } else {
  6037. return {
  6038. exp: val,
  6039. key: null
  6040. }
  6041. }
  6042. }
  6043. str = val;
  6044. index$1 = expressionPos = expressionEndPos = 0;
  6045. while (!eof()) {
  6046. chr = next();
  6047. /* istanbul ignore if */
  6048. if (isStringStart(chr)) {
  6049. parseString(chr);
  6050. } else if (chr === 0x5B) {
  6051. parseBracket(chr);
  6052. }
  6053. }
  6054. return {
  6055. exp: val.slice(0, expressionPos),
  6056. key: val.slice(expressionPos + 1, expressionEndPos)
  6057. }
  6058. }
  6059. function next () {
  6060. return str.charCodeAt(++index$1)
  6061. }
  6062. function eof () {
  6063. return index$1 >= len
  6064. }
  6065. function isStringStart (chr) {
  6066. return chr === 0x22 || chr === 0x27
  6067. }
  6068. function parseBracket (chr) {
  6069. var inBracket = 1;
  6070. expressionPos = index$1;
  6071. while (!eof()) {
  6072. chr = next();
  6073. if (isStringStart(chr)) {
  6074. parseString(chr);
  6075. continue
  6076. }
  6077. if (chr === 0x5B) { inBracket++; }
  6078. if (chr === 0x5D) { inBracket--; }
  6079. if (inBracket === 0) {
  6080. expressionEndPos = index$1;
  6081. break
  6082. }
  6083. }
  6084. }
  6085. function parseString (chr) {
  6086. var stringQuote = chr;
  6087. while (!eof()) {
  6088. chr = next();
  6089. if (chr === stringQuote) {
  6090. break
  6091. }
  6092. }
  6093. }
  6094. /* */
  6095. var warn$1;
  6096. // in some cases, the event used has to be determined at runtime
  6097. // so we used some reserved tokens during compile.
  6098. var RANGE_TOKEN = '__r';
  6099. var CHECKBOX_RADIO_TOKEN = '__c';
  6100. function model (
  6101. el,
  6102. dir,
  6103. _warn
  6104. ) {
  6105. warn$1 = _warn;
  6106. var value = dir.value;
  6107. var modifiers = dir.modifiers;
  6108. var tag = el.tag;
  6109. var type = el.attrsMap.type;
  6110. {
  6111. // inputs with type="file" are read only and setting the input's
  6112. // value will throw an error.
  6113. if (tag === 'input' && type === 'file') {
  6114. warn$1(
  6115. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6116. "File inputs are read only. Use a v-on:change listener instead."
  6117. );
  6118. }
  6119. }
  6120. if (el.component) {
  6121. genComponentModel(el, value, modifiers);
  6122. // component v-model doesn't need extra runtime
  6123. return false
  6124. } else if (tag === 'select') {
  6125. genSelect(el, value, modifiers);
  6126. } else if (tag === 'input' && type === 'checkbox') {
  6127. genCheckboxModel(el, value, modifiers);
  6128. } else if (tag === 'input' && type === 'radio') {
  6129. genRadioModel(el, value, modifiers);
  6130. } else if (tag === 'input' || tag === 'textarea') {
  6131. genDefaultModel(el, value, modifiers);
  6132. } else if (!config.isReservedTag(tag)) {
  6133. genComponentModel(el, value, modifiers);
  6134. // component v-model doesn't need extra runtime
  6135. return false
  6136. } else {
  6137. warn$1(
  6138. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6139. "v-model is not supported on this element type. " +
  6140. 'If you are working with contenteditable, it\'s recommended to ' +
  6141. 'wrap a library dedicated for that purpose inside a custom component.'
  6142. );
  6143. }
  6144. // ensure runtime directive metadata
  6145. return true
  6146. }
  6147. function genCheckboxModel (
  6148. el,
  6149. value,
  6150. modifiers
  6151. ) {
  6152. var number = modifiers && modifiers.number;
  6153. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6154. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6155. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6156. addProp(el, 'checked',
  6157. "Array.isArray(" + value + ")" +
  6158. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6159. trueValueBinding === 'true'
  6160. ? (":(" + value + ")")
  6161. : (":_q(" + value + "," + trueValueBinding + ")")
  6162. )
  6163. );
  6164. addHandler(el, 'change',
  6165. "var $$a=" + value + "," +
  6166. '$$el=$event.target,' +
  6167. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6168. 'if(Array.isArray($$a)){' +
  6169. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6170. '$$i=_i($$a,$$v);' +
  6171. "if($$el.checked){$$i<0&&(" + value + "=$$a.concat([$$v]))}" +
  6172. "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
  6173. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6174. null, true
  6175. );
  6176. }
  6177. function genRadioModel (
  6178. el,
  6179. value,
  6180. modifiers
  6181. ) {
  6182. var number = modifiers && modifiers.number;
  6183. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6184. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6185. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6186. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6187. }
  6188. function genSelect (
  6189. el,
  6190. value,
  6191. modifiers
  6192. ) {
  6193. var number = modifiers && modifiers.number;
  6194. var selectedVal = "Array.prototype.filter" +
  6195. ".call($event.target.options,function(o){return o.selected})" +
  6196. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6197. "return " + (number ? '_n(val)' : 'val') + "})";
  6198. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6199. var code = "var $$selectedVal = " + selectedVal + ";";
  6200. code = code + " " + (genAssignmentCode(value, assignment));
  6201. addHandler(el, 'change', code, null, true);
  6202. }
  6203. function genDefaultModel (
  6204. el,
  6205. value,
  6206. modifiers
  6207. ) {
  6208. var type = el.attrsMap.type;
  6209. // warn if v-bind:value conflicts with v-model
  6210. {
  6211. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6212. if (value$1) {
  6213. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6214. warn$1(
  6215. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6216. 'because the latter already expands to a value binding internally'
  6217. );
  6218. }
  6219. }
  6220. var ref = modifiers || {};
  6221. var lazy = ref.lazy;
  6222. var number = ref.number;
  6223. var trim = ref.trim;
  6224. var needCompositionGuard = !lazy && type !== 'range';
  6225. var event = lazy
  6226. ? 'change'
  6227. : type === 'range'
  6228. ? RANGE_TOKEN
  6229. : 'input';
  6230. var valueExpression = '$event.target.value';
  6231. if (trim) {
  6232. valueExpression = "$event.target.value.trim()";
  6233. }
  6234. if (number) {
  6235. valueExpression = "_n(" + valueExpression + ")";
  6236. }
  6237. var code = genAssignmentCode(value, valueExpression);
  6238. if (needCompositionGuard) {
  6239. code = "if($event.target.composing)return;" + code;
  6240. }
  6241. addProp(el, 'value', ("(" + value + ")"));
  6242. addHandler(el, event, code, null, true);
  6243. if (trim || number) {
  6244. addHandler(el, 'blur', '$forceUpdate()');
  6245. }
  6246. }
  6247. /* */
  6248. // normalize v-model event tokens that can only be determined at runtime.
  6249. // it's important to place the event as the first in the array because
  6250. // the whole point is ensuring the v-model callback gets called before
  6251. // user-attached handlers.
  6252. function normalizeEvents (on) {
  6253. /* istanbul ignore if */
  6254. if (isDef(on[RANGE_TOKEN])) {
  6255. // IE input[type=range] only supports `change` event
  6256. var event = isIE ? 'change' : 'input';
  6257. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6258. delete on[RANGE_TOKEN];
  6259. }
  6260. // This was originally intended to fix #4521 but no longer necessary
  6261. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6262. /* istanbul ignore if */
  6263. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6264. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6265. delete on[CHECKBOX_RADIO_TOKEN];
  6266. }
  6267. }
  6268. var target$1;
  6269. function createOnceHandler (handler, event, capture) {
  6270. var _target = target$1; // save current target element in closure
  6271. return function onceHandler () {
  6272. var res = handler.apply(null, arguments);
  6273. if (res !== null) {
  6274. remove$2(event, onceHandler, capture, _target);
  6275. }
  6276. }
  6277. }
  6278. function add$1 (
  6279. event,
  6280. handler,
  6281. once$$1,
  6282. capture,
  6283. passive
  6284. ) {
  6285. handler = withMacroTask(handler);
  6286. if (once$$1) { handler = createOnceHandler(handler, event, capture); }
  6287. target$1.addEventListener(
  6288. event,
  6289. handler,
  6290. supportsPassive
  6291. ? { capture: capture, passive: passive }
  6292. : capture
  6293. );
  6294. }
  6295. function remove$2 (
  6296. event,
  6297. handler,
  6298. capture,
  6299. _target
  6300. ) {
  6301. (_target || target$1).removeEventListener(
  6302. event,
  6303. handler._withTask || handler,
  6304. capture
  6305. );
  6306. }
  6307. function updateDOMListeners (oldVnode, vnode) {
  6308. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6309. return
  6310. }
  6311. var on = vnode.data.on || {};
  6312. var oldOn = oldVnode.data.on || {};
  6313. target$1 = vnode.elm;
  6314. normalizeEvents(on);
  6315. updateListeners(on, oldOn, add$1, remove$2, vnode.context);
  6316. target$1 = undefined;
  6317. }
  6318. var events = {
  6319. create: updateDOMListeners,
  6320. update: updateDOMListeners
  6321. };
  6322. /* */
  6323. function updateDOMProps (oldVnode, vnode) {
  6324. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6325. return
  6326. }
  6327. var key, cur;
  6328. var elm = vnode.elm;
  6329. var oldProps = oldVnode.data.domProps || {};
  6330. var props = vnode.data.domProps || {};
  6331. // clone observed objects, as the user probably wants to mutate it
  6332. if (isDef(props.__ob__)) {
  6333. props = vnode.data.domProps = extend({}, props);
  6334. }
  6335. for (key in oldProps) {
  6336. if (isUndef(props[key])) {
  6337. elm[key] = '';
  6338. }
  6339. }
  6340. for (key in props) {
  6341. cur = props[key];
  6342. // ignore children if the node has textContent or innerHTML,
  6343. // as these will throw away existing DOM nodes and cause removal errors
  6344. // on subsequent patches (#3360)
  6345. if (key === 'textContent' || key === 'innerHTML') {
  6346. if (vnode.children) { vnode.children.length = 0; }
  6347. if (cur === oldProps[key]) { continue }
  6348. // #6601 work around Chrome version <= 55 bug where single textNode
  6349. // replaced by innerHTML/textContent retains its parentNode property
  6350. if (elm.childNodes.length === 1) {
  6351. elm.removeChild(elm.childNodes[0]);
  6352. }
  6353. }
  6354. if (key === 'value') {
  6355. // store value as _value as well since
  6356. // non-string values will be stringified
  6357. elm._value = cur;
  6358. // avoid resetting cursor position when value is the same
  6359. var strCur = isUndef(cur) ? '' : String(cur);
  6360. if (shouldUpdateValue(elm, strCur)) {
  6361. elm.value = strCur;
  6362. }
  6363. } else {
  6364. elm[key] = cur;
  6365. }
  6366. }
  6367. }
  6368. // check platforms/web/util/attrs.js acceptValue
  6369. function shouldUpdateValue (elm, checkVal) {
  6370. return (!elm.composing && (
  6371. elm.tagName === 'OPTION' ||
  6372. isNotInFocusAndDirty(elm, checkVal) ||
  6373. isDirtyWithModifiers(elm, checkVal)
  6374. ))
  6375. }
  6376. function isNotInFocusAndDirty (elm, checkVal) {
  6377. // return true when textbox (.number and .trim) loses focus and its value is
  6378. // not equal to the updated value
  6379. var notInFocus = true;
  6380. // #6157
  6381. // work around IE bug when accessing document.activeElement in an iframe
  6382. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6383. return notInFocus && elm.value !== checkVal
  6384. }
  6385. function isDirtyWithModifiers (elm, newVal) {
  6386. var value = elm.value;
  6387. var modifiers = elm._vModifiers; // injected by v-model runtime
  6388. if (isDef(modifiers)) {
  6389. if (modifiers.lazy) {
  6390. // inputs with lazy should only be updated when not in focus
  6391. return false
  6392. }
  6393. if (modifiers.number) {
  6394. return toNumber(value) !== toNumber(newVal)
  6395. }
  6396. if (modifiers.trim) {
  6397. return value.trim() !== newVal.trim()
  6398. }
  6399. }
  6400. return value !== newVal
  6401. }
  6402. var domProps = {
  6403. create: updateDOMProps,
  6404. update: updateDOMProps
  6405. };
  6406. /* */
  6407. var parseStyleText = cached(function (cssText) {
  6408. var res = {};
  6409. var listDelimiter = /;(?![^(]*\))/g;
  6410. var propertyDelimiter = /:(.+)/;
  6411. cssText.split(listDelimiter).forEach(function (item) {
  6412. if (item) {
  6413. var tmp = item.split(propertyDelimiter);
  6414. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6415. }
  6416. });
  6417. return res
  6418. });
  6419. // merge static and dynamic style data on the same vnode
  6420. function normalizeStyleData (data) {
  6421. var style = normalizeStyleBinding(data.style);
  6422. // static style is pre-processed into an object during compilation
  6423. // and is always a fresh object, so it's safe to merge into it
  6424. return data.staticStyle
  6425. ? extend(data.staticStyle, style)
  6426. : style
  6427. }
  6428. // normalize possible array / string values into Object
  6429. function normalizeStyleBinding (bindingStyle) {
  6430. if (Array.isArray(bindingStyle)) {
  6431. return toObject(bindingStyle)
  6432. }
  6433. if (typeof bindingStyle === 'string') {
  6434. return parseStyleText(bindingStyle)
  6435. }
  6436. return bindingStyle
  6437. }
  6438. /**
  6439. * parent component style should be after child's
  6440. * so that parent component's style could override it
  6441. */
  6442. function getStyle (vnode, checkChild) {
  6443. var res = {};
  6444. var styleData;
  6445. if (checkChild) {
  6446. var childNode = vnode;
  6447. while (childNode.componentInstance) {
  6448. childNode = childNode.componentInstance._vnode;
  6449. if (
  6450. childNode && childNode.data &&
  6451. (styleData = normalizeStyleData(childNode.data))
  6452. ) {
  6453. extend(res, styleData);
  6454. }
  6455. }
  6456. }
  6457. if ((styleData = normalizeStyleData(vnode.data))) {
  6458. extend(res, styleData);
  6459. }
  6460. var parentNode = vnode;
  6461. while ((parentNode = parentNode.parent)) {
  6462. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  6463. extend(res, styleData);
  6464. }
  6465. }
  6466. return res
  6467. }
  6468. /* */
  6469. var cssVarRE = /^--/;
  6470. var importantRE = /\s*!important$/;
  6471. var setProp = function (el, name, val) {
  6472. /* istanbul ignore if */
  6473. if (cssVarRE.test(name)) {
  6474. el.style.setProperty(name, val);
  6475. } else if (importantRE.test(val)) {
  6476. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  6477. } else {
  6478. var normalizedName = normalize(name);
  6479. if (Array.isArray(val)) {
  6480. // Support values array created by autoprefixer, e.g.
  6481. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  6482. // Set them one by one, and the browser will only set those it can recognize
  6483. for (var i = 0, len = val.length; i < len; i++) {
  6484. el.style[normalizedName] = val[i];
  6485. }
  6486. } else {
  6487. el.style[normalizedName] = val;
  6488. }
  6489. }
  6490. };
  6491. var vendorNames = ['Webkit', 'Moz', 'ms'];
  6492. var emptyStyle;
  6493. var normalize = cached(function (prop) {
  6494. emptyStyle = emptyStyle || document.createElement('div').style;
  6495. prop = camelize(prop);
  6496. if (prop !== 'filter' && (prop in emptyStyle)) {
  6497. return prop
  6498. }
  6499. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  6500. for (var i = 0; i < vendorNames.length; i++) {
  6501. var name = vendorNames[i] + capName;
  6502. if (name in emptyStyle) {
  6503. return name
  6504. }
  6505. }
  6506. });
  6507. function updateStyle (oldVnode, vnode) {
  6508. var data = vnode.data;
  6509. var oldData = oldVnode.data;
  6510. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  6511. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  6512. ) {
  6513. return
  6514. }
  6515. var cur, name;
  6516. var el = vnode.elm;
  6517. var oldStaticStyle = oldData.staticStyle;
  6518. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  6519. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  6520. var oldStyle = oldStaticStyle || oldStyleBinding;
  6521. var style = normalizeStyleBinding(vnode.data.style) || {};
  6522. // store normalized style under a different key for next diff
  6523. // make sure to clone it if it's reactive, since the user likely wants
  6524. // to mutate it.
  6525. vnode.data.normalizedStyle = isDef(style.__ob__)
  6526. ? extend({}, style)
  6527. : style;
  6528. var newStyle = getStyle(vnode, true);
  6529. for (name in oldStyle) {
  6530. if (isUndef(newStyle[name])) {
  6531. setProp(el, name, '');
  6532. }
  6533. }
  6534. for (name in newStyle) {
  6535. cur = newStyle[name];
  6536. if (cur !== oldStyle[name]) {
  6537. // ie9 setting to null has no effect, must use empty string
  6538. setProp(el, name, cur == null ? '' : cur);
  6539. }
  6540. }
  6541. }
  6542. var style = {
  6543. create: updateStyle,
  6544. update: updateStyle
  6545. };
  6546. /* */
  6547. /**
  6548. * Add class with compatibility for SVG since classList is not supported on
  6549. * SVG elements in IE
  6550. */
  6551. function addClass (el, cls) {
  6552. /* istanbul ignore if */
  6553. if (!cls || !(cls = cls.trim())) {
  6554. return
  6555. }
  6556. /* istanbul ignore else */
  6557. if (el.classList) {
  6558. if (cls.indexOf(' ') > -1) {
  6559. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  6560. } else {
  6561. el.classList.add(cls);
  6562. }
  6563. } else {
  6564. var cur = " " + (el.getAttribute('class') || '') + " ";
  6565. if (cur.indexOf(' ' + cls + ' ') < 0) {
  6566. el.setAttribute('class', (cur + cls).trim());
  6567. }
  6568. }
  6569. }
  6570. /**
  6571. * Remove class with compatibility for SVG since classList is not supported on
  6572. * SVG elements in IE
  6573. */
  6574. function removeClass (el, cls) {
  6575. /* istanbul ignore if */
  6576. if (!cls || !(cls = cls.trim())) {
  6577. return
  6578. }
  6579. /* istanbul ignore else */
  6580. if (el.classList) {
  6581. if (cls.indexOf(' ') > -1) {
  6582. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  6583. } else {
  6584. el.classList.remove(cls);
  6585. }
  6586. if (!el.classList.length) {
  6587. el.removeAttribute('class');
  6588. }
  6589. } else {
  6590. var cur = " " + (el.getAttribute('class') || '') + " ";
  6591. var tar = ' ' + cls + ' ';
  6592. while (cur.indexOf(tar) >= 0) {
  6593. cur = cur.replace(tar, ' ');
  6594. }
  6595. cur = cur.trim();
  6596. if (cur) {
  6597. el.setAttribute('class', cur);
  6598. } else {
  6599. el.removeAttribute('class');
  6600. }
  6601. }
  6602. }
  6603. /* */
  6604. function resolveTransition (def) {
  6605. if (!def) {
  6606. return
  6607. }
  6608. /* istanbul ignore else */
  6609. if (typeof def === 'object') {
  6610. var res = {};
  6611. if (def.css !== false) {
  6612. extend(res, autoCssTransition(def.name || 'v'));
  6613. }
  6614. extend(res, def);
  6615. return res
  6616. } else if (typeof def === 'string') {
  6617. return autoCssTransition(def)
  6618. }
  6619. }
  6620. var autoCssTransition = cached(function (name) {
  6621. return {
  6622. enterClass: (name + "-enter"),
  6623. enterToClass: (name + "-enter-to"),
  6624. enterActiveClass: (name + "-enter-active"),
  6625. leaveClass: (name + "-leave"),
  6626. leaveToClass: (name + "-leave-to"),
  6627. leaveActiveClass: (name + "-leave-active")
  6628. }
  6629. });
  6630. var hasTransition = inBrowser && !isIE9;
  6631. var TRANSITION = 'transition';
  6632. var ANIMATION = 'animation';
  6633. // Transition property/event sniffing
  6634. var transitionProp = 'transition';
  6635. var transitionEndEvent = 'transitionend';
  6636. var animationProp = 'animation';
  6637. var animationEndEvent = 'animationend';
  6638. if (hasTransition) {
  6639. /* istanbul ignore if */
  6640. if (window.ontransitionend === undefined &&
  6641. window.onwebkittransitionend !== undefined
  6642. ) {
  6643. transitionProp = 'WebkitTransition';
  6644. transitionEndEvent = 'webkitTransitionEnd';
  6645. }
  6646. if (window.onanimationend === undefined &&
  6647. window.onwebkitanimationend !== undefined
  6648. ) {
  6649. animationProp = 'WebkitAnimation';
  6650. animationEndEvent = 'webkitAnimationEnd';
  6651. }
  6652. }
  6653. // binding to window is necessary to make hot reload work in IE in strict mode
  6654. var raf = inBrowser
  6655. ? window.requestAnimationFrame
  6656. ? window.requestAnimationFrame.bind(window)
  6657. : setTimeout
  6658. : /* istanbul ignore next */ function (fn) { return fn(); };
  6659. function nextFrame (fn) {
  6660. raf(function () {
  6661. raf(fn);
  6662. });
  6663. }
  6664. function addTransitionClass (el, cls) {
  6665. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  6666. if (transitionClasses.indexOf(cls) < 0) {
  6667. transitionClasses.push(cls);
  6668. addClass(el, cls);
  6669. }
  6670. }
  6671. function removeTransitionClass (el, cls) {
  6672. if (el._transitionClasses) {
  6673. remove(el._transitionClasses, cls);
  6674. }
  6675. removeClass(el, cls);
  6676. }
  6677. function whenTransitionEnds (
  6678. el,
  6679. expectedType,
  6680. cb
  6681. ) {
  6682. var ref = getTransitionInfo(el, expectedType);
  6683. var type = ref.type;
  6684. var timeout = ref.timeout;
  6685. var propCount = ref.propCount;
  6686. if (!type) { return cb() }
  6687. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  6688. var ended = 0;
  6689. var end = function () {
  6690. el.removeEventListener(event, onEnd);
  6691. cb();
  6692. };
  6693. var onEnd = function (e) {
  6694. if (e.target === el) {
  6695. if (++ended >= propCount) {
  6696. end();
  6697. }
  6698. }
  6699. };
  6700. setTimeout(function () {
  6701. if (ended < propCount) {
  6702. end();
  6703. }
  6704. }, timeout + 1);
  6705. el.addEventListener(event, onEnd);
  6706. }
  6707. var transformRE = /\b(transform|all)(,|$)/;
  6708. function getTransitionInfo (el, expectedType) {
  6709. var styles = window.getComputedStyle(el);
  6710. var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
  6711. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  6712. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  6713. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  6714. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  6715. var animationTimeout = getTimeout(animationDelays, animationDurations);
  6716. var type;
  6717. var timeout = 0;
  6718. var propCount = 0;
  6719. /* istanbul ignore if */
  6720. if (expectedType === TRANSITION) {
  6721. if (transitionTimeout > 0) {
  6722. type = TRANSITION;
  6723. timeout = transitionTimeout;
  6724. propCount = transitionDurations.length;
  6725. }
  6726. } else if (expectedType === ANIMATION) {
  6727. if (animationTimeout > 0) {
  6728. type = ANIMATION;
  6729. timeout = animationTimeout;
  6730. propCount = animationDurations.length;
  6731. }
  6732. } else {
  6733. timeout = Math.max(transitionTimeout, animationTimeout);
  6734. type = timeout > 0
  6735. ? transitionTimeout > animationTimeout
  6736. ? TRANSITION
  6737. : ANIMATION
  6738. : null;
  6739. propCount = type
  6740. ? type === TRANSITION
  6741. ? transitionDurations.length
  6742. : animationDurations.length
  6743. : 0;
  6744. }
  6745. var hasTransform =
  6746. type === TRANSITION &&
  6747. transformRE.test(styles[transitionProp + 'Property']);
  6748. return {
  6749. type: type,
  6750. timeout: timeout,
  6751. propCount: propCount,
  6752. hasTransform: hasTransform
  6753. }
  6754. }
  6755. function getTimeout (delays, durations) {
  6756. /* istanbul ignore next */
  6757. while (delays.length < durations.length) {
  6758. delays = delays.concat(delays);
  6759. }
  6760. return Math.max.apply(null, durations.map(function (d, i) {
  6761. return toMs(d) + toMs(delays[i])
  6762. }))
  6763. }
  6764. function toMs (s) {
  6765. return Number(s.slice(0, -1)) * 1000
  6766. }
  6767. /* */
  6768. function enter (vnode, toggleDisplay) {
  6769. var el = vnode.elm;
  6770. // call leave callback now
  6771. if (isDef(el._leaveCb)) {
  6772. el._leaveCb.cancelled = true;
  6773. el._leaveCb();
  6774. }
  6775. var data = resolveTransition(vnode.data.transition);
  6776. if (isUndef(data)) {
  6777. return
  6778. }
  6779. /* istanbul ignore if */
  6780. if (isDef(el._enterCb) || el.nodeType !== 1) {
  6781. return
  6782. }
  6783. var css = data.css;
  6784. var type = data.type;
  6785. var enterClass = data.enterClass;
  6786. var enterToClass = data.enterToClass;
  6787. var enterActiveClass = data.enterActiveClass;
  6788. var appearClass = data.appearClass;
  6789. var appearToClass = data.appearToClass;
  6790. var appearActiveClass = data.appearActiveClass;
  6791. var beforeEnter = data.beforeEnter;
  6792. var enter = data.enter;
  6793. var afterEnter = data.afterEnter;
  6794. var enterCancelled = data.enterCancelled;
  6795. var beforeAppear = data.beforeAppear;
  6796. var appear = data.appear;
  6797. var afterAppear = data.afterAppear;
  6798. var appearCancelled = data.appearCancelled;
  6799. var duration = data.duration;
  6800. // activeInstance will always be the <transition> component managing this
  6801. // transition. One edge case to check is when the <transition> is placed
  6802. // as the root node of a child component. In that case we need to check
  6803. // <transition>'s parent for appear check.
  6804. var context = activeInstance;
  6805. var transitionNode = activeInstance.$vnode;
  6806. while (transitionNode && transitionNode.parent) {
  6807. transitionNode = transitionNode.parent;
  6808. context = transitionNode.context;
  6809. }
  6810. var isAppear = !context._isMounted || !vnode.isRootInsert;
  6811. if (isAppear && !appear && appear !== '') {
  6812. return
  6813. }
  6814. var startClass = isAppear && appearClass
  6815. ? appearClass
  6816. : enterClass;
  6817. var activeClass = isAppear && appearActiveClass
  6818. ? appearActiveClass
  6819. : enterActiveClass;
  6820. var toClass = isAppear && appearToClass
  6821. ? appearToClass
  6822. : enterToClass;
  6823. var beforeEnterHook = isAppear
  6824. ? (beforeAppear || beforeEnter)
  6825. : beforeEnter;
  6826. var enterHook = isAppear
  6827. ? (typeof appear === 'function' ? appear : enter)
  6828. : enter;
  6829. var afterEnterHook = isAppear
  6830. ? (afterAppear || afterEnter)
  6831. : afterEnter;
  6832. var enterCancelledHook = isAppear
  6833. ? (appearCancelled || enterCancelled)
  6834. : enterCancelled;
  6835. var explicitEnterDuration = toNumber(
  6836. isObject(duration)
  6837. ? duration.enter
  6838. : duration
  6839. );
  6840. if ("development" !== 'production' && explicitEnterDuration != null) {
  6841. checkDuration(explicitEnterDuration, 'enter', vnode);
  6842. }
  6843. var expectsCSS = css !== false && !isIE9;
  6844. var userWantsControl = getHookArgumentsLength(enterHook);
  6845. var cb = el._enterCb = once(function () {
  6846. if (expectsCSS) {
  6847. removeTransitionClass(el, toClass);
  6848. removeTransitionClass(el, activeClass);
  6849. }
  6850. if (cb.cancelled) {
  6851. if (expectsCSS) {
  6852. removeTransitionClass(el, startClass);
  6853. }
  6854. enterCancelledHook && enterCancelledHook(el);
  6855. } else {
  6856. afterEnterHook && afterEnterHook(el);
  6857. }
  6858. el._enterCb = null;
  6859. });
  6860. if (!vnode.data.show) {
  6861. // remove pending leave element on enter by injecting an insert hook
  6862. mergeVNodeHook(vnode, 'insert', function () {
  6863. var parent = el.parentNode;
  6864. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  6865. if (pendingNode &&
  6866. pendingNode.tag === vnode.tag &&
  6867. pendingNode.elm._leaveCb
  6868. ) {
  6869. pendingNode.elm._leaveCb();
  6870. }
  6871. enterHook && enterHook(el, cb);
  6872. });
  6873. }
  6874. // start enter transition
  6875. beforeEnterHook && beforeEnterHook(el);
  6876. if (expectsCSS) {
  6877. addTransitionClass(el, startClass);
  6878. addTransitionClass(el, activeClass);
  6879. nextFrame(function () {
  6880. addTransitionClass(el, toClass);
  6881. removeTransitionClass(el, startClass);
  6882. if (!cb.cancelled && !userWantsControl) {
  6883. if (isValidDuration(explicitEnterDuration)) {
  6884. setTimeout(cb, explicitEnterDuration);
  6885. } else {
  6886. whenTransitionEnds(el, type, cb);
  6887. }
  6888. }
  6889. });
  6890. }
  6891. if (vnode.data.show) {
  6892. toggleDisplay && toggleDisplay();
  6893. enterHook && enterHook(el, cb);
  6894. }
  6895. if (!expectsCSS && !userWantsControl) {
  6896. cb();
  6897. }
  6898. }
  6899. function leave (vnode, rm) {
  6900. var el = vnode.elm;
  6901. // call enter callback now
  6902. if (isDef(el._enterCb)) {
  6903. el._enterCb.cancelled = true;
  6904. el._enterCb();
  6905. }
  6906. var data = resolveTransition(vnode.data.transition);
  6907. if (isUndef(data) || el.nodeType !== 1) {
  6908. return rm()
  6909. }
  6910. /* istanbul ignore if */
  6911. if (isDef(el._leaveCb)) {
  6912. return
  6913. }
  6914. var css = data.css;
  6915. var type = data.type;
  6916. var leaveClass = data.leaveClass;
  6917. var leaveToClass = data.leaveToClass;
  6918. var leaveActiveClass = data.leaveActiveClass;
  6919. var beforeLeave = data.beforeLeave;
  6920. var leave = data.leave;
  6921. var afterLeave = data.afterLeave;
  6922. var leaveCancelled = data.leaveCancelled;
  6923. var delayLeave = data.delayLeave;
  6924. var duration = data.duration;
  6925. var expectsCSS = css !== false && !isIE9;
  6926. var userWantsControl = getHookArgumentsLength(leave);
  6927. var explicitLeaveDuration = toNumber(
  6928. isObject(duration)
  6929. ? duration.leave
  6930. : duration
  6931. );
  6932. if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
  6933. checkDuration(explicitLeaveDuration, 'leave', vnode);
  6934. }
  6935. var cb = el._leaveCb = once(function () {
  6936. if (el.parentNode && el.parentNode._pending) {
  6937. el.parentNode._pending[vnode.key] = null;
  6938. }
  6939. if (expectsCSS) {
  6940. removeTransitionClass(el, leaveToClass);
  6941. removeTransitionClass(el, leaveActiveClass);
  6942. }
  6943. if (cb.cancelled) {
  6944. if (expectsCSS) {
  6945. removeTransitionClass(el, leaveClass);
  6946. }
  6947. leaveCancelled && leaveCancelled(el);
  6948. } else {
  6949. rm();
  6950. afterLeave && afterLeave(el);
  6951. }
  6952. el._leaveCb = null;
  6953. });
  6954. if (delayLeave) {
  6955. delayLeave(performLeave);
  6956. } else {
  6957. performLeave();
  6958. }
  6959. function performLeave () {
  6960. // the delayed leave may have already been cancelled
  6961. if (cb.cancelled) {
  6962. return
  6963. }
  6964. // record leaving element
  6965. if (!vnode.data.show) {
  6966. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  6967. }
  6968. beforeLeave && beforeLeave(el);
  6969. if (expectsCSS) {
  6970. addTransitionClass(el, leaveClass);
  6971. addTransitionClass(el, leaveActiveClass);
  6972. nextFrame(function () {
  6973. addTransitionClass(el, leaveToClass);
  6974. removeTransitionClass(el, leaveClass);
  6975. if (!cb.cancelled && !userWantsControl) {
  6976. if (isValidDuration(explicitLeaveDuration)) {
  6977. setTimeout(cb, explicitLeaveDuration);
  6978. } else {
  6979. whenTransitionEnds(el, type, cb);
  6980. }
  6981. }
  6982. });
  6983. }
  6984. leave && leave(el, cb);
  6985. if (!expectsCSS && !userWantsControl) {
  6986. cb();
  6987. }
  6988. }
  6989. }
  6990. // only used in dev mode
  6991. function checkDuration (val, name, vnode) {
  6992. if (typeof val !== 'number') {
  6993. warn(
  6994. "<transition> explicit " + name + " duration is not a valid number - " +
  6995. "got " + (JSON.stringify(val)) + ".",
  6996. vnode.context
  6997. );
  6998. } else if (isNaN(val)) {
  6999. warn(
  7000. "<transition> explicit " + name + " duration is NaN - " +
  7001. 'the duration expression might be incorrect.',
  7002. vnode.context
  7003. );
  7004. }
  7005. }
  7006. function isValidDuration (val) {
  7007. return typeof val === 'number' && !isNaN(val)
  7008. }
  7009. /**
  7010. * Normalize a transition hook's argument length. The hook may be:
  7011. * - a merged hook (invoker) with the original in .fns
  7012. * - a wrapped component method (check ._length)
  7013. * - a plain function (.length)
  7014. */
  7015. function getHookArgumentsLength (fn) {
  7016. if (isUndef(fn)) {
  7017. return false
  7018. }
  7019. var invokerFns = fn.fns;
  7020. if (isDef(invokerFns)) {
  7021. // invoker
  7022. return getHookArgumentsLength(
  7023. Array.isArray(invokerFns)
  7024. ? invokerFns[0]
  7025. : invokerFns
  7026. )
  7027. } else {
  7028. return (fn._length || fn.length) > 1
  7029. }
  7030. }
  7031. function _enter (_, vnode) {
  7032. if (vnode.data.show !== true) {
  7033. enter(vnode);
  7034. }
  7035. }
  7036. var transition = inBrowser ? {
  7037. create: _enter,
  7038. activate: _enter,
  7039. remove: function remove$$1 (vnode, rm) {
  7040. /* istanbul ignore else */
  7041. if (vnode.data.show !== true) {
  7042. leave(vnode, rm);
  7043. } else {
  7044. rm();
  7045. }
  7046. }
  7047. } : {};
  7048. var platformModules = [
  7049. attrs,
  7050. klass,
  7051. events,
  7052. domProps,
  7053. style,
  7054. transition
  7055. ];
  7056. /* */
  7057. // the directive module should be applied last, after all
  7058. // built-in modules have been applied.
  7059. var modules = platformModules.concat(baseModules);
  7060. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7061. /**
  7062. * Not type checking this file because flow doesn't like attaching
  7063. * properties to Elements.
  7064. */
  7065. /* istanbul ignore if */
  7066. if (isIE9) {
  7067. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7068. document.addEventListener('selectionchange', function () {
  7069. var el = document.activeElement;
  7070. if (el && el.vmodel) {
  7071. trigger(el, 'input');
  7072. }
  7073. });
  7074. }
  7075. var directive = {
  7076. inserted: function inserted (el, binding, vnode, oldVnode) {
  7077. if (vnode.tag === 'select') {
  7078. // #6903
  7079. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7080. mergeVNodeHook(vnode, 'postpatch', function () {
  7081. directive.componentUpdated(el, binding, vnode);
  7082. });
  7083. } else {
  7084. setSelected(el, binding, vnode.context);
  7085. }
  7086. el._vOptions = [].map.call(el.options, getValue);
  7087. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7088. el._vModifiers = binding.modifiers;
  7089. if (!binding.modifiers.lazy) {
  7090. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7091. // switching focus before confirming composition choice
  7092. // this also fixes the issue where some browsers e.g. iOS Chrome
  7093. // fires "change" instead of "input" on autocomplete.
  7094. el.addEventListener('change', onCompositionEnd);
  7095. if (!isAndroid) {
  7096. el.addEventListener('compositionstart', onCompositionStart);
  7097. el.addEventListener('compositionend', onCompositionEnd);
  7098. }
  7099. /* istanbul ignore if */
  7100. if (isIE9) {
  7101. el.vmodel = true;
  7102. }
  7103. }
  7104. }
  7105. },
  7106. componentUpdated: function componentUpdated (el, binding, vnode) {
  7107. if (vnode.tag === 'select') {
  7108. setSelected(el, binding, vnode.context);
  7109. // in case the options rendered by v-for have changed,
  7110. // it's possible that the value is out-of-sync with the rendered options.
  7111. // detect such cases and filter out values that no longer has a matching
  7112. // option in the DOM.
  7113. var prevOptions = el._vOptions;
  7114. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7115. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7116. // trigger change event if
  7117. // no matching option found for at least one value
  7118. var needReset = el.multiple
  7119. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7120. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7121. if (needReset) {
  7122. trigger(el, 'change');
  7123. }
  7124. }
  7125. }
  7126. }
  7127. };
  7128. function setSelected (el, binding, vm) {
  7129. actuallySetSelected(el, binding, vm);
  7130. /* istanbul ignore if */
  7131. if (isIE || isEdge) {
  7132. setTimeout(function () {
  7133. actuallySetSelected(el, binding, vm);
  7134. }, 0);
  7135. }
  7136. }
  7137. function actuallySetSelected (el, binding, vm) {
  7138. var value = binding.value;
  7139. var isMultiple = el.multiple;
  7140. if (isMultiple && !Array.isArray(value)) {
  7141. "development" !== 'production' && warn(
  7142. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7143. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7144. vm
  7145. );
  7146. return
  7147. }
  7148. var selected, option;
  7149. for (var i = 0, l = el.options.length; i < l; i++) {
  7150. option = el.options[i];
  7151. if (isMultiple) {
  7152. selected = looseIndexOf(value, getValue(option)) > -1;
  7153. if (option.selected !== selected) {
  7154. option.selected = selected;
  7155. }
  7156. } else {
  7157. if (looseEqual(getValue(option), value)) {
  7158. if (el.selectedIndex !== i) {
  7159. el.selectedIndex = i;
  7160. }
  7161. return
  7162. }
  7163. }
  7164. }
  7165. if (!isMultiple) {
  7166. el.selectedIndex = -1;
  7167. }
  7168. }
  7169. function hasNoMatchingOption (value, options) {
  7170. return options.every(function (o) { return !looseEqual(o, value); })
  7171. }
  7172. function getValue (option) {
  7173. return '_value' in option
  7174. ? option._value
  7175. : option.value
  7176. }
  7177. function onCompositionStart (e) {
  7178. e.target.composing = true;
  7179. }
  7180. function onCompositionEnd (e) {
  7181. // prevent triggering an input event for no reason
  7182. if (!e.target.composing) { return }
  7183. e.target.composing = false;
  7184. trigger(e.target, 'input');
  7185. }
  7186. function trigger (el, type) {
  7187. var e = document.createEvent('HTMLEvents');
  7188. e.initEvent(type, true, true);
  7189. el.dispatchEvent(e);
  7190. }
  7191. /* */
  7192. // recursively search for possible transition defined inside the component root
  7193. function locateNode (vnode) {
  7194. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7195. ? locateNode(vnode.componentInstance._vnode)
  7196. : vnode
  7197. }
  7198. var show = {
  7199. bind: function bind (el, ref, vnode) {
  7200. var value = ref.value;
  7201. vnode = locateNode(vnode);
  7202. var transition$$1 = vnode.data && vnode.data.transition;
  7203. var originalDisplay = el.__vOriginalDisplay =
  7204. el.style.display === 'none' ? '' : el.style.display;
  7205. if (value && transition$$1) {
  7206. vnode.data.show = true;
  7207. enter(vnode, function () {
  7208. el.style.display = originalDisplay;
  7209. });
  7210. } else {
  7211. el.style.display = value ? originalDisplay : 'none';
  7212. }
  7213. },
  7214. update: function update (el, ref, vnode) {
  7215. var value = ref.value;
  7216. var oldValue = ref.oldValue;
  7217. /* istanbul ignore if */
  7218. if (value === oldValue) { return }
  7219. vnode = locateNode(vnode);
  7220. var transition$$1 = vnode.data && vnode.data.transition;
  7221. if (transition$$1) {
  7222. vnode.data.show = true;
  7223. if (value) {
  7224. enter(vnode, function () {
  7225. el.style.display = el.__vOriginalDisplay;
  7226. });
  7227. } else {
  7228. leave(vnode, function () {
  7229. el.style.display = 'none';
  7230. });
  7231. }
  7232. } else {
  7233. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7234. }
  7235. },
  7236. unbind: function unbind (
  7237. el,
  7238. binding,
  7239. vnode,
  7240. oldVnode,
  7241. isDestroy
  7242. ) {
  7243. if (!isDestroy) {
  7244. el.style.display = el.__vOriginalDisplay;
  7245. }
  7246. }
  7247. };
  7248. var platformDirectives = {
  7249. model: directive,
  7250. show: show
  7251. };
  7252. /* */
  7253. // Provides transition support for a single element/component.
  7254. // supports transition mode (out-in / in-out)
  7255. var transitionProps = {
  7256. name: String,
  7257. appear: Boolean,
  7258. css: Boolean,
  7259. mode: String,
  7260. type: String,
  7261. enterClass: String,
  7262. leaveClass: String,
  7263. enterToClass: String,
  7264. leaveToClass: String,
  7265. enterActiveClass: String,
  7266. leaveActiveClass: String,
  7267. appearClass: String,
  7268. appearActiveClass: String,
  7269. appearToClass: String,
  7270. duration: [Number, String, Object]
  7271. };
  7272. // in case the child is also an abstract component, e.g. <keep-alive>
  7273. // we want to recursively retrieve the real component to be rendered
  7274. function getRealChild (vnode) {
  7275. var compOptions = vnode && vnode.componentOptions;
  7276. if (compOptions && compOptions.Ctor.options.abstract) {
  7277. return getRealChild(getFirstComponentChild(compOptions.children))
  7278. } else {
  7279. return vnode
  7280. }
  7281. }
  7282. function extractTransitionData (comp) {
  7283. var data = {};
  7284. var options = comp.$options;
  7285. // props
  7286. for (var key in options.propsData) {
  7287. data[key] = comp[key];
  7288. }
  7289. // events.
  7290. // extract listeners and pass them directly to the transition methods
  7291. var listeners = options._parentListeners;
  7292. for (var key$1 in listeners) {
  7293. data[camelize(key$1)] = listeners[key$1];
  7294. }
  7295. return data
  7296. }
  7297. function placeholder (h, rawChild) {
  7298. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7299. return h('keep-alive', {
  7300. props: rawChild.componentOptions.propsData
  7301. })
  7302. }
  7303. }
  7304. function hasParentTransition (vnode) {
  7305. while ((vnode = vnode.parent)) {
  7306. if (vnode.data.transition) {
  7307. return true
  7308. }
  7309. }
  7310. }
  7311. function isSameChild (child, oldChild) {
  7312. return oldChild.key === child.key && oldChild.tag === child.tag
  7313. }
  7314. var Transition = {
  7315. name: 'transition',
  7316. props: transitionProps,
  7317. abstract: true,
  7318. render: function render (h) {
  7319. var this$1 = this;
  7320. var children = this.$slots.default;
  7321. if (!children) {
  7322. return
  7323. }
  7324. // filter out text nodes (possible whitespaces)
  7325. children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
  7326. /* istanbul ignore if */
  7327. if (!children.length) {
  7328. return
  7329. }
  7330. // warn multiple elements
  7331. if ("development" !== 'production' && children.length > 1) {
  7332. warn(
  7333. '<transition> can only be used on a single element. Use ' +
  7334. '<transition-group> for lists.',
  7335. this.$parent
  7336. );
  7337. }
  7338. var mode = this.mode;
  7339. // warn invalid mode
  7340. if ("development" !== 'production' &&
  7341. mode && mode !== 'in-out' && mode !== 'out-in'
  7342. ) {
  7343. warn(
  7344. 'invalid <transition> mode: ' + mode,
  7345. this.$parent
  7346. );
  7347. }
  7348. var rawChild = children[0];
  7349. // if this is a component root node and the component's
  7350. // parent container node also has transition, skip.
  7351. if (hasParentTransition(this.$vnode)) {
  7352. return rawChild
  7353. }
  7354. // apply transition data to child
  7355. // use getRealChild() to ignore abstract components e.g. keep-alive
  7356. var child = getRealChild(rawChild);
  7357. /* istanbul ignore if */
  7358. if (!child) {
  7359. return rawChild
  7360. }
  7361. if (this._leaving) {
  7362. return placeholder(h, rawChild)
  7363. }
  7364. // ensure a key that is unique to the vnode type and to this transition
  7365. // component instance. This key will be used to remove pending leaving nodes
  7366. // during entering.
  7367. var id = "__transition-" + (this._uid) + "-";
  7368. child.key = child.key == null
  7369. ? child.isComment
  7370. ? id + 'comment'
  7371. : id + child.tag
  7372. : isPrimitive(child.key)
  7373. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7374. : child.key;
  7375. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7376. var oldRawChild = this._vnode;
  7377. var oldChild = getRealChild(oldRawChild);
  7378. // mark v-show
  7379. // so that the transition module can hand over the control to the directive
  7380. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  7381. child.data.show = true;
  7382. }
  7383. if (
  7384. oldChild &&
  7385. oldChild.data &&
  7386. !isSameChild(child, oldChild) &&
  7387. !isAsyncPlaceholder(oldChild) &&
  7388. // #6687 component root is a comment node
  7389. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7390. ) {
  7391. // replace old child transition data with fresh one
  7392. // important for dynamic transitions!
  7393. var oldData = oldChild.data.transition = extend({}, data);
  7394. // handle transition mode
  7395. if (mode === 'out-in') {
  7396. // return placeholder node and queue update when leave finishes
  7397. this._leaving = true;
  7398. mergeVNodeHook(oldData, 'afterLeave', function () {
  7399. this$1._leaving = false;
  7400. this$1.$forceUpdate();
  7401. });
  7402. return placeholder(h, rawChild)
  7403. } else if (mode === 'in-out') {
  7404. if (isAsyncPlaceholder(child)) {
  7405. return oldRawChild
  7406. }
  7407. var delayedLeave;
  7408. var performLeave = function () { delayedLeave(); };
  7409. mergeVNodeHook(data, 'afterEnter', performLeave);
  7410. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7411. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7412. }
  7413. }
  7414. return rawChild
  7415. }
  7416. };
  7417. /* */
  7418. // Provides transition support for list items.
  7419. // supports move transitions using the FLIP technique.
  7420. // Because the vdom's children update algorithm is "unstable" - i.e.
  7421. // it doesn't guarantee the relative positioning of removed elements,
  7422. // we force transition-group to update its children into two passes:
  7423. // in the first pass, we remove all nodes that need to be removed,
  7424. // triggering their leaving transition; in the second pass, we insert/move
  7425. // into the final desired state. This way in the second pass removed
  7426. // nodes will remain where they should be.
  7427. var props = extend({
  7428. tag: String,
  7429. moveClass: String
  7430. }, transitionProps);
  7431. delete props.mode;
  7432. var TransitionGroup = {
  7433. props: props,
  7434. render: function render (h) {
  7435. var tag = this.tag || this.$vnode.data.tag || 'span';
  7436. var map = Object.create(null);
  7437. var prevChildren = this.prevChildren = this.children;
  7438. var rawChildren = this.$slots.default || [];
  7439. var children = this.children = [];
  7440. var transitionData = extractTransitionData(this);
  7441. for (var i = 0; i < rawChildren.length; i++) {
  7442. var c = rawChildren[i];
  7443. if (c.tag) {
  7444. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  7445. children.push(c);
  7446. map[c.key] = c
  7447. ;(c.data || (c.data = {})).transition = transitionData;
  7448. } else {
  7449. var opts = c.componentOptions;
  7450. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  7451. warn(("<transition-group> children must be keyed: <" + name + ">"));
  7452. }
  7453. }
  7454. }
  7455. if (prevChildren) {
  7456. var kept = [];
  7457. var removed = [];
  7458. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  7459. var c$1 = prevChildren[i$1];
  7460. c$1.data.transition = transitionData;
  7461. c$1.data.pos = c$1.elm.getBoundingClientRect();
  7462. if (map[c$1.key]) {
  7463. kept.push(c$1);
  7464. } else {
  7465. removed.push(c$1);
  7466. }
  7467. }
  7468. this.kept = h(tag, null, kept);
  7469. this.removed = removed;
  7470. }
  7471. return h(tag, null, children)
  7472. },
  7473. beforeUpdate: function beforeUpdate () {
  7474. // force removing pass
  7475. this.__patch__(
  7476. this._vnode,
  7477. this.kept,
  7478. false, // hydrating
  7479. true // removeOnly (!important avoids unnecessary moves)
  7480. );
  7481. this._vnode = this.kept;
  7482. },
  7483. updated: function updated () {
  7484. var children = this.prevChildren;
  7485. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  7486. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  7487. return
  7488. }
  7489. // we divide the work into three loops to avoid mixing DOM reads and writes
  7490. // in each iteration - which helps prevent layout thrashing.
  7491. children.forEach(callPendingCbs);
  7492. children.forEach(recordPosition);
  7493. children.forEach(applyTranslation);
  7494. // force reflow to put everything in position
  7495. // assign to this to avoid being removed in tree-shaking
  7496. // $flow-disable-line
  7497. this._reflow = document.body.offsetHeight;
  7498. children.forEach(function (c) {
  7499. if (c.data.moved) {
  7500. var el = c.elm;
  7501. var s = el.style;
  7502. addTransitionClass(el, moveClass);
  7503. s.transform = s.WebkitTransform = s.transitionDuration = '';
  7504. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  7505. if (!e || /transform$/.test(e.propertyName)) {
  7506. el.removeEventListener(transitionEndEvent, cb);
  7507. el._moveCb = null;
  7508. removeTransitionClass(el, moveClass);
  7509. }
  7510. });
  7511. }
  7512. });
  7513. },
  7514. methods: {
  7515. hasMove: function hasMove (el, moveClass) {
  7516. /* istanbul ignore if */
  7517. if (!hasTransition) {
  7518. return false
  7519. }
  7520. /* istanbul ignore if */
  7521. if (this._hasMove) {
  7522. return this._hasMove
  7523. }
  7524. // Detect whether an element with the move class applied has
  7525. // CSS transitions. Since the element may be inside an entering
  7526. // transition at this very moment, we make a clone of it and remove
  7527. // all other transition classes applied to ensure only the move class
  7528. // is applied.
  7529. var clone = el.cloneNode();
  7530. if (el._transitionClasses) {
  7531. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  7532. }
  7533. addClass(clone, moveClass);
  7534. clone.style.display = 'none';
  7535. this.$el.appendChild(clone);
  7536. var info = getTransitionInfo(clone);
  7537. this.$el.removeChild(clone);
  7538. return (this._hasMove = info.hasTransform)
  7539. }
  7540. }
  7541. };
  7542. function callPendingCbs (c) {
  7543. /* istanbul ignore if */
  7544. if (c.elm._moveCb) {
  7545. c.elm._moveCb();
  7546. }
  7547. /* istanbul ignore if */
  7548. if (c.elm._enterCb) {
  7549. c.elm._enterCb();
  7550. }
  7551. }
  7552. function recordPosition (c) {
  7553. c.data.newPos = c.elm.getBoundingClientRect();
  7554. }
  7555. function applyTranslation (c) {
  7556. var oldPos = c.data.pos;
  7557. var newPos = c.data.newPos;
  7558. var dx = oldPos.left - newPos.left;
  7559. var dy = oldPos.top - newPos.top;
  7560. if (dx || dy) {
  7561. c.data.moved = true;
  7562. var s = c.elm.style;
  7563. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  7564. s.transitionDuration = '0s';
  7565. }
  7566. }
  7567. var platformComponents = {
  7568. Transition: Transition,
  7569. TransitionGroup: TransitionGroup
  7570. };
  7571. /* */
  7572. // install platform specific utils
  7573. Vue$3.config.mustUseProp = mustUseProp;
  7574. Vue$3.config.isReservedTag = isReservedTag;
  7575. Vue$3.config.isReservedAttr = isReservedAttr;
  7576. Vue$3.config.getTagNamespace = getTagNamespace;
  7577. Vue$3.config.isUnknownElement = isUnknownElement;
  7578. // install platform runtime directives & components
  7579. extend(Vue$3.options.directives, platformDirectives);
  7580. extend(Vue$3.options.components, platformComponents);
  7581. // install platform patch function
  7582. Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
  7583. // public mount method
  7584. Vue$3.prototype.$mount = function (
  7585. el,
  7586. hydrating
  7587. ) {
  7588. el = el && inBrowser ? query(el) : undefined;
  7589. return mountComponent(this, el, hydrating)
  7590. };
  7591. // devtools global hook
  7592. /* istanbul ignore next */
  7593. Vue$3.nextTick(function () {
  7594. if (config.devtools) {
  7595. if (devtools) {
  7596. devtools.emit('init', Vue$3);
  7597. } else if ("development" !== 'production' && isChrome) {
  7598. console[console.info ? 'info' : 'log'](
  7599. 'Download the Vue Devtools extension for a better development experience:\n' +
  7600. 'https://github.com/vuejs/vue-devtools'
  7601. );
  7602. }
  7603. }
  7604. if ("development" !== 'production' &&
  7605. config.productionTip !== false &&
  7606. inBrowser && typeof console !== 'undefined'
  7607. ) {
  7608. console[console.info ? 'info' : 'log'](
  7609. "You are running Vue in development mode.\n" +
  7610. "Make sure to turn on production mode when deploying for production.\n" +
  7611. "See more tips at https://vuejs.org/guide/deployment.html"
  7612. );
  7613. }
  7614. }, 0);
  7615. /* */
  7616. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  7617. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  7618. var buildRegex = cached(function (delimiters) {
  7619. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  7620. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  7621. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  7622. });
  7623. function parseText (
  7624. text,
  7625. delimiters
  7626. ) {
  7627. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  7628. if (!tagRE.test(text)) {
  7629. return
  7630. }
  7631. var tokens = [];
  7632. var rawTokens = [];
  7633. var lastIndex = tagRE.lastIndex = 0;
  7634. var match, index, tokenValue;
  7635. while ((match = tagRE.exec(text))) {
  7636. index = match.index;
  7637. // push text token
  7638. if (index > lastIndex) {
  7639. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  7640. tokens.push(JSON.stringify(tokenValue));
  7641. }
  7642. // tag token
  7643. var exp = parseFilters(match[1].trim());
  7644. tokens.push(("_s(" + exp + ")"));
  7645. rawTokens.push({ '@binding': exp });
  7646. lastIndex = index + match[0].length;
  7647. }
  7648. if (lastIndex < text.length) {
  7649. rawTokens.push(tokenValue = text.slice(lastIndex));
  7650. tokens.push(JSON.stringify(tokenValue));
  7651. }
  7652. return {
  7653. expression: tokens.join('+'),
  7654. tokens: rawTokens
  7655. }
  7656. }
  7657. /* */
  7658. function transformNode (el, options) {
  7659. var warn = options.warn || baseWarn;
  7660. var staticClass = getAndRemoveAttr(el, 'class');
  7661. if ("development" !== 'production' && staticClass) {
  7662. var res = parseText(staticClass, options.delimiters);
  7663. if (res) {
  7664. warn(
  7665. "class=\"" + staticClass + "\": " +
  7666. 'Interpolation inside attributes has been removed. ' +
  7667. 'Use v-bind or the colon shorthand instead. For example, ' +
  7668. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  7669. );
  7670. }
  7671. }
  7672. if (staticClass) {
  7673. el.staticClass = JSON.stringify(staticClass);
  7674. }
  7675. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  7676. if (classBinding) {
  7677. el.classBinding = classBinding;
  7678. }
  7679. }
  7680. function genData (el) {
  7681. var data = '';
  7682. if (el.staticClass) {
  7683. data += "staticClass:" + (el.staticClass) + ",";
  7684. }
  7685. if (el.classBinding) {
  7686. data += "class:" + (el.classBinding) + ",";
  7687. }
  7688. return data
  7689. }
  7690. var klass$1 = {
  7691. staticKeys: ['staticClass'],
  7692. transformNode: transformNode,
  7693. genData: genData
  7694. };
  7695. /* */
  7696. function transformNode$1 (el, options) {
  7697. var warn = options.warn || baseWarn;
  7698. var staticStyle = getAndRemoveAttr(el, 'style');
  7699. if (staticStyle) {
  7700. /* istanbul ignore if */
  7701. {
  7702. var res = parseText(staticStyle, options.delimiters);
  7703. if (res) {
  7704. warn(
  7705. "style=\"" + staticStyle + "\": " +
  7706. 'Interpolation inside attributes has been removed. ' +
  7707. 'Use v-bind or the colon shorthand instead. For example, ' +
  7708. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  7709. );
  7710. }
  7711. }
  7712. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  7713. }
  7714. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  7715. if (styleBinding) {
  7716. el.styleBinding = styleBinding;
  7717. }
  7718. }
  7719. function genData$1 (el) {
  7720. var data = '';
  7721. if (el.staticStyle) {
  7722. data += "staticStyle:" + (el.staticStyle) + ",";
  7723. }
  7724. if (el.styleBinding) {
  7725. data += "style:(" + (el.styleBinding) + "),";
  7726. }
  7727. return data
  7728. }
  7729. var style$1 = {
  7730. staticKeys: ['staticStyle'],
  7731. transformNode: transformNode$1,
  7732. genData: genData$1
  7733. };
  7734. /* */
  7735. var decoder;
  7736. var he = {
  7737. decode: function decode (html) {
  7738. decoder = decoder || document.createElement('div');
  7739. decoder.innerHTML = html;
  7740. return decoder.textContent
  7741. }
  7742. };
  7743. /* */
  7744. var isUnaryTag = makeMap(
  7745. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  7746. 'link,meta,param,source,track,wbr'
  7747. );
  7748. // Elements that you can, intentionally, leave open
  7749. // (and which close themselves)
  7750. var canBeLeftOpenTag = makeMap(
  7751. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  7752. );
  7753. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  7754. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  7755. var isNonPhrasingTag = makeMap(
  7756. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  7757. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  7758. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  7759. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  7760. 'title,tr,track'
  7761. );
  7762. /**
  7763. * Not type-checking this file because it's mostly vendor code.
  7764. */
  7765. /*!
  7766. * HTML Parser By John Resig (ejohn.org)
  7767. * Modified by Juriy "kangax" Zaytsev
  7768. * Original code by Erik Arvidsson, Mozilla Public License
  7769. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  7770. */
  7771. // Regular Expressions for parsing tags and attributes
  7772. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  7773. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  7774. // but for Vue templates we can enforce a simple charset
  7775. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  7776. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  7777. var startTagOpen = new RegExp(("^<" + qnameCapture));
  7778. var startTagClose = /^\s*(\/?)>/;
  7779. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  7780. var doctype = /^<!DOCTYPE [^>]+>/i;
  7781. var comment = /^<!--/;
  7782. var conditionalComment = /^<!\[/;
  7783. var IS_REGEX_CAPTURING_BROKEN = false;
  7784. 'x'.replace(/x(.)?/g, function (m, g) {
  7785. IS_REGEX_CAPTURING_BROKEN = g === '';
  7786. });
  7787. // Special Elements (can contain anything)
  7788. var isPlainTextElement = makeMap('script,style,textarea', true);
  7789. var reCache = {};
  7790. var decodingMap = {
  7791. '&lt;': '<',
  7792. '&gt;': '>',
  7793. '&quot;': '"',
  7794. '&amp;': '&',
  7795. '&#10;': '\n',
  7796. '&#9;': '\t'
  7797. };
  7798. var encodedAttr = /&(?:lt|gt|quot|amp);/g;
  7799. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10|#9);/g;
  7800. // #5992
  7801. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  7802. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  7803. function decodeAttr (value, shouldDecodeNewlines) {
  7804. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  7805. return value.replace(re, function (match) { return decodingMap[match]; })
  7806. }
  7807. function parseHTML (html, options) {
  7808. var stack = [];
  7809. var expectHTML = options.expectHTML;
  7810. var isUnaryTag$$1 = options.isUnaryTag || no;
  7811. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  7812. var index = 0;
  7813. var last, lastTag;
  7814. while (html) {
  7815. last = html;
  7816. // Make sure we're not in a plaintext content element like script/style
  7817. if (!lastTag || !isPlainTextElement(lastTag)) {
  7818. var textEnd = html.indexOf('<');
  7819. if (textEnd === 0) {
  7820. // Comment:
  7821. if (comment.test(html)) {
  7822. var commentEnd = html.indexOf('-->');
  7823. if (commentEnd >= 0) {
  7824. if (options.shouldKeepComment) {
  7825. options.comment(html.substring(4, commentEnd));
  7826. }
  7827. advance(commentEnd + 3);
  7828. continue
  7829. }
  7830. }
  7831. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  7832. if (conditionalComment.test(html)) {
  7833. var conditionalEnd = html.indexOf(']>');
  7834. if (conditionalEnd >= 0) {
  7835. advance(conditionalEnd + 2);
  7836. continue
  7837. }
  7838. }
  7839. // Doctype:
  7840. var doctypeMatch = html.match(doctype);
  7841. if (doctypeMatch) {
  7842. advance(doctypeMatch[0].length);
  7843. continue
  7844. }
  7845. // End tag:
  7846. var endTagMatch = html.match(endTag);
  7847. if (endTagMatch) {
  7848. var curIndex = index;
  7849. advance(endTagMatch[0].length);
  7850. parseEndTag(endTagMatch[1], curIndex, index);
  7851. continue
  7852. }
  7853. // Start tag:
  7854. var startTagMatch = parseStartTag();
  7855. if (startTagMatch) {
  7856. handleStartTag(startTagMatch);
  7857. if (shouldIgnoreFirstNewline(lastTag, html)) {
  7858. advance(1);
  7859. }
  7860. continue
  7861. }
  7862. }
  7863. var text = (void 0), rest = (void 0), next = (void 0);
  7864. if (textEnd >= 0) {
  7865. rest = html.slice(textEnd);
  7866. while (
  7867. !endTag.test(rest) &&
  7868. !startTagOpen.test(rest) &&
  7869. !comment.test(rest) &&
  7870. !conditionalComment.test(rest)
  7871. ) {
  7872. // < in plain text, be forgiving and treat it as text
  7873. next = rest.indexOf('<', 1);
  7874. if (next < 0) { break }
  7875. textEnd += next;
  7876. rest = html.slice(textEnd);
  7877. }
  7878. text = html.substring(0, textEnd);
  7879. advance(textEnd);
  7880. }
  7881. if (textEnd < 0) {
  7882. text = html;
  7883. html = '';
  7884. }
  7885. if (options.chars && text) {
  7886. options.chars(text);
  7887. }
  7888. } else {
  7889. var endTagLength = 0;
  7890. var stackedTag = lastTag.toLowerCase();
  7891. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  7892. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  7893. endTagLength = endTag.length;
  7894. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  7895. text = text
  7896. .replace(/<!--([\s\S]*?)-->/g, '$1')
  7897. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  7898. }
  7899. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  7900. text = text.slice(1);
  7901. }
  7902. if (options.chars) {
  7903. options.chars(text);
  7904. }
  7905. return ''
  7906. });
  7907. index += html.length - rest$1.length;
  7908. html = rest$1;
  7909. parseEndTag(stackedTag, index - endTagLength, index);
  7910. }
  7911. if (html === last) {
  7912. options.chars && options.chars(html);
  7913. if ("development" !== 'production' && !stack.length && options.warn) {
  7914. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""));
  7915. }
  7916. break
  7917. }
  7918. }
  7919. // Clean up any remaining tags
  7920. parseEndTag();
  7921. function advance (n) {
  7922. index += n;
  7923. html = html.substring(n);
  7924. }
  7925. function parseStartTag () {
  7926. var start = html.match(startTagOpen);
  7927. if (start) {
  7928. var match = {
  7929. tagName: start[1],
  7930. attrs: [],
  7931. start: index
  7932. };
  7933. advance(start[0].length);
  7934. var end, attr;
  7935. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  7936. advance(attr[0].length);
  7937. match.attrs.push(attr);
  7938. }
  7939. if (end) {
  7940. match.unarySlash = end[1];
  7941. advance(end[0].length);
  7942. match.end = index;
  7943. return match
  7944. }
  7945. }
  7946. }
  7947. function handleStartTag (match) {
  7948. var tagName = match.tagName;
  7949. var unarySlash = match.unarySlash;
  7950. if (expectHTML) {
  7951. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  7952. parseEndTag(lastTag);
  7953. }
  7954. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  7955. parseEndTag(tagName);
  7956. }
  7957. }
  7958. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  7959. var l = match.attrs.length;
  7960. var attrs = new Array(l);
  7961. for (var i = 0; i < l; i++) {
  7962. var args = match.attrs[i];
  7963. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  7964. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  7965. if (args[3] === '') { delete args[3]; }
  7966. if (args[4] === '') { delete args[4]; }
  7967. if (args[5] === '') { delete args[5]; }
  7968. }
  7969. var value = args[3] || args[4] || args[5] || '';
  7970. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  7971. ? options.shouldDecodeNewlinesForHref
  7972. : options.shouldDecodeNewlines;
  7973. attrs[i] = {
  7974. name: args[1],
  7975. value: decodeAttr(value, shouldDecodeNewlines)
  7976. };
  7977. }
  7978. if (!unary) {
  7979. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs });
  7980. lastTag = tagName;
  7981. }
  7982. if (options.start) {
  7983. options.start(tagName, attrs, unary, match.start, match.end);
  7984. }
  7985. }
  7986. function parseEndTag (tagName, start, end) {
  7987. var pos, lowerCasedTagName;
  7988. if (start == null) { start = index; }
  7989. if (end == null) { end = index; }
  7990. if (tagName) {
  7991. lowerCasedTagName = tagName.toLowerCase();
  7992. }
  7993. // Find the closest opened tag of the same type
  7994. if (tagName) {
  7995. for (pos = stack.length - 1; pos >= 0; pos--) {
  7996. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  7997. break
  7998. }
  7999. }
  8000. } else {
  8001. // If no tag name is provided, clean shop
  8002. pos = 0;
  8003. }
  8004. if (pos >= 0) {
  8005. // Close all the open elements, up the stack
  8006. for (var i = stack.length - 1; i >= pos; i--) {
  8007. if ("development" !== 'production' &&
  8008. (i > pos || !tagName) &&
  8009. options.warn
  8010. ) {
  8011. options.warn(
  8012. ("tag <" + (stack[i].tag) + "> has no matching end tag.")
  8013. );
  8014. }
  8015. if (options.end) {
  8016. options.end(stack[i].tag, start, end);
  8017. }
  8018. }
  8019. // Remove the open elements from the stack
  8020. stack.length = pos;
  8021. lastTag = pos && stack[pos - 1].tag;
  8022. } else if (lowerCasedTagName === 'br') {
  8023. if (options.start) {
  8024. options.start(tagName, [], true, start, end);
  8025. }
  8026. } else if (lowerCasedTagName === 'p') {
  8027. if (options.start) {
  8028. options.start(tagName, [], false, start, end);
  8029. }
  8030. if (options.end) {
  8031. options.end(tagName, start, end);
  8032. }
  8033. }
  8034. }
  8035. }
  8036. /* */
  8037. var onRE = /^@|^v-on:/;
  8038. var dirRE = /^v-|^@|^:/;
  8039. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  8040. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8041. var stripParensRE = /^\(|\)$/g;
  8042. var argRE = /:(.*)$/;
  8043. var bindRE = /^:|^v-bind:/;
  8044. var modifierRE = /\.[^.]+/g;
  8045. var decodeHTMLCached = cached(he.decode);
  8046. // configurable state
  8047. var warn$2;
  8048. var delimiters;
  8049. var transforms;
  8050. var preTransforms;
  8051. var postTransforms;
  8052. var platformIsPreTag;
  8053. var platformMustUseProp;
  8054. var platformGetTagNamespace;
  8055. function createASTElement (
  8056. tag,
  8057. attrs,
  8058. parent
  8059. ) {
  8060. return {
  8061. type: 1,
  8062. tag: tag,
  8063. attrsList: attrs,
  8064. attrsMap: makeAttrsMap(attrs),
  8065. parent: parent,
  8066. children: []
  8067. }
  8068. }
  8069. /**
  8070. * Convert HTML string to AST.
  8071. */
  8072. function parse (
  8073. template,
  8074. options
  8075. ) {
  8076. warn$2 = options.warn || baseWarn;
  8077. platformIsPreTag = options.isPreTag || no;
  8078. platformMustUseProp = options.mustUseProp || no;
  8079. platformGetTagNamespace = options.getTagNamespace || no;
  8080. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8081. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8082. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8083. delimiters = options.delimiters;
  8084. var stack = [];
  8085. var preserveWhitespace = options.preserveWhitespace !== false;
  8086. var root;
  8087. var currentParent;
  8088. var inVPre = false;
  8089. var inPre = false;
  8090. var warned = false;
  8091. function warnOnce (msg) {
  8092. if (!warned) {
  8093. warned = true;
  8094. warn$2(msg);
  8095. }
  8096. }
  8097. function closeElement (element) {
  8098. // check pre state
  8099. if (element.pre) {
  8100. inVPre = false;
  8101. }
  8102. if (platformIsPreTag(element.tag)) {
  8103. inPre = false;
  8104. }
  8105. // apply post-transforms
  8106. for (var i = 0; i < postTransforms.length; i++) {
  8107. postTransforms[i](element, options);
  8108. }
  8109. }
  8110. parseHTML(template, {
  8111. warn: warn$2,
  8112. expectHTML: options.expectHTML,
  8113. isUnaryTag: options.isUnaryTag,
  8114. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8115. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8116. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8117. shouldKeepComment: options.comments,
  8118. start: function start (tag, attrs, unary) {
  8119. // check namespace.
  8120. // inherit parent ns if there is one
  8121. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8122. // handle IE svg bug
  8123. /* istanbul ignore if */
  8124. if (isIE && ns === 'svg') {
  8125. attrs = guardIESVGBug(attrs);
  8126. }
  8127. var element = createASTElement(tag, attrs, currentParent);
  8128. if (ns) {
  8129. element.ns = ns;
  8130. }
  8131. if (isForbiddenTag(element) && !isServerRendering()) {
  8132. element.forbidden = true;
  8133. "development" !== 'production' && warn$2(
  8134. 'Templates should only be responsible for mapping the state to the ' +
  8135. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8136. "<" + tag + ">" + ', as they will not be parsed.'
  8137. );
  8138. }
  8139. // apply pre-transforms
  8140. for (var i = 0; i < preTransforms.length; i++) {
  8141. element = preTransforms[i](element, options) || element;
  8142. }
  8143. if (!inVPre) {
  8144. processPre(element);
  8145. if (element.pre) {
  8146. inVPre = true;
  8147. }
  8148. }
  8149. if (platformIsPreTag(element.tag)) {
  8150. inPre = true;
  8151. }
  8152. if (inVPre) {
  8153. processRawAttrs(element);
  8154. } else if (!element.processed) {
  8155. // structural directives
  8156. processFor(element);
  8157. processIf(element);
  8158. processOnce(element);
  8159. // element-scope stuff
  8160. processElement(element, options);
  8161. }
  8162. function checkRootConstraints (el) {
  8163. {
  8164. if (el.tag === 'slot' || el.tag === 'template') {
  8165. warnOnce(
  8166. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8167. 'contain multiple nodes.'
  8168. );
  8169. }
  8170. if (el.attrsMap.hasOwnProperty('v-for')) {
  8171. warnOnce(
  8172. 'Cannot use v-for on stateful component root element because ' +
  8173. 'it renders multiple elements.'
  8174. );
  8175. }
  8176. }
  8177. }
  8178. // tree management
  8179. if (!root) {
  8180. root = element;
  8181. checkRootConstraints(root);
  8182. } else if (!stack.length) {
  8183. // allow root elements with v-if, v-else-if and v-else
  8184. if (root.if && (element.elseif || element.else)) {
  8185. checkRootConstraints(element);
  8186. addIfCondition(root, {
  8187. exp: element.elseif,
  8188. block: element
  8189. });
  8190. } else {
  8191. warnOnce(
  8192. "Component template should contain exactly one root element. " +
  8193. "If you are using v-if on multiple elements, " +
  8194. "use v-else-if to chain them instead."
  8195. );
  8196. }
  8197. }
  8198. if (currentParent && !element.forbidden) {
  8199. if (element.elseif || element.else) {
  8200. processIfConditions(element, currentParent);
  8201. } else if (element.slotScope) { // scoped slot
  8202. currentParent.plain = false;
  8203. var name = element.slotTarget || '"default"';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8204. } else {
  8205. currentParent.children.push(element);
  8206. element.parent = currentParent;
  8207. }
  8208. }
  8209. if (!unary) {
  8210. currentParent = element;
  8211. stack.push(element);
  8212. } else {
  8213. closeElement(element);
  8214. }
  8215. },
  8216. end: function end () {
  8217. // remove trailing whitespace
  8218. var element = stack[stack.length - 1];
  8219. var lastNode = element.children[element.children.length - 1];
  8220. if (lastNode && lastNode.type === 3 && lastNode.text === ' ' && !inPre) {
  8221. element.children.pop();
  8222. }
  8223. // pop stack
  8224. stack.length -= 1;
  8225. currentParent = stack[stack.length - 1];
  8226. closeElement(element);
  8227. },
  8228. chars: function chars (text) {
  8229. if (!currentParent) {
  8230. {
  8231. if (text === template) {
  8232. warnOnce(
  8233. 'Component template requires a root element, rather than just text.'
  8234. );
  8235. } else if ((text = text.trim())) {
  8236. warnOnce(
  8237. ("text \"" + text + "\" outside root element will be ignored.")
  8238. );
  8239. }
  8240. }
  8241. return
  8242. }
  8243. // IE textarea placeholder bug
  8244. /* istanbul ignore if */
  8245. if (isIE &&
  8246. currentParent.tag === 'textarea' &&
  8247. currentParent.attrsMap.placeholder === text
  8248. ) {
  8249. return
  8250. }
  8251. var children = currentParent.children;
  8252. text = inPre || text.trim()
  8253. ? isTextTag(currentParent) ? text : decodeHTMLCached(text)
  8254. // only preserve whitespace if its not right after a starting tag
  8255. : preserveWhitespace && children.length ? ' ' : '';
  8256. if (text) {
  8257. var res;
  8258. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8259. children.push({
  8260. type: 2,
  8261. expression: res.expression,
  8262. tokens: res.tokens,
  8263. text: text
  8264. });
  8265. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8266. children.push({
  8267. type: 3,
  8268. text: text
  8269. });
  8270. }
  8271. }
  8272. },
  8273. comment: function comment (text) {
  8274. currentParent.children.push({
  8275. type: 3,
  8276. text: text,
  8277. isComment: true
  8278. });
  8279. }
  8280. });
  8281. return root
  8282. }
  8283. function processPre (el) {
  8284. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8285. el.pre = true;
  8286. }
  8287. }
  8288. function processRawAttrs (el) {
  8289. var l = el.attrsList.length;
  8290. if (l) {
  8291. var attrs = el.attrs = new Array(l);
  8292. for (var i = 0; i < l; i++) {
  8293. attrs[i] = {
  8294. name: el.attrsList[i].name,
  8295. value: JSON.stringify(el.attrsList[i].value)
  8296. };
  8297. }
  8298. } else if (!el.pre) {
  8299. // non root node in pre blocks with no attributes
  8300. el.plain = true;
  8301. }
  8302. }
  8303. function processElement (element, options) {
  8304. processKey(element);
  8305. // determine whether this is a plain element after
  8306. // removing structural attributes
  8307. element.plain = !element.key && !element.attrsList.length;
  8308. processRef(element);
  8309. processSlot(element);
  8310. processComponent(element);
  8311. for (var i = 0; i < transforms.length; i++) {
  8312. element = transforms[i](element, options) || element;
  8313. }
  8314. processAttrs(element);
  8315. }
  8316. function processKey (el) {
  8317. var exp = getBindingAttr(el, 'key');
  8318. if (exp) {
  8319. if ("development" !== 'production' && el.tag === 'template') {
  8320. warn$2("<template> cannot be keyed. Place the key on real elements instead.");
  8321. }
  8322. el.key = exp;
  8323. }
  8324. }
  8325. function processRef (el) {
  8326. var ref = getBindingAttr(el, 'ref');
  8327. if (ref) {
  8328. el.ref = ref;
  8329. el.refInFor = checkInFor(el);
  8330. }
  8331. }
  8332. function processFor (el) {
  8333. var exp;
  8334. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  8335. var res = parseFor(exp);
  8336. if (res) {
  8337. extend(el, res);
  8338. } else {
  8339. warn$2(
  8340. ("Invalid v-for expression: " + exp)
  8341. );
  8342. }
  8343. }
  8344. }
  8345. function parseFor (exp) {
  8346. var inMatch = exp.match(forAliasRE);
  8347. if (!inMatch) { return }
  8348. var res = {};
  8349. res.for = inMatch[2].trim();
  8350. var alias = inMatch[1].trim().replace(stripParensRE, '');
  8351. var iteratorMatch = alias.match(forIteratorRE);
  8352. if (iteratorMatch) {
  8353. res.alias = alias.replace(forIteratorRE, '');
  8354. res.iterator1 = iteratorMatch[1].trim();
  8355. if (iteratorMatch[2]) {
  8356. res.iterator2 = iteratorMatch[2].trim();
  8357. }
  8358. } else {
  8359. res.alias = alias;
  8360. }
  8361. return res
  8362. }
  8363. function processIf (el) {
  8364. var exp = getAndRemoveAttr(el, 'v-if');
  8365. if (exp) {
  8366. el.if = exp;
  8367. addIfCondition(el, {
  8368. exp: exp,
  8369. block: el
  8370. });
  8371. } else {
  8372. if (getAndRemoveAttr(el, 'v-else') != null) {
  8373. el.else = true;
  8374. }
  8375. var elseif = getAndRemoveAttr(el, 'v-else-if');
  8376. if (elseif) {
  8377. el.elseif = elseif;
  8378. }
  8379. }
  8380. }
  8381. function processIfConditions (el, parent) {
  8382. var prev = findPrevElement(parent.children);
  8383. if (prev && prev.if) {
  8384. addIfCondition(prev, {
  8385. exp: el.elseif,
  8386. block: el
  8387. });
  8388. } else {
  8389. warn$2(
  8390. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  8391. "used on element <" + (el.tag) + "> without corresponding v-if."
  8392. );
  8393. }
  8394. }
  8395. function findPrevElement (children) {
  8396. var i = children.length;
  8397. while (i--) {
  8398. if (children[i].type === 1) {
  8399. return children[i]
  8400. } else {
  8401. if ("development" !== 'production' && children[i].text !== ' ') {
  8402. warn$2(
  8403. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  8404. "will be ignored."
  8405. );
  8406. }
  8407. children.pop();
  8408. }
  8409. }
  8410. }
  8411. function addIfCondition (el, condition) {
  8412. if (!el.ifConditions) {
  8413. el.ifConditions = [];
  8414. }
  8415. el.ifConditions.push(condition);
  8416. }
  8417. function processOnce (el) {
  8418. var once$$1 = getAndRemoveAttr(el, 'v-once');
  8419. if (once$$1 != null) {
  8420. el.once = true;
  8421. }
  8422. }
  8423. function processSlot (el) {
  8424. if (el.tag === 'slot') {
  8425. el.slotName = getBindingAttr(el, 'name');
  8426. if ("development" !== 'production' && el.key) {
  8427. warn$2(
  8428. "`key` does not work on <slot> because slots are abstract outlets " +
  8429. "and can possibly expand into multiple elements. " +
  8430. "Use the key on a wrapping element instead."
  8431. );
  8432. }
  8433. } else {
  8434. var slotScope;
  8435. if (el.tag === 'template') {
  8436. slotScope = getAndRemoveAttr(el, 'scope');
  8437. /* istanbul ignore if */
  8438. if ("development" !== 'production' && slotScope) {
  8439. warn$2(
  8440. "the \"scope\" attribute for scoped slots have been deprecated and " +
  8441. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  8442. "can also be used on plain elements in addition to <template> to " +
  8443. "denote scoped slots.",
  8444. true
  8445. );
  8446. }
  8447. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  8448. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  8449. /* istanbul ignore if */
  8450. if ("development" !== 'production' && el.attrsMap['v-for']) {
  8451. warn$2(
  8452. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  8453. "(v-for takes higher priority). Use a wrapper <template> for the " +
  8454. "scoped slot to make it clearer.",
  8455. true
  8456. );
  8457. }
  8458. el.slotScope = slotScope;
  8459. }
  8460. var slotTarget = getBindingAttr(el, 'slot');
  8461. if (slotTarget) {
  8462. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  8463. // preserve slot as an attribute for native shadow DOM compat
  8464. // only for non-scoped slots.
  8465. if (el.tag !== 'template' && !el.slotScope) {
  8466. addAttr(el, 'slot', slotTarget);
  8467. }
  8468. }
  8469. }
  8470. }
  8471. function processComponent (el) {
  8472. var binding;
  8473. if ((binding = getBindingAttr(el, 'is'))) {
  8474. el.component = binding;
  8475. }
  8476. if (getAndRemoveAttr(el, 'inline-template') != null) {
  8477. el.inlineTemplate = true;
  8478. }
  8479. }
  8480. function processAttrs (el) {
  8481. var list = el.attrsList;
  8482. var i, l, name, rawName, value, modifiers, isProp;
  8483. for (i = 0, l = list.length; i < l; i++) {
  8484. name = rawName = list[i].name;
  8485. value = list[i].value;
  8486. if (dirRE.test(name)) {
  8487. // mark element as dynamic
  8488. el.hasBindings = true;
  8489. // modifiers
  8490. modifiers = parseModifiers(name);
  8491. if (modifiers) {
  8492. name = name.replace(modifierRE, '');
  8493. }
  8494. if (bindRE.test(name)) { // v-bind
  8495. name = name.replace(bindRE, '');
  8496. value = parseFilters(value);
  8497. isProp = false;
  8498. if (modifiers) {
  8499. if (modifiers.prop) {
  8500. isProp = true;
  8501. name = camelize(name);
  8502. if (name === 'innerHtml') { name = 'innerHTML'; }
  8503. }
  8504. if (modifiers.camel) {
  8505. name = camelize(name);
  8506. }
  8507. if (modifiers.sync) {
  8508. addHandler(
  8509. el,
  8510. ("update:" + (camelize(name))),
  8511. genAssignmentCode(value, "$event")
  8512. );
  8513. }
  8514. }
  8515. if (isProp || (
  8516. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  8517. )) {
  8518. addProp(el, name, value);
  8519. } else {
  8520. addAttr(el, name, value);
  8521. }
  8522. } else if (onRE.test(name)) { // v-on
  8523. name = name.replace(onRE, '');
  8524. addHandler(el, name, value, modifiers, false, warn$2);
  8525. } else { // normal directives
  8526. name = name.replace(dirRE, '');
  8527. // parse arg
  8528. var argMatch = name.match(argRE);
  8529. var arg = argMatch && argMatch[1];
  8530. if (arg) {
  8531. name = name.slice(0, -(arg.length + 1));
  8532. }
  8533. addDirective(el, name, rawName, value, arg, modifiers);
  8534. if ("development" !== 'production' && name === 'model') {
  8535. checkForAliasModel(el, value);
  8536. }
  8537. }
  8538. } else {
  8539. // literal attribute
  8540. {
  8541. var res = parseText(value, delimiters);
  8542. if (res) {
  8543. warn$2(
  8544. name + "=\"" + value + "\": " +
  8545. 'Interpolation inside attributes has been removed. ' +
  8546. 'Use v-bind or the colon shorthand instead. For example, ' +
  8547. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  8548. );
  8549. }
  8550. }
  8551. addAttr(el, name, JSON.stringify(value));
  8552. // #6887 firefox doesn't update muted state if set via attribute
  8553. // even immediately after element creation
  8554. if (!el.component &&
  8555. name === 'muted' &&
  8556. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  8557. addProp(el, name, 'true');
  8558. }
  8559. }
  8560. }
  8561. }
  8562. function checkInFor (el) {
  8563. var parent = el;
  8564. while (parent) {
  8565. if (parent.for !== undefined) {
  8566. return true
  8567. }
  8568. parent = parent.parent;
  8569. }
  8570. return false
  8571. }
  8572. function parseModifiers (name) {
  8573. var match = name.match(modifierRE);
  8574. if (match) {
  8575. var ret = {};
  8576. match.forEach(function (m) { ret[m.slice(1)] = true; });
  8577. return ret
  8578. }
  8579. }
  8580. function makeAttrsMap (attrs) {
  8581. var map = {};
  8582. for (var i = 0, l = attrs.length; i < l; i++) {
  8583. if (
  8584. "development" !== 'production' &&
  8585. map[attrs[i].name] && !isIE && !isEdge
  8586. ) {
  8587. warn$2('duplicate attribute: ' + attrs[i].name);
  8588. }
  8589. map[attrs[i].name] = attrs[i].value;
  8590. }
  8591. return map
  8592. }
  8593. // for script (e.g. type="x/template") or style, do not decode content
  8594. function isTextTag (el) {
  8595. return el.tag === 'script' || el.tag === 'style'
  8596. }
  8597. function isForbiddenTag (el) {
  8598. return (
  8599. el.tag === 'style' ||
  8600. (el.tag === 'script' && (
  8601. !el.attrsMap.type ||
  8602. el.attrsMap.type === 'text/javascript'
  8603. ))
  8604. )
  8605. }
  8606. var ieNSBug = /^xmlns:NS\d+/;
  8607. var ieNSPrefix = /^NS\d+:/;
  8608. /* istanbul ignore next */
  8609. function guardIESVGBug (attrs) {
  8610. var res = [];
  8611. for (var i = 0; i < attrs.length; i++) {
  8612. var attr = attrs[i];
  8613. if (!ieNSBug.test(attr.name)) {
  8614. attr.name = attr.name.replace(ieNSPrefix, '');
  8615. res.push(attr);
  8616. }
  8617. }
  8618. return res
  8619. }
  8620. function checkForAliasModel (el, value) {
  8621. var _el = el;
  8622. while (_el) {
  8623. if (_el.for && _el.alias === value) {
  8624. warn$2(
  8625. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  8626. "You are binding v-model directly to a v-for iteration alias. " +
  8627. "This will not be able to modify the v-for source array because " +
  8628. "writing to the alias is like modifying a function local variable. " +
  8629. "Consider using an array of objects and use v-model on an object property instead."
  8630. );
  8631. }
  8632. _el = _el.parent;
  8633. }
  8634. }
  8635. /* */
  8636. /**
  8637. * Expand input[v-model] with dyanmic type bindings into v-if-else chains
  8638. * Turn this:
  8639. * <input v-model="data[type]" :type="type">
  8640. * into this:
  8641. * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]">
  8642. * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]">
  8643. * <input v-else :type="type" v-model="data[type]">
  8644. */
  8645. function preTransformNode (el, options) {
  8646. if (el.tag === 'input') {
  8647. var map = el.attrsMap;
  8648. if (map['v-model'] && (map['v-bind:type'] || map[':type'])) {
  8649. var typeBinding = getBindingAttr(el, 'type');
  8650. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  8651. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  8652. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  8653. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  8654. // 1. checkbox
  8655. var branch0 = cloneASTElement(el);
  8656. // process for on the main node
  8657. processFor(branch0);
  8658. addRawAttr(branch0, 'type', 'checkbox');
  8659. processElement(branch0, options);
  8660. branch0.processed = true; // prevent it from double-processed
  8661. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  8662. addIfCondition(branch0, {
  8663. exp: branch0.if,
  8664. block: branch0
  8665. });
  8666. // 2. add radio else-if condition
  8667. var branch1 = cloneASTElement(el);
  8668. getAndRemoveAttr(branch1, 'v-for', true);
  8669. addRawAttr(branch1, 'type', 'radio');
  8670. processElement(branch1, options);
  8671. addIfCondition(branch0, {
  8672. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  8673. block: branch1
  8674. });
  8675. // 3. other
  8676. var branch2 = cloneASTElement(el);
  8677. getAndRemoveAttr(branch2, 'v-for', true);
  8678. addRawAttr(branch2, ':type', typeBinding);
  8679. processElement(branch2, options);
  8680. addIfCondition(branch0, {
  8681. exp: ifCondition,
  8682. block: branch2
  8683. });
  8684. if (hasElse) {
  8685. branch0.else = true;
  8686. } else if (elseIfCondition) {
  8687. branch0.elseif = elseIfCondition;
  8688. }
  8689. return branch0
  8690. }
  8691. }
  8692. }
  8693. function cloneASTElement (el) {
  8694. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  8695. }
  8696. var model$2 = {
  8697. preTransformNode: preTransformNode
  8698. };
  8699. var modules$1 = [
  8700. klass$1,
  8701. style$1,
  8702. model$2
  8703. ];
  8704. /* */
  8705. function text (el, dir) {
  8706. if (dir.value) {
  8707. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  8708. }
  8709. }
  8710. /* */
  8711. function html (el, dir) {
  8712. if (dir.value) {
  8713. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  8714. }
  8715. }
  8716. var directives$1 = {
  8717. model: model,
  8718. text: text,
  8719. html: html
  8720. };
  8721. /* */
  8722. var baseOptions = {
  8723. expectHTML: true,
  8724. modules: modules$1,
  8725. directives: directives$1,
  8726. isPreTag: isPreTag,
  8727. isUnaryTag: isUnaryTag,
  8728. mustUseProp: mustUseProp,
  8729. canBeLeftOpenTag: canBeLeftOpenTag,
  8730. isReservedTag: isReservedTag,
  8731. getTagNamespace: getTagNamespace,
  8732. staticKeys: genStaticKeys(modules$1)
  8733. };
  8734. /* */
  8735. var isStaticKey;
  8736. var isPlatformReservedTag;
  8737. var genStaticKeysCached = cached(genStaticKeys$1);
  8738. /**
  8739. * Goal of the optimizer: walk the generated template AST tree
  8740. * and detect sub-trees that are purely static, i.e. parts of
  8741. * the DOM that never needs to change.
  8742. *
  8743. * Once we detect these sub-trees, we can:
  8744. *
  8745. * 1. Hoist them into constants, so that we no longer need to
  8746. * create fresh nodes for them on each re-render;
  8747. * 2. Completely skip them in the patching process.
  8748. */
  8749. function optimize (root, options) {
  8750. if (!root) { return }
  8751. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  8752. isPlatformReservedTag = options.isReservedTag || no;
  8753. // first pass: mark all non-static nodes.
  8754. markStatic$1(root);
  8755. // second pass: mark static roots.
  8756. markStaticRoots(root, false);
  8757. }
  8758. function genStaticKeys$1 (keys) {
  8759. return makeMap(
  8760. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  8761. (keys ? ',' + keys : '')
  8762. )
  8763. }
  8764. function markStatic$1 (node) {
  8765. node.static = isStatic(node);
  8766. if (node.type === 1) {
  8767. // do not make component slot content static. this avoids
  8768. // 1. components not able to mutate slot nodes
  8769. // 2. static slot content fails for hot-reloading
  8770. if (
  8771. !isPlatformReservedTag(node.tag) &&
  8772. node.tag !== 'slot' &&
  8773. node.attrsMap['inline-template'] == null
  8774. ) {
  8775. return
  8776. }
  8777. for (var i = 0, l = node.children.length; i < l; i++) {
  8778. var child = node.children[i];
  8779. markStatic$1(child);
  8780. if (!child.static) {
  8781. node.static = false;
  8782. }
  8783. }
  8784. if (node.ifConditions) {
  8785. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  8786. var block = node.ifConditions[i$1].block;
  8787. markStatic$1(block);
  8788. if (!block.static) {
  8789. node.static = false;
  8790. }
  8791. }
  8792. }
  8793. }
  8794. }
  8795. function markStaticRoots (node, isInFor) {
  8796. if (node.type === 1) {
  8797. if (node.static || node.once) {
  8798. node.staticInFor = isInFor;
  8799. }
  8800. // For a node to qualify as a static root, it should have children that
  8801. // are not just static text. Otherwise the cost of hoisting out will
  8802. // outweigh the benefits and it's better off to just always render it fresh.
  8803. if (node.static && node.children.length && !(
  8804. node.children.length === 1 &&
  8805. node.children[0].type === 3
  8806. )) {
  8807. node.staticRoot = true;
  8808. return
  8809. } else {
  8810. node.staticRoot = false;
  8811. }
  8812. if (node.children) {
  8813. for (var i = 0, l = node.children.length; i < l; i++) {
  8814. markStaticRoots(node.children[i], isInFor || !!node.for);
  8815. }
  8816. }
  8817. if (node.ifConditions) {
  8818. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  8819. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  8820. }
  8821. }
  8822. }
  8823. }
  8824. function isStatic (node) {
  8825. if (node.type === 2) { // expression
  8826. return false
  8827. }
  8828. if (node.type === 3) { // text
  8829. return true
  8830. }
  8831. return !!(node.pre || (
  8832. !node.hasBindings && // no dynamic bindings
  8833. !node.if && !node.for && // not v-if or v-for or v-else
  8834. !isBuiltInTag(node.tag) && // not a built-in
  8835. isPlatformReservedTag(node.tag) && // not a component
  8836. !isDirectChildOfTemplateFor(node) &&
  8837. Object.keys(node).every(isStaticKey)
  8838. ))
  8839. }
  8840. function isDirectChildOfTemplateFor (node) {
  8841. while (node.parent) {
  8842. node = node.parent;
  8843. if (node.tag !== 'template') {
  8844. return false
  8845. }
  8846. if (node.for) {
  8847. return true
  8848. }
  8849. }
  8850. return false
  8851. }
  8852. /* */
  8853. var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  8854. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  8855. // keyCode aliases
  8856. var keyCodes = {
  8857. esc: 27,
  8858. tab: 9,
  8859. enter: 13,
  8860. space: 32,
  8861. up: 38,
  8862. left: 37,
  8863. right: 39,
  8864. down: 40,
  8865. 'delete': [8, 46]
  8866. };
  8867. // #4868: modifiers that prevent the execution of the listener
  8868. // need to explicitly return null so that we can determine whether to remove
  8869. // the listener for .once
  8870. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  8871. var modifierCode = {
  8872. stop: '$event.stopPropagation();',
  8873. prevent: '$event.preventDefault();',
  8874. self: genGuard("$event.target !== $event.currentTarget"),
  8875. ctrl: genGuard("!$event.ctrlKey"),
  8876. shift: genGuard("!$event.shiftKey"),
  8877. alt: genGuard("!$event.altKey"),
  8878. meta: genGuard("!$event.metaKey"),
  8879. left: genGuard("'button' in $event && $event.button !== 0"),
  8880. middle: genGuard("'button' in $event && $event.button !== 1"),
  8881. right: genGuard("'button' in $event && $event.button !== 2")
  8882. };
  8883. function genHandlers (
  8884. events,
  8885. isNative,
  8886. warn
  8887. ) {
  8888. var res = isNative ? 'nativeOn:{' : 'on:{';
  8889. for (var name in events) {
  8890. res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  8891. }
  8892. return res.slice(0, -1) + '}'
  8893. }
  8894. function genHandler (
  8895. name,
  8896. handler
  8897. ) {
  8898. if (!handler) {
  8899. return 'function(){}'
  8900. }
  8901. if (Array.isArray(handler)) {
  8902. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  8903. }
  8904. var isMethodPath = simplePathRE.test(handler.value);
  8905. var isFunctionExpression = fnExpRE.test(handler.value);
  8906. if (!handler.modifiers) {
  8907. if (isMethodPath || isFunctionExpression) {
  8908. return handler.value
  8909. }
  8910. /* istanbul ignore if */
  8911. return ("function($event){" + (handler.value) + "}") // inline statement
  8912. } else {
  8913. var code = '';
  8914. var genModifierCode = '';
  8915. var keys = [];
  8916. for (var key in handler.modifiers) {
  8917. if (modifierCode[key]) {
  8918. genModifierCode += modifierCode[key];
  8919. // left/right
  8920. if (keyCodes[key]) {
  8921. keys.push(key);
  8922. }
  8923. } else if (key === 'exact') {
  8924. var modifiers = (handler.modifiers);
  8925. genModifierCode += genGuard(
  8926. ['ctrl', 'shift', 'alt', 'meta']
  8927. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  8928. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  8929. .join('||')
  8930. );
  8931. } else {
  8932. keys.push(key);
  8933. }
  8934. }
  8935. if (keys.length) {
  8936. code += genKeyFilter(keys);
  8937. }
  8938. // Make sure modifiers like prevent and stop get executed after key filtering
  8939. if (genModifierCode) {
  8940. code += genModifierCode;
  8941. }
  8942. var handlerCode = isMethodPath
  8943. ? handler.value + '($event)'
  8944. : isFunctionExpression
  8945. ? ("(" + (handler.value) + ")($event)")
  8946. : handler.value;
  8947. /* istanbul ignore if */
  8948. return ("function($event){" + code + handlerCode + "}")
  8949. }
  8950. }
  8951. function genKeyFilter (keys) {
  8952. return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
  8953. }
  8954. function genFilterCode (key) {
  8955. var keyVal = parseInt(key, 10);
  8956. if (keyVal) {
  8957. return ("$event.keyCode!==" + keyVal)
  8958. }
  8959. var code = keyCodes[key];
  8960. return (
  8961. "_k($event.keyCode," +
  8962. (JSON.stringify(key)) + "," +
  8963. (JSON.stringify(code)) + "," +
  8964. "$event.key)"
  8965. )
  8966. }
  8967. /* */
  8968. function on (el, dir) {
  8969. if ("development" !== 'production' && dir.modifiers) {
  8970. warn("v-on without argument does not support modifiers.");
  8971. }
  8972. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  8973. }
  8974. /* */
  8975. function bind$1 (el, dir) {
  8976. el.wrapData = function (code) {
  8977. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  8978. };
  8979. }
  8980. /* */
  8981. var baseDirectives = {
  8982. on: on,
  8983. bind: bind$1,
  8984. cloak: noop
  8985. };
  8986. /* */
  8987. var CodegenState = function CodegenState (options) {
  8988. this.options = options;
  8989. this.warn = options.warn || baseWarn;
  8990. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  8991. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  8992. this.directives = extend(extend({}, baseDirectives), options.directives);
  8993. var isReservedTag = options.isReservedTag || no;
  8994. this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
  8995. this.onceId = 0;
  8996. this.staticRenderFns = [];
  8997. };
  8998. function generate (
  8999. ast,
  9000. options
  9001. ) {
  9002. var state = new CodegenState(options);
  9003. var code = ast ? genElement(ast, state) : '_c("div")';
  9004. return {
  9005. render: ("with(this){return " + code + "}"),
  9006. staticRenderFns: state.staticRenderFns
  9007. }
  9008. }
  9009. function genElement (el, state) {
  9010. if (el.staticRoot && !el.staticProcessed) {
  9011. return genStatic(el, state)
  9012. } else if (el.once && !el.onceProcessed) {
  9013. return genOnce(el, state)
  9014. } else if (el.for && !el.forProcessed) {
  9015. return genFor(el, state)
  9016. } else if (el.if && !el.ifProcessed) {
  9017. return genIf(el, state)
  9018. } else if (el.tag === 'template' && !el.slotTarget) {
  9019. return genChildren(el, state) || 'void 0'
  9020. } else if (el.tag === 'slot') {
  9021. return genSlot(el, state)
  9022. } else {
  9023. // component or element
  9024. var code;
  9025. if (el.component) {
  9026. code = genComponent(el.component, el, state);
  9027. } else {
  9028. var data = el.plain ? undefined : genData$2(el, state);
  9029. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9030. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9031. }
  9032. // module transforms
  9033. for (var i = 0; i < state.transforms.length; i++) {
  9034. code = state.transforms[i](el, code);
  9035. }
  9036. return code
  9037. }
  9038. }
  9039. // hoist static sub-trees out
  9040. function genStatic (el, state) {
  9041. el.staticProcessed = true;
  9042. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9043. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9044. }
  9045. // v-once
  9046. function genOnce (el, state) {
  9047. el.onceProcessed = true;
  9048. if (el.if && !el.ifProcessed) {
  9049. return genIf(el, state)
  9050. } else if (el.staticInFor) {
  9051. var key = '';
  9052. var parent = el.parent;
  9053. while (parent) {
  9054. if (parent.for) {
  9055. key = parent.key;
  9056. break
  9057. }
  9058. parent = parent.parent;
  9059. }
  9060. if (!key) {
  9061. "development" !== 'production' && state.warn(
  9062. "v-once can only be used inside v-for that is keyed. "
  9063. );
  9064. return genElement(el, state)
  9065. }
  9066. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9067. } else {
  9068. return genStatic(el, state)
  9069. }
  9070. }
  9071. function genIf (
  9072. el,
  9073. state,
  9074. altGen,
  9075. altEmpty
  9076. ) {
  9077. el.ifProcessed = true; // avoid recursion
  9078. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  9079. }
  9080. function genIfConditions (
  9081. conditions,
  9082. state,
  9083. altGen,
  9084. altEmpty
  9085. ) {
  9086. if (!conditions.length) {
  9087. return altEmpty || '_e()'
  9088. }
  9089. var condition = conditions.shift();
  9090. if (condition.exp) {
  9091. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  9092. } else {
  9093. return ("" + (genTernaryExp(condition.block)))
  9094. }
  9095. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  9096. function genTernaryExp (el) {
  9097. return altGen
  9098. ? altGen(el, state)
  9099. : el.once
  9100. ? genOnce(el, state)
  9101. : genElement(el, state)
  9102. }
  9103. }
  9104. function genFor (
  9105. el,
  9106. state,
  9107. altGen,
  9108. altHelper
  9109. ) {
  9110. var exp = el.for;
  9111. var alias = el.alias;
  9112. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  9113. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  9114. if ("development" !== 'production' &&
  9115. state.maybeComponent(el) &&
  9116. el.tag !== 'slot' &&
  9117. el.tag !== 'template' &&
  9118. !el.key
  9119. ) {
  9120. state.warn(
  9121. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  9122. "v-for should have explicit keys. " +
  9123. "See https://vuejs.org/guide/list.html#key for more info.",
  9124. true /* tip */
  9125. );
  9126. }
  9127. el.forProcessed = true; // avoid recursion
  9128. return (altHelper || '_l') + "((" + exp + ")," +
  9129. "function(" + alias + iterator1 + iterator2 + "){" +
  9130. "return " + ((altGen || genElement)(el, state)) +
  9131. '})'
  9132. }
  9133. function genData$2 (el, state) {
  9134. var data = '{';
  9135. // directives first.
  9136. // directives may mutate the el's other properties before they are generated.
  9137. var dirs = genDirectives(el, state);
  9138. if (dirs) { data += dirs + ','; }
  9139. // key
  9140. if (el.key) {
  9141. data += "key:" + (el.key) + ",";
  9142. }
  9143. // ref
  9144. if (el.ref) {
  9145. data += "ref:" + (el.ref) + ",";
  9146. }
  9147. if (el.refInFor) {
  9148. data += "refInFor:true,";
  9149. }
  9150. // pre
  9151. if (el.pre) {
  9152. data += "pre:true,";
  9153. }
  9154. // record original tag name for components using "is" attribute
  9155. if (el.component) {
  9156. data += "tag:\"" + (el.tag) + "\",";
  9157. }
  9158. // module data generation functions
  9159. for (var i = 0; i < state.dataGenFns.length; i++) {
  9160. data += state.dataGenFns[i](el);
  9161. }
  9162. // attributes
  9163. if (el.attrs) {
  9164. data += "attrs:{" + (genProps(el.attrs)) + "},";
  9165. }
  9166. // DOM props
  9167. if (el.props) {
  9168. data += "domProps:{" + (genProps(el.props)) + "},";
  9169. }
  9170. // event handlers
  9171. if (el.events) {
  9172. data += (genHandlers(el.events, false, state.warn)) + ",";
  9173. }
  9174. if (el.nativeEvents) {
  9175. data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
  9176. }
  9177. // slot target
  9178. // only for non-scoped slots
  9179. if (el.slotTarget && !el.slotScope) {
  9180. data += "slot:" + (el.slotTarget) + ",";
  9181. }
  9182. // scoped slots
  9183. if (el.scopedSlots) {
  9184. data += (genScopedSlots(el.scopedSlots, state)) + ",";
  9185. }
  9186. // component v-model
  9187. if (el.model) {
  9188. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  9189. }
  9190. // inline-template
  9191. if (el.inlineTemplate) {
  9192. var inlineTemplate = genInlineTemplate(el, state);
  9193. if (inlineTemplate) {
  9194. data += inlineTemplate + ",";
  9195. }
  9196. }
  9197. data = data.replace(/,$/, '') + '}';
  9198. // v-bind data wrap
  9199. if (el.wrapData) {
  9200. data = el.wrapData(data);
  9201. }
  9202. // v-on data wrap
  9203. if (el.wrapListeners) {
  9204. data = el.wrapListeners(data);
  9205. }
  9206. return data
  9207. }
  9208. function genDirectives (el, state) {
  9209. var dirs = el.directives;
  9210. if (!dirs) { return }
  9211. var res = 'directives:[';
  9212. var hasRuntime = false;
  9213. var i, l, dir, needRuntime;
  9214. for (i = 0, l = dirs.length; i < l; i++) {
  9215. dir = dirs[i];
  9216. needRuntime = true;
  9217. var gen = state.directives[dir.name];
  9218. if (gen) {
  9219. // compile-time directive that manipulates AST.
  9220. // returns true if it also needs a runtime counterpart.
  9221. needRuntime = !!gen(el, dir, state.warn);
  9222. }
  9223. if (needRuntime) {
  9224. hasRuntime = true;
  9225. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  9226. }
  9227. }
  9228. if (hasRuntime) {
  9229. return res.slice(0, -1) + ']'
  9230. }
  9231. }
  9232. function genInlineTemplate (el, state) {
  9233. var ast = el.children[0];
  9234. if ("development" !== 'production' && (
  9235. el.children.length !== 1 || ast.type !== 1
  9236. )) {
  9237. state.warn('Inline-template components must have exactly one child element.');
  9238. }
  9239. if (ast.type === 1) {
  9240. var inlineRenderFns = generate(ast, state.options);
  9241. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  9242. }
  9243. }
  9244. function genScopedSlots (
  9245. slots,
  9246. state
  9247. ) {
  9248. return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
  9249. return genScopedSlot(key, slots[key], state)
  9250. }).join(',')) + "])")
  9251. }
  9252. function genScopedSlot (
  9253. key,
  9254. el,
  9255. state
  9256. ) {
  9257. if (el.for && !el.forProcessed) {
  9258. return genForScopedSlot(key, el, state)
  9259. }
  9260. var fn = "function(" + (String(el.slotScope)) + "){" +
  9261. "return " + (el.tag === 'template'
  9262. ? el.if
  9263. ? ((el.if) + "?" + (genChildren(el, state) || 'undefined') + ":undefined")
  9264. : genChildren(el, state) || 'undefined'
  9265. : genElement(el, state)) + "}";
  9266. return ("{key:" + key + ",fn:" + fn + "}")
  9267. }
  9268. function genForScopedSlot (
  9269. key,
  9270. el,
  9271. state
  9272. ) {
  9273. var exp = el.for;
  9274. var alias = el.alias;
  9275. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  9276. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  9277. el.forProcessed = true; // avoid recursion
  9278. return "_l((" + exp + ")," +
  9279. "function(" + alias + iterator1 + iterator2 + "){" +
  9280. "return " + (genScopedSlot(key, el, state)) +
  9281. '})'
  9282. }
  9283. function genChildren (
  9284. el,
  9285. state,
  9286. checkSkip,
  9287. altGenElement,
  9288. altGenNode
  9289. ) {
  9290. var children = el.children;
  9291. if (children.length) {
  9292. var el$1 = children[0];
  9293. // optimize single v-for
  9294. if (children.length === 1 &&
  9295. el$1.for &&
  9296. el$1.tag !== 'template' &&
  9297. el$1.tag !== 'slot'
  9298. ) {
  9299. return (altGenElement || genElement)(el$1, state)
  9300. }
  9301. var normalizationType = checkSkip
  9302. ? getNormalizationType(children, state.maybeComponent)
  9303. : 0;
  9304. var gen = altGenNode || genNode;
  9305. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
  9306. }
  9307. }
  9308. // determine the normalization needed for the children array.
  9309. // 0: no normalization needed
  9310. // 1: simple normalization needed (possible 1-level deep nested array)
  9311. // 2: full normalization needed
  9312. function getNormalizationType (
  9313. children,
  9314. maybeComponent
  9315. ) {
  9316. var res = 0;
  9317. for (var i = 0; i < children.length; i++) {
  9318. var el = children[i];
  9319. if (el.type !== 1) {
  9320. continue
  9321. }
  9322. if (needsNormalization(el) ||
  9323. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  9324. res = 2;
  9325. break
  9326. }
  9327. if (maybeComponent(el) ||
  9328. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  9329. res = 1;
  9330. }
  9331. }
  9332. return res
  9333. }
  9334. function needsNormalization (el) {
  9335. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  9336. }
  9337. function genNode (node, state) {
  9338. if (node.type === 1) {
  9339. return genElement(node, state)
  9340. } if (node.type === 3 && node.isComment) {
  9341. return genComment(node)
  9342. } else {
  9343. return genText(node)
  9344. }
  9345. }
  9346. function genText (text) {
  9347. return ("_v(" + (text.type === 2
  9348. ? text.expression // no need for () because already wrapped in _s()
  9349. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  9350. }
  9351. function genComment (comment) {
  9352. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  9353. }
  9354. function genSlot (el, state) {
  9355. var slotName = el.slotName || '"default"';
  9356. var children = genChildren(el, state);
  9357. var res = "_t(" + slotName + (children ? ("," + children) : '');
  9358. var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
  9359. var bind$$1 = el.attrsMap['v-bind'];
  9360. if ((attrs || bind$$1) && !children) {
  9361. res += ",null";
  9362. }
  9363. if (attrs) {
  9364. res += "," + attrs;
  9365. }
  9366. if (bind$$1) {
  9367. res += (attrs ? '' : ',null') + "," + bind$$1;
  9368. }
  9369. return res + ')'
  9370. }
  9371. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  9372. function genComponent (
  9373. componentName,
  9374. el,
  9375. state
  9376. ) {
  9377. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9378. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  9379. }
  9380. function genProps (props) {
  9381. var res = '';
  9382. for (var i = 0; i < props.length; i++) {
  9383. var prop = props[i];
  9384. /* istanbul ignore if */
  9385. {
  9386. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  9387. }
  9388. }
  9389. return res.slice(0, -1)
  9390. }
  9391. // #3895, #4268
  9392. function transformSpecialNewlines (text) {
  9393. return text
  9394. .replace(/\u2028/g, '\\u2028')
  9395. .replace(/\u2029/g, '\\u2029')
  9396. }
  9397. /* */
  9398. // these keywords should not appear inside expressions, but operators like
  9399. // typeof, instanceof and in are allowed
  9400. var prohibitedKeywordRE = new RegExp('\\b' + (
  9401. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  9402. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  9403. 'extends,finally,continue,debugger,function,arguments'
  9404. ).split(',').join('\\b|\\b') + '\\b');
  9405. // these unary operators should not be used as property/method names
  9406. var unaryOperatorsRE = new RegExp('\\b' + (
  9407. 'delete,typeof,void'
  9408. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  9409. // strip strings in expressions
  9410. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  9411. // detect problematic expressions in a template
  9412. function detectErrors (ast) {
  9413. var errors = [];
  9414. if (ast) {
  9415. checkNode(ast, errors);
  9416. }
  9417. return errors
  9418. }
  9419. function checkNode (node, errors) {
  9420. if (node.type === 1) {
  9421. for (var name in node.attrsMap) {
  9422. if (dirRE.test(name)) {
  9423. var value = node.attrsMap[name];
  9424. if (value) {
  9425. if (name === 'v-for') {
  9426. checkFor(node, ("v-for=\"" + value + "\""), errors);
  9427. } else if (onRE.test(name)) {
  9428. checkEvent(value, (name + "=\"" + value + "\""), errors);
  9429. } else {
  9430. checkExpression(value, (name + "=\"" + value + "\""), errors);
  9431. }
  9432. }
  9433. }
  9434. }
  9435. if (node.children) {
  9436. for (var i = 0; i < node.children.length; i++) {
  9437. checkNode(node.children[i], errors);
  9438. }
  9439. }
  9440. } else if (node.type === 2) {
  9441. checkExpression(node.expression, node.text, errors);
  9442. }
  9443. }
  9444. function checkEvent (exp, text, errors) {
  9445. var stipped = exp.replace(stripStringRE, '');
  9446. var keywordMatch = stipped.match(unaryOperatorsRE);
  9447. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  9448. errors.push(
  9449. "avoid using JavaScript unary operator as property name: " +
  9450. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
  9451. );
  9452. }
  9453. checkExpression(exp, text, errors);
  9454. }
  9455. function checkFor (node, text, errors) {
  9456. checkExpression(node.for || '', text, errors);
  9457. checkIdentifier(node.alias, 'v-for alias', text, errors);
  9458. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  9459. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  9460. }
  9461. function checkIdentifier (
  9462. ident,
  9463. type,
  9464. text,
  9465. errors
  9466. ) {
  9467. if (typeof ident === 'string') {
  9468. try {
  9469. new Function(("var " + ident + "=_"));
  9470. } catch (e) {
  9471. errors.push(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())));
  9472. }
  9473. }
  9474. }
  9475. function checkExpression (exp, text, errors) {
  9476. try {
  9477. new Function(("return " + exp));
  9478. } catch (e) {
  9479. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  9480. if (keywordMatch) {
  9481. errors.push(
  9482. "avoid using JavaScript keyword as property name: " +
  9483. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim())
  9484. );
  9485. } else {
  9486. errors.push(
  9487. "invalid expression: " + (e.message) + " in\n\n" +
  9488. " " + exp + "\n\n" +
  9489. " Raw expression: " + (text.trim()) + "\n"
  9490. );
  9491. }
  9492. }
  9493. }
  9494. /* */
  9495. function createFunction (code, errors) {
  9496. try {
  9497. return new Function(code)
  9498. } catch (err) {
  9499. errors.push({ err: err, code: code });
  9500. return noop
  9501. }
  9502. }
  9503. function createCompileToFunctionFn (compile) {
  9504. var cache = Object.create(null);
  9505. return function compileToFunctions (
  9506. template,
  9507. options,
  9508. vm
  9509. ) {
  9510. options = extend({}, options);
  9511. var warn$$1 = options.warn || warn;
  9512. delete options.warn;
  9513. /* istanbul ignore if */
  9514. {
  9515. // detect possible CSP restriction
  9516. try {
  9517. new Function('return 1');
  9518. } catch (e) {
  9519. if (e.toString().match(/unsafe-eval|CSP/)) {
  9520. warn$$1(
  9521. 'It seems you are using the standalone build of Vue.js in an ' +
  9522. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  9523. 'The template compiler cannot work in this environment. Consider ' +
  9524. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  9525. 'templates into render functions.'
  9526. );
  9527. }
  9528. }
  9529. }
  9530. // check cache
  9531. var key = options.delimiters
  9532. ? String(options.delimiters) + template
  9533. : template;
  9534. if (cache[key]) {
  9535. return cache[key]
  9536. }
  9537. // compile
  9538. var compiled = compile(template, options);
  9539. // check compilation errors/tips
  9540. {
  9541. if (compiled.errors && compiled.errors.length) {
  9542. warn$$1(
  9543. "Error compiling template:\n\n" + template + "\n\n" +
  9544. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  9545. vm
  9546. );
  9547. }
  9548. if (compiled.tips && compiled.tips.length) {
  9549. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  9550. }
  9551. }
  9552. // turn code into functions
  9553. var res = {};
  9554. var fnGenErrors = [];
  9555. res.render = createFunction(compiled.render, fnGenErrors);
  9556. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  9557. return createFunction(code, fnGenErrors)
  9558. });
  9559. // check function generation errors.
  9560. // this should only happen if there is a bug in the compiler itself.
  9561. // mostly for codegen development use
  9562. /* istanbul ignore if */
  9563. {
  9564. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  9565. warn$$1(
  9566. "Failed to generate render function:\n\n" +
  9567. fnGenErrors.map(function (ref) {
  9568. var err = ref.err;
  9569. var code = ref.code;
  9570. return ((err.toString()) + " in\n\n" + code + "\n");
  9571. }).join('\n'),
  9572. vm
  9573. );
  9574. }
  9575. }
  9576. return (cache[key] = res)
  9577. }
  9578. }
  9579. /* */
  9580. function createCompilerCreator (baseCompile) {
  9581. return function createCompiler (baseOptions) {
  9582. function compile (
  9583. template,
  9584. options
  9585. ) {
  9586. var finalOptions = Object.create(baseOptions);
  9587. var errors = [];
  9588. var tips = [];
  9589. finalOptions.warn = function (msg, tip) {
  9590. (tip ? tips : errors).push(msg);
  9591. };
  9592. if (options) {
  9593. // merge custom modules
  9594. if (options.modules) {
  9595. finalOptions.modules =
  9596. (baseOptions.modules || []).concat(options.modules);
  9597. }
  9598. // merge custom directives
  9599. if (options.directives) {
  9600. finalOptions.directives = extend(
  9601. Object.create(baseOptions.directives || null),
  9602. options.directives
  9603. );
  9604. }
  9605. // copy other options
  9606. for (var key in options) {
  9607. if (key !== 'modules' && key !== 'directives') {
  9608. finalOptions[key] = options[key];
  9609. }
  9610. }
  9611. }
  9612. var compiled = baseCompile(template, finalOptions);
  9613. {
  9614. errors.push.apply(errors, detectErrors(compiled.ast));
  9615. }
  9616. compiled.errors = errors;
  9617. compiled.tips = tips;
  9618. return compiled
  9619. }
  9620. return {
  9621. compile: compile,
  9622. compileToFunctions: createCompileToFunctionFn(compile)
  9623. }
  9624. }
  9625. }
  9626. /* */
  9627. // `createCompilerCreator` allows creating compilers that use alternative
  9628. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  9629. // Here we just export a default compiler using the default parts.
  9630. var createCompiler = createCompilerCreator(function baseCompile (
  9631. template,
  9632. options
  9633. ) {
  9634. var ast = parse(template.trim(), options);
  9635. if (options.optimize !== false) {
  9636. optimize(ast, options);
  9637. }
  9638. var code = generate(ast, options);
  9639. return {
  9640. ast: ast,
  9641. render: code.render,
  9642. staticRenderFns: code.staticRenderFns
  9643. }
  9644. });
  9645. /* */
  9646. var ref$1 = createCompiler(baseOptions);
  9647. var compileToFunctions = ref$1.compileToFunctions;
  9648. /* */
  9649. // check whether current browser encodes a char inside attribute values
  9650. var div;
  9651. function getShouldDecode (href) {
  9652. div = div || document.createElement('div');
  9653. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  9654. return div.innerHTML.indexOf('&#10;') > 0
  9655. }
  9656. // #3663: IE encodes newlines inside attribute values while other browsers don't
  9657. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  9658. // #6828: chrome encodes content in a[href]
  9659. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  9660. /* */
  9661. var idToTemplate = cached(function (id) {
  9662. var el = query(id);
  9663. return el && el.innerHTML
  9664. });
  9665. var mount = Vue$3.prototype.$mount;
  9666. Vue$3.prototype.$mount = function (
  9667. el,
  9668. hydrating
  9669. ) {
  9670. el = el && query(el);
  9671. /* istanbul ignore if */
  9672. if (el === document.body || el === document.documentElement) {
  9673. "development" !== 'production' && warn(
  9674. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  9675. );
  9676. return this
  9677. }
  9678. var options = this.$options;
  9679. // resolve template/el and convert to render function
  9680. if (!options.render) {
  9681. var template = options.template;
  9682. if (template) {
  9683. if (typeof template === 'string') {
  9684. if (template.charAt(0) === '#') {
  9685. template = idToTemplate(template);
  9686. /* istanbul ignore if */
  9687. if ("development" !== 'production' && !template) {
  9688. warn(
  9689. ("Template element not found or is empty: " + (options.template)),
  9690. this
  9691. );
  9692. }
  9693. }
  9694. } else if (template.nodeType) {
  9695. template = template.innerHTML;
  9696. } else {
  9697. {
  9698. warn('invalid template option:' + template, this);
  9699. }
  9700. return this
  9701. }
  9702. } else if (el) {
  9703. template = getOuterHTML(el);
  9704. }
  9705. if (template) {
  9706. /* istanbul ignore if */
  9707. if ("development" !== 'production' && config.performance && mark) {
  9708. mark('compile');
  9709. }
  9710. var ref = compileToFunctions(template, {
  9711. shouldDecodeNewlines: shouldDecodeNewlines,
  9712. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  9713. delimiters: options.delimiters,
  9714. comments: options.comments
  9715. }, this);
  9716. var render = ref.render;
  9717. var staticRenderFns = ref.staticRenderFns;
  9718. options.render = render;
  9719. options.staticRenderFns = staticRenderFns;
  9720. /* istanbul ignore if */
  9721. if ("development" !== 'production' && config.performance && mark) {
  9722. mark('compile end');
  9723. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  9724. }
  9725. }
  9726. }
  9727. return mount.call(this, el, hydrating)
  9728. };
  9729. /**
  9730. * Get outerHTML of elements, taking care
  9731. * of SVG elements in IE as well.
  9732. */
  9733. function getOuterHTML (el) {
  9734. if (el.outerHTML) {
  9735. return el.outerHTML
  9736. } else {
  9737. var container = document.createElement('div');
  9738. container.appendChild(el.cloneNode(true));
  9739. return container.innerHTML
  9740. }
  9741. }
  9742. Vue$3.compile = compileToFunctions;
  9743. return Vue$3;
  9744. })));