vue.js 332 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908
  1. /*!
  2. * Vue.js v2.6.7
  3. * (c) 2014-2019 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 = global || self, global.Vue = factory());
  10. }(this, function () { 'use strict';
  11. /* */
  12. var emptyObject = Object.freeze({});
  13. // These helpers produce 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. function isPromise (val) {
  72. return (
  73. isDef(val) &&
  74. typeof val.then === 'function' &&
  75. typeof val.catch === 'function'
  76. )
  77. }
  78. /**
  79. * Convert a value to a string that is actually rendered.
  80. */
  81. function toString (val) {
  82. return val == null
  83. ? ''
  84. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  85. ? JSON.stringify(val, null, 2)
  86. : String(val)
  87. }
  88. /**
  89. * Convert an input value to a number for persistence.
  90. * If the conversion fails, return original string.
  91. */
  92. function toNumber (val) {
  93. var n = parseFloat(val);
  94. return isNaN(n) ? val : n
  95. }
  96. /**
  97. * Make a map and return a function for checking if a key
  98. * is in that map.
  99. */
  100. function makeMap (
  101. str,
  102. expectsLowerCase
  103. ) {
  104. var map = Object.create(null);
  105. var list = str.split(',');
  106. for (var i = 0; i < list.length; i++) {
  107. map[list[i]] = true;
  108. }
  109. return expectsLowerCase
  110. ? function (val) { return map[val.toLowerCase()]; }
  111. : function (val) { return map[val]; }
  112. }
  113. /**
  114. * Check if a tag is a built-in tag.
  115. */
  116. var isBuiltInTag = makeMap('slot,component', true);
  117. /**
  118. * Check if an attribute is a reserved attribute.
  119. */
  120. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  121. /**
  122. * Remove an item from an array.
  123. */
  124. function remove (arr, item) {
  125. if (arr.length) {
  126. var index = arr.indexOf(item);
  127. if (index > -1) {
  128. return arr.splice(index, 1)
  129. }
  130. }
  131. }
  132. /**
  133. * Check whether an object has the property.
  134. */
  135. var hasOwnProperty = Object.prototype.hasOwnProperty;
  136. function hasOwn (obj, key) {
  137. return hasOwnProperty.call(obj, key)
  138. }
  139. /**
  140. * Create a cached version of a pure function.
  141. */
  142. function cached (fn) {
  143. var cache = Object.create(null);
  144. return (function cachedFn (str) {
  145. var hit = cache[str];
  146. return hit || (cache[str] = fn(str))
  147. })
  148. }
  149. /**
  150. * Camelize a hyphen-delimited string.
  151. */
  152. var camelizeRE = /-(\w)/g;
  153. var camelize = cached(function (str) {
  154. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  155. });
  156. /**
  157. * Capitalize a string.
  158. */
  159. var capitalize = cached(function (str) {
  160. return str.charAt(0).toUpperCase() + str.slice(1)
  161. });
  162. /**
  163. * Hyphenate a camelCase string.
  164. */
  165. var hyphenateRE = /\B([A-Z])/g;
  166. var hyphenate = cached(function (str) {
  167. return str.replace(hyphenateRE, '-$1').toLowerCase()
  168. });
  169. /**
  170. * Simple bind polyfill for environments that do not support it,
  171. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  172. * since native bind is now performant enough in most browsers.
  173. * But removing it would mean breaking code that was able to run in
  174. * PhantomJS 1.x, so this must be kept for backward compatibility.
  175. */
  176. /* istanbul ignore next */
  177. function polyfillBind (fn, ctx) {
  178. function boundFn (a) {
  179. var l = arguments.length;
  180. return l
  181. ? l > 1
  182. ? fn.apply(ctx, arguments)
  183. : fn.call(ctx, a)
  184. : fn.call(ctx)
  185. }
  186. boundFn._length = fn.length;
  187. return boundFn
  188. }
  189. function nativeBind (fn, ctx) {
  190. return fn.bind(ctx)
  191. }
  192. var bind = Function.prototype.bind
  193. ? nativeBind
  194. : polyfillBind;
  195. /**
  196. * Convert an Array-like object to a real Array.
  197. */
  198. function toArray (list, start) {
  199. start = start || 0;
  200. var i = list.length - start;
  201. var ret = new Array(i);
  202. while (i--) {
  203. ret[i] = list[i + start];
  204. }
  205. return ret
  206. }
  207. /**
  208. * Mix properties into target object.
  209. */
  210. function extend (to, _from) {
  211. for (var key in _from) {
  212. to[key] = _from[key];
  213. }
  214. return to
  215. }
  216. /**
  217. * Merge an Array of Objects into a single Object.
  218. */
  219. function toObject (arr) {
  220. var res = {};
  221. for (var i = 0; i < arr.length; i++) {
  222. if (arr[i]) {
  223. extend(res, arr[i]);
  224. }
  225. }
  226. return res
  227. }
  228. /* eslint-disable no-unused-vars */
  229. /**
  230. * Perform no operation.
  231. * Stubbing args to make Flow happy without leaving useless transpiled code
  232. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  233. */
  234. function noop (a, b, c) {}
  235. /**
  236. * Always return false.
  237. */
  238. var no = function (a, b, c) { return false; };
  239. /* eslint-enable no-unused-vars */
  240. /**
  241. * Return the same value.
  242. */
  243. var identity = function (_) { return _; };
  244. /**
  245. * Generate a string containing static keys from compiler modules.
  246. */
  247. function genStaticKeys (modules) {
  248. return modules.reduce(function (keys, m) {
  249. return keys.concat(m.staticKeys || [])
  250. }, []).join(',')
  251. }
  252. /**
  253. * Check if two values are loosely equal - that is,
  254. * if they are plain objects, do they have the same shape?
  255. */
  256. function looseEqual (a, b) {
  257. if (a === b) { return true }
  258. var isObjectA = isObject(a);
  259. var isObjectB = isObject(b);
  260. if (isObjectA && isObjectB) {
  261. try {
  262. var isArrayA = Array.isArray(a);
  263. var isArrayB = Array.isArray(b);
  264. if (isArrayA && isArrayB) {
  265. return a.length === b.length && a.every(function (e, i) {
  266. return looseEqual(e, b[i])
  267. })
  268. } else if (a instanceof Date && b instanceof Date) {
  269. return a.getTime() === b.getTime()
  270. } else if (!isArrayA && !isArrayB) {
  271. var keysA = Object.keys(a);
  272. var keysB = Object.keys(b);
  273. return keysA.length === keysB.length && keysA.every(function (key) {
  274. return looseEqual(a[key], b[key])
  275. })
  276. } else {
  277. /* istanbul ignore next */
  278. return false
  279. }
  280. } catch (e) {
  281. /* istanbul ignore next */
  282. return false
  283. }
  284. } else if (!isObjectA && !isObjectB) {
  285. return String(a) === String(b)
  286. } else {
  287. return false
  288. }
  289. }
  290. /**
  291. * Return the first index at which a loosely equal value can be
  292. * found in the array (if value is a plain object, the array must
  293. * contain an object of the same shape), or -1 if it is not present.
  294. */
  295. function looseIndexOf (arr, val) {
  296. for (var i = 0; i < arr.length; i++) {
  297. if (looseEqual(arr[i], val)) { return i }
  298. }
  299. return -1
  300. }
  301. /**
  302. * Ensure a function is called only once.
  303. */
  304. function once (fn) {
  305. var called = false;
  306. return function () {
  307. if (!called) {
  308. called = true;
  309. fn.apply(this, arguments);
  310. }
  311. }
  312. }
  313. var SSR_ATTR = 'data-server-rendered';
  314. var ASSET_TYPES = [
  315. 'component',
  316. 'directive',
  317. 'filter'
  318. ];
  319. var LIFECYCLE_HOOKS = [
  320. 'beforeCreate',
  321. 'created',
  322. 'beforeMount',
  323. 'mounted',
  324. 'beforeUpdate',
  325. 'updated',
  326. 'beforeDestroy',
  327. 'destroyed',
  328. 'activated',
  329. 'deactivated',
  330. 'errorCaptured',
  331. 'serverPrefetch'
  332. ];
  333. /* */
  334. var config = ({
  335. /**
  336. * Option merge strategies (used in core/util/options)
  337. */
  338. // $flow-disable-line
  339. optionMergeStrategies: Object.create(null),
  340. /**
  341. * Whether to suppress warnings.
  342. */
  343. silent: false,
  344. /**
  345. * Show production mode tip message on boot?
  346. */
  347. productionTip: "development" !== 'production',
  348. /**
  349. * Whether to enable devtools
  350. */
  351. devtools: "development" !== 'production',
  352. /**
  353. * Whether to record perf
  354. */
  355. performance: false,
  356. /**
  357. * Error handler for watcher errors
  358. */
  359. errorHandler: null,
  360. /**
  361. * Warn handler for watcher warns
  362. */
  363. warnHandler: null,
  364. /**
  365. * Ignore certain custom elements
  366. */
  367. ignoredElements: [],
  368. /**
  369. * Custom user key aliases for v-on
  370. */
  371. // $flow-disable-line
  372. keyCodes: Object.create(null),
  373. /**
  374. * Check if a tag is reserved so that it cannot be registered as a
  375. * component. This is platform-dependent and may be overwritten.
  376. */
  377. isReservedTag: no,
  378. /**
  379. * Check if an attribute is reserved so that it cannot be used as a component
  380. * prop. This is platform-dependent and may be overwritten.
  381. */
  382. isReservedAttr: no,
  383. /**
  384. * Check if a tag is an unknown element.
  385. * Platform-dependent.
  386. */
  387. isUnknownElement: no,
  388. /**
  389. * Get the namespace of an element
  390. */
  391. getTagNamespace: noop,
  392. /**
  393. * Parse the real tag name for the specific platform.
  394. */
  395. parsePlatformTagName: identity,
  396. /**
  397. * Check if an attribute must be bound using property, e.g. value
  398. * Platform-dependent.
  399. */
  400. mustUseProp: no,
  401. /**
  402. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  403. * This will significantly reduce performance if set to false.
  404. */
  405. async: true,
  406. /**
  407. * Exposed for legacy reasons
  408. */
  409. _lifecycleHooks: LIFECYCLE_HOOKS
  410. });
  411. /* */
  412. /**
  413. * unicode letters used for parsing html tags, component names and property paths.
  414. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  415. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  416. */
  417. var unicodeLetters = 'a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD';
  418. /**
  419. * Check if a string starts with $ or _
  420. */
  421. function isReserved (str) {
  422. var c = (str + '').charCodeAt(0);
  423. return c === 0x24 || c === 0x5F
  424. }
  425. /**
  426. * Define a property.
  427. */
  428. function def (obj, key, val, enumerable) {
  429. Object.defineProperty(obj, key, {
  430. value: val,
  431. enumerable: !!enumerable,
  432. writable: true,
  433. configurable: true
  434. });
  435. }
  436. /**
  437. * Parse simple path.
  438. */
  439. var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
  440. function parsePath (path) {
  441. if (bailRE.test(path)) {
  442. return
  443. }
  444. var segments = path.split('.');
  445. return function (obj) {
  446. for (var i = 0; i < segments.length; i++) {
  447. if (!obj) { return }
  448. obj = obj[segments[i]];
  449. }
  450. return obj
  451. }
  452. }
  453. /* */
  454. // can we use __proto__?
  455. var hasProto = '__proto__' in {};
  456. // Browser environment sniffing
  457. var inBrowser = typeof window !== 'undefined';
  458. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  459. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  460. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  461. var isIE = UA && /msie|trident/.test(UA);
  462. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  463. var isEdge = UA && UA.indexOf('edge/') > 0;
  464. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  465. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  466. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  467. var isPhantomJS = UA && /phantomjs/.test(UA);
  468. var isFF = UA && UA.match(/firefox\/(\d+)/);
  469. // Firefox has a "watch" function on Object.prototype...
  470. var nativeWatch = ({}).watch;
  471. var supportsPassive = false;
  472. if (inBrowser) {
  473. try {
  474. var opts = {};
  475. Object.defineProperty(opts, 'passive', ({
  476. get: function get () {
  477. /* istanbul ignore next */
  478. supportsPassive = true;
  479. }
  480. })); // https://github.com/facebook/flow/issues/285
  481. window.addEventListener('test-passive', null, opts);
  482. } catch (e) {}
  483. }
  484. // this needs to be lazy-evaled because vue may be required before
  485. // vue-server-renderer can set VUE_ENV
  486. var _isServer;
  487. var isServerRendering = function () {
  488. if (_isServer === undefined) {
  489. /* istanbul ignore if */
  490. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  491. // detect presence of vue-server-renderer and avoid
  492. // Webpack shimming the process
  493. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  494. } else {
  495. _isServer = false;
  496. }
  497. }
  498. return _isServer
  499. };
  500. // detect devtools
  501. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  502. /* istanbul ignore next */
  503. function isNative (Ctor) {
  504. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  505. }
  506. var hasSymbol =
  507. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  508. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  509. var _Set;
  510. /* istanbul ignore if */ // $flow-disable-line
  511. if (typeof Set !== 'undefined' && isNative(Set)) {
  512. // use native Set when available.
  513. _Set = Set;
  514. } else {
  515. // a non-standard Set polyfill that only works with primitive keys.
  516. _Set = /*@__PURE__*/(function () {
  517. function Set () {
  518. this.set = Object.create(null);
  519. }
  520. Set.prototype.has = function has (key) {
  521. return this.set[key] === true
  522. };
  523. Set.prototype.add = function add (key) {
  524. this.set[key] = true;
  525. };
  526. Set.prototype.clear = function clear () {
  527. this.set = Object.create(null);
  528. };
  529. return Set;
  530. }());
  531. }
  532. /* */
  533. var warn = noop;
  534. var tip = noop;
  535. var generateComponentTrace = (noop); // work around flow check
  536. var formatComponentName = (noop);
  537. {
  538. var hasConsole = typeof console !== 'undefined';
  539. var classifyRE = /(?:^|[-_])(\w)/g;
  540. var classify = function (str) { return str
  541. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  542. .replace(/[-_]/g, ''); };
  543. warn = function (msg, vm) {
  544. var trace = vm ? generateComponentTrace(vm) : '';
  545. if (config.warnHandler) {
  546. config.warnHandler.call(null, msg, vm, trace);
  547. } else if (hasConsole && (!config.silent)) {
  548. console.error(("[Vue warn]: " + msg + trace));
  549. }
  550. };
  551. tip = function (msg, vm) {
  552. if (hasConsole && (!config.silent)) {
  553. console.warn("[Vue tip]: " + msg + (
  554. vm ? generateComponentTrace(vm) : ''
  555. ));
  556. }
  557. };
  558. formatComponentName = function (vm, includeFile) {
  559. if (vm.$root === vm) {
  560. return '<Root>'
  561. }
  562. var options = typeof vm === 'function' && vm.cid != null
  563. ? vm.options
  564. : vm._isVue
  565. ? vm.$options || vm.constructor.options
  566. : vm;
  567. var name = options.name || options._componentTag;
  568. var file = options.__file;
  569. if (!name && file) {
  570. var match = file.match(/([^/\\]+)\.vue$/);
  571. name = match && match[1];
  572. }
  573. return (
  574. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  575. (file && includeFile !== false ? (" at " + file) : '')
  576. )
  577. };
  578. var repeat = function (str, n) {
  579. var res = '';
  580. while (n) {
  581. if (n % 2 === 1) { res += str; }
  582. if (n > 1) { str += str; }
  583. n >>= 1;
  584. }
  585. return res
  586. };
  587. generateComponentTrace = function (vm) {
  588. if (vm._isVue && vm.$parent) {
  589. var tree = [];
  590. var currentRecursiveSequence = 0;
  591. while (vm) {
  592. if (tree.length > 0) {
  593. var last = tree[tree.length - 1];
  594. if (last.constructor === vm.constructor) {
  595. currentRecursiveSequence++;
  596. vm = vm.$parent;
  597. continue
  598. } else if (currentRecursiveSequence > 0) {
  599. tree[tree.length - 1] = [last, currentRecursiveSequence];
  600. currentRecursiveSequence = 0;
  601. }
  602. }
  603. tree.push(vm);
  604. vm = vm.$parent;
  605. }
  606. return '\n\nfound in\n\n' + tree
  607. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  608. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  609. : formatComponentName(vm))); })
  610. .join('\n')
  611. } else {
  612. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  613. }
  614. };
  615. }
  616. /* */
  617. var uid = 0;
  618. /**
  619. * A dep is an observable that can have multiple
  620. * directives subscribing to it.
  621. */
  622. var Dep = function Dep () {
  623. this.id = uid++;
  624. this.subs = [];
  625. };
  626. Dep.prototype.addSub = function addSub (sub) {
  627. this.subs.push(sub);
  628. };
  629. Dep.prototype.removeSub = function removeSub (sub) {
  630. remove(this.subs, sub);
  631. };
  632. Dep.prototype.depend = function depend () {
  633. if (Dep.target) {
  634. Dep.target.addDep(this);
  635. }
  636. };
  637. Dep.prototype.notify = function notify () {
  638. // stabilize the subscriber list first
  639. var subs = this.subs.slice();
  640. if (!config.async) {
  641. // subs aren't sorted in scheduler if not running async
  642. // we need to sort them now to make sure they fire in correct
  643. // order
  644. subs.sort(function (a, b) { return a.id - b.id; });
  645. }
  646. for (var i = 0, l = subs.length; i < l; i++) {
  647. subs[i].update();
  648. }
  649. };
  650. // The current target watcher being evaluated.
  651. // This is globally unique because only one watcher
  652. // can be evaluated at a time.
  653. Dep.target = null;
  654. var targetStack = [];
  655. function pushTarget (target) {
  656. targetStack.push(target);
  657. Dep.target = target;
  658. }
  659. function popTarget () {
  660. targetStack.pop();
  661. Dep.target = targetStack[targetStack.length - 1];
  662. }
  663. /* */
  664. var VNode = function VNode (
  665. tag,
  666. data,
  667. children,
  668. text,
  669. elm,
  670. context,
  671. componentOptions,
  672. asyncFactory
  673. ) {
  674. this.tag = tag;
  675. this.data = data;
  676. this.children = children;
  677. this.text = text;
  678. this.elm = elm;
  679. this.ns = undefined;
  680. this.context = context;
  681. this.fnContext = undefined;
  682. this.fnOptions = undefined;
  683. this.fnScopeId = undefined;
  684. this.key = data && data.key;
  685. this.componentOptions = componentOptions;
  686. this.componentInstance = undefined;
  687. this.parent = undefined;
  688. this.raw = false;
  689. this.isStatic = false;
  690. this.isRootInsert = true;
  691. this.isComment = false;
  692. this.isCloned = false;
  693. this.isOnce = false;
  694. this.asyncFactory = asyncFactory;
  695. this.asyncMeta = undefined;
  696. this.isAsyncPlaceholder = false;
  697. };
  698. var prototypeAccessors = { child: { configurable: true } };
  699. // DEPRECATED: alias for componentInstance for backwards compat.
  700. /* istanbul ignore next */
  701. prototypeAccessors.child.get = function () {
  702. return this.componentInstance
  703. };
  704. Object.defineProperties( VNode.prototype, prototypeAccessors );
  705. var createEmptyVNode = function (text) {
  706. if ( text === void 0 ) text = '';
  707. var node = new VNode();
  708. node.text = text;
  709. node.isComment = true;
  710. return node
  711. };
  712. function createTextVNode (val) {
  713. return new VNode(undefined, undefined, undefined, String(val))
  714. }
  715. // optimized shallow clone
  716. // used for static nodes and slot nodes because they may be reused across
  717. // multiple renders, cloning them avoids errors when DOM manipulations rely
  718. // on their elm reference.
  719. function cloneVNode (vnode) {
  720. var cloned = new VNode(
  721. vnode.tag,
  722. vnode.data,
  723. // #7975
  724. // clone children array to avoid mutating original in case of cloning
  725. // a child.
  726. vnode.children && vnode.children.slice(),
  727. vnode.text,
  728. vnode.elm,
  729. vnode.context,
  730. vnode.componentOptions,
  731. vnode.asyncFactory
  732. );
  733. cloned.ns = vnode.ns;
  734. cloned.isStatic = vnode.isStatic;
  735. cloned.key = vnode.key;
  736. cloned.isComment = vnode.isComment;
  737. cloned.fnContext = vnode.fnContext;
  738. cloned.fnOptions = vnode.fnOptions;
  739. cloned.fnScopeId = vnode.fnScopeId;
  740. cloned.asyncMeta = vnode.asyncMeta;
  741. cloned.isCloned = true;
  742. return cloned
  743. }
  744. /*
  745. * not type checking this file because flow doesn't play well with
  746. * dynamically accessing methods on Array prototype
  747. */
  748. var arrayProto = Array.prototype;
  749. var arrayMethods = Object.create(arrayProto);
  750. var methodsToPatch = [
  751. 'push',
  752. 'pop',
  753. 'shift',
  754. 'unshift',
  755. 'splice',
  756. 'sort',
  757. 'reverse'
  758. ];
  759. /**
  760. * Intercept mutating methods and emit events
  761. */
  762. methodsToPatch.forEach(function (method) {
  763. // cache original method
  764. var original = arrayProto[method];
  765. def(arrayMethods, method, function mutator () {
  766. var args = [], len = arguments.length;
  767. while ( len-- ) args[ len ] = arguments[ len ];
  768. var result = original.apply(this, args);
  769. var ob = this.__ob__;
  770. var inserted;
  771. switch (method) {
  772. case 'push':
  773. case 'unshift':
  774. inserted = args;
  775. break
  776. case 'splice':
  777. inserted = args.slice(2);
  778. break
  779. }
  780. if (inserted) { ob.observeArray(inserted); }
  781. // notify change
  782. ob.dep.notify();
  783. return result
  784. });
  785. });
  786. /* */
  787. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  788. /**
  789. * In some cases we may want to disable observation inside a component's
  790. * update computation.
  791. */
  792. var shouldObserve = true;
  793. function toggleObserving (value) {
  794. shouldObserve = value;
  795. }
  796. /**
  797. * Observer class that is attached to each observed
  798. * object. Once attached, the observer converts the target
  799. * object's property keys into getter/setters that
  800. * collect dependencies and dispatch updates.
  801. */
  802. var Observer = function Observer (value) {
  803. this.value = value;
  804. this.dep = new Dep();
  805. this.vmCount = 0;
  806. def(value, '__ob__', this);
  807. if (Array.isArray(value)) {
  808. if (hasProto) {
  809. protoAugment(value, arrayMethods);
  810. } else {
  811. copyAugment(value, arrayMethods, arrayKeys);
  812. }
  813. this.observeArray(value);
  814. } else {
  815. this.walk(value);
  816. }
  817. };
  818. /**
  819. * Walk through all properties and convert them into
  820. * getter/setters. This method should only be called when
  821. * value type is Object.
  822. */
  823. Observer.prototype.walk = function walk (obj) {
  824. var keys = Object.keys(obj);
  825. for (var i = 0; i < keys.length; i++) {
  826. defineReactive$$1(obj, keys[i]);
  827. }
  828. };
  829. /**
  830. * Observe a list of Array items.
  831. */
  832. Observer.prototype.observeArray = function observeArray (items) {
  833. for (var i = 0, l = items.length; i < l; i++) {
  834. observe(items[i]);
  835. }
  836. };
  837. // helpers
  838. /**
  839. * Augment a target Object or Array by intercepting
  840. * the prototype chain using __proto__
  841. */
  842. function protoAugment (target, src) {
  843. /* eslint-disable no-proto */
  844. target.__proto__ = src;
  845. /* eslint-enable no-proto */
  846. }
  847. /**
  848. * Augment a target Object or Array by defining
  849. * hidden properties.
  850. */
  851. /* istanbul ignore next */
  852. function copyAugment (target, src, keys) {
  853. for (var i = 0, l = keys.length; i < l; i++) {
  854. var key = keys[i];
  855. def(target, key, src[key]);
  856. }
  857. }
  858. /**
  859. * Attempt to create an observer instance for a value,
  860. * returns the new observer if successfully observed,
  861. * or the existing observer if the value already has one.
  862. */
  863. function observe (value, asRootData) {
  864. if (!isObject(value) || value instanceof VNode) {
  865. return
  866. }
  867. var ob;
  868. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  869. ob = value.__ob__;
  870. } else if (
  871. shouldObserve &&
  872. !isServerRendering() &&
  873. (Array.isArray(value) || isPlainObject(value)) &&
  874. Object.isExtensible(value) &&
  875. !value._isVue
  876. ) {
  877. ob = new Observer(value);
  878. }
  879. if (asRootData && ob) {
  880. ob.vmCount++;
  881. }
  882. return ob
  883. }
  884. /**
  885. * Define a reactive property on an Object.
  886. */
  887. function defineReactive$$1 (
  888. obj,
  889. key,
  890. val,
  891. customSetter,
  892. shallow
  893. ) {
  894. var dep = new Dep();
  895. var property = Object.getOwnPropertyDescriptor(obj, key);
  896. if (property && property.configurable === false) {
  897. return
  898. }
  899. // cater for pre-defined getter/setters
  900. var getter = property && property.get;
  901. var setter = property && property.set;
  902. if ((!getter || setter) && arguments.length === 2) {
  903. val = obj[key];
  904. }
  905. var childOb = !shallow && observe(val);
  906. Object.defineProperty(obj, key, {
  907. enumerable: true,
  908. configurable: true,
  909. get: function reactiveGetter () {
  910. var value = getter ? getter.call(obj) : val;
  911. if (Dep.target) {
  912. dep.depend();
  913. if (childOb) {
  914. childOb.dep.depend();
  915. if (Array.isArray(value)) {
  916. dependArray(value);
  917. }
  918. }
  919. }
  920. return value
  921. },
  922. set: function reactiveSetter (newVal) {
  923. var value = getter ? getter.call(obj) : val;
  924. /* eslint-disable no-self-compare */
  925. if (newVal === value || (newVal !== newVal && value !== value)) {
  926. return
  927. }
  928. /* eslint-enable no-self-compare */
  929. if (customSetter) {
  930. customSetter();
  931. }
  932. // #7981: for accessor properties without setter
  933. if (getter && !setter) { return }
  934. if (setter) {
  935. setter.call(obj, newVal);
  936. } else {
  937. val = newVal;
  938. }
  939. childOb = !shallow && observe(newVal);
  940. dep.notify();
  941. }
  942. });
  943. }
  944. /**
  945. * Set a property on an object. Adds the new property and
  946. * triggers change notification if the property doesn't
  947. * already exist.
  948. */
  949. function set (target, key, val) {
  950. if (isUndef(target) || isPrimitive(target)
  951. ) {
  952. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  953. }
  954. if (Array.isArray(target) && isValidArrayIndex(key)) {
  955. target.length = Math.max(target.length, key);
  956. target.splice(key, 1, val);
  957. return val
  958. }
  959. if (key in target && !(key in Object.prototype)) {
  960. target[key] = val;
  961. return val
  962. }
  963. var ob = (target).__ob__;
  964. if (target._isVue || (ob && ob.vmCount)) {
  965. warn(
  966. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  967. 'at runtime - declare it upfront in the data option.'
  968. );
  969. return val
  970. }
  971. if (!ob) {
  972. target[key] = val;
  973. return val
  974. }
  975. defineReactive$$1(ob.value, key, val);
  976. ob.dep.notify();
  977. return val
  978. }
  979. /**
  980. * Delete a property and trigger change if necessary.
  981. */
  982. function del (target, key) {
  983. if (isUndef(target) || isPrimitive(target)
  984. ) {
  985. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  986. }
  987. if (Array.isArray(target) && isValidArrayIndex(key)) {
  988. target.splice(key, 1);
  989. return
  990. }
  991. var ob = (target).__ob__;
  992. if (target._isVue || (ob && ob.vmCount)) {
  993. warn(
  994. 'Avoid deleting properties on a Vue instance or its root $data ' +
  995. '- just set it to null.'
  996. );
  997. return
  998. }
  999. if (!hasOwn(target, key)) {
  1000. return
  1001. }
  1002. delete target[key];
  1003. if (!ob) {
  1004. return
  1005. }
  1006. ob.dep.notify();
  1007. }
  1008. /**
  1009. * Collect dependencies on array elements when the array is touched, since
  1010. * we cannot intercept array element access like property getters.
  1011. */
  1012. function dependArray (value) {
  1013. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1014. e = value[i];
  1015. e && e.__ob__ && e.__ob__.dep.depend();
  1016. if (Array.isArray(e)) {
  1017. dependArray(e);
  1018. }
  1019. }
  1020. }
  1021. /* */
  1022. /**
  1023. * Option overwriting strategies are functions that handle
  1024. * how to merge a parent option value and a child option
  1025. * value into the final value.
  1026. */
  1027. var strats = config.optionMergeStrategies;
  1028. /**
  1029. * Options with restrictions
  1030. */
  1031. {
  1032. strats.el = strats.propsData = function (parent, child, vm, key) {
  1033. if (!vm) {
  1034. warn(
  1035. "option \"" + key + "\" can only be used during instance " +
  1036. 'creation with the `new` keyword.'
  1037. );
  1038. }
  1039. return defaultStrat(parent, child)
  1040. };
  1041. }
  1042. /**
  1043. * Helper that recursively merges two data objects together.
  1044. */
  1045. function mergeData (to, from) {
  1046. if (!from) { return to }
  1047. var key, toVal, fromVal;
  1048. var keys = hasSymbol
  1049. ? Reflect.ownKeys(from)
  1050. : Object.keys(from);
  1051. for (var i = 0; i < keys.length; i++) {
  1052. key = keys[i];
  1053. // in case the object is already observed...
  1054. if (key === '__ob__') { continue }
  1055. toVal = to[key];
  1056. fromVal = from[key];
  1057. if (!hasOwn(to, key)) {
  1058. set(to, key, fromVal);
  1059. } else if (
  1060. toVal !== fromVal &&
  1061. isPlainObject(toVal) &&
  1062. isPlainObject(fromVal)
  1063. ) {
  1064. mergeData(toVal, fromVal);
  1065. }
  1066. }
  1067. return to
  1068. }
  1069. /**
  1070. * Data
  1071. */
  1072. function mergeDataOrFn (
  1073. parentVal,
  1074. childVal,
  1075. vm
  1076. ) {
  1077. if (!vm) {
  1078. // in a Vue.extend merge, both should be functions
  1079. if (!childVal) {
  1080. return parentVal
  1081. }
  1082. if (!parentVal) {
  1083. return childVal
  1084. }
  1085. // when parentVal & childVal are both present,
  1086. // we need to return a function that returns the
  1087. // merged result of both functions... no need to
  1088. // check if parentVal is a function here because
  1089. // it has to be a function to pass previous merges.
  1090. return function mergedDataFn () {
  1091. return mergeData(
  1092. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1093. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1094. )
  1095. }
  1096. } else {
  1097. return function mergedInstanceDataFn () {
  1098. // instance merge
  1099. var instanceData = typeof childVal === 'function'
  1100. ? childVal.call(vm, vm)
  1101. : childVal;
  1102. var defaultData = typeof parentVal === 'function'
  1103. ? parentVal.call(vm, vm)
  1104. : parentVal;
  1105. if (instanceData) {
  1106. return mergeData(instanceData, defaultData)
  1107. } else {
  1108. return defaultData
  1109. }
  1110. }
  1111. }
  1112. }
  1113. strats.data = function (
  1114. parentVal,
  1115. childVal,
  1116. vm
  1117. ) {
  1118. if (!vm) {
  1119. if (childVal && typeof childVal !== 'function') {
  1120. warn(
  1121. 'The "data" option should be a function ' +
  1122. 'that returns a per-instance value in component ' +
  1123. 'definitions.',
  1124. vm
  1125. );
  1126. return parentVal
  1127. }
  1128. return mergeDataOrFn(parentVal, childVal)
  1129. }
  1130. return mergeDataOrFn(parentVal, childVal, vm)
  1131. };
  1132. /**
  1133. * Hooks and props are merged as arrays.
  1134. */
  1135. function mergeHook (
  1136. parentVal,
  1137. childVal
  1138. ) {
  1139. var res = childVal
  1140. ? parentVal
  1141. ? parentVal.concat(childVal)
  1142. : Array.isArray(childVal)
  1143. ? childVal
  1144. : [childVal]
  1145. : parentVal;
  1146. return res
  1147. ? dedupeHooks(res)
  1148. : res
  1149. }
  1150. function dedupeHooks (hooks) {
  1151. var res = [];
  1152. for (var i = 0; i < hooks.length; i++) {
  1153. if (res.indexOf(hooks[i]) === -1) {
  1154. res.push(hooks[i]);
  1155. }
  1156. }
  1157. return res
  1158. }
  1159. LIFECYCLE_HOOKS.forEach(function (hook) {
  1160. strats[hook] = mergeHook;
  1161. });
  1162. /**
  1163. * Assets
  1164. *
  1165. * When a vm is present (instance creation), we need to do
  1166. * a three-way merge between constructor options, instance
  1167. * options and parent options.
  1168. */
  1169. function mergeAssets (
  1170. parentVal,
  1171. childVal,
  1172. vm,
  1173. key
  1174. ) {
  1175. var res = Object.create(parentVal || null);
  1176. if (childVal) {
  1177. assertObjectType(key, childVal, vm);
  1178. return extend(res, childVal)
  1179. } else {
  1180. return res
  1181. }
  1182. }
  1183. ASSET_TYPES.forEach(function (type) {
  1184. strats[type + 's'] = mergeAssets;
  1185. });
  1186. /**
  1187. * Watchers.
  1188. *
  1189. * Watchers hashes should not overwrite one
  1190. * another, so we merge them as arrays.
  1191. */
  1192. strats.watch = function (
  1193. parentVal,
  1194. childVal,
  1195. vm,
  1196. key
  1197. ) {
  1198. // work around Firefox's Object.prototype.watch...
  1199. if (parentVal === nativeWatch) { parentVal = undefined; }
  1200. if (childVal === nativeWatch) { childVal = undefined; }
  1201. /* istanbul ignore if */
  1202. if (!childVal) { return Object.create(parentVal || null) }
  1203. {
  1204. assertObjectType(key, childVal, vm);
  1205. }
  1206. if (!parentVal) { return childVal }
  1207. var ret = {};
  1208. extend(ret, parentVal);
  1209. for (var key$1 in childVal) {
  1210. var parent = ret[key$1];
  1211. var child = childVal[key$1];
  1212. if (parent && !Array.isArray(parent)) {
  1213. parent = [parent];
  1214. }
  1215. ret[key$1] = parent
  1216. ? parent.concat(child)
  1217. : Array.isArray(child) ? child : [child];
  1218. }
  1219. return ret
  1220. };
  1221. /**
  1222. * Other object hashes.
  1223. */
  1224. strats.props =
  1225. strats.methods =
  1226. strats.inject =
  1227. strats.computed = function (
  1228. parentVal,
  1229. childVal,
  1230. vm,
  1231. key
  1232. ) {
  1233. if (childVal && "development" !== 'production') {
  1234. assertObjectType(key, childVal, vm);
  1235. }
  1236. if (!parentVal) { return childVal }
  1237. var ret = Object.create(null);
  1238. extend(ret, parentVal);
  1239. if (childVal) { extend(ret, childVal); }
  1240. return ret
  1241. };
  1242. strats.provide = mergeDataOrFn;
  1243. /**
  1244. * Default strategy.
  1245. */
  1246. var defaultStrat = function (parentVal, childVal) {
  1247. return childVal === undefined
  1248. ? parentVal
  1249. : childVal
  1250. };
  1251. /**
  1252. * Validate component names
  1253. */
  1254. function checkComponents (options) {
  1255. for (var key in options.components) {
  1256. validateComponentName(key);
  1257. }
  1258. }
  1259. function validateComponentName (name) {
  1260. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*$")).test(name)) {
  1261. warn(
  1262. 'Invalid component name: "' + name + '". Component names ' +
  1263. 'should conform to valid custom element name in html5 specification.'
  1264. );
  1265. }
  1266. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1267. warn(
  1268. 'Do not use built-in or reserved HTML elements as component ' +
  1269. 'id: ' + name
  1270. );
  1271. }
  1272. }
  1273. /**
  1274. * Ensure all props option syntax are normalized into the
  1275. * Object-based format.
  1276. */
  1277. function normalizeProps (options, vm) {
  1278. var props = options.props;
  1279. if (!props) { return }
  1280. var res = {};
  1281. var i, val, name;
  1282. if (Array.isArray(props)) {
  1283. i = props.length;
  1284. while (i--) {
  1285. val = props[i];
  1286. if (typeof val === 'string') {
  1287. name = camelize(val);
  1288. res[name] = { type: null };
  1289. } else {
  1290. warn('props must be strings when using array syntax.');
  1291. }
  1292. }
  1293. } else if (isPlainObject(props)) {
  1294. for (var key in props) {
  1295. val = props[key];
  1296. name = camelize(key);
  1297. res[name] = isPlainObject(val)
  1298. ? val
  1299. : { type: val };
  1300. }
  1301. } else {
  1302. warn(
  1303. "Invalid value for option \"props\": expected an Array or an Object, " +
  1304. "but got " + (toRawType(props)) + ".",
  1305. vm
  1306. );
  1307. }
  1308. options.props = res;
  1309. }
  1310. /**
  1311. * Normalize all injections into Object-based format
  1312. */
  1313. function normalizeInject (options, vm) {
  1314. var inject = options.inject;
  1315. if (!inject) { return }
  1316. var normalized = options.inject = {};
  1317. if (Array.isArray(inject)) {
  1318. for (var i = 0; i < inject.length; i++) {
  1319. normalized[inject[i]] = { from: inject[i] };
  1320. }
  1321. } else if (isPlainObject(inject)) {
  1322. for (var key in inject) {
  1323. var val = inject[key];
  1324. normalized[key] = isPlainObject(val)
  1325. ? extend({ from: key }, val)
  1326. : { from: val };
  1327. }
  1328. } else {
  1329. warn(
  1330. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1331. "but got " + (toRawType(inject)) + ".",
  1332. vm
  1333. );
  1334. }
  1335. }
  1336. /**
  1337. * Normalize raw function directives into object format.
  1338. */
  1339. function normalizeDirectives (options) {
  1340. var dirs = options.directives;
  1341. if (dirs) {
  1342. for (var key in dirs) {
  1343. var def$$1 = dirs[key];
  1344. if (typeof def$$1 === 'function') {
  1345. dirs[key] = { bind: def$$1, update: def$$1 };
  1346. }
  1347. }
  1348. }
  1349. }
  1350. function assertObjectType (name, value, vm) {
  1351. if (!isPlainObject(value)) {
  1352. warn(
  1353. "Invalid value for option \"" + name + "\": expected an Object, " +
  1354. "but got " + (toRawType(value)) + ".",
  1355. vm
  1356. );
  1357. }
  1358. }
  1359. /**
  1360. * Merge two option objects into a new one.
  1361. * Core utility used in both instantiation and inheritance.
  1362. */
  1363. function mergeOptions (
  1364. parent,
  1365. child,
  1366. vm
  1367. ) {
  1368. {
  1369. checkComponents(child);
  1370. }
  1371. if (typeof child === 'function') {
  1372. child = child.options;
  1373. }
  1374. normalizeProps(child, vm);
  1375. normalizeInject(child, vm);
  1376. normalizeDirectives(child);
  1377. // Apply extends and mixins on the child options,
  1378. // but only if it is a raw options object that isn't
  1379. // the result of another mergeOptions call.
  1380. // Only merged options has the _base property.
  1381. if (!child._base) {
  1382. if (child.extends) {
  1383. parent = mergeOptions(parent, child.extends, vm);
  1384. }
  1385. if (child.mixins) {
  1386. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1387. parent = mergeOptions(parent, child.mixins[i], vm);
  1388. }
  1389. }
  1390. }
  1391. var options = {};
  1392. var key;
  1393. for (key in parent) {
  1394. mergeField(key);
  1395. }
  1396. for (key in child) {
  1397. if (!hasOwn(parent, key)) {
  1398. mergeField(key);
  1399. }
  1400. }
  1401. function mergeField (key) {
  1402. var strat = strats[key] || defaultStrat;
  1403. options[key] = strat(parent[key], child[key], vm, key);
  1404. }
  1405. return options
  1406. }
  1407. /**
  1408. * Resolve an asset.
  1409. * This function is used because child instances need access
  1410. * to assets defined in its ancestor chain.
  1411. */
  1412. function resolveAsset (
  1413. options,
  1414. type,
  1415. id,
  1416. warnMissing
  1417. ) {
  1418. /* istanbul ignore if */
  1419. if (typeof id !== 'string') {
  1420. return
  1421. }
  1422. var assets = options[type];
  1423. // check local registration variations first
  1424. if (hasOwn(assets, id)) { return assets[id] }
  1425. var camelizedId = camelize(id);
  1426. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1427. var PascalCaseId = capitalize(camelizedId);
  1428. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1429. // fallback to prototype chain
  1430. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1431. if (warnMissing && !res) {
  1432. warn(
  1433. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1434. options
  1435. );
  1436. }
  1437. return res
  1438. }
  1439. /* */
  1440. function validateProp (
  1441. key,
  1442. propOptions,
  1443. propsData,
  1444. vm
  1445. ) {
  1446. var prop = propOptions[key];
  1447. var absent = !hasOwn(propsData, key);
  1448. var value = propsData[key];
  1449. // boolean casting
  1450. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1451. if (booleanIndex > -1) {
  1452. if (absent && !hasOwn(prop, 'default')) {
  1453. value = false;
  1454. } else if (value === '' || value === hyphenate(key)) {
  1455. // only cast empty string / same name to boolean if
  1456. // boolean has higher priority
  1457. var stringIndex = getTypeIndex(String, prop.type);
  1458. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1459. value = true;
  1460. }
  1461. }
  1462. }
  1463. // check default value
  1464. if (value === undefined) {
  1465. value = getPropDefaultValue(vm, prop, key);
  1466. // since the default value is a fresh copy,
  1467. // make sure to observe it.
  1468. var prevShouldObserve = shouldObserve;
  1469. toggleObserving(true);
  1470. observe(value);
  1471. toggleObserving(prevShouldObserve);
  1472. }
  1473. {
  1474. assertProp(prop, key, value, vm, absent);
  1475. }
  1476. return value
  1477. }
  1478. /**
  1479. * Get the default value of a prop.
  1480. */
  1481. function getPropDefaultValue (vm, prop, key) {
  1482. // no default, return undefined
  1483. if (!hasOwn(prop, 'default')) {
  1484. return undefined
  1485. }
  1486. var def = prop.default;
  1487. // warn against non-factory defaults for Object & Array
  1488. if (isObject(def)) {
  1489. warn(
  1490. 'Invalid default value for prop "' + key + '": ' +
  1491. 'Props with type Object/Array must use a factory function ' +
  1492. 'to return the default value.',
  1493. vm
  1494. );
  1495. }
  1496. // the raw prop value was also undefined from previous render,
  1497. // return previous default value to avoid unnecessary watcher trigger
  1498. if (vm && vm.$options.propsData &&
  1499. vm.$options.propsData[key] === undefined &&
  1500. vm._props[key] !== undefined
  1501. ) {
  1502. return vm._props[key]
  1503. }
  1504. // call factory function for non-Function types
  1505. // a value is Function if its prototype is function even across different execution context
  1506. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1507. ? def.call(vm)
  1508. : def
  1509. }
  1510. /**
  1511. * Assert whether a prop is valid.
  1512. */
  1513. function assertProp (
  1514. prop,
  1515. name,
  1516. value,
  1517. vm,
  1518. absent
  1519. ) {
  1520. if (prop.required && absent) {
  1521. warn(
  1522. 'Missing required prop: "' + name + '"',
  1523. vm
  1524. );
  1525. return
  1526. }
  1527. if (value == null && !prop.required) {
  1528. return
  1529. }
  1530. var type = prop.type;
  1531. var valid = !type || type === true;
  1532. var expectedTypes = [];
  1533. if (type) {
  1534. if (!Array.isArray(type)) {
  1535. type = [type];
  1536. }
  1537. for (var i = 0; i < type.length && !valid; i++) {
  1538. var assertedType = assertType(value, type[i]);
  1539. expectedTypes.push(assertedType.expectedType || '');
  1540. valid = assertedType.valid;
  1541. }
  1542. }
  1543. if (!valid) {
  1544. warn(
  1545. getInvalidTypeMessage(name, value, expectedTypes),
  1546. vm
  1547. );
  1548. return
  1549. }
  1550. var validator = prop.validator;
  1551. if (validator) {
  1552. if (!validator(value)) {
  1553. warn(
  1554. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1555. vm
  1556. );
  1557. }
  1558. }
  1559. }
  1560. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1561. function assertType (value, type) {
  1562. var valid;
  1563. var expectedType = getType(type);
  1564. if (simpleCheckRE.test(expectedType)) {
  1565. var t = typeof value;
  1566. valid = t === expectedType.toLowerCase();
  1567. // for primitive wrapper objects
  1568. if (!valid && t === 'object') {
  1569. valid = value instanceof type;
  1570. }
  1571. } else if (expectedType === 'Object') {
  1572. valid = isPlainObject(value);
  1573. } else if (expectedType === 'Array') {
  1574. valid = Array.isArray(value);
  1575. } else {
  1576. valid = value instanceof type;
  1577. }
  1578. return {
  1579. valid: valid,
  1580. expectedType: expectedType
  1581. }
  1582. }
  1583. /**
  1584. * Use function string name to check built-in types,
  1585. * because a simple equality check will fail when running
  1586. * across different vms / iframes.
  1587. */
  1588. function getType (fn) {
  1589. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1590. return match ? match[1] : ''
  1591. }
  1592. function isSameType (a, b) {
  1593. return getType(a) === getType(b)
  1594. }
  1595. function getTypeIndex (type, expectedTypes) {
  1596. if (!Array.isArray(expectedTypes)) {
  1597. return isSameType(expectedTypes, type) ? 0 : -1
  1598. }
  1599. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1600. if (isSameType(expectedTypes[i], type)) {
  1601. return i
  1602. }
  1603. }
  1604. return -1
  1605. }
  1606. function getInvalidTypeMessage (name, value, expectedTypes) {
  1607. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1608. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1609. var expectedType = expectedTypes[0];
  1610. var receivedType = toRawType(value);
  1611. var expectedValue = styleValue(value, expectedType);
  1612. var receivedValue = styleValue(value, receivedType);
  1613. // check if we need to specify expected value
  1614. if (expectedTypes.length === 1 &&
  1615. isExplicable(expectedType) &&
  1616. !isBoolean(expectedType, receivedType)) {
  1617. message += " with value " + expectedValue;
  1618. }
  1619. message += ", got " + receivedType + " ";
  1620. // check if we need to specify received value
  1621. if (isExplicable(receivedType)) {
  1622. message += "with value " + receivedValue + ".";
  1623. }
  1624. return message
  1625. }
  1626. function styleValue (value, type) {
  1627. if (type === 'String') {
  1628. return ("\"" + value + "\"")
  1629. } else if (type === 'Number') {
  1630. return ("" + (Number(value)))
  1631. } else {
  1632. return ("" + value)
  1633. }
  1634. }
  1635. function isExplicable (value) {
  1636. var explicitTypes = ['string', 'number', 'boolean'];
  1637. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1638. }
  1639. function isBoolean () {
  1640. var args = [], len = arguments.length;
  1641. while ( len-- ) args[ len ] = arguments[ len ];
  1642. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1643. }
  1644. /* */
  1645. function handleError (err, vm, info) {
  1646. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1647. // See: https://github.com/vuejs/vuex/issues/1505
  1648. pushTarget();
  1649. try {
  1650. if (vm) {
  1651. var cur = vm;
  1652. while ((cur = cur.$parent)) {
  1653. var hooks = cur.$options.errorCaptured;
  1654. if (hooks) {
  1655. for (var i = 0; i < hooks.length; i++) {
  1656. try {
  1657. var capture = hooks[i].call(cur, err, vm, info) === false;
  1658. if (capture) { return }
  1659. } catch (e) {
  1660. globalHandleError(e, cur, 'errorCaptured hook');
  1661. }
  1662. }
  1663. }
  1664. }
  1665. }
  1666. globalHandleError(err, vm, info);
  1667. } finally {
  1668. popTarget();
  1669. }
  1670. }
  1671. function invokeWithErrorHandling (
  1672. handler,
  1673. context,
  1674. args,
  1675. vm,
  1676. info
  1677. ) {
  1678. var res;
  1679. try {
  1680. res = args ? handler.apply(context, args) : handler.call(context);
  1681. if (res && !res._isVue && isPromise(res)) {
  1682. // issue #9511
  1683. // reassign to res to avoid catch triggering multiple times when nested calls
  1684. res = res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1685. }
  1686. } catch (e) {
  1687. handleError(e, vm, info);
  1688. }
  1689. return res
  1690. }
  1691. function globalHandleError (err, vm, info) {
  1692. if (config.errorHandler) {
  1693. try {
  1694. return config.errorHandler.call(null, err, vm, info)
  1695. } catch (e) {
  1696. // if the user intentionally throws the original error in the handler,
  1697. // do not log it twice
  1698. if (e !== err) {
  1699. logError(e, null, 'config.errorHandler');
  1700. }
  1701. }
  1702. }
  1703. logError(err, vm, info);
  1704. }
  1705. function logError (err, vm, info) {
  1706. {
  1707. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1708. }
  1709. /* istanbul ignore else */
  1710. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1711. console.error(err);
  1712. } else {
  1713. throw err
  1714. }
  1715. }
  1716. /* */
  1717. var isUsingMicroTask = false;
  1718. var callbacks = [];
  1719. var pending = false;
  1720. function flushCallbacks () {
  1721. pending = false;
  1722. var copies = callbacks.slice(0);
  1723. callbacks.length = 0;
  1724. for (var i = 0; i < copies.length; i++) {
  1725. copies[i]();
  1726. }
  1727. }
  1728. // Here we have async deferring wrappers using microtasks.
  1729. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1730. // However, it has subtle problems when state is changed right before repaint
  1731. // (e.g. #6813, out-in transitions).
  1732. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1733. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1734. // So we now use microtasks everywhere, again.
  1735. // A major drawback of this tradeoff is that there are some scenarios
  1736. // where microtasks have too high a priority and fire in between supposedly
  1737. // sequential events (e.g. #4521, #6690, which have workarounds)
  1738. // or even between bubbling of the same event (#6566).
  1739. var timerFunc;
  1740. // The nextTick behavior leverages the microtask queue, which can be accessed
  1741. // via either native Promise.then or MutationObserver.
  1742. // MutationObserver has wider support, however it is seriously bugged in
  1743. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1744. // completely stops working after triggering a few times... so, if native
  1745. // Promise is available, we will use it:
  1746. /* istanbul ignore next, $flow-disable-line */
  1747. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1748. var p = Promise.resolve();
  1749. timerFunc = function () {
  1750. p.then(flushCallbacks);
  1751. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1752. // it can get stuck in a weird state where callbacks are pushed into the
  1753. // microtask queue but the queue isn't being flushed, until the browser
  1754. // needs to do some other work, e.g. handle a timer. Therefore we can
  1755. // "force" the microtask queue to be flushed by adding an empty timer.
  1756. if (isIOS) { setTimeout(noop); }
  1757. };
  1758. isUsingMicroTask = true;
  1759. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1760. isNative(MutationObserver) ||
  1761. // PhantomJS and iOS 7.x
  1762. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1763. )) {
  1764. // Use MutationObserver where native Promise is not available,
  1765. // e.g. PhantomJS, iOS7, Android 4.4
  1766. // (#6466 MutationObserver is unreliable in IE11)
  1767. var counter = 1;
  1768. var observer = new MutationObserver(flushCallbacks);
  1769. var textNode = document.createTextNode(String(counter));
  1770. observer.observe(textNode, {
  1771. characterData: true
  1772. });
  1773. timerFunc = function () {
  1774. counter = (counter + 1) % 2;
  1775. textNode.data = String(counter);
  1776. };
  1777. isUsingMicroTask = true;
  1778. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1779. // Fallback to setImmediate.
  1780. // Techinically it leverages the (macro) task queue,
  1781. // but it is still a better choice than setTimeout.
  1782. timerFunc = function () {
  1783. setImmediate(flushCallbacks);
  1784. };
  1785. } else {
  1786. // Fallback to setTimeout.
  1787. timerFunc = function () {
  1788. setTimeout(flushCallbacks, 0);
  1789. };
  1790. }
  1791. function nextTick (cb, ctx) {
  1792. var _resolve;
  1793. callbacks.push(function () {
  1794. if (cb) {
  1795. try {
  1796. cb.call(ctx);
  1797. } catch (e) {
  1798. handleError(e, ctx, 'nextTick');
  1799. }
  1800. } else if (_resolve) {
  1801. _resolve(ctx);
  1802. }
  1803. });
  1804. if (!pending) {
  1805. pending = true;
  1806. timerFunc();
  1807. }
  1808. // $flow-disable-line
  1809. if (!cb && typeof Promise !== 'undefined') {
  1810. return new Promise(function (resolve) {
  1811. _resolve = resolve;
  1812. })
  1813. }
  1814. }
  1815. /* */
  1816. var mark;
  1817. var measure;
  1818. {
  1819. var perf = inBrowser && window.performance;
  1820. /* istanbul ignore if */
  1821. if (
  1822. perf &&
  1823. perf.mark &&
  1824. perf.measure &&
  1825. perf.clearMarks &&
  1826. perf.clearMeasures
  1827. ) {
  1828. mark = function (tag) { return perf.mark(tag); };
  1829. measure = function (name, startTag, endTag) {
  1830. perf.measure(name, startTag, endTag);
  1831. perf.clearMarks(startTag);
  1832. perf.clearMarks(endTag);
  1833. // perf.clearMeasures(name)
  1834. };
  1835. }
  1836. }
  1837. /* not type checking this file because flow doesn't play well with Proxy */
  1838. var initProxy;
  1839. {
  1840. var allowedGlobals = makeMap(
  1841. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1842. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1843. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1844. 'require' // for Webpack/Browserify
  1845. );
  1846. var warnNonPresent = function (target, key) {
  1847. warn(
  1848. "Property or method \"" + key + "\" is not defined on the instance but " +
  1849. 'referenced during render. Make sure that this property is reactive, ' +
  1850. 'either in the data option, or for class-based components, by ' +
  1851. 'initializing the property. ' +
  1852. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1853. target
  1854. );
  1855. };
  1856. var warnReservedPrefix = function (target, key) {
  1857. warn(
  1858. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1859. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1860. 'prevent conflicts with Vue internals' +
  1861. 'See: https://vuejs.org/v2/api/#data',
  1862. target
  1863. );
  1864. };
  1865. var hasProxy =
  1866. typeof Proxy !== 'undefined' && isNative(Proxy);
  1867. if (hasProxy) {
  1868. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1869. config.keyCodes = new Proxy(config.keyCodes, {
  1870. set: function set (target, key, value) {
  1871. if (isBuiltInModifier(key)) {
  1872. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1873. return false
  1874. } else {
  1875. target[key] = value;
  1876. return true
  1877. }
  1878. }
  1879. });
  1880. }
  1881. var hasHandler = {
  1882. has: function has (target, key) {
  1883. var has = key in target;
  1884. var isAllowed = allowedGlobals(key) ||
  1885. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1886. if (!has && !isAllowed) {
  1887. if (key in target.$data) { warnReservedPrefix(target, key); }
  1888. else { warnNonPresent(target, key); }
  1889. }
  1890. return has || !isAllowed
  1891. }
  1892. };
  1893. var getHandler = {
  1894. get: function get (target, key) {
  1895. if (typeof key === 'string' && !(key in target)) {
  1896. if (key in target.$data) { warnReservedPrefix(target, key); }
  1897. else { warnNonPresent(target, key); }
  1898. }
  1899. return target[key]
  1900. }
  1901. };
  1902. initProxy = function initProxy (vm) {
  1903. if (hasProxy) {
  1904. // determine which proxy handler to use
  1905. var options = vm.$options;
  1906. var handlers = options.render && options.render._withStripped
  1907. ? getHandler
  1908. : hasHandler;
  1909. vm._renderProxy = new Proxy(vm, handlers);
  1910. } else {
  1911. vm._renderProxy = vm;
  1912. }
  1913. };
  1914. }
  1915. /* */
  1916. var seenObjects = new _Set();
  1917. /**
  1918. * Recursively traverse an object to evoke all converted
  1919. * getters, so that every nested property inside the object
  1920. * is collected as a "deep" dependency.
  1921. */
  1922. function traverse (val) {
  1923. _traverse(val, seenObjects);
  1924. seenObjects.clear();
  1925. }
  1926. function _traverse (val, seen) {
  1927. var i, keys;
  1928. var isA = Array.isArray(val);
  1929. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1930. return
  1931. }
  1932. if (val.__ob__) {
  1933. var depId = val.__ob__.dep.id;
  1934. if (seen.has(depId)) {
  1935. return
  1936. }
  1937. seen.add(depId);
  1938. }
  1939. if (isA) {
  1940. i = val.length;
  1941. while (i--) { _traverse(val[i], seen); }
  1942. } else {
  1943. keys = Object.keys(val);
  1944. i = keys.length;
  1945. while (i--) { _traverse(val[keys[i]], seen); }
  1946. }
  1947. }
  1948. /* */
  1949. var normalizeEvent = cached(function (name) {
  1950. var passive = name.charAt(0) === '&';
  1951. name = passive ? name.slice(1) : name;
  1952. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1953. name = once$$1 ? name.slice(1) : name;
  1954. var capture = name.charAt(0) === '!';
  1955. name = capture ? name.slice(1) : name;
  1956. return {
  1957. name: name,
  1958. once: once$$1,
  1959. capture: capture,
  1960. passive: passive
  1961. }
  1962. });
  1963. function createFnInvoker (fns, vm) {
  1964. function invoker () {
  1965. var arguments$1 = arguments;
  1966. var fns = invoker.fns;
  1967. if (Array.isArray(fns)) {
  1968. var cloned = fns.slice();
  1969. for (var i = 0; i < cloned.length; i++) {
  1970. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1971. }
  1972. } else {
  1973. // return handler return value for single handlers
  1974. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1975. }
  1976. }
  1977. invoker.fns = fns;
  1978. return invoker
  1979. }
  1980. function updateListeners (
  1981. on,
  1982. oldOn,
  1983. add,
  1984. remove$$1,
  1985. createOnceHandler,
  1986. vm
  1987. ) {
  1988. var name, def$$1, cur, old, event;
  1989. for (name in on) {
  1990. def$$1 = cur = on[name];
  1991. old = oldOn[name];
  1992. event = normalizeEvent(name);
  1993. if (isUndef(cur)) {
  1994. warn(
  1995. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1996. vm
  1997. );
  1998. } else if (isUndef(old)) {
  1999. if (isUndef(cur.fns)) {
  2000. cur = on[name] = createFnInvoker(cur, vm);
  2001. }
  2002. if (isTrue(event.once)) {
  2003. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  2004. }
  2005. add(event.name, cur, event.capture, event.passive, event.params);
  2006. } else if (cur !== old) {
  2007. old.fns = cur;
  2008. on[name] = old;
  2009. }
  2010. }
  2011. for (name in oldOn) {
  2012. if (isUndef(on[name])) {
  2013. event = normalizeEvent(name);
  2014. remove$$1(event.name, oldOn[name], event.capture);
  2015. }
  2016. }
  2017. }
  2018. /* */
  2019. function mergeVNodeHook (def, hookKey, hook) {
  2020. if (def instanceof VNode) {
  2021. def = def.data.hook || (def.data.hook = {});
  2022. }
  2023. var invoker;
  2024. var oldHook = def[hookKey];
  2025. function wrappedHook () {
  2026. hook.apply(this, arguments);
  2027. // important: remove merged hook to ensure it's called only once
  2028. // and prevent memory leak
  2029. remove(invoker.fns, wrappedHook);
  2030. }
  2031. if (isUndef(oldHook)) {
  2032. // no existing hook
  2033. invoker = createFnInvoker([wrappedHook]);
  2034. } else {
  2035. /* istanbul ignore if */
  2036. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2037. // already a merged invoker
  2038. invoker = oldHook;
  2039. invoker.fns.push(wrappedHook);
  2040. } else {
  2041. // existing plain hook
  2042. invoker = createFnInvoker([oldHook, wrappedHook]);
  2043. }
  2044. }
  2045. invoker.merged = true;
  2046. def[hookKey] = invoker;
  2047. }
  2048. /* */
  2049. function extractPropsFromVNodeData (
  2050. data,
  2051. Ctor,
  2052. tag
  2053. ) {
  2054. // we are only extracting raw values here.
  2055. // validation and default values are handled in the child
  2056. // component itself.
  2057. var propOptions = Ctor.options.props;
  2058. if (isUndef(propOptions)) {
  2059. return
  2060. }
  2061. var res = {};
  2062. var attrs = data.attrs;
  2063. var props = data.props;
  2064. if (isDef(attrs) || isDef(props)) {
  2065. for (var key in propOptions) {
  2066. var altKey = hyphenate(key);
  2067. {
  2068. var keyInLowerCase = key.toLowerCase();
  2069. if (
  2070. key !== keyInLowerCase &&
  2071. attrs && hasOwn(attrs, keyInLowerCase)
  2072. ) {
  2073. tip(
  2074. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2075. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2076. " \"" + key + "\". " +
  2077. "Note that HTML attributes are case-insensitive and camelCased " +
  2078. "props need to use their kebab-case equivalents when using in-DOM " +
  2079. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2080. );
  2081. }
  2082. }
  2083. checkProp(res, props, key, altKey, true) ||
  2084. checkProp(res, attrs, key, altKey, false);
  2085. }
  2086. }
  2087. return res
  2088. }
  2089. function checkProp (
  2090. res,
  2091. hash,
  2092. key,
  2093. altKey,
  2094. preserve
  2095. ) {
  2096. if (isDef(hash)) {
  2097. if (hasOwn(hash, key)) {
  2098. res[key] = hash[key];
  2099. if (!preserve) {
  2100. delete hash[key];
  2101. }
  2102. return true
  2103. } else if (hasOwn(hash, altKey)) {
  2104. res[key] = hash[altKey];
  2105. if (!preserve) {
  2106. delete hash[altKey];
  2107. }
  2108. return true
  2109. }
  2110. }
  2111. return false
  2112. }
  2113. /* */
  2114. // The template compiler attempts to minimize the need for normalization by
  2115. // statically analyzing the template at compile time.
  2116. //
  2117. // For plain HTML markup, normalization can be completely skipped because the
  2118. // generated render function is guaranteed to return Array<VNode>. There are
  2119. // two cases where extra normalization is needed:
  2120. // 1. When the children contains components - because a functional component
  2121. // may return an Array instead of a single root. In this case, just a simple
  2122. // normalization is needed - if any child is an Array, we flatten the whole
  2123. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2124. // because functional components already normalize their own children.
  2125. function simpleNormalizeChildren (children) {
  2126. for (var i = 0; i < children.length; i++) {
  2127. if (Array.isArray(children[i])) {
  2128. return Array.prototype.concat.apply([], children)
  2129. }
  2130. }
  2131. return children
  2132. }
  2133. // 2. When the children contains constructs that always generated nested Arrays,
  2134. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2135. // with hand-written render functions / JSX. In such cases a full normalization
  2136. // is needed to cater to all possible types of children values.
  2137. function normalizeChildren (children) {
  2138. return isPrimitive(children)
  2139. ? [createTextVNode(children)]
  2140. : Array.isArray(children)
  2141. ? normalizeArrayChildren(children)
  2142. : undefined
  2143. }
  2144. function isTextNode (node) {
  2145. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2146. }
  2147. function normalizeArrayChildren (children, nestedIndex) {
  2148. var res = [];
  2149. var i, c, lastIndex, last;
  2150. for (i = 0; i < children.length; i++) {
  2151. c = children[i];
  2152. if (isUndef(c) || typeof c === 'boolean') { continue }
  2153. lastIndex = res.length - 1;
  2154. last = res[lastIndex];
  2155. // nested
  2156. if (Array.isArray(c)) {
  2157. if (c.length > 0) {
  2158. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2159. // merge adjacent text nodes
  2160. if (isTextNode(c[0]) && isTextNode(last)) {
  2161. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2162. c.shift();
  2163. }
  2164. res.push.apply(res, c);
  2165. }
  2166. } else if (isPrimitive(c)) {
  2167. if (isTextNode(last)) {
  2168. // merge adjacent text nodes
  2169. // this is necessary for SSR hydration because text nodes are
  2170. // essentially merged when rendered to HTML strings
  2171. res[lastIndex] = createTextVNode(last.text + c);
  2172. } else if (c !== '') {
  2173. // convert primitive to vnode
  2174. res.push(createTextVNode(c));
  2175. }
  2176. } else {
  2177. if (isTextNode(c) && isTextNode(last)) {
  2178. // merge adjacent text nodes
  2179. res[lastIndex] = createTextVNode(last.text + c.text);
  2180. } else {
  2181. // default key for nested array children (likely generated by v-for)
  2182. if (isTrue(children._isVList) &&
  2183. isDef(c.tag) &&
  2184. isUndef(c.key) &&
  2185. isDef(nestedIndex)) {
  2186. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2187. }
  2188. res.push(c);
  2189. }
  2190. }
  2191. }
  2192. return res
  2193. }
  2194. /* */
  2195. function initProvide (vm) {
  2196. var provide = vm.$options.provide;
  2197. if (provide) {
  2198. vm._provided = typeof provide === 'function'
  2199. ? provide.call(vm)
  2200. : provide;
  2201. }
  2202. }
  2203. function initInjections (vm) {
  2204. var result = resolveInject(vm.$options.inject, vm);
  2205. if (result) {
  2206. toggleObserving(false);
  2207. Object.keys(result).forEach(function (key) {
  2208. /* istanbul ignore else */
  2209. {
  2210. defineReactive$$1(vm, key, result[key], function () {
  2211. warn(
  2212. "Avoid mutating an injected value directly since the changes will be " +
  2213. "overwritten whenever the provided component re-renders. " +
  2214. "injection being mutated: \"" + key + "\"",
  2215. vm
  2216. );
  2217. });
  2218. }
  2219. });
  2220. toggleObserving(true);
  2221. }
  2222. }
  2223. function resolveInject (inject, vm) {
  2224. if (inject) {
  2225. // inject is :any because flow is not smart enough to figure out cached
  2226. var result = Object.create(null);
  2227. var keys = hasSymbol
  2228. ? Reflect.ownKeys(inject)
  2229. : Object.keys(inject);
  2230. for (var i = 0; i < keys.length; i++) {
  2231. var key = keys[i];
  2232. // #6574 in case the inject object is observed...
  2233. if (key === '__ob__') { continue }
  2234. var provideKey = inject[key].from;
  2235. var source = vm;
  2236. while (source) {
  2237. if (source._provided && hasOwn(source._provided, provideKey)) {
  2238. result[key] = source._provided[provideKey];
  2239. break
  2240. }
  2241. source = source.$parent;
  2242. }
  2243. if (!source) {
  2244. if ('default' in inject[key]) {
  2245. var provideDefault = inject[key].default;
  2246. result[key] = typeof provideDefault === 'function'
  2247. ? provideDefault.call(vm)
  2248. : provideDefault;
  2249. } else {
  2250. warn(("Injection \"" + key + "\" not found"), vm);
  2251. }
  2252. }
  2253. }
  2254. return result
  2255. }
  2256. }
  2257. /* */
  2258. /**
  2259. * Runtime helper for resolving raw children VNodes into a slot object.
  2260. */
  2261. function resolveSlots (
  2262. children,
  2263. context
  2264. ) {
  2265. if (!children || !children.length) {
  2266. return {}
  2267. }
  2268. var slots = {};
  2269. for (var i = 0, l = children.length; i < l; i++) {
  2270. var child = children[i];
  2271. var data = child.data;
  2272. // remove slot attribute if the node is resolved as a Vue slot node
  2273. if (data && data.attrs && data.attrs.slot) {
  2274. delete data.attrs.slot;
  2275. }
  2276. // named slots should only be respected if the vnode was rendered in the
  2277. // same context.
  2278. if ((child.context === context || child.fnContext === context) &&
  2279. data && data.slot != null
  2280. ) {
  2281. var name = data.slot;
  2282. var slot = (slots[name] || (slots[name] = []));
  2283. if (child.tag === 'template') {
  2284. slot.push.apply(slot, child.children || []);
  2285. } else {
  2286. slot.push(child);
  2287. }
  2288. } else {
  2289. (slots.default || (slots.default = [])).push(child);
  2290. }
  2291. }
  2292. // ignore slots that contains only whitespace
  2293. for (var name$1 in slots) {
  2294. if (slots[name$1].every(isWhitespace)) {
  2295. delete slots[name$1];
  2296. }
  2297. }
  2298. return slots
  2299. }
  2300. function isWhitespace (node) {
  2301. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2302. }
  2303. /* */
  2304. function normalizeScopedSlots (
  2305. slots,
  2306. normalSlots,
  2307. prevSlots
  2308. ) {
  2309. var res;
  2310. var isStable = slots ? !!slots.$stable : true;
  2311. var key = slots && slots.$key;
  2312. if (!slots) {
  2313. res = {};
  2314. } else if (slots._normalized) {
  2315. // fast path 1: child component re-render only, parent did not change
  2316. return slots._normalized
  2317. } else if (
  2318. isStable &&
  2319. prevSlots &&
  2320. prevSlots !== emptyObject &&
  2321. key === prevSlots.$key &&
  2322. Object.keys(normalSlots).length === 0
  2323. ) {
  2324. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2325. // only need to normalize once
  2326. return prevSlots
  2327. } else {
  2328. res = {};
  2329. for (var key$1 in slots) {
  2330. if (slots[key$1] && key$1[0] !== '$') {
  2331. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2332. }
  2333. }
  2334. }
  2335. // expose normal slots on scopedSlots
  2336. for (var key$2 in normalSlots) {
  2337. if (!(key$2 in res)) {
  2338. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2339. }
  2340. }
  2341. // avoriaz seems to mock a non-extensible $scopedSlots object
  2342. // and when that is passed down this would cause an error
  2343. if (slots && Object.isExtensible(slots)) {
  2344. (slots)._normalized = res;
  2345. }
  2346. def(res, '$stable', isStable);
  2347. def(res, '$key', key);
  2348. return res
  2349. }
  2350. function normalizeScopedSlot(normalSlots, key, fn) {
  2351. var normalized = function () {
  2352. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2353. res = res && typeof res === 'object' && !Array.isArray(res)
  2354. ? [res] // single vnode
  2355. : normalizeChildren(res);
  2356. return res && res.length === 0
  2357. ? undefined
  2358. : res
  2359. };
  2360. // this is a slot using the new v-slot syntax without scope. although it is
  2361. // compiled as a scoped slot, render fn users would expect it to be present
  2362. // on this.$slots because the usage is semantically a normal slot.
  2363. if (fn.proxy) {
  2364. Object.defineProperty(normalSlots, key, {
  2365. get: normalized,
  2366. enumerable: true,
  2367. configurable: true
  2368. });
  2369. }
  2370. return normalized
  2371. }
  2372. function proxyNormalSlot(slots, key) {
  2373. return function () { return slots[key]; }
  2374. }
  2375. /* */
  2376. /**
  2377. * Runtime helper for rendering v-for lists.
  2378. */
  2379. function renderList (
  2380. val,
  2381. render
  2382. ) {
  2383. var ret, i, l, keys, key;
  2384. if (Array.isArray(val) || typeof val === 'string') {
  2385. ret = new Array(val.length);
  2386. for (i = 0, l = val.length; i < l; i++) {
  2387. ret[i] = render(val[i], i);
  2388. }
  2389. } else if (typeof val === 'number') {
  2390. ret = new Array(val);
  2391. for (i = 0; i < val; i++) {
  2392. ret[i] = render(i + 1, i);
  2393. }
  2394. } else if (isObject(val)) {
  2395. if (hasSymbol && val[Symbol.iterator]) {
  2396. ret = [];
  2397. var iterator = val[Symbol.iterator]();
  2398. var result = iterator.next();
  2399. while (!result.done) {
  2400. ret.push(render(result.value, ret.length));
  2401. result = iterator.next();
  2402. }
  2403. } else {
  2404. keys = Object.keys(val);
  2405. ret = new Array(keys.length);
  2406. for (i = 0, l = keys.length; i < l; i++) {
  2407. key = keys[i];
  2408. ret[i] = render(val[key], key, i);
  2409. }
  2410. }
  2411. }
  2412. if (!isDef(ret)) {
  2413. ret = [];
  2414. }
  2415. (ret)._isVList = true;
  2416. return ret
  2417. }
  2418. /* */
  2419. /**
  2420. * Runtime helper for rendering <slot>
  2421. */
  2422. function renderSlot (
  2423. name,
  2424. fallback,
  2425. props,
  2426. bindObject
  2427. ) {
  2428. var scopedSlotFn = this.$scopedSlots[name];
  2429. var nodes;
  2430. if (scopedSlotFn) { // scoped slot
  2431. props = props || {};
  2432. if (bindObject) {
  2433. if (!isObject(bindObject)) {
  2434. warn(
  2435. 'slot v-bind without argument expects an Object',
  2436. this
  2437. );
  2438. }
  2439. props = extend(extend({}, bindObject), props);
  2440. }
  2441. nodes = scopedSlotFn(props) || fallback;
  2442. } else {
  2443. nodes = this.$slots[name] || fallback;
  2444. }
  2445. var target = props && props.slot;
  2446. if (target) {
  2447. return this.$createElement('template', { slot: target }, nodes)
  2448. } else {
  2449. return nodes
  2450. }
  2451. }
  2452. /* */
  2453. /**
  2454. * Runtime helper for resolving filters
  2455. */
  2456. function resolveFilter (id) {
  2457. return resolveAsset(this.$options, 'filters', id, true) || identity
  2458. }
  2459. /* */
  2460. function isKeyNotMatch (expect, actual) {
  2461. if (Array.isArray(expect)) {
  2462. return expect.indexOf(actual) === -1
  2463. } else {
  2464. return expect !== actual
  2465. }
  2466. }
  2467. /**
  2468. * Runtime helper for checking keyCodes from config.
  2469. * exposed as Vue.prototype._k
  2470. * passing in eventKeyName as last argument separately for backwards compat
  2471. */
  2472. function checkKeyCodes (
  2473. eventKeyCode,
  2474. key,
  2475. builtInKeyCode,
  2476. eventKeyName,
  2477. builtInKeyName
  2478. ) {
  2479. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2480. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2481. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2482. } else if (mappedKeyCode) {
  2483. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2484. } else if (eventKeyName) {
  2485. return hyphenate(eventKeyName) !== key
  2486. }
  2487. }
  2488. /* */
  2489. /**
  2490. * Runtime helper for merging v-bind="object" into a VNode's data.
  2491. */
  2492. function bindObjectProps (
  2493. data,
  2494. tag,
  2495. value,
  2496. asProp,
  2497. isSync
  2498. ) {
  2499. if (value) {
  2500. if (!isObject(value)) {
  2501. warn(
  2502. 'v-bind without argument expects an Object or Array value',
  2503. this
  2504. );
  2505. } else {
  2506. if (Array.isArray(value)) {
  2507. value = toObject(value);
  2508. }
  2509. var hash;
  2510. var loop = function ( key ) {
  2511. if (
  2512. key === 'class' ||
  2513. key === 'style' ||
  2514. isReservedAttribute(key)
  2515. ) {
  2516. hash = data;
  2517. } else {
  2518. var type = data.attrs && data.attrs.type;
  2519. hash = asProp || config.mustUseProp(tag, type, key)
  2520. ? data.domProps || (data.domProps = {})
  2521. : data.attrs || (data.attrs = {});
  2522. }
  2523. var camelizedKey = camelize(key);
  2524. if (!(key in hash) && !(camelizedKey in hash)) {
  2525. hash[key] = value[key];
  2526. if (isSync) {
  2527. var on = data.on || (data.on = {});
  2528. on[("update:" + camelizedKey)] = function ($event) {
  2529. value[key] = $event;
  2530. };
  2531. }
  2532. }
  2533. };
  2534. for (var key in value) loop( key );
  2535. }
  2536. }
  2537. return data
  2538. }
  2539. /* */
  2540. /**
  2541. * Runtime helper for rendering static trees.
  2542. */
  2543. function renderStatic (
  2544. index,
  2545. isInFor
  2546. ) {
  2547. var cached = this._staticTrees || (this._staticTrees = []);
  2548. var tree = cached[index];
  2549. // if has already-rendered static tree and not inside v-for,
  2550. // we can reuse the same tree.
  2551. if (tree && !isInFor) {
  2552. return tree
  2553. }
  2554. // otherwise, render a fresh tree.
  2555. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2556. this._renderProxy,
  2557. null,
  2558. this // for render fns generated for functional component templates
  2559. );
  2560. markStatic(tree, ("__static__" + index), false);
  2561. return tree
  2562. }
  2563. /**
  2564. * Runtime helper for v-once.
  2565. * Effectively it means marking the node as static with a unique key.
  2566. */
  2567. function markOnce (
  2568. tree,
  2569. index,
  2570. key
  2571. ) {
  2572. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2573. return tree
  2574. }
  2575. function markStatic (
  2576. tree,
  2577. key,
  2578. isOnce
  2579. ) {
  2580. if (Array.isArray(tree)) {
  2581. for (var i = 0; i < tree.length; i++) {
  2582. if (tree[i] && typeof tree[i] !== 'string') {
  2583. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2584. }
  2585. }
  2586. } else {
  2587. markStaticNode(tree, key, isOnce);
  2588. }
  2589. }
  2590. function markStaticNode (node, key, isOnce) {
  2591. node.isStatic = true;
  2592. node.key = key;
  2593. node.isOnce = isOnce;
  2594. }
  2595. /* */
  2596. function bindObjectListeners (data, value) {
  2597. if (value) {
  2598. if (!isPlainObject(value)) {
  2599. warn(
  2600. 'v-on without argument expects an Object value',
  2601. this
  2602. );
  2603. } else {
  2604. var on = data.on = data.on ? extend({}, data.on) : {};
  2605. for (var key in value) {
  2606. var existing = on[key];
  2607. var ours = value[key];
  2608. on[key] = existing ? [].concat(existing, ours) : ours;
  2609. }
  2610. }
  2611. }
  2612. return data
  2613. }
  2614. /* */
  2615. function resolveScopedSlots (
  2616. fns, // see flow/vnode
  2617. res,
  2618. // the following are added in 2.6
  2619. hasDynamicKeys,
  2620. contentHashKey
  2621. ) {
  2622. res = res || { $stable: !hasDynamicKeys };
  2623. for (var i = 0; i < fns.length; i++) {
  2624. var slot = fns[i];
  2625. if (Array.isArray(slot)) {
  2626. resolveScopedSlots(slot, res, hasDynamicKeys);
  2627. } else if (slot) {
  2628. // marker for reverse proxying v-slot without scope on this.$slots
  2629. if (slot.proxy) {
  2630. slot.fn.proxy = true;
  2631. }
  2632. res[slot.key] = slot.fn;
  2633. }
  2634. }
  2635. if (contentHashKey) {
  2636. (res).$key = contentHashKey;
  2637. }
  2638. return res
  2639. }
  2640. /* */
  2641. function bindDynamicKeys (baseObj, values) {
  2642. for (var i = 0; i < values.length; i += 2) {
  2643. var key = values[i];
  2644. if (typeof key === 'string' && key) {
  2645. baseObj[values[i]] = values[i + 1];
  2646. } else if (key !== '' && key !== null) {
  2647. // null is a speical value for explicitly removing a binding
  2648. warn(
  2649. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2650. this
  2651. );
  2652. }
  2653. }
  2654. return baseObj
  2655. }
  2656. // helper to dynamically append modifier runtime markers to event names.
  2657. // ensure only append when value is already string, otherwise it will be cast
  2658. // to string and cause the type check to miss.
  2659. function prependModifier (value, symbol) {
  2660. return typeof value === 'string' ? symbol + value : value
  2661. }
  2662. /* */
  2663. function installRenderHelpers (target) {
  2664. target._o = markOnce;
  2665. target._n = toNumber;
  2666. target._s = toString;
  2667. target._l = renderList;
  2668. target._t = renderSlot;
  2669. target._q = looseEqual;
  2670. target._i = looseIndexOf;
  2671. target._m = renderStatic;
  2672. target._f = resolveFilter;
  2673. target._k = checkKeyCodes;
  2674. target._b = bindObjectProps;
  2675. target._v = createTextVNode;
  2676. target._e = createEmptyVNode;
  2677. target._u = resolveScopedSlots;
  2678. target._g = bindObjectListeners;
  2679. target._d = bindDynamicKeys;
  2680. target._p = prependModifier;
  2681. }
  2682. /* */
  2683. function FunctionalRenderContext (
  2684. data,
  2685. props,
  2686. children,
  2687. parent,
  2688. Ctor
  2689. ) {
  2690. var this$1 = this;
  2691. var options = Ctor.options;
  2692. // ensure the createElement function in functional components
  2693. // gets a unique context - this is necessary for correct named slot check
  2694. var contextVm;
  2695. if (hasOwn(parent, '_uid')) {
  2696. contextVm = Object.create(parent);
  2697. // $flow-disable-line
  2698. contextVm._original = parent;
  2699. } else {
  2700. // the context vm passed in is a functional context as well.
  2701. // in this case we want to make sure we are able to get a hold to the
  2702. // real context instance.
  2703. contextVm = parent;
  2704. // $flow-disable-line
  2705. parent = parent._original;
  2706. }
  2707. var isCompiled = isTrue(options._compiled);
  2708. var needNormalization = !isCompiled;
  2709. this.data = data;
  2710. this.props = props;
  2711. this.children = children;
  2712. this.parent = parent;
  2713. this.listeners = data.on || emptyObject;
  2714. this.injections = resolveInject(options.inject, parent);
  2715. this.slots = function () {
  2716. if (!this$1.$slots) {
  2717. normalizeScopedSlots(
  2718. data.scopedSlots,
  2719. this$1.$slots = resolveSlots(children, parent)
  2720. );
  2721. }
  2722. return this$1.$slots
  2723. };
  2724. Object.defineProperty(this, 'scopedSlots', ({
  2725. enumerable: true,
  2726. get: function get () {
  2727. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2728. }
  2729. }));
  2730. // support for compiled functional template
  2731. if (isCompiled) {
  2732. // exposing $options for renderStatic()
  2733. this.$options = options;
  2734. // pre-resolve slots for renderSlot()
  2735. this.$slots = this.slots();
  2736. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2737. }
  2738. if (options._scopeId) {
  2739. this._c = function (a, b, c, d) {
  2740. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2741. if (vnode && !Array.isArray(vnode)) {
  2742. vnode.fnScopeId = options._scopeId;
  2743. vnode.fnContext = parent;
  2744. }
  2745. return vnode
  2746. };
  2747. } else {
  2748. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2749. }
  2750. }
  2751. installRenderHelpers(FunctionalRenderContext.prototype);
  2752. function createFunctionalComponent (
  2753. Ctor,
  2754. propsData,
  2755. data,
  2756. contextVm,
  2757. children
  2758. ) {
  2759. var options = Ctor.options;
  2760. var props = {};
  2761. var propOptions = options.props;
  2762. if (isDef(propOptions)) {
  2763. for (var key in propOptions) {
  2764. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2765. }
  2766. } else {
  2767. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2768. if (isDef(data.props)) { mergeProps(props, data.props); }
  2769. }
  2770. var renderContext = new FunctionalRenderContext(
  2771. data,
  2772. props,
  2773. children,
  2774. contextVm,
  2775. Ctor
  2776. );
  2777. var vnode = options.render.call(null, renderContext._c, renderContext);
  2778. if (vnode instanceof VNode) {
  2779. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2780. } else if (Array.isArray(vnode)) {
  2781. var vnodes = normalizeChildren(vnode) || [];
  2782. var res = new Array(vnodes.length);
  2783. for (var i = 0; i < vnodes.length; i++) {
  2784. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2785. }
  2786. return res
  2787. }
  2788. }
  2789. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2790. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2791. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2792. // that should not be matched to match.
  2793. var clone = cloneVNode(vnode);
  2794. clone.fnContext = contextVm;
  2795. clone.fnOptions = options;
  2796. {
  2797. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2798. }
  2799. if (data.slot) {
  2800. (clone.data || (clone.data = {})).slot = data.slot;
  2801. }
  2802. return clone
  2803. }
  2804. function mergeProps (to, from) {
  2805. for (var key in from) {
  2806. to[camelize(key)] = from[key];
  2807. }
  2808. }
  2809. /* */
  2810. /* */
  2811. /* */
  2812. /* */
  2813. // inline hooks to be invoked on component VNodes during patch
  2814. var componentVNodeHooks = {
  2815. init: function init (vnode, hydrating) {
  2816. if (
  2817. vnode.componentInstance &&
  2818. !vnode.componentInstance._isDestroyed &&
  2819. vnode.data.keepAlive
  2820. ) {
  2821. // kept-alive components, treat as a patch
  2822. var mountedNode = vnode; // work around flow
  2823. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2824. } else {
  2825. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2826. vnode,
  2827. activeInstance
  2828. );
  2829. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2830. }
  2831. },
  2832. prepatch: function prepatch (oldVnode, vnode) {
  2833. var options = vnode.componentOptions;
  2834. var child = vnode.componentInstance = oldVnode.componentInstance;
  2835. updateChildComponent(
  2836. child,
  2837. options.propsData, // updated props
  2838. options.listeners, // updated listeners
  2839. vnode, // new parent vnode
  2840. options.children // new children
  2841. );
  2842. },
  2843. insert: function insert (vnode) {
  2844. var context = vnode.context;
  2845. var componentInstance = vnode.componentInstance;
  2846. if (!componentInstance._isMounted) {
  2847. componentInstance._isMounted = true;
  2848. callHook(componentInstance, 'mounted');
  2849. }
  2850. if (vnode.data.keepAlive) {
  2851. if (context._isMounted) {
  2852. // vue-router#1212
  2853. // During updates, a kept-alive component's child components may
  2854. // change, so directly walking the tree here may call activated hooks
  2855. // on incorrect children. Instead we push them into a queue which will
  2856. // be processed after the whole patch process ended.
  2857. queueActivatedComponent(componentInstance);
  2858. } else {
  2859. activateChildComponent(componentInstance, true /* direct */);
  2860. }
  2861. }
  2862. },
  2863. destroy: function destroy (vnode) {
  2864. var componentInstance = vnode.componentInstance;
  2865. if (!componentInstance._isDestroyed) {
  2866. if (!vnode.data.keepAlive) {
  2867. componentInstance.$destroy();
  2868. } else {
  2869. deactivateChildComponent(componentInstance, true /* direct */);
  2870. }
  2871. }
  2872. }
  2873. };
  2874. var hooksToMerge = Object.keys(componentVNodeHooks);
  2875. function createComponent (
  2876. Ctor,
  2877. data,
  2878. context,
  2879. children,
  2880. tag
  2881. ) {
  2882. if (isUndef(Ctor)) {
  2883. return
  2884. }
  2885. var baseCtor = context.$options._base;
  2886. // plain options object: turn it into a constructor
  2887. if (isObject(Ctor)) {
  2888. Ctor = baseCtor.extend(Ctor);
  2889. }
  2890. // if at this stage it's not a constructor or an async component factory,
  2891. // reject.
  2892. if (typeof Ctor !== 'function') {
  2893. {
  2894. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2895. }
  2896. return
  2897. }
  2898. // async component
  2899. var asyncFactory;
  2900. if (isUndef(Ctor.cid)) {
  2901. asyncFactory = Ctor;
  2902. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2903. if (Ctor === undefined) {
  2904. // return a placeholder node for async component, which is rendered
  2905. // as a comment node but preserves all the raw information for the node.
  2906. // the information will be used for async server-rendering and hydration.
  2907. return createAsyncPlaceholder(
  2908. asyncFactory,
  2909. data,
  2910. context,
  2911. children,
  2912. tag
  2913. )
  2914. }
  2915. }
  2916. data = data || {};
  2917. // resolve constructor options in case global mixins are applied after
  2918. // component constructor creation
  2919. resolveConstructorOptions(Ctor);
  2920. // transform component v-model data into props & events
  2921. if (isDef(data.model)) {
  2922. transformModel(Ctor.options, data);
  2923. }
  2924. // extract props
  2925. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  2926. // functional component
  2927. if (isTrue(Ctor.options.functional)) {
  2928. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2929. }
  2930. // extract listeners, since these needs to be treated as
  2931. // child component listeners instead of DOM listeners
  2932. var listeners = data.on;
  2933. // replace with listeners with .native modifier
  2934. // so it gets processed during parent component patch.
  2935. data.on = data.nativeOn;
  2936. if (isTrue(Ctor.options.abstract)) {
  2937. // abstract components do not keep anything
  2938. // other than props & listeners & slot
  2939. // work around flow
  2940. var slot = data.slot;
  2941. data = {};
  2942. if (slot) {
  2943. data.slot = slot;
  2944. }
  2945. }
  2946. // install component management hooks onto the placeholder node
  2947. installComponentHooks(data);
  2948. // return a placeholder vnode
  2949. var name = Ctor.options.name || tag;
  2950. var vnode = new VNode(
  2951. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2952. data, undefined, undefined, undefined, context,
  2953. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2954. asyncFactory
  2955. );
  2956. return vnode
  2957. }
  2958. function createComponentInstanceForVnode (
  2959. vnode, // we know it's MountedComponentVNode but flow doesn't
  2960. parent // activeInstance in lifecycle state
  2961. ) {
  2962. var options = {
  2963. _isComponent: true,
  2964. _parentVnode: vnode,
  2965. parent: parent
  2966. };
  2967. // check inline-template render functions
  2968. var inlineTemplate = vnode.data.inlineTemplate;
  2969. if (isDef(inlineTemplate)) {
  2970. options.render = inlineTemplate.render;
  2971. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2972. }
  2973. return new vnode.componentOptions.Ctor(options)
  2974. }
  2975. function installComponentHooks (data) {
  2976. var hooks = data.hook || (data.hook = {});
  2977. for (var i = 0; i < hooksToMerge.length; i++) {
  2978. var key = hooksToMerge[i];
  2979. var existing = hooks[key];
  2980. var toMerge = componentVNodeHooks[key];
  2981. if (existing !== toMerge && !(existing && existing._merged)) {
  2982. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  2983. }
  2984. }
  2985. }
  2986. function mergeHook$1 (f1, f2) {
  2987. var merged = function (a, b) {
  2988. // flow complains about extra args which is why we use any
  2989. f1(a, b);
  2990. f2(a, b);
  2991. };
  2992. merged._merged = true;
  2993. return merged
  2994. }
  2995. // transform component v-model info (value and callback) into
  2996. // prop and event handler respectively.
  2997. function transformModel (options, data) {
  2998. var prop = (options.model && options.model.prop) || 'value';
  2999. var event = (options.model && options.model.event) || 'input'
  3000. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3001. var on = data.on || (data.on = {});
  3002. var existing = on[event];
  3003. var callback = data.model.callback;
  3004. if (isDef(existing)) {
  3005. if (
  3006. Array.isArray(existing)
  3007. ? existing.indexOf(callback) === -1
  3008. : existing !== callback
  3009. ) {
  3010. on[event] = [callback].concat(existing);
  3011. }
  3012. } else {
  3013. on[event] = callback;
  3014. }
  3015. }
  3016. /* */
  3017. var SIMPLE_NORMALIZE = 1;
  3018. var ALWAYS_NORMALIZE = 2;
  3019. // wrapper function for providing a more flexible interface
  3020. // without getting yelled at by flow
  3021. function createElement (
  3022. context,
  3023. tag,
  3024. data,
  3025. children,
  3026. normalizationType,
  3027. alwaysNormalize
  3028. ) {
  3029. if (Array.isArray(data) || isPrimitive(data)) {
  3030. normalizationType = children;
  3031. children = data;
  3032. data = undefined;
  3033. }
  3034. if (isTrue(alwaysNormalize)) {
  3035. normalizationType = ALWAYS_NORMALIZE;
  3036. }
  3037. return _createElement(context, tag, data, children, normalizationType)
  3038. }
  3039. function _createElement (
  3040. context,
  3041. tag,
  3042. data,
  3043. children,
  3044. normalizationType
  3045. ) {
  3046. if (isDef(data) && isDef((data).__ob__)) {
  3047. warn(
  3048. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3049. 'Always create fresh vnode data objects in each render!',
  3050. context
  3051. );
  3052. return createEmptyVNode()
  3053. }
  3054. // object syntax in v-bind
  3055. if (isDef(data) && isDef(data.is)) {
  3056. tag = data.is;
  3057. }
  3058. if (!tag) {
  3059. // in case of component :is set to falsy value
  3060. return createEmptyVNode()
  3061. }
  3062. // warn against non-primitive key
  3063. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3064. ) {
  3065. {
  3066. warn(
  3067. 'Avoid using non-primitive value as key, ' +
  3068. 'use string/number value instead.',
  3069. context
  3070. );
  3071. }
  3072. }
  3073. // support single function children as default scoped slot
  3074. if (Array.isArray(children) &&
  3075. typeof children[0] === 'function'
  3076. ) {
  3077. data = data || {};
  3078. data.scopedSlots = { default: children[0] };
  3079. children.length = 0;
  3080. }
  3081. if (normalizationType === ALWAYS_NORMALIZE) {
  3082. children = normalizeChildren(children);
  3083. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3084. children = simpleNormalizeChildren(children);
  3085. }
  3086. var vnode, ns;
  3087. if (typeof tag === 'string') {
  3088. var Ctor;
  3089. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3090. if (config.isReservedTag(tag)) {
  3091. // platform built-in elements
  3092. vnode = new VNode(
  3093. config.parsePlatformTagName(tag), data, children,
  3094. undefined, undefined, context
  3095. );
  3096. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3097. // component
  3098. vnode = createComponent(Ctor, data, context, children, tag);
  3099. } else {
  3100. // unknown or unlisted namespaced elements
  3101. // check at runtime because it may get assigned a namespace when its
  3102. // parent normalizes children
  3103. vnode = new VNode(
  3104. tag, data, children,
  3105. undefined, undefined, context
  3106. );
  3107. }
  3108. } else {
  3109. // direct component options / constructor
  3110. vnode = createComponent(tag, data, context, children);
  3111. }
  3112. if (Array.isArray(vnode)) {
  3113. return vnode
  3114. } else if (isDef(vnode)) {
  3115. if (isDef(ns)) { applyNS(vnode, ns); }
  3116. if (isDef(data)) { registerDeepBindings(data); }
  3117. return vnode
  3118. } else {
  3119. return createEmptyVNode()
  3120. }
  3121. }
  3122. function applyNS (vnode, ns, force) {
  3123. vnode.ns = ns;
  3124. if (vnode.tag === 'foreignObject') {
  3125. // use default namespace inside foreignObject
  3126. ns = undefined;
  3127. force = true;
  3128. }
  3129. if (isDef(vnode.children)) {
  3130. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3131. var child = vnode.children[i];
  3132. if (isDef(child.tag) && (
  3133. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3134. applyNS(child, ns, force);
  3135. }
  3136. }
  3137. }
  3138. }
  3139. // ref #5318
  3140. // necessary to ensure parent re-render when deep bindings like :style and
  3141. // :class are used on slot nodes
  3142. function registerDeepBindings (data) {
  3143. if (isObject(data.style)) {
  3144. traverse(data.style);
  3145. }
  3146. if (isObject(data.class)) {
  3147. traverse(data.class);
  3148. }
  3149. }
  3150. /* */
  3151. function initRender (vm) {
  3152. vm._vnode = null; // the root of the child tree
  3153. vm._staticTrees = null; // v-once cached trees
  3154. var options = vm.$options;
  3155. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3156. var renderContext = parentVnode && parentVnode.context;
  3157. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3158. vm.$scopedSlots = emptyObject;
  3159. // bind the createElement fn to this instance
  3160. // so that we get proper render context inside it.
  3161. // args order: tag, data, children, normalizationType, alwaysNormalize
  3162. // internal version is used by render functions compiled from templates
  3163. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3164. // normalization is always applied for the public version, used in
  3165. // user-written render functions.
  3166. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3167. // $attrs & $listeners are exposed for easier HOC creation.
  3168. // they need to be reactive so that HOCs using them are always updated
  3169. var parentData = parentVnode && parentVnode.data;
  3170. /* istanbul ignore else */
  3171. {
  3172. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3173. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3174. }, true);
  3175. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3176. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3177. }, true);
  3178. }
  3179. }
  3180. var currentRenderingInstance = null;
  3181. function renderMixin (Vue) {
  3182. // install runtime convenience helpers
  3183. installRenderHelpers(Vue.prototype);
  3184. Vue.prototype.$nextTick = function (fn) {
  3185. return nextTick(fn, this)
  3186. };
  3187. Vue.prototype._render = function () {
  3188. var vm = this;
  3189. var ref = vm.$options;
  3190. var render = ref.render;
  3191. var _parentVnode = ref._parentVnode;
  3192. if (_parentVnode) {
  3193. vm.$scopedSlots = normalizeScopedSlots(
  3194. _parentVnode.data.scopedSlots,
  3195. vm.$slots,
  3196. vm.$scopedSlots
  3197. );
  3198. }
  3199. // set parent vnode. this allows render functions to have access
  3200. // to the data on the placeholder node.
  3201. vm.$vnode = _parentVnode;
  3202. // render self
  3203. var vnode;
  3204. try {
  3205. // There's no need to maintain a stack becaues all render fns are called
  3206. // separately from one another. Nested component's render fns are called
  3207. // when parent component is patched.
  3208. currentRenderingInstance = vm;
  3209. vnode = render.call(vm._renderProxy, vm.$createElement);
  3210. } catch (e) {
  3211. handleError(e, vm, "render");
  3212. // return error render result,
  3213. // or previous vnode to prevent render error causing blank component
  3214. /* istanbul ignore else */
  3215. if (vm.$options.renderError) {
  3216. try {
  3217. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3218. } catch (e) {
  3219. handleError(e, vm, "renderError");
  3220. vnode = vm._vnode;
  3221. }
  3222. } else {
  3223. vnode = vm._vnode;
  3224. }
  3225. } finally {
  3226. currentRenderingInstance = null;
  3227. }
  3228. // if the returned array contains only a single node, allow it
  3229. if (Array.isArray(vnode) && vnode.length === 1) {
  3230. vnode = vnode[0];
  3231. }
  3232. // return empty vnode in case the render function errored out
  3233. if (!(vnode instanceof VNode)) {
  3234. if (Array.isArray(vnode)) {
  3235. warn(
  3236. 'Multiple root nodes returned from render function. Render function ' +
  3237. 'should return a single root node.',
  3238. vm
  3239. );
  3240. }
  3241. vnode = createEmptyVNode();
  3242. }
  3243. // set parent
  3244. vnode.parent = _parentVnode;
  3245. return vnode
  3246. };
  3247. }
  3248. /* */
  3249. function ensureCtor (comp, base) {
  3250. if (
  3251. comp.__esModule ||
  3252. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3253. ) {
  3254. comp = comp.default;
  3255. }
  3256. return isObject(comp)
  3257. ? base.extend(comp)
  3258. : comp
  3259. }
  3260. function createAsyncPlaceholder (
  3261. factory,
  3262. data,
  3263. context,
  3264. children,
  3265. tag
  3266. ) {
  3267. var node = createEmptyVNode();
  3268. node.asyncFactory = factory;
  3269. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3270. return node
  3271. }
  3272. function resolveAsyncComponent (
  3273. factory,
  3274. baseCtor
  3275. ) {
  3276. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3277. return factory.errorComp
  3278. }
  3279. if (isDef(factory.resolved)) {
  3280. return factory.resolved
  3281. }
  3282. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3283. return factory.loadingComp
  3284. }
  3285. var owner = currentRenderingInstance;
  3286. if (isDef(factory.owners)) {
  3287. // already pending
  3288. factory.owners.push(owner);
  3289. } else {
  3290. var owners = factory.owners = [owner];
  3291. var sync = true;
  3292. var forceRender = function (renderCompleted) {
  3293. for (var i = 0, l = owners.length; i < l; i++) {
  3294. (owners[i]).$forceUpdate();
  3295. }
  3296. if (renderCompleted) {
  3297. owners.length = 0;
  3298. }
  3299. };
  3300. var resolve = once(function (res) {
  3301. // cache resolved
  3302. factory.resolved = ensureCtor(res, baseCtor);
  3303. // invoke callbacks only if this is not a synchronous resolve
  3304. // (async resolves are shimmed as synchronous during SSR)
  3305. if (!sync) {
  3306. forceRender(true);
  3307. } else {
  3308. owners.length = 0;
  3309. }
  3310. });
  3311. var reject = once(function (reason) {
  3312. warn(
  3313. "Failed to resolve async component: " + (String(factory)) +
  3314. (reason ? ("\nReason: " + reason) : '')
  3315. );
  3316. if (isDef(factory.errorComp)) {
  3317. factory.error = true;
  3318. forceRender(true);
  3319. }
  3320. });
  3321. var res = factory(resolve, reject);
  3322. if (isObject(res)) {
  3323. if (isPromise(res)) {
  3324. // () => Promise
  3325. if (isUndef(factory.resolved)) {
  3326. res.then(resolve, reject);
  3327. }
  3328. } else if (isPromise(res.component)) {
  3329. res.component.then(resolve, reject);
  3330. if (isDef(res.error)) {
  3331. factory.errorComp = ensureCtor(res.error, baseCtor);
  3332. }
  3333. if (isDef(res.loading)) {
  3334. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3335. if (res.delay === 0) {
  3336. factory.loading = true;
  3337. } else {
  3338. setTimeout(function () {
  3339. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3340. factory.loading = true;
  3341. forceRender(false);
  3342. }
  3343. }, res.delay || 200);
  3344. }
  3345. }
  3346. if (isDef(res.timeout)) {
  3347. setTimeout(function () {
  3348. if (isUndef(factory.resolved)) {
  3349. reject(
  3350. "timeout (" + (res.timeout) + "ms)"
  3351. );
  3352. }
  3353. }, res.timeout);
  3354. }
  3355. }
  3356. }
  3357. sync = false;
  3358. // return in case resolved synchronously
  3359. return factory.loading
  3360. ? factory.loadingComp
  3361. : factory.resolved
  3362. }
  3363. }
  3364. /* */
  3365. function isAsyncPlaceholder (node) {
  3366. return node.isComment && node.asyncFactory
  3367. }
  3368. /* */
  3369. function getFirstComponentChild (children) {
  3370. if (Array.isArray(children)) {
  3371. for (var i = 0; i < children.length; i++) {
  3372. var c = children[i];
  3373. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3374. return c
  3375. }
  3376. }
  3377. }
  3378. }
  3379. /* */
  3380. /* */
  3381. function initEvents (vm) {
  3382. vm._events = Object.create(null);
  3383. vm._hasHookEvent = false;
  3384. // init parent attached events
  3385. var listeners = vm.$options._parentListeners;
  3386. if (listeners) {
  3387. updateComponentListeners(vm, listeners);
  3388. }
  3389. }
  3390. var target;
  3391. function add (event, fn) {
  3392. target.$on(event, fn);
  3393. }
  3394. function remove$1 (event, fn) {
  3395. target.$off(event, fn);
  3396. }
  3397. function createOnceHandler (event, fn) {
  3398. var _target = target;
  3399. return function onceHandler () {
  3400. var res = fn.apply(null, arguments);
  3401. if (res !== null) {
  3402. _target.$off(event, onceHandler);
  3403. }
  3404. }
  3405. }
  3406. function updateComponentListeners (
  3407. vm,
  3408. listeners,
  3409. oldListeners
  3410. ) {
  3411. target = vm;
  3412. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3413. target = undefined;
  3414. }
  3415. function eventsMixin (Vue) {
  3416. var hookRE = /^hook:/;
  3417. Vue.prototype.$on = function (event, fn) {
  3418. var vm = this;
  3419. if (Array.isArray(event)) {
  3420. for (var i = 0, l = event.length; i < l; i++) {
  3421. vm.$on(event[i], fn);
  3422. }
  3423. } else {
  3424. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3425. // optimize hook:event cost by using a boolean flag marked at registration
  3426. // instead of a hash lookup
  3427. if (hookRE.test(event)) {
  3428. vm._hasHookEvent = true;
  3429. }
  3430. }
  3431. return vm
  3432. };
  3433. Vue.prototype.$once = function (event, fn) {
  3434. var vm = this;
  3435. function on () {
  3436. vm.$off(event, on);
  3437. fn.apply(vm, arguments);
  3438. }
  3439. on.fn = fn;
  3440. vm.$on(event, on);
  3441. return vm
  3442. };
  3443. Vue.prototype.$off = function (event, fn) {
  3444. var vm = this;
  3445. // all
  3446. if (!arguments.length) {
  3447. vm._events = Object.create(null);
  3448. return vm
  3449. }
  3450. // array of events
  3451. if (Array.isArray(event)) {
  3452. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3453. vm.$off(event[i$1], fn);
  3454. }
  3455. return vm
  3456. }
  3457. // specific event
  3458. var cbs = vm._events[event];
  3459. if (!cbs) {
  3460. return vm
  3461. }
  3462. if (!fn) {
  3463. vm._events[event] = null;
  3464. return vm
  3465. }
  3466. // specific handler
  3467. var cb;
  3468. var i = cbs.length;
  3469. while (i--) {
  3470. cb = cbs[i];
  3471. if (cb === fn || cb.fn === fn) {
  3472. cbs.splice(i, 1);
  3473. break
  3474. }
  3475. }
  3476. return vm
  3477. };
  3478. Vue.prototype.$emit = function (event) {
  3479. var vm = this;
  3480. {
  3481. var lowerCaseEvent = event.toLowerCase();
  3482. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3483. tip(
  3484. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3485. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3486. "Note that HTML attributes are case-insensitive and you cannot use " +
  3487. "v-on to listen to camelCase events when using in-DOM templates. " +
  3488. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3489. );
  3490. }
  3491. }
  3492. var cbs = vm._events[event];
  3493. if (cbs) {
  3494. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3495. var args = toArray(arguments, 1);
  3496. var info = "event handler for \"" + event + "\"";
  3497. for (var i = 0, l = cbs.length; i < l; i++) {
  3498. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3499. }
  3500. }
  3501. return vm
  3502. };
  3503. }
  3504. /* */
  3505. var activeInstance = null;
  3506. var isUpdatingChildComponent = false;
  3507. function setActiveInstance(vm) {
  3508. var prevActiveInstance = activeInstance;
  3509. activeInstance = vm;
  3510. return function () {
  3511. activeInstance = prevActiveInstance;
  3512. }
  3513. }
  3514. function initLifecycle (vm) {
  3515. var options = vm.$options;
  3516. // locate first non-abstract parent
  3517. var parent = options.parent;
  3518. if (parent && !options.abstract) {
  3519. while (parent.$options.abstract && parent.$parent) {
  3520. parent = parent.$parent;
  3521. }
  3522. parent.$children.push(vm);
  3523. }
  3524. vm.$parent = parent;
  3525. vm.$root = parent ? parent.$root : vm;
  3526. vm.$children = [];
  3527. vm.$refs = {};
  3528. vm._watcher = null;
  3529. vm._inactive = null;
  3530. vm._directInactive = false;
  3531. vm._isMounted = false;
  3532. vm._isDestroyed = false;
  3533. vm._isBeingDestroyed = false;
  3534. }
  3535. function lifecycleMixin (Vue) {
  3536. Vue.prototype._update = function (vnode, hydrating) {
  3537. var vm = this;
  3538. var prevEl = vm.$el;
  3539. var prevVnode = vm._vnode;
  3540. var restoreActiveInstance = setActiveInstance(vm);
  3541. vm._vnode = vnode;
  3542. // Vue.prototype.__patch__ is injected in entry points
  3543. // based on the rendering backend used.
  3544. if (!prevVnode) {
  3545. // initial render
  3546. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3547. } else {
  3548. // updates
  3549. vm.$el = vm.__patch__(prevVnode, vnode);
  3550. }
  3551. restoreActiveInstance();
  3552. // update __vue__ reference
  3553. if (prevEl) {
  3554. prevEl.__vue__ = null;
  3555. }
  3556. if (vm.$el) {
  3557. vm.$el.__vue__ = vm;
  3558. }
  3559. // if parent is an HOC, update its $el as well
  3560. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3561. vm.$parent.$el = vm.$el;
  3562. }
  3563. // updated hook is called by the scheduler to ensure that children are
  3564. // updated in a parent's updated hook.
  3565. };
  3566. Vue.prototype.$forceUpdate = function () {
  3567. var vm = this;
  3568. if (vm._watcher) {
  3569. vm._watcher.update();
  3570. }
  3571. };
  3572. Vue.prototype.$destroy = function () {
  3573. var vm = this;
  3574. if (vm._isBeingDestroyed) {
  3575. return
  3576. }
  3577. callHook(vm, 'beforeDestroy');
  3578. vm._isBeingDestroyed = true;
  3579. // remove self from parent
  3580. var parent = vm.$parent;
  3581. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3582. remove(parent.$children, vm);
  3583. }
  3584. // teardown watchers
  3585. if (vm._watcher) {
  3586. vm._watcher.teardown();
  3587. }
  3588. var i = vm._watchers.length;
  3589. while (i--) {
  3590. vm._watchers[i].teardown();
  3591. }
  3592. // remove reference from data ob
  3593. // frozen object may not have observer.
  3594. if (vm._data.__ob__) {
  3595. vm._data.__ob__.vmCount--;
  3596. }
  3597. // call the last hook...
  3598. vm._isDestroyed = true;
  3599. // invoke destroy hooks on current rendered tree
  3600. vm.__patch__(vm._vnode, null);
  3601. // fire destroyed hook
  3602. callHook(vm, 'destroyed');
  3603. // turn off all instance listeners.
  3604. vm.$off();
  3605. // remove __vue__ reference
  3606. if (vm.$el) {
  3607. vm.$el.__vue__ = null;
  3608. }
  3609. // release circular reference (#6759)
  3610. if (vm.$vnode) {
  3611. vm.$vnode.parent = null;
  3612. }
  3613. };
  3614. }
  3615. function mountComponent (
  3616. vm,
  3617. el,
  3618. hydrating
  3619. ) {
  3620. vm.$el = el;
  3621. if (!vm.$options.render) {
  3622. vm.$options.render = createEmptyVNode;
  3623. {
  3624. /* istanbul ignore if */
  3625. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3626. vm.$options.el || el) {
  3627. warn(
  3628. 'You are using the runtime-only build of Vue where the template ' +
  3629. 'compiler is not available. Either pre-compile the templates into ' +
  3630. 'render functions, or use the compiler-included build.',
  3631. vm
  3632. );
  3633. } else {
  3634. warn(
  3635. 'Failed to mount component: template or render function not defined.',
  3636. vm
  3637. );
  3638. }
  3639. }
  3640. }
  3641. callHook(vm, 'beforeMount');
  3642. var updateComponent;
  3643. /* istanbul ignore if */
  3644. if (config.performance && mark) {
  3645. updateComponent = function () {
  3646. var name = vm._name;
  3647. var id = vm._uid;
  3648. var startTag = "vue-perf-start:" + id;
  3649. var endTag = "vue-perf-end:" + id;
  3650. mark(startTag);
  3651. var vnode = vm._render();
  3652. mark(endTag);
  3653. measure(("vue " + name + " render"), startTag, endTag);
  3654. mark(startTag);
  3655. vm._update(vnode, hydrating);
  3656. mark(endTag);
  3657. measure(("vue " + name + " patch"), startTag, endTag);
  3658. };
  3659. } else {
  3660. updateComponent = function () {
  3661. vm._update(vm._render(), hydrating);
  3662. };
  3663. }
  3664. // we set this to vm._watcher inside the watcher's constructor
  3665. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3666. // component's mounted hook), which relies on vm._watcher being already defined
  3667. new Watcher(vm, updateComponent, noop, {
  3668. before: function before () {
  3669. if (vm._isMounted && !vm._isDestroyed) {
  3670. callHook(vm, 'beforeUpdate');
  3671. }
  3672. }
  3673. }, true /* isRenderWatcher */);
  3674. hydrating = false;
  3675. // manually mounted instance, call mounted on self
  3676. // mounted is called for render-created child components in its inserted hook
  3677. if (vm.$vnode == null) {
  3678. vm._isMounted = true;
  3679. callHook(vm, 'mounted');
  3680. }
  3681. return vm
  3682. }
  3683. function updateChildComponent (
  3684. vm,
  3685. propsData,
  3686. listeners,
  3687. parentVnode,
  3688. renderChildren
  3689. ) {
  3690. {
  3691. isUpdatingChildComponent = true;
  3692. }
  3693. // determine whether component has slot children
  3694. // we need to do this before overwriting $options._renderChildren.
  3695. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3696. // dynamic slot names). Static scoped slots compiled from template has the
  3697. // "$stable" marker.
  3698. var newScopedSlots = parentVnode.data.scopedSlots;
  3699. var oldScopedSlots = vm.$scopedSlots;
  3700. var hasDynamicScopedSlot = !!(
  3701. (newScopedSlots && !newScopedSlots.$stable) ||
  3702. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3703. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3704. );
  3705. // Any static slot children from the parent may have changed during parent's
  3706. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3707. // update is necessary to ensure correctness.
  3708. var needsForceUpdate = !!(
  3709. renderChildren || // has new static slots
  3710. vm.$options._renderChildren || // has old static slots
  3711. hasDynamicScopedSlot
  3712. );
  3713. vm.$options._parentVnode = parentVnode;
  3714. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3715. if (vm._vnode) { // update child tree's parent
  3716. vm._vnode.parent = parentVnode;
  3717. }
  3718. vm.$options._renderChildren = renderChildren;
  3719. // update $attrs and $listeners hash
  3720. // these are also reactive so they may trigger child update if the child
  3721. // used them during render
  3722. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3723. vm.$listeners = listeners || emptyObject;
  3724. // update props
  3725. if (propsData && vm.$options.props) {
  3726. toggleObserving(false);
  3727. var props = vm._props;
  3728. var propKeys = vm.$options._propKeys || [];
  3729. for (var i = 0; i < propKeys.length; i++) {
  3730. var key = propKeys[i];
  3731. var propOptions = vm.$options.props; // wtf flow?
  3732. props[key] = validateProp(key, propOptions, propsData, vm);
  3733. }
  3734. toggleObserving(true);
  3735. // keep a copy of raw propsData
  3736. vm.$options.propsData = propsData;
  3737. }
  3738. // update listeners
  3739. listeners = listeners || emptyObject;
  3740. var oldListeners = vm.$options._parentListeners;
  3741. vm.$options._parentListeners = listeners;
  3742. updateComponentListeners(vm, listeners, oldListeners);
  3743. // resolve slots + force update if has children
  3744. if (needsForceUpdate) {
  3745. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3746. vm.$forceUpdate();
  3747. }
  3748. {
  3749. isUpdatingChildComponent = false;
  3750. }
  3751. }
  3752. function isInInactiveTree (vm) {
  3753. while (vm && (vm = vm.$parent)) {
  3754. if (vm._inactive) { return true }
  3755. }
  3756. return false
  3757. }
  3758. function activateChildComponent (vm, direct) {
  3759. if (direct) {
  3760. vm._directInactive = false;
  3761. if (isInInactiveTree(vm)) {
  3762. return
  3763. }
  3764. } else if (vm._directInactive) {
  3765. return
  3766. }
  3767. if (vm._inactive || vm._inactive === null) {
  3768. vm._inactive = false;
  3769. for (var i = 0; i < vm.$children.length; i++) {
  3770. activateChildComponent(vm.$children[i]);
  3771. }
  3772. callHook(vm, 'activated');
  3773. }
  3774. }
  3775. function deactivateChildComponent (vm, direct) {
  3776. if (direct) {
  3777. vm._directInactive = true;
  3778. if (isInInactiveTree(vm)) {
  3779. return
  3780. }
  3781. }
  3782. if (!vm._inactive) {
  3783. vm._inactive = true;
  3784. for (var i = 0; i < vm.$children.length; i++) {
  3785. deactivateChildComponent(vm.$children[i]);
  3786. }
  3787. callHook(vm, 'deactivated');
  3788. }
  3789. }
  3790. function callHook (vm, hook) {
  3791. // #7573 disable dep collection when invoking lifecycle hooks
  3792. pushTarget();
  3793. var handlers = vm.$options[hook];
  3794. var info = hook + " hook";
  3795. if (handlers) {
  3796. for (var i = 0, j = handlers.length; i < j; i++) {
  3797. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3798. }
  3799. }
  3800. if (vm._hasHookEvent) {
  3801. vm.$emit('hook:' + hook);
  3802. }
  3803. popTarget();
  3804. }
  3805. /* */
  3806. var MAX_UPDATE_COUNT = 100;
  3807. var queue = [];
  3808. var activatedChildren = [];
  3809. var has = {};
  3810. var circular = {};
  3811. var waiting = false;
  3812. var flushing = false;
  3813. var index = 0;
  3814. /**
  3815. * Reset the scheduler's state.
  3816. */
  3817. function resetSchedulerState () {
  3818. index = queue.length = activatedChildren.length = 0;
  3819. has = {};
  3820. {
  3821. circular = {};
  3822. }
  3823. waiting = flushing = false;
  3824. }
  3825. // Async edge case #6566 requires saving the timestamp when event listeners are
  3826. // attached. However, calling performance.now() has a perf overhead especially
  3827. // if the page has thousands of event listeners. Instead, we take a timestamp
  3828. // every time the scheduler flushes and use that for all event listeners
  3829. // attached during that flush.
  3830. var currentFlushTimestamp = 0;
  3831. // Async edge case fix requires storing an event listener's attach timestamp.
  3832. var getNow = Date.now;
  3833. // Determine what event timestamp the browser is using. Annoyingly, the
  3834. // timestamp can either be hi-res (relative to page load) or low-res
  3835. // (relative to UNIX epoch), so in order to compare time we have to use the
  3836. // same timestamp type when saving the flush timestamp.
  3837. if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
  3838. // if the low-res timestamp which is bigger than the event timestamp
  3839. // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
  3840. // and we need to use the hi-res version for event listeners as well.
  3841. getNow = function () { return performance.now(); };
  3842. }
  3843. /**
  3844. * Flush both queues and run the watchers.
  3845. */
  3846. function flushSchedulerQueue () {
  3847. currentFlushTimestamp = getNow();
  3848. flushing = true;
  3849. var watcher, id;
  3850. // Sort queue before flush.
  3851. // This ensures that:
  3852. // 1. Components are updated from parent to child. (because parent is always
  3853. // created before the child)
  3854. // 2. A component's user watchers are run before its render watcher (because
  3855. // user watchers are created before the render watcher)
  3856. // 3. If a component is destroyed during a parent component's watcher run,
  3857. // its watchers can be skipped.
  3858. queue.sort(function (a, b) { return a.id - b.id; });
  3859. // do not cache length because more watchers might be pushed
  3860. // as we run existing watchers
  3861. for (index = 0; index < queue.length; index++) {
  3862. watcher = queue[index];
  3863. if (watcher.before) {
  3864. watcher.before();
  3865. }
  3866. id = watcher.id;
  3867. has[id] = null;
  3868. watcher.run();
  3869. // in dev build, check and stop circular updates.
  3870. if (has[id] != null) {
  3871. circular[id] = (circular[id] || 0) + 1;
  3872. if (circular[id] > MAX_UPDATE_COUNT) {
  3873. warn(
  3874. 'You may have an infinite update loop ' + (
  3875. watcher.user
  3876. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3877. : "in a component render function."
  3878. ),
  3879. watcher.vm
  3880. );
  3881. break
  3882. }
  3883. }
  3884. }
  3885. // keep copies of post queues before resetting state
  3886. var activatedQueue = activatedChildren.slice();
  3887. var updatedQueue = queue.slice();
  3888. resetSchedulerState();
  3889. // call component updated and activated hooks
  3890. callActivatedHooks(activatedQueue);
  3891. callUpdatedHooks(updatedQueue);
  3892. // devtool hook
  3893. /* istanbul ignore if */
  3894. if (devtools && config.devtools) {
  3895. devtools.emit('flush');
  3896. }
  3897. }
  3898. function callUpdatedHooks (queue) {
  3899. var i = queue.length;
  3900. while (i--) {
  3901. var watcher = queue[i];
  3902. var vm = watcher.vm;
  3903. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3904. callHook(vm, 'updated');
  3905. }
  3906. }
  3907. }
  3908. /**
  3909. * Queue a kept-alive component that was activated during patch.
  3910. * The queue will be processed after the entire tree has been patched.
  3911. */
  3912. function queueActivatedComponent (vm) {
  3913. // setting _inactive to false here so that a render function can
  3914. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3915. vm._inactive = false;
  3916. activatedChildren.push(vm);
  3917. }
  3918. function callActivatedHooks (queue) {
  3919. for (var i = 0; i < queue.length; i++) {
  3920. queue[i]._inactive = true;
  3921. activateChildComponent(queue[i], true /* true */);
  3922. }
  3923. }
  3924. /**
  3925. * Push a watcher into the watcher queue.
  3926. * Jobs with duplicate IDs will be skipped unless it's
  3927. * pushed when the queue is being flushed.
  3928. */
  3929. function queueWatcher (watcher) {
  3930. var id = watcher.id;
  3931. if (has[id] == null) {
  3932. has[id] = true;
  3933. if (!flushing) {
  3934. queue.push(watcher);
  3935. } else {
  3936. // if already flushing, splice the watcher based on its id
  3937. // if already past its id, it will be run next immediately.
  3938. var i = queue.length - 1;
  3939. while (i > index && queue[i].id > watcher.id) {
  3940. i--;
  3941. }
  3942. queue.splice(i + 1, 0, watcher);
  3943. }
  3944. // queue the flush
  3945. if (!waiting) {
  3946. waiting = true;
  3947. if (!config.async) {
  3948. flushSchedulerQueue();
  3949. return
  3950. }
  3951. nextTick(flushSchedulerQueue);
  3952. }
  3953. }
  3954. }
  3955. /* */
  3956. var uid$2 = 0;
  3957. /**
  3958. * A watcher parses an expression, collects dependencies,
  3959. * and fires callback when the expression value changes.
  3960. * This is used for both the $watch() api and directives.
  3961. */
  3962. var Watcher = function Watcher (
  3963. vm,
  3964. expOrFn,
  3965. cb,
  3966. options,
  3967. isRenderWatcher
  3968. ) {
  3969. this.vm = vm;
  3970. if (isRenderWatcher) {
  3971. vm._watcher = this;
  3972. }
  3973. vm._watchers.push(this);
  3974. // options
  3975. if (options) {
  3976. this.deep = !!options.deep;
  3977. this.user = !!options.user;
  3978. this.lazy = !!options.lazy;
  3979. this.sync = !!options.sync;
  3980. this.before = options.before;
  3981. } else {
  3982. this.deep = this.user = this.lazy = this.sync = false;
  3983. }
  3984. this.cb = cb;
  3985. this.id = ++uid$2; // uid for batching
  3986. this.active = true;
  3987. this.dirty = this.lazy; // for lazy watchers
  3988. this.deps = [];
  3989. this.newDeps = [];
  3990. this.depIds = new _Set();
  3991. this.newDepIds = new _Set();
  3992. this.expression = expOrFn.toString();
  3993. // parse expression for getter
  3994. if (typeof expOrFn === 'function') {
  3995. this.getter = expOrFn;
  3996. } else {
  3997. this.getter = parsePath(expOrFn);
  3998. if (!this.getter) {
  3999. this.getter = noop;
  4000. warn(
  4001. "Failed watching path: \"" + expOrFn + "\" " +
  4002. 'Watcher only accepts simple dot-delimited paths. ' +
  4003. 'For full control, use a function instead.',
  4004. vm
  4005. );
  4006. }
  4007. }
  4008. this.value = this.lazy
  4009. ? undefined
  4010. : this.get();
  4011. };
  4012. /**
  4013. * Evaluate the getter, and re-collect dependencies.
  4014. */
  4015. Watcher.prototype.get = function get () {
  4016. pushTarget(this);
  4017. var value;
  4018. var vm = this.vm;
  4019. try {
  4020. value = this.getter.call(vm, vm);
  4021. } catch (e) {
  4022. if (this.user) {
  4023. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4024. } else {
  4025. throw e
  4026. }
  4027. } finally {
  4028. // "touch" every property so they are all tracked as
  4029. // dependencies for deep watching
  4030. if (this.deep) {
  4031. traverse(value);
  4032. }
  4033. popTarget();
  4034. this.cleanupDeps();
  4035. }
  4036. return value
  4037. };
  4038. /**
  4039. * Add a dependency to this directive.
  4040. */
  4041. Watcher.prototype.addDep = function addDep (dep) {
  4042. var id = dep.id;
  4043. if (!this.newDepIds.has(id)) {
  4044. this.newDepIds.add(id);
  4045. this.newDeps.push(dep);
  4046. if (!this.depIds.has(id)) {
  4047. dep.addSub(this);
  4048. }
  4049. }
  4050. };
  4051. /**
  4052. * Clean up for dependency collection.
  4053. */
  4054. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4055. var i = this.deps.length;
  4056. while (i--) {
  4057. var dep = this.deps[i];
  4058. if (!this.newDepIds.has(dep.id)) {
  4059. dep.removeSub(this);
  4060. }
  4061. }
  4062. var tmp = this.depIds;
  4063. this.depIds = this.newDepIds;
  4064. this.newDepIds = tmp;
  4065. this.newDepIds.clear();
  4066. tmp = this.deps;
  4067. this.deps = this.newDeps;
  4068. this.newDeps = tmp;
  4069. this.newDeps.length = 0;
  4070. };
  4071. /**
  4072. * Subscriber interface.
  4073. * Will be called when a dependency changes.
  4074. */
  4075. Watcher.prototype.update = function update () {
  4076. /* istanbul ignore else */
  4077. if (this.lazy) {
  4078. this.dirty = true;
  4079. } else if (this.sync) {
  4080. this.run();
  4081. } else {
  4082. queueWatcher(this);
  4083. }
  4084. };
  4085. /**
  4086. * Scheduler job interface.
  4087. * Will be called by the scheduler.
  4088. */
  4089. Watcher.prototype.run = function run () {
  4090. if (this.active) {
  4091. var value = this.get();
  4092. if (
  4093. value !== this.value ||
  4094. // Deep watchers and watchers on Object/Arrays should fire even
  4095. // when the value is the same, because the value may
  4096. // have mutated.
  4097. isObject(value) ||
  4098. this.deep
  4099. ) {
  4100. // set new value
  4101. var oldValue = this.value;
  4102. this.value = value;
  4103. if (this.user) {
  4104. try {
  4105. this.cb.call(this.vm, value, oldValue);
  4106. } catch (e) {
  4107. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4108. }
  4109. } else {
  4110. this.cb.call(this.vm, value, oldValue);
  4111. }
  4112. }
  4113. }
  4114. };
  4115. /**
  4116. * Evaluate the value of the watcher.
  4117. * This only gets called for lazy watchers.
  4118. */
  4119. Watcher.prototype.evaluate = function evaluate () {
  4120. this.value = this.get();
  4121. this.dirty = false;
  4122. };
  4123. /**
  4124. * Depend on all deps collected by this watcher.
  4125. */
  4126. Watcher.prototype.depend = function depend () {
  4127. var i = this.deps.length;
  4128. while (i--) {
  4129. this.deps[i].depend();
  4130. }
  4131. };
  4132. /**
  4133. * Remove self from all dependencies' subscriber list.
  4134. */
  4135. Watcher.prototype.teardown = function teardown () {
  4136. if (this.active) {
  4137. // remove self from vm's watcher list
  4138. // this is a somewhat expensive operation so we skip it
  4139. // if the vm is being destroyed.
  4140. if (!this.vm._isBeingDestroyed) {
  4141. remove(this.vm._watchers, this);
  4142. }
  4143. var i = this.deps.length;
  4144. while (i--) {
  4145. this.deps[i].removeSub(this);
  4146. }
  4147. this.active = false;
  4148. }
  4149. };
  4150. /* */
  4151. var sharedPropertyDefinition = {
  4152. enumerable: true,
  4153. configurable: true,
  4154. get: noop,
  4155. set: noop
  4156. };
  4157. function proxy (target, sourceKey, key) {
  4158. sharedPropertyDefinition.get = function proxyGetter () {
  4159. return this[sourceKey][key]
  4160. };
  4161. sharedPropertyDefinition.set = function proxySetter (val) {
  4162. this[sourceKey][key] = val;
  4163. };
  4164. Object.defineProperty(target, key, sharedPropertyDefinition);
  4165. }
  4166. function initState (vm) {
  4167. vm._watchers = [];
  4168. var opts = vm.$options;
  4169. if (opts.props) { initProps(vm, opts.props); }
  4170. if (opts.methods) { initMethods(vm, opts.methods); }
  4171. if (opts.data) {
  4172. initData(vm);
  4173. } else {
  4174. observe(vm._data = {}, true /* asRootData */);
  4175. }
  4176. if (opts.computed) { initComputed(vm, opts.computed); }
  4177. if (opts.watch && opts.watch !== nativeWatch) {
  4178. initWatch(vm, opts.watch);
  4179. }
  4180. }
  4181. function initProps (vm, propsOptions) {
  4182. var propsData = vm.$options.propsData || {};
  4183. var props = vm._props = {};
  4184. // cache prop keys so that future props updates can iterate using Array
  4185. // instead of dynamic object key enumeration.
  4186. var keys = vm.$options._propKeys = [];
  4187. var isRoot = !vm.$parent;
  4188. // root instance props should be converted
  4189. if (!isRoot) {
  4190. toggleObserving(false);
  4191. }
  4192. var loop = function ( key ) {
  4193. keys.push(key);
  4194. var value = validateProp(key, propsOptions, propsData, vm);
  4195. /* istanbul ignore else */
  4196. {
  4197. var hyphenatedKey = hyphenate(key);
  4198. if (isReservedAttribute(hyphenatedKey) ||
  4199. config.isReservedAttr(hyphenatedKey)) {
  4200. warn(
  4201. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4202. vm
  4203. );
  4204. }
  4205. defineReactive$$1(props, key, value, function () {
  4206. if (!isRoot && !isUpdatingChildComponent) {
  4207. warn(
  4208. "Avoid mutating a prop directly since the value will be " +
  4209. "overwritten whenever the parent component re-renders. " +
  4210. "Instead, use a data or computed property based on the prop's " +
  4211. "value. Prop being mutated: \"" + key + "\"",
  4212. vm
  4213. );
  4214. }
  4215. });
  4216. }
  4217. // static props are already proxied on the component's prototype
  4218. // during Vue.extend(). We only need to proxy props defined at
  4219. // instantiation here.
  4220. if (!(key in vm)) {
  4221. proxy(vm, "_props", key);
  4222. }
  4223. };
  4224. for (var key in propsOptions) loop( key );
  4225. toggleObserving(true);
  4226. }
  4227. function initData (vm) {
  4228. var data = vm.$options.data;
  4229. data = vm._data = typeof data === 'function'
  4230. ? getData(data, vm)
  4231. : data || {};
  4232. if (!isPlainObject(data)) {
  4233. data = {};
  4234. warn(
  4235. 'data functions should return an object:\n' +
  4236. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4237. vm
  4238. );
  4239. }
  4240. // proxy data on instance
  4241. var keys = Object.keys(data);
  4242. var props = vm.$options.props;
  4243. var methods = vm.$options.methods;
  4244. var i = keys.length;
  4245. while (i--) {
  4246. var key = keys[i];
  4247. {
  4248. if (methods && hasOwn(methods, key)) {
  4249. warn(
  4250. ("Method \"" + key + "\" has already been defined as a data property."),
  4251. vm
  4252. );
  4253. }
  4254. }
  4255. if (props && hasOwn(props, key)) {
  4256. warn(
  4257. "The data property \"" + key + "\" is already declared as a prop. " +
  4258. "Use prop default value instead.",
  4259. vm
  4260. );
  4261. } else if (!isReserved(key)) {
  4262. proxy(vm, "_data", key);
  4263. }
  4264. }
  4265. // observe data
  4266. observe(data, true /* asRootData */);
  4267. }
  4268. function getData (data, vm) {
  4269. // #7573 disable dep collection when invoking data getters
  4270. pushTarget();
  4271. try {
  4272. return data.call(vm, vm)
  4273. } catch (e) {
  4274. handleError(e, vm, "data()");
  4275. return {}
  4276. } finally {
  4277. popTarget();
  4278. }
  4279. }
  4280. var computedWatcherOptions = { lazy: true };
  4281. function initComputed (vm, computed) {
  4282. // $flow-disable-line
  4283. var watchers = vm._computedWatchers = Object.create(null);
  4284. // computed properties are just getters during SSR
  4285. var isSSR = isServerRendering();
  4286. for (var key in computed) {
  4287. var userDef = computed[key];
  4288. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4289. if (getter == null) {
  4290. warn(
  4291. ("Getter is missing for computed property \"" + key + "\"."),
  4292. vm
  4293. );
  4294. }
  4295. if (!isSSR) {
  4296. // create internal watcher for the computed property.
  4297. watchers[key] = new Watcher(
  4298. vm,
  4299. getter || noop,
  4300. noop,
  4301. computedWatcherOptions
  4302. );
  4303. }
  4304. // component-defined computed properties are already defined on the
  4305. // component prototype. We only need to define computed properties defined
  4306. // at instantiation here.
  4307. if (!(key in vm)) {
  4308. defineComputed(vm, key, userDef);
  4309. } else {
  4310. if (key in vm.$data) {
  4311. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4312. } else if (vm.$options.props && key in vm.$options.props) {
  4313. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4314. }
  4315. }
  4316. }
  4317. }
  4318. function defineComputed (
  4319. target,
  4320. key,
  4321. userDef
  4322. ) {
  4323. var shouldCache = !isServerRendering();
  4324. if (typeof userDef === 'function') {
  4325. sharedPropertyDefinition.get = shouldCache
  4326. ? createComputedGetter(key)
  4327. : createGetterInvoker(userDef);
  4328. sharedPropertyDefinition.set = noop;
  4329. } else {
  4330. sharedPropertyDefinition.get = userDef.get
  4331. ? shouldCache && userDef.cache !== false
  4332. ? createComputedGetter(key)
  4333. : createGetterInvoker(userDef.get)
  4334. : noop;
  4335. sharedPropertyDefinition.set = userDef.set || noop;
  4336. }
  4337. if (sharedPropertyDefinition.set === noop) {
  4338. sharedPropertyDefinition.set = function () {
  4339. warn(
  4340. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4341. this
  4342. );
  4343. };
  4344. }
  4345. Object.defineProperty(target, key, sharedPropertyDefinition);
  4346. }
  4347. function createComputedGetter (key) {
  4348. return function computedGetter () {
  4349. var watcher = this._computedWatchers && this._computedWatchers[key];
  4350. if (watcher) {
  4351. if (watcher.dirty) {
  4352. watcher.evaluate();
  4353. }
  4354. if (Dep.target) {
  4355. watcher.depend();
  4356. }
  4357. return watcher.value
  4358. }
  4359. }
  4360. }
  4361. function createGetterInvoker(fn) {
  4362. return function computedGetter () {
  4363. return fn.call(this, this)
  4364. }
  4365. }
  4366. function initMethods (vm, methods) {
  4367. var props = vm.$options.props;
  4368. for (var key in methods) {
  4369. {
  4370. if (typeof methods[key] !== 'function') {
  4371. warn(
  4372. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4373. "Did you reference the function correctly?",
  4374. vm
  4375. );
  4376. }
  4377. if (props && hasOwn(props, key)) {
  4378. warn(
  4379. ("Method \"" + key + "\" has already been defined as a prop."),
  4380. vm
  4381. );
  4382. }
  4383. if ((key in vm) && isReserved(key)) {
  4384. warn(
  4385. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4386. "Avoid defining component methods that start with _ or $."
  4387. );
  4388. }
  4389. }
  4390. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4391. }
  4392. }
  4393. function initWatch (vm, watch) {
  4394. for (var key in watch) {
  4395. var handler = watch[key];
  4396. if (Array.isArray(handler)) {
  4397. for (var i = 0; i < handler.length; i++) {
  4398. createWatcher(vm, key, handler[i]);
  4399. }
  4400. } else {
  4401. createWatcher(vm, key, handler);
  4402. }
  4403. }
  4404. }
  4405. function createWatcher (
  4406. vm,
  4407. expOrFn,
  4408. handler,
  4409. options
  4410. ) {
  4411. if (isPlainObject(handler)) {
  4412. options = handler;
  4413. handler = handler.handler;
  4414. }
  4415. if (typeof handler === 'string') {
  4416. handler = vm[handler];
  4417. }
  4418. return vm.$watch(expOrFn, handler, options)
  4419. }
  4420. function stateMixin (Vue) {
  4421. // flow somehow has problems with directly declared definition object
  4422. // when using Object.defineProperty, so we have to procedurally build up
  4423. // the object here.
  4424. var dataDef = {};
  4425. dataDef.get = function () { return this._data };
  4426. var propsDef = {};
  4427. propsDef.get = function () { return this._props };
  4428. {
  4429. dataDef.set = function () {
  4430. warn(
  4431. 'Avoid replacing instance root $data. ' +
  4432. 'Use nested data properties instead.',
  4433. this
  4434. );
  4435. };
  4436. propsDef.set = function () {
  4437. warn("$props is readonly.", this);
  4438. };
  4439. }
  4440. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4441. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4442. Vue.prototype.$set = set;
  4443. Vue.prototype.$delete = del;
  4444. Vue.prototype.$watch = function (
  4445. expOrFn,
  4446. cb,
  4447. options
  4448. ) {
  4449. var vm = this;
  4450. if (isPlainObject(cb)) {
  4451. return createWatcher(vm, expOrFn, cb, options)
  4452. }
  4453. options = options || {};
  4454. options.user = true;
  4455. var watcher = new Watcher(vm, expOrFn, cb, options);
  4456. if (options.immediate) {
  4457. try {
  4458. cb.call(vm, watcher.value);
  4459. } catch (error) {
  4460. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4461. }
  4462. }
  4463. return function unwatchFn () {
  4464. watcher.teardown();
  4465. }
  4466. };
  4467. }
  4468. /* */
  4469. var uid$3 = 0;
  4470. function initMixin (Vue) {
  4471. Vue.prototype._init = function (options) {
  4472. var vm = this;
  4473. // a uid
  4474. vm._uid = uid$3++;
  4475. var startTag, endTag;
  4476. /* istanbul ignore if */
  4477. if (config.performance && mark) {
  4478. startTag = "vue-perf-start:" + (vm._uid);
  4479. endTag = "vue-perf-end:" + (vm._uid);
  4480. mark(startTag);
  4481. }
  4482. // a flag to avoid this being observed
  4483. vm._isVue = true;
  4484. // merge options
  4485. if (options && options._isComponent) {
  4486. // optimize internal component instantiation
  4487. // since dynamic options merging is pretty slow, and none of the
  4488. // internal component options needs special treatment.
  4489. initInternalComponent(vm, options);
  4490. } else {
  4491. vm.$options = mergeOptions(
  4492. resolveConstructorOptions(vm.constructor),
  4493. options || {},
  4494. vm
  4495. );
  4496. }
  4497. /* istanbul ignore else */
  4498. {
  4499. initProxy(vm);
  4500. }
  4501. // expose real self
  4502. vm._self = vm;
  4503. initLifecycle(vm);
  4504. initEvents(vm);
  4505. initRender(vm);
  4506. callHook(vm, 'beforeCreate');
  4507. initInjections(vm); // resolve injections before data/props
  4508. initState(vm);
  4509. initProvide(vm); // resolve provide after data/props
  4510. callHook(vm, 'created');
  4511. /* istanbul ignore if */
  4512. if (config.performance && mark) {
  4513. vm._name = formatComponentName(vm, false);
  4514. mark(endTag);
  4515. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4516. }
  4517. if (vm.$options.el) {
  4518. vm.$mount(vm.$options.el);
  4519. }
  4520. };
  4521. }
  4522. function initInternalComponent (vm, options) {
  4523. var opts = vm.$options = Object.create(vm.constructor.options);
  4524. // doing this because it's faster than dynamic enumeration.
  4525. var parentVnode = options._parentVnode;
  4526. opts.parent = options.parent;
  4527. opts._parentVnode = parentVnode;
  4528. var vnodeComponentOptions = parentVnode.componentOptions;
  4529. opts.propsData = vnodeComponentOptions.propsData;
  4530. opts._parentListeners = vnodeComponentOptions.listeners;
  4531. opts._renderChildren = vnodeComponentOptions.children;
  4532. opts._componentTag = vnodeComponentOptions.tag;
  4533. if (options.render) {
  4534. opts.render = options.render;
  4535. opts.staticRenderFns = options.staticRenderFns;
  4536. }
  4537. }
  4538. function resolveConstructorOptions (Ctor) {
  4539. var options = Ctor.options;
  4540. if (Ctor.super) {
  4541. var superOptions = resolveConstructorOptions(Ctor.super);
  4542. var cachedSuperOptions = Ctor.superOptions;
  4543. if (superOptions !== cachedSuperOptions) {
  4544. // super option changed,
  4545. // need to resolve new options.
  4546. Ctor.superOptions = superOptions;
  4547. // check if there are any late-modified/attached options (#4976)
  4548. var modifiedOptions = resolveModifiedOptions(Ctor);
  4549. // update base extend options
  4550. if (modifiedOptions) {
  4551. extend(Ctor.extendOptions, modifiedOptions);
  4552. }
  4553. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4554. if (options.name) {
  4555. options.components[options.name] = Ctor;
  4556. }
  4557. }
  4558. }
  4559. return options
  4560. }
  4561. function resolveModifiedOptions (Ctor) {
  4562. var modified;
  4563. var latest = Ctor.options;
  4564. var sealed = Ctor.sealedOptions;
  4565. for (var key in latest) {
  4566. if (latest[key] !== sealed[key]) {
  4567. if (!modified) { modified = {}; }
  4568. modified[key] = latest[key];
  4569. }
  4570. }
  4571. return modified
  4572. }
  4573. function Vue (options) {
  4574. if (!(this instanceof Vue)
  4575. ) {
  4576. warn('Vue is a constructor and should be called with the `new` keyword');
  4577. }
  4578. this._init(options);
  4579. }
  4580. initMixin(Vue);
  4581. stateMixin(Vue);
  4582. eventsMixin(Vue);
  4583. lifecycleMixin(Vue);
  4584. renderMixin(Vue);
  4585. /* */
  4586. function initUse (Vue) {
  4587. Vue.use = function (plugin) {
  4588. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4589. if (installedPlugins.indexOf(plugin) > -1) {
  4590. return this
  4591. }
  4592. // additional parameters
  4593. var args = toArray(arguments, 1);
  4594. args.unshift(this);
  4595. if (typeof plugin.install === 'function') {
  4596. plugin.install.apply(plugin, args);
  4597. } else if (typeof plugin === 'function') {
  4598. plugin.apply(null, args);
  4599. }
  4600. installedPlugins.push(plugin);
  4601. return this
  4602. };
  4603. }
  4604. /* */
  4605. function initMixin$1 (Vue) {
  4606. Vue.mixin = function (mixin) {
  4607. this.options = mergeOptions(this.options, mixin);
  4608. return this
  4609. };
  4610. }
  4611. /* */
  4612. function initExtend (Vue) {
  4613. /**
  4614. * Each instance constructor, including Vue, has a unique
  4615. * cid. This enables us to create wrapped "child
  4616. * constructors" for prototypal inheritance and cache them.
  4617. */
  4618. Vue.cid = 0;
  4619. var cid = 1;
  4620. /**
  4621. * Class inheritance
  4622. */
  4623. Vue.extend = function (extendOptions) {
  4624. extendOptions = extendOptions || {};
  4625. var Super = this;
  4626. var SuperId = Super.cid;
  4627. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4628. if (cachedCtors[SuperId]) {
  4629. return cachedCtors[SuperId]
  4630. }
  4631. var name = extendOptions.name || Super.options.name;
  4632. if (name) {
  4633. validateComponentName(name);
  4634. }
  4635. var Sub = function VueComponent (options) {
  4636. this._init(options);
  4637. };
  4638. Sub.prototype = Object.create(Super.prototype);
  4639. Sub.prototype.constructor = Sub;
  4640. Sub.cid = cid++;
  4641. Sub.options = mergeOptions(
  4642. Super.options,
  4643. extendOptions
  4644. );
  4645. Sub['super'] = Super;
  4646. // For props and computed properties, we define the proxy getters on
  4647. // the Vue instances at extension time, on the extended prototype. This
  4648. // avoids Object.defineProperty calls for each instance created.
  4649. if (Sub.options.props) {
  4650. initProps$1(Sub);
  4651. }
  4652. if (Sub.options.computed) {
  4653. initComputed$1(Sub);
  4654. }
  4655. // allow further extension/mixin/plugin usage
  4656. Sub.extend = Super.extend;
  4657. Sub.mixin = Super.mixin;
  4658. Sub.use = Super.use;
  4659. // create asset registers, so extended classes
  4660. // can have their private assets too.
  4661. ASSET_TYPES.forEach(function (type) {
  4662. Sub[type] = Super[type];
  4663. });
  4664. // enable recursive self-lookup
  4665. if (name) {
  4666. Sub.options.components[name] = Sub;
  4667. }
  4668. // keep a reference to the super options at extension time.
  4669. // later at instantiation we can check if Super's options have
  4670. // been updated.
  4671. Sub.superOptions = Super.options;
  4672. Sub.extendOptions = extendOptions;
  4673. Sub.sealedOptions = extend({}, Sub.options);
  4674. // cache constructor
  4675. cachedCtors[SuperId] = Sub;
  4676. return Sub
  4677. };
  4678. }
  4679. function initProps$1 (Comp) {
  4680. var props = Comp.options.props;
  4681. for (var key in props) {
  4682. proxy(Comp.prototype, "_props", key);
  4683. }
  4684. }
  4685. function initComputed$1 (Comp) {
  4686. var computed = Comp.options.computed;
  4687. for (var key in computed) {
  4688. defineComputed(Comp.prototype, key, computed[key]);
  4689. }
  4690. }
  4691. /* */
  4692. function initAssetRegisters (Vue) {
  4693. /**
  4694. * Create asset registration methods.
  4695. */
  4696. ASSET_TYPES.forEach(function (type) {
  4697. Vue[type] = function (
  4698. id,
  4699. definition
  4700. ) {
  4701. if (!definition) {
  4702. return this.options[type + 's'][id]
  4703. } else {
  4704. /* istanbul ignore if */
  4705. if (type === 'component') {
  4706. validateComponentName(id);
  4707. }
  4708. if (type === 'component' && isPlainObject(definition)) {
  4709. definition.name = definition.name || id;
  4710. definition = this.options._base.extend(definition);
  4711. }
  4712. if (type === 'directive' && typeof definition === 'function') {
  4713. definition = { bind: definition, update: definition };
  4714. }
  4715. this.options[type + 's'][id] = definition;
  4716. return definition
  4717. }
  4718. };
  4719. });
  4720. }
  4721. /* */
  4722. function getComponentName (opts) {
  4723. return opts && (opts.Ctor.options.name || opts.tag)
  4724. }
  4725. function matches (pattern, name) {
  4726. if (Array.isArray(pattern)) {
  4727. return pattern.indexOf(name) > -1
  4728. } else if (typeof pattern === 'string') {
  4729. return pattern.split(',').indexOf(name) > -1
  4730. } else if (isRegExp(pattern)) {
  4731. return pattern.test(name)
  4732. }
  4733. /* istanbul ignore next */
  4734. return false
  4735. }
  4736. function pruneCache (keepAliveInstance, filter) {
  4737. var cache = keepAliveInstance.cache;
  4738. var keys = keepAliveInstance.keys;
  4739. var _vnode = keepAliveInstance._vnode;
  4740. for (var key in cache) {
  4741. var cachedNode = cache[key];
  4742. if (cachedNode) {
  4743. var name = getComponentName(cachedNode.componentOptions);
  4744. if (name && !filter(name)) {
  4745. pruneCacheEntry(cache, key, keys, _vnode);
  4746. }
  4747. }
  4748. }
  4749. }
  4750. function pruneCacheEntry (
  4751. cache,
  4752. key,
  4753. keys,
  4754. current
  4755. ) {
  4756. var cached$$1 = cache[key];
  4757. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4758. cached$$1.componentInstance.$destroy();
  4759. }
  4760. cache[key] = null;
  4761. remove(keys, key);
  4762. }
  4763. var patternTypes = [String, RegExp, Array];
  4764. var KeepAlive = {
  4765. name: 'keep-alive',
  4766. abstract: true,
  4767. props: {
  4768. include: patternTypes,
  4769. exclude: patternTypes,
  4770. max: [String, Number]
  4771. },
  4772. created: function created () {
  4773. this.cache = Object.create(null);
  4774. this.keys = [];
  4775. },
  4776. destroyed: function destroyed () {
  4777. for (var key in this.cache) {
  4778. pruneCacheEntry(this.cache, key, this.keys);
  4779. }
  4780. },
  4781. mounted: function mounted () {
  4782. var this$1 = this;
  4783. this.$watch('include', function (val) {
  4784. pruneCache(this$1, function (name) { return matches(val, name); });
  4785. });
  4786. this.$watch('exclude', function (val) {
  4787. pruneCache(this$1, function (name) { return !matches(val, name); });
  4788. });
  4789. },
  4790. render: function render () {
  4791. var slot = this.$slots.default;
  4792. var vnode = getFirstComponentChild(slot);
  4793. var componentOptions = vnode && vnode.componentOptions;
  4794. if (componentOptions) {
  4795. // check pattern
  4796. var name = getComponentName(componentOptions);
  4797. var ref = this;
  4798. var include = ref.include;
  4799. var exclude = ref.exclude;
  4800. if (
  4801. // not included
  4802. (include && (!name || !matches(include, name))) ||
  4803. // excluded
  4804. (exclude && name && matches(exclude, name))
  4805. ) {
  4806. return vnode
  4807. }
  4808. var ref$1 = this;
  4809. var cache = ref$1.cache;
  4810. var keys = ref$1.keys;
  4811. var key = vnode.key == null
  4812. // same constructor may get registered as different local components
  4813. // so cid alone is not enough (#3269)
  4814. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4815. : vnode.key;
  4816. if (cache[key]) {
  4817. vnode.componentInstance = cache[key].componentInstance;
  4818. // make current key freshest
  4819. remove(keys, key);
  4820. keys.push(key);
  4821. } else {
  4822. cache[key] = vnode;
  4823. keys.push(key);
  4824. // prune oldest entry
  4825. if (this.max && keys.length > parseInt(this.max)) {
  4826. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4827. }
  4828. }
  4829. vnode.data.keepAlive = true;
  4830. }
  4831. return vnode || (slot && slot[0])
  4832. }
  4833. };
  4834. var builtInComponents = {
  4835. KeepAlive: KeepAlive
  4836. };
  4837. /* */
  4838. function initGlobalAPI (Vue) {
  4839. // config
  4840. var configDef = {};
  4841. configDef.get = function () { return config; };
  4842. {
  4843. configDef.set = function () {
  4844. warn(
  4845. 'Do not replace the Vue.config object, set individual fields instead.'
  4846. );
  4847. };
  4848. }
  4849. Object.defineProperty(Vue, 'config', configDef);
  4850. // exposed util methods.
  4851. // NOTE: these are not considered part of the public API - avoid relying on
  4852. // them unless you are aware of the risk.
  4853. Vue.util = {
  4854. warn: warn,
  4855. extend: extend,
  4856. mergeOptions: mergeOptions,
  4857. defineReactive: defineReactive$$1
  4858. };
  4859. Vue.set = set;
  4860. Vue.delete = del;
  4861. Vue.nextTick = nextTick;
  4862. // 2.6 explicit observable API
  4863. Vue.observable = function (obj) {
  4864. observe(obj);
  4865. return obj
  4866. };
  4867. Vue.options = Object.create(null);
  4868. ASSET_TYPES.forEach(function (type) {
  4869. Vue.options[type + 's'] = Object.create(null);
  4870. });
  4871. // this is used to identify the "base" constructor to extend all plain-object
  4872. // components with in Weex's multi-instance scenarios.
  4873. Vue.options._base = Vue;
  4874. extend(Vue.options.components, builtInComponents);
  4875. initUse(Vue);
  4876. initMixin$1(Vue);
  4877. initExtend(Vue);
  4878. initAssetRegisters(Vue);
  4879. }
  4880. initGlobalAPI(Vue);
  4881. Object.defineProperty(Vue.prototype, '$isServer', {
  4882. get: isServerRendering
  4883. });
  4884. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4885. get: function get () {
  4886. /* istanbul ignore next */
  4887. return this.$vnode && this.$vnode.ssrContext
  4888. }
  4889. });
  4890. // expose FunctionalRenderContext for ssr runtime helper installation
  4891. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4892. value: FunctionalRenderContext
  4893. });
  4894. Vue.version = '2.6.7';
  4895. /* */
  4896. // these are reserved for web because they are directly compiled away
  4897. // during template compilation
  4898. var isReservedAttr = makeMap('style,class');
  4899. // attributes that should be using props for binding
  4900. var acceptValue = makeMap('input,textarea,option,select,progress');
  4901. var mustUseProp = function (tag, type, attr) {
  4902. return (
  4903. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4904. (attr === 'selected' && tag === 'option') ||
  4905. (attr === 'checked' && tag === 'input') ||
  4906. (attr === 'muted' && tag === 'video')
  4907. )
  4908. };
  4909. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4910. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4911. var convertEnumeratedValue = function (key, value) {
  4912. return isFalsyAttrValue(value) || value === 'false'
  4913. ? 'false'
  4914. // allow arbitrary string value for contenteditable
  4915. : key === 'contenteditable' && isValidContentEditableValue(value)
  4916. ? value
  4917. : 'true'
  4918. };
  4919. var isBooleanAttr = makeMap(
  4920. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4921. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4922. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4923. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4924. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4925. 'truespeed,typemustmatch,visible'
  4926. );
  4927. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4928. var isXlink = function (name) {
  4929. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4930. };
  4931. var getXlinkProp = function (name) {
  4932. return isXlink(name) ? name.slice(6, name.length) : ''
  4933. };
  4934. var isFalsyAttrValue = function (val) {
  4935. return val == null || val === false
  4936. };
  4937. /* */
  4938. function genClassForVnode (vnode) {
  4939. var data = vnode.data;
  4940. var parentNode = vnode;
  4941. var childNode = vnode;
  4942. while (isDef(childNode.componentInstance)) {
  4943. childNode = childNode.componentInstance._vnode;
  4944. if (childNode && childNode.data) {
  4945. data = mergeClassData(childNode.data, data);
  4946. }
  4947. }
  4948. while (isDef(parentNode = parentNode.parent)) {
  4949. if (parentNode && parentNode.data) {
  4950. data = mergeClassData(data, parentNode.data);
  4951. }
  4952. }
  4953. return renderClass(data.staticClass, data.class)
  4954. }
  4955. function mergeClassData (child, parent) {
  4956. return {
  4957. staticClass: concat(child.staticClass, parent.staticClass),
  4958. class: isDef(child.class)
  4959. ? [child.class, parent.class]
  4960. : parent.class
  4961. }
  4962. }
  4963. function renderClass (
  4964. staticClass,
  4965. dynamicClass
  4966. ) {
  4967. if (isDef(staticClass) || isDef(dynamicClass)) {
  4968. return concat(staticClass, stringifyClass(dynamicClass))
  4969. }
  4970. /* istanbul ignore next */
  4971. return ''
  4972. }
  4973. function concat (a, b) {
  4974. return a ? b ? (a + ' ' + b) : a : (b || '')
  4975. }
  4976. function stringifyClass (value) {
  4977. if (Array.isArray(value)) {
  4978. return stringifyArray(value)
  4979. }
  4980. if (isObject(value)) {
  4981. return stringifyObject(value)
  4982. }
  4983. if (typeof value === 'string') {
  4984. return value
  4985. }
  4986. /* istanbul ignore next */
  4987. return ''
  4988. }
  4989. function stringifyArray (value) {
  4990. var res = '';
  4991. var stringified;
  4992. for (var i = 0, l = value.length; i < l; i++) {
  4993. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  4994. if (res) { res += ' '; }
  4995. res += stringified;
  4996. }
  4997. }
  4998. return res
  4999. }
  5000. function stringifyObject (value) {
  5001. var res = '';
  5002. for (var key in value) {
  5003. if (value[key]) {
  5004. if (res) { res += ' '; }
  5005. res += key;
  5006. }
  5007. }
  5008. return res
  5009. }
  5010. /* */
  5011. var namespaceMap = {
  5012. svg: 'http://www.w3.org/2000/svg',
  5013. math: 'http://www.w3.org/1998/Math/MathML'
  5014. };
  5015. var isHTMLTag = makeMap(
  5016. 'html,body,base,head,link,meta,style,title,' +
  5017. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5018. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5019. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5020. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5021. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5022. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5023. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5024. 'output,progress,select,textarea,' +
  5025. 'details,dialog,menu,menuitem,summary,' +
  5026. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5027. );
  5028. // this map is intentionally selective, only covering SVG elements that may
  5029. // contain child elements.
  5030. var isSVG = makeMap(
  5031. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5032. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5033. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5034. true
  5035. );
  5036. var isPreTag = function (tag) { return tag === 'pre'; };
  5037. var isReservedTag = function (tag) {
  5038. return isHTMLTag(tag) || isSVG(tag)
  5039. };
  5040. function getTagNamespace (tag) {
  5041. if (isSVG(tag)) {
  5042. return 'svg'
  5043. }
  5044. // basic support for MathML
  5045. // note it doesn't support other MathML elements being component roots
  5046. if (tag === 'math') {
  5047. return 'math'
  5048. }
  5049. }
  5050. var unknownElementCache = Object.create(null);
  5051. function isUnknownElement (tag) {
  5052. /* istanbul ignore if */
  5053. if (!inBrowser) {
  5054. return true
  5055. }
  5056. if (isReservedTag(tag)) {
  5057. return false
  5058. }
  5059. tag = tag.toLowerCase();
  5060. /* istanbul ignore if */
  5061. if (unknownElementCache[tag] != null) {
  5062. return unknownElementCache[tag]
  5063. }
  5064. var el = document.createElement(tag);
  5065. if (tag.indexOf('-') > -1) {
  5066. // http://stackoverflow.com/a/28210364/1070244
  5067. return (unknownElementCache[tag] = (
  5068. el.constructor === window.HTMLUnknownElement ||
  5069. el.constructor === window.HTMLElement
  5070. ))
  5071. } else {
  5072. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5073. }
  5074. }
  5075. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5076. /* */
  5077. /**
  5078. * Query an element selector if it's not an element already.
  5079. */
  5080. function query (el) {
  5081. if (typeof el === 'string') {
  5082. var selected = document.querySelector(el);
  5083. if (!selected) {
  5084. warn(
  5085. 'Cannot find element: ' + el
  5086. );
  5087. return document.createElement('div')
  5088. }
  5089. return selected
  5090. } else {
  5091. return el
  5092. }
  5093. }
  5094. /* */
  5095. function createElement$1 (tagName, vnode) {
  5096. var elm = document.createElement(tagName);
  5097. if (tagName !== 'select') {
  5098. return elm
  5099. }
  5100. // false or null will remove the attribute but undefined will not
  5101. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5102. elm.setAttribute('multiple', 'multiple');
  5103. }
  5104. return elm
  5105. }
  5106. function createElementNS (namespace, tagName) {
  5107. return document.createElementNS(namespaceMap[namespace], tagName)
  5108. }
  5109. function createTextNode (text) {
  5110. return document.createTextNode(text)
  5111. }
  5112. function createComment (text) {
  5113. return document.createComment(text)
  5114. }
  5115. function insertBefore (parentNode, newNode, referenceNode) {
  5116. parentNode.insertBefore(newNode, referenceNode);
  5117. }
  5118. function removeChild (node, child) {
  5119. node.removeChild(child);
  5120. }
  5121. function appendChild (node, child) {
  5122. node.appendChild(child);
  5123. }
  5124. function parentNode (node) {
  5125. return node.parentNode
  5126. }
  5127. function nextSibling (node) {
  5128. return node.nextSibling
  5129. }
  5130. function tagName (node) {
  5131. return node.tagName
  5132. }
  5133. function setTextContent (node, text) {
  5134. node.textContent = text;
  5135. }
  5136. function setStyleScope (node, scopeId) {
  5137. node.setAttribute(scopeId, '');
  5138. }
  5139. var nodeOps = /*#__PURE__*/Object.freeze({
  5140. createElement: createElement$1,
  5141. createElementNS: createElementNS,
  5142. createTextNode: createTextNode,
  5143. createComment: createComment,
  5144. insertBefore: insertBefore,
  5145. removeChild: removeChild,
  5146. appendChild: appendChild,
  5147. parentNode: parentNode,
  5148. nextSibling: nextSibling,
  5149. tagName: tagName,
  5150. setTextContent: setTextContent,
  5151. setStyleScope: setStyleScope
  5152. });
  5153. /* */
  5154. var ref = {
  5155. create: function create (_, vnode) {
  5156. registerRef(vnode);
  5157. },
  5158. update: function update (oldVnode, vnode) {
  5159. if (oldVnode.data.ref !== vnode.data.ref) {
  5160. registerRef(oldVnode, true);
  5161. registerRef(vnode);
  5162. }
  5163. },
  5164. destroy: function destroy (vnode) {
  5165. registerRef(vnode, true);
  5166. }
  5167. };
  5168. function registerRef (vnode, isRemoval) {
  5169. var key = vnode.data.ref;
  5170. if (!isDef(key)) { return }
  5171. var vm = vnode.context;
  5172. var ref = vnode.componentInstance || vnode.elm;
  5173. var refs = vm.$refs;
  5174. if (isRemoval) {
  5175. if (Array.isArray(refs[key])) {
  5176. remove(refs[key], ref);
  5177. } else if (refs[key] === ref) {
  5178. refs[key] = undefined;
  5179. }
  5180. } else {
  5181. if (vnode.data.refInFor) {
  5182. if (!Array.isArray(refs[key])) {
  5183. refs[key] = [ref];
  5184. } else if (refs[key].indexOf(ref) < 0) {
  5185. // $flow-disable-line
  5186. refs[key].push(ref);
  5187. }
  5188. } else {
  5189. refs[key] = ref;
  5190. }
  5191. }
  5192. }
  5193. /**
  5194. * Virtual DOM patching algorithm based on Snabbdom by
  5195. * Simon Friis Vindum (@paldepind)
  5196. * Licensed under the MIT License
  5197. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5198. *
  5199. * modified by Evan You (@yyx990803)
  5200. *
  5201. * Not type-checking this because this file is perf-critical and the cost
  5202. * of making flow understand it is not worth it.
  5203. */
  5204. var emptyNode = new VNode('', {}, []);
  5205. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5206. function sameVnode (a, b) {
  5207. return (
  5208. a.key === b.key && (
  5209. (
  5210. a.tag === b.tag &&
  5211. a.isComment === b.isComment &&
  5212. isDef(a.data) === isDef(b.data) &&
  5213. sameInputType(a, b)
  5214. ) || (
  5215. isTrue(a.isAsyncPlaceholder) &&
  5216. a.asyncFactory === b.asyncFactory &&
  5217. isUndef(b.asyncFactory.error)
  5218. )
  5219. )
  5220. )
  5221. }
  5222. function sameInputType (a, b) {
  5223. if (a.tag !== 'input') { return true }
  5224. var i;
  5225. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5226. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5227. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5228. }
  5229. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5230. var i, key;
  5231. var map = {};
  5232. for (i = beginIdx; i <= endIdx; ++i) {
  5233. key = children[i].key;
  5234. if (isDef(key)) { map[key] = i; }
  5235. }
  5236. return map
  5237. }
  5238. function createPatchFunction (backend) {
  5239. var i, j;
  5240. var cbs = {};
  5241. var modules = backend.modules;
  5242. var nodeOps = backend.nodeOps;
  5243. for (i = 0; i < hooks.length; ++i) {
  5244. cbs[hooks[i]] = [];
  5245. for (j = 0; j < modules.length; ++j) {
  5246. if (isDef(modules[j][hooks[i]])) {
  5247. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5248. }
  5249. }
  5250. }
  5251. function emptyNodeAt (elm) {
  5252. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5253. }
  5254. function createRmCb (childElm, listeners) {
  5255. function remove$$1 () {
  5256. if (--remove$$1.listeners === 0) {
  5257. removeNode(childElm);
  5258. }
  5259. }
  5260. remove$$1.listeners = listeners;
  5261. return remove$$1
  5262. }
  5263. function removeNode (el) {
  5264. var parent = nodeOps.parentNode(el);
  5265. // element may have already been removed due to v-html / v-text
  5266. if (isDef(parent)) {
  5267. nodeOps.removeChild(parent, el);
  5268. }
  5269. }
  5270. function isUnknownElement$$1 (vnode, inVPre) {
  5271. return (
  5272. !inVPre &&
  5273. !vnode.ns &&
  5274. !(
  5275. config.ignoredElements.length &&
  5276. config.ignoredElements.some(function (ignore) {
  5277. return isRegExp(ignore)
  5278. ? ignore.test(vnode.tag)
  5279. : ignore === vnode.tag
  5280. })
  5281. ) &&
  5282. config.isUnknownElement(vnode.tag)
  5283. )
  5284. }
  5285. var creatingElmInVPre = 0;
  5286. function createElm (
  5287. vnode,
  5288. insertedVnodeQueue,
  5289. parentElm,
  5290. refElm,
  5291. nested,
  5292. ownerArray,
  5293. index
  5294. ) {
  5295. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5296. // This vnode was used in a previous render!
  5297. // now it's used as a new node, overwriting its elm would cause
  5298. // potential patch errors down the road when it's used as an insertion
  5299. // reference node. Instead, we clone the node on-demand before creating
  5300. // associated DOM element for it.
  5301. vnode = ownerArray[index] = cloneVNode(vnode);
  5302. }
  5303. vnode.isRootInsert = !nested; // for transition enter check
  5304. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5305. return
  5306. }
  5307. var data = vnode.data;
  5308. var children = vnode.children;
  5309. var tag = vnode.tag;
  5310. if (isDef(tag)) {
  5311. {
  5312. if (data && data.pre) {
  5313. creatingElmInVPre++;
  5314. }
  5315. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5316. warn(
  5317. 'Unknown custom element: <' + tag + '> - did you ' +
  5318. 'register the component correctly? For recursive components, ' +
  5319. 'make sure to provide the "name" option.',
  5320. vnode.context
  5321. );
  5322. }
  5323. }
  5324. vnode.elm = vnode.ns
  5325. ? nodeOps.createElementNS(vnode.ns, tag)
  5326. : nodeOps.createElement(tag, vnode);
  5327. setScope(vnode);
  5328. /* istanbul ignore if */
  5329. {
  5330. createChildren(vnode, children, insertedVnodeQueue);
  5331. if (isDef(data)) {
  5332. invokeCreateHooks(vnode, insertedVnodeQueue);
  5333. }
  5334. insert(parentElm, vnode.elm, refElm);
  5335. }
  5336. if (data && data.pre) {
  5337. creatingElmInVPre--;
  5338. }
  5339. } else if (isTrue(vnode.isComment)) {
  5340. vnode.elm = nodeOps.createComment(vnode.text);
  5341. insert(parentElm, vnode.elm, refElm);
  5342. } else {
  5343. vnode.elm = nodeOps.createTextNode(vnode.text);
  5344. insert(parentElm, vnode.elm, refElm);
  5345. }
  5346. }
  5347. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5348. var i = vnode.data;
  5349. if (isDef(i)) {
  5350. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5351. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5352. i(vnode, false /* hydrating */);
  5353. }
  5354. // after calling the init hook, if the vnode is a child component
  5355. // it should've created a child instance and mounted it. the child
  5356. // component also has set the placeholder vnode's elm.
  5357. // in that case we can just return the element and be done.
  5358. if (isDef(vnode.componentInstance)) {
  5359. initComponent(vnode, insertedVnodeQueue);
  5360. insert(parentElm, vnode.elm, refElm);
  5361. if (isTrue(isReactivated)) {
  5362. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5363. }
  5364. return true
  5365. }
  5366. }
  5367. }
  5368. function initComponent (vnode, insertedVnodeQueue) {
  5369. if (isDef(vnode.data.pendingInsert)) {
  5370. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5371. vnode.data.pendingInsert = null;
  5372. }
  5373. vnode.elm = vnode.componentInstance.$el;
  5374. if (isPatchable(vnode)) {
  5375. invokeCreateHooks(vnode, insertedVnodeQueue);
  5376. setScope(vnode);
  5377. } else {
  5378. // empty component root.
  5379. // skip all element-related modules except for ref (#3455)
  5380. registerRef(vnode);
  5381. // make sure to invoke the insert hook
  5382. insertedVnodeQueue.push(vnode);
  5383. }
  5384. }
  5385. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5386. var i;
  5387. // hack for #4339: a reactivated component with inner transition
  5388. // does not trigger because the inner node's created hooks are not called
  5389. // again. It's not ideal to involve module-specific logic in here but
  5390. // there doesn't seem to be a better way to do it.
  5391. var innerNode = vnode;
  5392. while (innerNode.componentInstance) {
  5393. innerNode = innerNode.componentInstance._vnode;
  5394. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5395. for (i = 0; i < cbs.activate.length; ++i) {
  5396. cbs.activate[i](emptyNode, innerNode);
  5397. }
  5398. insertedVnodeQueue.push(innerNode);
  5399. break
  5400. }
  5401. }
  5402. // unlike a newly created component,
  5403. // a reactivated keep-alive component doesn't insert itself
  5404. insert(parentElm, vnode.elm, refElm);
  5405. }
  5406. function insert (parent, elm, ref$$1) {
  5407. if (isDef(parent)) {
  5408. if (isDef(ref$$1)) {
  5409. if (nodeOps.parentNode(ref$$1) === parent) {
  5410. nodeOps.insertBefore(parent, elm, ref$$1);
  5411. }
  5412. } else {
  5413. nodeOps.appendChild(parent, elm);
  5414. }
  5415. }
  5416. }
  5417. function createChildren (vnode, children, insertedVnodeQueue) {
  5418. if (Array.isArray(children)) {
  5419. {
  5420. checkDuplicateKeys(children);
  5421. }
  5422. for (var i = 0; i < children.length; ++i) {
  5423. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5424. }
  5425. } else if (isPrimitive(vnode.text)) {
  5426. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5427. }
  5428. }
  5429. function isPatchable (vnode) {
  5430. while (vnode.componentInstance) {
  5431. vnode = vnode.componentInstance._vnode;
  5432. }
  5433. return isDef(vnode.tag)
  5434. }
  5435. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5436. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5437. cbs.create[i$1](emptyNode, vnode);
  5438. }
  5439. i = vnode.data.hook; // Reuse variable
  5440. if (isDef(i)) {
  5441. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5442. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5443. }
  5444. }
  5445. // set scope id attribute for scoped CSS.
  5446. // this is implemented as a special case to avoid the overhead
  5447. // of going through the normal attribute patching process.
  5448. function setScope (vnode) {
  5449. var i;
  5450. if (isDef(i = vnode.fnScopeId)) {
  5451. nodeOps.setStyleScope(vnode.elm, i);
  5452. } else {
  5453. var ancestor = vnode;
  5454. while (ancestor) {
  5455. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5456. nodeOps.setStyleScope(vnode.elm, i);
  5457. }
  5458. ancestor = ancestor.parent;
  5459. }
  5460. }
  5461. // for slot content they should also get the scopeId from the host instance.
  5462. if (isDef(i = activeInstance) &&
  5463. i !== vnode.context &&
  5464. i !== vnode.fnContext &&
  5465. isDef(i = i.$options._scopeId)
  5466. ) {
  5467. nodeOps.setStyleScope(vnode.elm, i);
  5468. }
  5469. }
  5470. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5471. for (; startIdx <= endIdx; ++startIdx) {
  5472. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5473. }
  5474. }
  5475. function invokeDestroyHook (vnode) {
  5476. var i, j;
  5477. var data = vnode.data;
  5478. if (isDef(data)) {
  5479. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5480. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5481. }
  5482. if (isDef(i = vnode.children)) {
  5483. for (j = 0; j < vnode.children.length; ++j) {
  5484. invokeDestroyHook(vnode.children[j]);
  5485. }
  5486. }
  5487. }
  5488. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  5489. for (; startIdx <= endIdx; ++startIdx) {
  5490. var ch = vnodes[startIdx];
  5491. if (isDef(ch)) {
  5492. if (isDef(ch.tag)) {
  5493. removeAndInvokeRemoveHook(ch);
  5494. invokeDestroyHook(ch);
  5495. } else { // Text node
  5496. removeNode(ch.elm);
  5497. }
  5498. }
  5499. }
  5500. }
  5501. function removeAndInvokeRemoveHook (vnode, rm) {
  5502. if (isDef(rm) || isDef(vnode.data)) {
  5503. var i;
  5504. var listeners = cbs.remove.length + 1;
  5505. if (isDef(rm)) {
  5506. // we have a recursively passed down rm callback
  5507. // increase the listeners count
  5508. rm.listeners += listeners;
  5509. } else {
  5510. // directly removing
  5511. rm = createRmCb(vnode.elm, listeners);
  5512. }
  5513. // recursively invoke hooks on child component root node
  5514. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5515. removeAndInvokeRemoveHook(i, rm);
  5516. }
  5517. for (i = 0; i < cbs.remove.length; ++i) {
  5518. cbs.remove[i](vnode, rm);
  5519. }
  5520. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5521. i(vnode, rm);
  5522. } else {
  5523. rm();
  5524. }
  5525. } else {
  5526. removeNode(vnode.elm);
  5527. }
  5528. }
  5529. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5530. var oldStartIdx = 0;
  5531. var newStartIdx = 0;
  5532. var oldEndIdx = oldCh.length - 1;
  5533. var oldStartVnode = oldCh[0];
  5534. var oldEndVnode = oldCh[oldEndIdx];
  5535. var newEndIdx = newCh.length - 1;
  5536. var newStartVnode = newCh[0];
  5537. var newEndVnode = newCh[newEndIdx];
  5538. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5539. // removeOnly is a special flag used only by <transition-group>
  5540. // to ensure removed elements stay in correct relative positions
  5541. // during leaving transitions
  5542. var canMove = !removeOnly;
  5543. {
  5544. checkDuplicateKeys(newCh);
  5545. }
  5546. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5547. if (isUndef(oldStartVnode)) {
  5548. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5549. } else if (isUndef(oldEndVnode)) {
  5550. oldEndVnode = oldCh[--oldEndIdx];
  5551. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5552. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5553. oldStartVnode = oldCh[++oldStartIdx];
  5554. newStartVnode = newCh[++newStartIdx];
  5555. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5556. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5557. oldEndVnode = oldCh[--oldEndIdx];
  5558. newEndVnode = newCh[--newEndIdx];
  5559. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5560. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5561. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5562. oldStartVnode = oldCh[++oldStartIdx];
  5563. newEndVnode = newCh[--newEndIdx];
  5564. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5565. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5566. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5567. oldEndVnode = oldCh[--oldEndIdx];
  5568. newStartVnode = newCh[++newStartIdx];
  5569. } else {
  5570. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5571. idxInOld = isDef(newStartVnode.key)
  5572. ? oldKeyToIdx[newStartVnode.key]
  5573. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5574. if (isUndef(idxInOld)) { // New element
  5575. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5576. } else {
  5577. vnodeToMove = oldCh[idxInOld];
  5578. if (sameVnode(vnodeToMove, newStartVnode)) {
  5579. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5580. oldCh[idxInOld] = undefined;
  5581. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5582. } else {
  5583. // same key but different element. treat as new element
  5584. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5585. }
  5586. }
  5587. newStartVnode = newCh[++newStartIdx];
  5588. }
  5589. }
  5590. if (oldStartIdx > oldEndIdx) {
  5591. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5592. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5593. } else if (newStartIdx > newEndIdx) {
  5594. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  5595. }
  5596. }
  5597. function checkDuplicateKeys (children) {
  5598. var seenKeys = {};
  5599. for (var i = 0; i < children.length; i++) {
  5600. var vnode = children[i];
  5601. var key = vnode.key;
  5602. if (isDef(key)) {
  5603. if (seenKeys[key]) {
  5604. warn(
  5605. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5606. vnode.context
  5607. );
  5608. } else {
  5609. seenKeys[key] = true;
  5610. }
  5611. }
  5612. }
  5613. }
  5614. function findIdxInOld (node, oldCh, start, end) {
  5615. for (var i = start; i < end; i++) {
  5616. var c = oldCh[i];
  5617. if (isDef(c) && sameVnode(node, c)) { return i }
  5618. }
  5619. }
  5620. function patchVnode (
  5621. oldVnode,
  5622. vnode,
  5623. insertedVnodeQueue,
  5624. ownerArray,
  5625. index,
  5626. removeOnly
  5627. ) {
  5628. if (oldVnode === vnode) {
  5629. return
  5630. }
  5631. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5632. // clone reused vnode
  5633. vnode = ownerArray[index] = cloneVNode(vnode);
  5634. }
  5635. var elm = vnode.elm = oldVnode.elm;
  5636. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5637. if (isDef(vnode.asyncFactory.resolved)) {
  5638. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5639. } else {
  5640. vnode.isAsyncPlaceholder = true;
  5641. }
  5642. return
  5643. }
  5644. // reuse element for static trees.
  5645. // note we only do this if the vnode is cloned -
  5646. // if the new node is not cloned it means the render functions have been
  5647. // reset by the hot-reload-api and we need to do a proper re-render.
  5648. if (isTrue(vnode.isStatic) &&
  5649. isTrue(oldVnode.isStatic) &&
  5650. vnode.key === oldVnode.key &&
  5651. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5652. ) {
  5653. vnode.componentInstance = oldVnode.componentInstance;
  5654. return
  5655. }
  5656. var i;
  5657. var data = vnode.data;
  5658. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5659. i(oldVnode, vnode);
  5660. }
  5661. var oldCh = oldVnode.children;
  5662. var ch = vnode.children;
  5663. if (isDef(data) && isPatchable(vnode)) {
  5664. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5665. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5666. }
  5667. if (isUndef(vnode.text)) {
  5668. if (isDef(oldCh) && isDef(ch)) {
  5669. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5670. } else if (isDef(ch)) {
  5671. {
  5672. checkDuplicateKeys(ch);
  5673. }
  5674. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5675. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5676. } else if (isDef(oldCh)) {
  5677. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  5678. } else if (isDef(oldVnode.text)) {
  5679. nodeOps.setTextContent(elm, '');
  5680. }
  5681. } else if (oldVnode.text !== vnode.text) {
  5682. nodeOps.setTextContent(elm, vnode.text);
  5683. }
  5684. if (isDef(data)) {
  5685. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5686. }
  5687. }
  5688. function invokeInsertHook (vnode, queue, initial) {
  5689. // delay insert hooks for component root nodes, invoke them after the
  5690. // element is really inserted
  5691. if (isTrue(initial) && isDef(vnode.parent)) {
  5692. vnode.parent.data.pendingInsert = queue;
  5693. } else {
  5694. for (var i = 0; i < queue.length; ++i) {
  5695. queue[i].data.hook.insert(queue[i]);
  5696. }
  5697. }
  5698. }
  5699. var hydrationBailed = false;
  5700. // list of modules that can skip create hook during hydration because they
  5701. // are already rendered on the client or has no need for initialization
  5702. // Note: style is excluded because it relies on initial clone for future
  5703. // deep updates (#7063).
  5704. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5705. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5706. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5707. var i;
  5708. var tag = vnode.tag;
  5709. var data = vnode.data;
  5710. var children = vnode.children;
  5711. inVPre = inVPre || (data && data.pre);
  5712. vnode.elm = elm;
  5713. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5714. vnode.isAsyncPlaceholder = true;
  5715. return true
  5716. }
  5717. // assert node match
  5718. {
  5719. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5720. return false
  5721. }
  5722. }
  5723. if (isDef(data)) {
  5724. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5725. if (isDef(i = vnode.componentInstance)) {
  5726. // child component. it should have hydrated its own tree.
  5727. initComponent(vnode, insertedVnodeQueue);
  5728. return true
  5729. }
  5730. }
  5731. if (isDef(tag)) {
  5732. if (isDef(children)) {
  5733. // empty element, allow client to pick up and populate children
  5734. if (!elm.hasChildNodes()) {
  5735. createChildren(vnode, children, insertedVnodeQueue);
  5736. } else {
  5737. // v-html and domProps: innerHTML
  5738. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5739. if (i !== elm.innerHTML) {
  5740. /* istanbul ignore if */
  5741. if (typeof console !== 'undefined' &&
  5742. !hydrationBailed
  5743. ) {
  5744. hydrationBailed = true;
  5745. console.warn('Parent: ', elm);
  5746. console.warn('server innerHTML: ', i);
  5747. console.warn('client innerHTML: ', elm.innerHTML);
  5748. }
  5749. return false
  5750. }
  5751. } else {
  5752. // iterate and compare children lists
  5753. var childrenMatch = true;
  5754. var childNode = elm.firstChild;
  5755. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5756. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5757. childrenMatch = false;
  5758. break
  5759. }
  5760. childNode = childNode.nextSibling;
  5761. }
  5762. // if childNode is not null, it means the actual childNodes list is
  5763. // longer than the virtual children list.
  5764. if (!childrenMatch || childNode) {
  5765. /* istanbul ignore if */
  5766. if (typeof console !== 'undefined' &&
  5767. !hydrationBailed
  5768. ) {
  5769. hydrationBailed = true;
  5770. console.warn('Parent: ', elm);
  5771. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5772. }
  5773. return false
  5774. }
  5775. }
  5776. }
  5777. }
  5778. if (isDef(data)) {
  5779. var fullInvoke = false;
  5780. for (var key in data) {
  5781. if (!isRenderedModule(key)) {
  5782. fullInvoke = true;
  5783. invokeCreateHooks(vnode, insertedVnodeQueue);
  5784. break
  5785. }
  5786. }
  5787. if (!fullInvoke && data['class']) {
  5788. // ensure collecting deps for deep class bindings for future updates
  5789. traverse(data['class']);
  5790. }
  5791. }
  5792. } else if (elm.data !== vnode.text) {
  5793. elm.data = vnode.text;
  5794. }
  5795. return true
  5796. }
  5797. function assertNodeMatch (node, vnode, inVPre) {
  5798. if (isDef(vnode.tag)) {
  5799. return vnode.tag.indexOf('vue-component') === 0 || (
  5800. !isUnknownElement$$1(vnode, inVPre) &&
  5801. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5802. )
  5803. } else {
  5804. return node.nodeType === (vnode.isComment ? 8 : 3)
  5805. }
  5806. }
  5807. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5808. if (isUndef(vnode)) {
  5809. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5810. return
  5811. }
  5812. var isInitialPatch = false;
  5813. var insertedVnodeQueue = [];
  5814. if (isUndef(oldVnode)) {
  5815. // empty mount (likely as component), create new root element
  5816. isInitialPatch = true;
  5817. createElm(vnode, insertedVnodeQueue);
  5818. } else {
  5819. var isRealElement = isDef(oldVnode.nodeType);
  5820. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5821. // patch existing root node
  5822. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5823. } else {
  5824. if (isRealElement) {
  5825. // mounting to a real element
  5826. // check if this is server-rendered content and if we can perform
  5827. // a successful hydration.
  5828. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5829. oldVnode.removeAttribute(SSR_ATTR);
  5830. hydrating = true;
  5831. }
  5832. if (isTrue(hydrating)) {
  5833. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5834. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5835. return oldVnode
  5836. } else {
  5837. warn(
  5838. 'The client-side rendered virtual DOM tree is not matching ' +
  5839. 'server-rendered content. This is likely caused by incorrect ' +
  5840. 'HTML markup, for example nesting block-level elements inside ' +
  5841. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5842. 'full client-side render.'
  5843. );
  5844. }
  5845. }
  5846. // either not server-rendered, or hydration failed.
  5847. // create an empty node and replace it
  5848. oldVnode = emptyNodeAt(oldVnode);
  5849. }
  5850. // replacing existing element
  5851. var oldElm = oldVnode.elm;
  5852. var parentElm = nodeOps.parentNode(oldElm);
  5853. // create new node
  5854. createElm(
  5855. vnode,
  5856. insertedVnodeQueue,
  5857. // extremely rare edge case: do not insert if old element is in a
  5858. // leaving transition. Only happens when combining transition +
  5859. // keep-alive + HOCs. (#4590)
  5860. oldElm._leaveCb ? null : parentElm,
  5861. nodeOps.nextSibling(oldElm)
  5862. );
  5863. // update parent placeholder node element, recursively
  5864. if (isDef(vnode.parent)) {
  5865. var ancestor = vnode.parent;
  5866. var patchable = isPatchable(vnode);
  5867. while (ancestor) {
  5868. for (var i = 0; i < cbs.destroy.length; ++i) {
  5869. cbs.destroy[i](ancestor);
  5870. }
  5871. ancestor.elm = vnode.elm;
  5872. if (patchable) {
  5873. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5874. cbs.create[i$1](emptyNode, ancestor);
  5875. }
  5876. // #6513
  5877. // invoke insert hooks that may have been merged by create hooks.
  5878. // e.g. for directives that uses the "inserted" hook.
  5879. var insert = ancestor.data.hook.insert;
  5880. if (insert.merged) {
  5881. // start at index 1 to avoid re-invoking component mounted hook
  5882. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5883. insert.fns[i$2]();
  5884. }
  5885. }
  5886. } else {
  5887. registerRef(ancestor);
  5888. }
  5889. ancestor = ancestor.parent;
  5890. }
  5891. }
  5892. // destroy old node
  5893. if (isDef(parentElm)) {
  5894. removeVnodes(parentElm, [oldVnode], 0, 0);
  5895. } else if (isDef(oldVnode.tag)) {
  5896. invokeDestroyHook(oldVnode);
  5897. }
  5898. }
  5899. }
  5900. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5901. return vnode.elm
  5902. }
  5903. }
  5904. /* */
  5905. var directives = {
  5906. create: updateDirectives,
  5907. update: updateDirectives,
  5908. destroy: function unbindDirectives (vnode) {
  5909. updateDirectives(vnode, emptyNode);
  5910. }
  5911. };
  5912. function updateDirectives (oldVnode, vnode) {
  5913. if (oldVnode.data.directives || vnode.data.directives) {
  5914. _update(oldVnode, vnode);
  5915. }
  5916. }
  5917. function _update (oldVnode, vnode) {
  5918. var isCreate = oldVnode === emptyNode;
  5919. var isDestroy = vnode === emptyNode;
  5920. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5921. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5922. var dirsWithInsert = [];
  5923. var dirsWithPostpatch = [];
  5924. var key, oldDir, dir;
  5925. for (key in newDirs) {
  5926. oldDir = oldDirs[key];
  5927. dir = newDirs[key];
  5928. if (!oldDir) {
  5929. // new directive, bind
  5930. callHook$1(dir, 'bind', vnode, oldVnode);
  5931. if (dir.def && dir.def.inserted) {
  5932. dirsWithInsert.push(dir);
  5933. }
  5934. } else {
  5935. // existing directive, update
  5936. dir.oldValue = oldDir.value;
  5937. dir.oldArg = oldDir.arg;
  5938. callHook$1(dir, 'update', vnode, oldVnode);
  5939. if (dir.def && dir.def.componentUpdated) {
  5940. dirsWithPostpatch.push(dir);
  5941. }
  5942. }
  5943. }
  5944. if (dirsWithInsert.length) {
  5945. var callInsert = function () {
  5946. for (var i = 0; i < dirsWithInsert.length; i++) {
  5947. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5948. }
  5949. };
  5950. if (isCreate) {
  5951. mergeVNodeHook(vnode, 'insert', callInsert);
  5952. } else {
  5953. callInsert();
  5954. }
  5955. }
  5956. if (dirsWithPostpatch.length) {
  5957. mergeVNodeHook(vnode, 'postpatch', function () {
  5958. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5959. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5960. }
  5961. });
  5962. }
  5963. if (!isCreate) {
  5964. for (key in oldDirs) {
  5965. if (!newDirs[key]) {
  5966. // no longer present, unbind
  5967. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  5968. }
  5969. }
  5970. }
  5971. }
  5972. var emptyModifiers = Object.create(null);
  5973. function normalizeDirectives$1 (
  5974. dirs,
  5975. vm
  5976. ) {
  5977. var res = Object.create(null);
  5978. if (!dirs) {
  5979. // $flow-disable-line
  5980. return res
  5981. }
  5982. var i, dir;
  5983. for (i = 0; i < dirs.length; i++) {
  5984. dir = dirs[i];
  5985. if (!dir.modifiers) {
  5986. // $flow-disable-line
  5987. dir.modifiers = emptyModifiers;
  5988. }
  5989. res[getRawDirName(dir)] = dir;
  5990. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  5991. }
  5992. // $flow-disable-line
  5993. return res
  5994. }
  5995. function getRawDirName (dir) {
  5996. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  5997. }
  5998. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  5999. var fn = dir.def && dir.def[hook];
  6000. if (fn) {
  6001. try {
  6002. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6003. } catch (e) {
  6004. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6005. }
  6006. }
  6007. }
  6008. var baseModules = [
  6009. ref,
  6010. directives
  6011. ];
  6012. /* */
  6013. function updateAttrs (oldVnode, vnode) {
  6014. var opts = vnode.componentOptions;
  6015. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6016. return
  6017. }
  6018. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6019. return
  6020. }
  6021. var key, cur, old;
  6022. var elm = vnode.elm;
  6023. var oldAttrs = oldVnode.data.attrs || {};
  6024. var attrs = vnode.data.attrs || {};
  6025. // clone observed objects, as the user probably wants to mutate it
  6026. if (isDef(attrs.__ob__)) {
  6027. attrs = vnode.data.attrs = extend({}, attrs);
  6028. }
  6029. for (key in attrs) {
  6030. cur = attrs[key];
  6031. old = oldAttrs[key];
  6032. if (old !== cur) {
  6033. setAttr(elm, key, cur);
  6034. }
  6035. }
  6036. // #4391: in IE9, setting type can reset value for input[type=radio]
  6037. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6038. /* istanbul ignore if */
  6039. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6040. setAttr(elm, 'value', attrs.value);
  6041. }
  6042. for (key in oldAttrs) {
  6043. if (isUndef(attrs[key])) {
  6044. if (isXlink(key)) {
  6045. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6046. } else if (!isEnumeratedAttr(key)) {
  6047. elm.removeAttribute(key);
  6048. }
  6049. }
  6050. }
  6051. }
  6052. function setAttr (el, key, value) {
  6053. if (el.tagName.indexOf('-') > -1) {
  6054. baseSetAttr(el, key, value);
  6055. } else if (isBooleanAttr(key)) {
  6056. // set attribute for blank value
  6057. // e.g. <option disabled>Select one</option>
  6058. if (isFalsyAttrValue(value)) {
  6059. el.removeAttribute(key);
  6060. } else {
  6061. // technically allowfullscreen is a boolean attribute for <iframe>,
  6062. // but Flash expects a value of "true" when used on <embed> tag
  6063. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6064. ? 'true'
  6065. : key;
  6066. el.setAttribute(key, value);
  6067. }
  6068. } else if (isEnumeratedAttr(key)) {
  6069. el.setAttribute(key, convertEnumeratedValue(key, value));
  6070. } else if (isXlink(key)) {
  6071. if (isFalsyAttrValue(value)) {
  6072. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6073. } else {
  6074. el.setAttributeNS(xlinkNS, key, value);
  6075. }
  6076. } else {
  6077. baseSetAttr(el, key, value);
  6078. }
  6079. }
  6080. function baseSetAttr (el, key, value) {
  6081. if (isFalsyAttrValue(value)) {
  6082. el.removeAttribute(key);
  6083. } else {
  6084. // #7138: IE10 & 11 fires input event when setting placeholder on
  6085. // <textarea>... block the first input event and remove the blocker
  6086. // immediately.
  6087. /* istanbul ignore if */
  6088. if (
  6089. isIE && !isIE9 &&
  6090. el.tagName === 'TEXTAREA' &&
  6091. key === 'placeholder' && value !== '' && !el.__ieph
  6092. ) {
  6093. var blocker = function (e) {
  6094. e.stopImmediatePropagation();
  6095. el.removeEventListener('input', blocker);
  6096. };
  6097. el.addEventListener('input', blocker);
  6098. // $flow-disable-line
  6099. el.__ieph = true; /* IE placeholder patched */
  6100. }
  6101. el.setAttribute(key, value);
  6102. }
  6103. }
  6104. var attrs = {
  6105. create: updateAttrs,
  6106. update: updateAttrs
  6107. };
  6108. /* */
  6109. function updateClass (oldVnode, vnode) {
  6110. var el = vnode.elm;
  6111. var data = vnode.data;
  6112. var oldData = oldVnode.data;
  6113. if (
  6114. isUndef(data.staticClass) &&
  6115. isUndef(data.class) && (
  6116. isUndef(oldData) || (
  6117. isUndef(oldData.staticClass) &&
  6118. isUndef(oldData.class)
  6119. )
  6120. )
  6121. ) {
  6122. return
  6123. }
  6124. var cls = genClassForVnode(vnode);
  6125. // handle transition classes
  6126. var transitionClass = el._transitionClasses;
  6127. if (isDef(transitionClass)) {
  6128. cls = concat(cls, stringifyClass(transitionClass));
  6129. }
  6130. // set the class
  6131. if (cls !== el._prevClass) {
  6132. el.setAttribute('class', cls);
  6133. el._prevClass = cls;
  6134. }
  6135. }
  6136. var klass = {
  6137. create: updateClass,
  6138. update: updateClass
  6139. };
  6140. /* */
  6141. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6142. function parseFilters (exp) {
  6143. var inSingle = false;
  6144. var inDouble = false;
  6145. var inTemplateString = false;
  6146. var inRegex = false;
  6147. var curly = 0;
  6148. var square = 0;
  6149. var paren = 0;
  6150. var lastFilterIndex = 0;
  6151. var c, prev, i, expression, filters;
  6152. for (i = 0; i < exp.length; i++) {
  6153. prev = c;
  6154. c = exp.charCodeAt(i);
  6155. if (inSingle) {
  6156. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  6157. } else if (inDouble) {
  6158. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  6159. } else if (inTemplateString) {
  6160. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  6161. } else if (inRegex) {
  6162. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  6163. } else if (
  6164. c === 0x7C && // pipe
  6165. exp.charCodeAt(i + 1) !== 0x7C &&
  6166. exp.charCodeAt(i - 1) !== 0x7C &&
  6167. !curly && !square && !paren
  6168. ) {
  6169. if (expression === undefined) {
  6170. // first filter, end of expression
  6171. lastFilterIndex = i + 1;
  6172. expression = exp.slice(0, i).trim();
  6173. } else {
  6174. pushFilter();
  6175. }
  6176. } else {
  6177. switch (c) {
  6178. case 0x22: inDouble = true; break // "
  6179. case 0x27: inSingle = true; break // '
  6180. case 0x60: inTemplateString = true; break // `
  6181. case 0x28: paren++; break // (
  6182. case 0x29: paren--; break // )
  6183. case 0x5B: square++; break // [
  6184. case 0x5D: square--; break // ]
  6185. case 0x7B: curly++; break // {
  6186. case 0x7D: curly--; break // }
  6187. }
  6188. if (c === 0x2f) { // /
  6189. var j = i - 1;
  6190. var p = (void 0);
  6191. // find first non-whitespace prev char
  6192. for (; j >= 0; j--) {
  6193. p = exp.charAt(j);
  6194. if (p !== ' ') { break }
  6195. }
  6196. if (!p || !validDivisionCharRE.test(p)) {
  6197. inRegex = true;
  6198. }
  6199. }
  6200. }
  6201. }
  6202. if (expression === undefined) {
  6203. expression = exp.slice(0, i).trim();
  6204. } else if (lastFilterIndex !== 0) {
  6205. pushFilter();
  6206. }
  6207. function pushFilter () {
  6208. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6209. lastFilterIndex = i + 1;
  6210. }
  6211. if (filters) {
  6212. for (i = 0; i < filters.length; i++) {
  6213. expression = wrapFilter(expression, filters[i]);
  6214. }
  6215. }
  6216. return expression
  6217. }
  6218. function wrapFilter (exp, filter) {
  6219. var i = filter.indexOf('(');
  6220. if (i < 0) {
  6221. // _f: resolveFilter
  6222. return ("_f(\"" + filter + "\")(" + exp + ")")
  6223. } else {
  6224. var name = filter.slice(0, i);
  6225. var args = filter.slice(i + 1);
  6226. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6227. }
  6228. }
  6229. /* */
  6230. /* eslint-disable no-unused-vars */
  6231. function baseWarn (msg, range) {
  6232. console.error(("[Vue compiler]: " + msg));
  6233. }
  6234. /* eslint-enable no-unused-vars */
  6235. function pluckModuleFunction (
  6236. modules,
  6237. key
  6238. ) {
  6239. return modules
  6240. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6241. : []
  6242. }
  6243. function addProp (el, name, value, range, dynamic) {
  6244. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6245. el.plain = false;
  6246. }
  6247. function addAttr (el, name, value, range, dynamic) {
  6248. var attrs = dynamic
  6249. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  6250. : (el.attrs || (el.attrs = []));
  6251. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6252. el.plain = false;
  6253. }
  6254. // add a raw attr (use this in preTransforms)
  6255. function addRawAttr (el, name, value, range) {
  6256. el.attrsMap[name] = value;
  6257. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  6258. }
  6259. function addDirective (
  6260. el,
  6261. name,
  6262. rawName,
  6263. value,
  6264. arg,
  6265. isDynamicArg,
  6266. modifiers,
  6267. range
  6268. ) {
  6269. (el.directives || (el.directives = [])).push(rangeSetItem({
  6270. name: name,
  6271. rawName: rawName,
  6272. value: value,
  6273. arg: arg,
  6274. isDynamicArg: isDynamicArg,
  6275. modifiers: modifiers
  6276. }, range));
  6277. el.plain = false;
  6278. }
  6279. function prependModifierMarker (symbol, name, dynamic) {
  6280. return dynamic
  6281. ? ("_p(" + name + ",\"" + symbol + "\")")
  6282. : symbol + name // mark the event as captured
  6283. }
  6284. function addHandler (
  6285. el,
  6286. name,
  6287. value,
  6288. modifiers,
  6289. important,
  6290. warn,
  6291. range,
  6292. dynamic
  6293. ) {
  6294. modifiers = modifiers || emptyObject;
  6295. // warn prevent and passive modifier
  6296. /* istanbul ignore if */
  6297. if (
  6298. warn &&
  6299. modifiers.prevent && modifiers.passive
  6300. ) {
  6301. warn(
  6302. 'passive and prevent can\'t be used together. ' +
  6303. 'Passive handler can\'t prevent default event.',
  6304. range
  6305. );
  6306. }
  6307. // normalize click.right and click.middle since they don't actually fire
  6308. // this is technically browser-specific, but at least for now browsers are
  6309. // the only target envs that have right/middle clicks.
  6310. if (modifiers.right) {
  6311. if (dynamic) {
  6312. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  6313. } else if (name === 'click') {
  6314. name = 'contextmenu';
  6315. delete modifiers.right;
  6316. }
  6317. } else if (modifiers.middle) {
  6318. if (dynamic) {
  6319. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  6320. } else if (name === 'click') {
  6321. name = 'mouseup';
  6322. }
  6323. }
  6324. // check capture modifier
  6325. if (modifiers.capture) {
  6326. delete modifiers.capture;
  6327. name = prependModifierMarker('!', name, dynamic);
  6328. }
  6329. if (modifiers.once) {
  6330. delete modifiers.once;
  6331. name = prependModifierMarker('~', name, dynamic);
  6332. }
  6333. /* istanbul ignore if */
  6334. if (modifiers.passive) {
  6335. delete modifiers.passive;
  6336. name = prependModifierMarker('&', name, dynamic);
  6337. }
  6338. var events;
  6339. if (modifiers.native) {
  6340. delete modifiers.native;
  6341. events = el.nativeEvents || (el.nativeEvents = {});
  6342. } else {
  6343. events = el.events || (el.events = {});
  6344. }
  6345. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  6346. if (modifiers !== emptyObject) {
  6347. newHandler.modifiers = modifiers;
  6348. }
  6349. var handlers = events[name];
  6350. /* istanbul ignore if */
  6351. if (Array.isArray(handlers)) {
  6352. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6353. } else if (handlers) {
  6354. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6355. } else {
  6356. events[name] = newHandler;
  6357. }
  6358. el.plain = false;
  6359. }
  6360. function getRawBindingAttr (
  6361. el,
  6362. name
  6363. ) {
  6364. return el.rawAttrsMap[':' + name] ||
  6365. el.rawAttrsMap['v-bind:' + name] ||
  6366. el.rawAttrsMap[name]
  6367. }
  6368. function getBindingAttr (
  6369. el,
  6370. name,
  6371. getStatic
  6372. ) {
  6373. var dynamicValue =
  6374. getAndRemoveAttr(el, ':' + name) ||
  6375. getAndRemoveAttr(el, 'v-bind:' + name);
  6376. if (dynamicValue != null) {
  6377. return parseFilters(dynamicValue)
  6378. } else if (getStatic !== false) {
  6379. var staticValue = getAndRemoveAttr(el, name);
  6380. if (staticValue != null) {
  6381. return JSON.stringify(staticValue)
  6382. }
  6383. }
  6384. }
  6385. // note: this only removes the attr from the Array (attrsList) so that it
  6386. // doesn't get processed by processAttrs.
  6387. // By default it does NOT remove it from the map (attrsMap) because the map is
  6388. // needed during codegen.
  6389. function getAndRemoveAttr (
  6390. el,
  6391. name,
  6392. removeFromMap
  6393. ) {
  6394. var val;
  6395. if ((val = el.attrsMap[name]) != null) {
  6396. var list = el.attrsList;
  6397. for (var i = 0, l = list.length; i < l; i++) {
  6398. if (list[i].name === name) {
  6399. list.splice(i, 1);
  6400. break
  6401. }
  6402. }
  6403. }
  6404. if (removeFromMap) {
  6405. delete el.attrsMap[name];
  6406. }
  6407. return val
  6408. }
  6409. function getAndRemoveAttrByRegex (
  6410. el,
  6411. name
  6412. ) {
  6413. var list = el.attrsList;
  6414. for (var i = 0, l = list.length; i < l; i++) {
  6415. var attr = list[i];
  6416. if (name.test(attr.name)) {
  6417. list.splice(i, 1);
  6418. return attr
  6419. }
  6420. }
  6421. }
  6422. function rangeSetItem (
  6423. item,
  6424. range
  6425. ) {
  6426. if (range) {
  6427. if (range.start != null) {
  6428. item.start = range.start;
  6429. }
  6430. if (range.end != null) {
  6431. item.end = range.end;
  6432. }
  6433. }
  6434. return item
  6435. }
  6436. /* */
  6437. /**
  6438. * Cross-platform code generation for component v-model
  6439. */
  6440. function genComponentModel (
  6441. el,
  6442. value,
  6443. modifiers
  6444. ) {
  6445. var ref = modifiers || {};
  6446. var number = ref.number;
  6447. var trim = ref.trim;
  6448. var baseValueExpression = '$$v';
  6449. var valueExpression = baseValueExpression;
  6450. if (trim) {
  6451. valueExpression =
  6452. "(typeof " + baseValueExpression + " === 'string'" +
  6453. "? " + baseValueExpression + ".trim()" +
  6454. ": " + baseValueExpression + ")";
  6455. }
  6456. if (number) {
  6457. valueExpression = "_n(" + valueExpression + ")";
  6458. }
  6459. var assignment = genAssignmentCode(value, valueExpression);
  6460. el.model = {
  6461. value: ("(" + value + ")"),
  6462. expression: JSON.stringify(value),
  6463. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6464. };
  6465. }
  6466. /**
  6467. * Cross-platform codegen helper for generating v-model value assignment code.
  6468. */
  6469. function genAssignmentCode (
  6470. value,
  6471. assignment
  6472. ) {
  6473. var res = parseModel(value);
  6474. if (res.key === null) {
  6475. return (value + "=" + assignment)
  6476. } else {
  6477. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6478. }
  6479. }
  6480. /**
  6481. * Parse a v-model expression into a base path and a final key segment.
  6482. * Handles both dot-path and possible square brackets.
  6483. *
  6484. * Possible cases:
  6485. *
  6486. * - test
  6487. * - test[key]
  6488. * - test[test1[key]]
  6489. * - test["a"][key]
  6490. * - xxx.test[a[a].test1[key]]
  6491. * - test.xxx.a["asa"][test1[key]]
  6492. *
  6493. */
  6494. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6495. function parseModel (val) {
  6496. // Fix https://github.com/vuejs/vue/pull/7730
  6497. // allow v-model="obj.val " (trailing whitespace)
  6498. val = val.trim();
  6499. len = val.length;
  6500. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6501. index$1 = val.lastIndexOf('.');
  6502. if (index$1 > -1) {
  6503. return {
  6504. exp: val.slice(0, index$1),
  6505. key: '"' + val.slice(index$1 + 1) + '"'
  6506. }
  6507. } else {
  6508. return {
  6509. exp: val,
  6510. key: null
  6511. }
  6512. }
  6513. }
  6514. str = val;
  6515. index$1 = expressionPos = expressionEndPos = 0;
  6516. while (!eof()) {
  6517. chr = next();
  6518. /* istanbul ignore if */
  6519. if (isStringStart(chr)) {
  6520. parseString(chr);
  6521. } else if (chr === 0x5B) {
  6522. parseBracket(chr);
  6523. }
  6524. }
  6525. return {
  6526. exp: val.slice(0, expressionPos),
  6527. key: val.slice(expressionPos + 1, expressionEndPos)
  6528. }
  6529. }
  6530. function next () {
  6531. return str.charCodeAt(++index$1)
  6532. }
  6533. function eof () {
  6534. return index$1 >= len
  6535. }
  6536. function isStringStart (chr) {
  6537. return chr === 0x22 || chr === 0x27
  6538. }
  6539. function parseBracket (chr) {
  6540. var inBracket = 1;
  6541. expressionPos = index$1;
  6542. while (!eof()) {
  6543. chr = next();
  6544. if (isStringStart(chr)) {
  6545. parseString(chr);
  6546. continue
  6547. }
  6548. if (chr === 0x5B) { inBracket++; }
  6549. if (chr === 0x5D) { inBracket--; }
  6550. if (inBracket === 0) {
  6551. expressionEndPos = index$1;
  6552. break
  6553. }
  6554. }
  6555. }
  6556. function parseString (chr) {
  6557. var stringQuote = chr;
  6558. while (!eof()) {
  6559. chr = next();
  6560. if (chr === stringQuote) {
  6561. break
  6562. }
  6563. }
  6564. }
  6565. /* */
  6566. var warn$1;
  6567. // in some cases, the event used has to be determined at runtime
  6568. // so we used some reserved tokens during compile.
  6569. var RANGE_TOKEN = '__r';
  6570. var CHECKBOX_RADIO_TOKEN = '__c';
  6571. function model (
  6572. el,
  6573. dir,
  6574. _warn
  6575. ) {
  6576. warn$1 = _warn;
  6577. var value = dir.value;
  6578. var modifiers = dir.modifiers;
  6579. var tag = el.tag;
  6580. var type = el.attrsMap.type;
  6581. {
  6582. // inputs with type="file" are read only and setting the input's
  6583. // value will throw an error.
  6584. if (tag === 'input' && type === 'file') {
  6585. warn$1(
  6586. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6587. "File inputs are read only. Use a v-on:change listener instead.",
  6588. el.rawAttrsMap['v-model']
  6589. );
  6590. }
  6591. }
  6592. if (el.component) {
  6593. genComponentModel(el, value, modifiers);
  6594. // component v-model doesn't need extra runtime
  6595. return false
  6596. } else if (tag === 'select') {
  6597. genSelect(el, value, modifiers);
  6598. } else if (tag === 'input' && type === 'checkbox') {
  6599. genCheckboxModel(el, value, modifiers);
  6600. } else if (tag === 'input' && type === 'radio') {
  6601. genRadioModel(el, value, modifiers);
  6602. } else if (tag === 'input' || tag === 'textarea') {
  6603. genDefaultModel(el, value, modifiers);
  6604. } else if (!config.isReservedTag(tag)) {
  6605. genComponentModel(el, value, modifiers);
  6606. // component v-model doesn't need extra runtime
  6607. return false
  6608. } else {
  6609. warn$1(
  6610. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6611. "v-model is not supported on this element type. " +
  6612. 'If you are working with contenteditable, it\'s recommended to ' +
  6613. 'wrap a library dedicated for that purpose inside a custom component.',
  6614. el.rawAttrsMap['v-model']
  6615. );
  6616. }
  6617. // ensure runtime directive metadata
  6618. return true
  6619. }
  6620. function genCheckboxModel (
  6621. el,
  6622. value,
  6623. modifiers
  6624. ) {
  6625. var number = modifiers && modifiers.number;
  6626. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6627. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6628. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6629. addProp(el, 'checked',
  6630. "Array.isArray(" + value + ")" +
  6631. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6632. trueValueBinding === 'true'
  6633. ? (":(" + value + ")")
  6634. : (":_q(" + value + "," + trueValueBinding + ")")
  6635. )
  6636. );
  6637. addHandler(el, 'change',
  6638. "var $$a=" + value + "," +
  6639. '$$el=$event.target,' +
  6640. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6641. 'if(Array.isArray($$a)){' +
  6642. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6643. '$$i=_i($$a,$$v);' +
  6644. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6645. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6646. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6647. null, true
  6648. );
  6649. }
  6650. function genRadioModel (
  6651. el,
  6652. value,
  6653. modifiers
  6654. ) {
  6655. var number = modifiers && modifiers.number;
  6656. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6657. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6658. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6659. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6660. }
  6661. function genSelect (
  6662. el,
  6663. value,
  6664. modifiers
  6665. ) {
  6666. var number = modifiers && modifiers.number;
  6667. var selectedVal = "Array.prototype.filter" +
  6668. ".call($event.target.options,function(o){return o.selected})" +
  6669. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6670. "return " + (number ? '_n(val)' : 'val') + "})";
  6671. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6672. var code = "var $$selectedVal = " + selectedVal + ";";
  6673. code = code + " " + (genAssignmentCode(value, assignment));
  6674. addHandler(el, 'change', code, null, true);
  6675. }
  6676. function genDefaultModel (
  6677. el,
  6678. value,
  6679. modifiers
  6680. ) {
  6681. var type = el.attrsMap.type;
  6682. // warn if v-bind:value conflicts with v-model
  6683. // except for inputs with v-bind:type
  6684. {
  6685. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6686. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6687. if (value$1 && !typeBinding) {
  6688. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6689. warn$1(
  6690. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6691. 'because the latter already expands to a value binding internally',
  6692. el.rawAttrsMap[binding]
  6693. );
  6694. }
  6695. }
  6696. var ref = modifiers || {};
  6697. var lazy = ref.lazy;
  6698. var number = ref.number;
  6699. var trim = ref.trim;
  6700. var needCompositionGuard = !lazy && type !== 'range';
  6701. var event = lazy
  6702. ? 'change'
  6703. : type === 'range'
  6704. ? RANGE_TOKEN
  6705. : 'input';
  6706. var valueExpression = '$event.target.value';
  6707. if (trim) {
  6708. valueExpression = "$event.target.value.trim()";
  6709. }
  6710. if (number) {
  6711. valueExpression = "_n(" + valueExpression + ")";
  6712. }
  6713. var code = genAssignmentCode(value, valueExpression);
  6714. if (needCompositionGuard) {
  6715. code = "if($event.target.composing)return;" + code;
  6716. }
  6717. addProp(el, 'value', ("(" + value + ")"));
  6718. addHandler(el, event, code, null, true);
  6719. if (trim || number) {
  6720. addHandler(el, 'blur', '$forceUpdate()');
  6721. }
  6722. }
  6723. /* */
  6724. // normalize v-model event tokens that can only be determined at runtime.
  6725. // it's important to place the event as the first in the array because
  6726. // the whole point is ensuring the v-model callback gets called before
  6727. // user-attached handlers.
  6728. function normalizeEvents (on) {
  6729. /* istanbul ignore if */
  6730. if (isDef(on[RANGE_TOKEN])) {
  6731. // IE input[type=range] only supports `change` event
  6732. var event = isIE ? 'change' : 'input';
  6733. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6734. delete on[RANGE_TOKEN];
  6735. }
  6736. // This was originally intended to fix #4521 but no longer necessary
  6737. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6738. /* istanbul ignore if */
  6739. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6740. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6741. delete on[CHECKBOX_RADIO_TOKEN];
  6742. }
  6743. }
  6744. var target$1;
  6745. function createOnceHandler$1 (event, handler, capture) {
  6746. var _target = target$1; // save current target element in closure
  6747. return function onceHandler () {
  6748. var res = handler.apply(null, arguments);
  6749. if (res !== null) {
  6750. remove$2(event, onceHandler, capture, _target);
  6751. }
  6752. }
  6753. }
  6754. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6755. // implementation and does not fire microtasks in between event propagation, so
  6756. // safe to exclude.
  6757. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6758. function add$1 (
  6759. name,
  6760. handler,
  6761. capture,
  6762. passive
  6763. ) {
  6764. // async edge case #6566: inner click event triggers patch, event handler
  6765. // attached to outer element during patch, and triggered again. This
  6766. // happens because browsers fire microtask ticks between event propagation.
  6767. // the solution is simple: we save the timestamp when a handler is attached,
  6768. // and the handler would only fire if the event passed to it was fired
  6769. // AFTER it was attached.
  6770. if (useMicrotaskFix) {
  6771. var attachedTimestamp = currentFlushTimestamp;
  6772. var original = handler;
  6773. handler = original._wrapper = function (e) {
  6774. if (
  6775. // no bubbling, should always fire.
  6776. // this is just a safety net in case event.timeStamp is unreliable in
  6777. // certain weird environments...
  6778. e.target === e.currentTarget ||
  6779. // event is fired after handler attachment
  6780. e.timeStamp >= attachedTimestamp ||
  6781. // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
  6782. e.timeStamp === 0 ||
  6783. // #9448 bail if event is fired in another document in a multi-page
  6784. // electron/nw.js app, since event.timeStamp will be using a different
  6785. // starting reference
  6786. e.target.ownerDocument !== document
  6787. ) {
  6788. return original.apply(this, arguments)
  6789. }
  6790. };
  6791. }
  6792. target$1.addEventListener(
  6793. name,
  6794. handler,
  6795. supportsPassive
  6796. ? { capture: capture, passive: passive }
  6797. : capture
  6798. );
  6799. }
  6800. function remove$2 (
  6801. name,
  6802. handler,
  6803. capture,
  6804. _target
  6805. ) {
  6806. (_target || target$1).removeEventListener(
  6807. name,
  6808. handler._wrapper || handler,
  6809. capture
  6810. );
  6811. }
  6812. function updateDOMListeners (oldVnode, vnode) {
  6813. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6814. return
  6815. }
  6816. var on = vnode.data.on || {};
  6817. var oldOn = oldVnode.data.on || {};
  6818. target$1 = vnode.elm;
  6819. normalizeEvents(on);
  6820. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6821. target$1 = undefined;
  6822. }
  6823. var events = {
  6824. create: updateDOMListeners,
  6825. update: updateDOMListeners
  6826. };
  6827. /* */
  6828. var svgContainer;
  6829. function updateDOMProps (oldVnode, vnode) {
  6830. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6831. return
  6832. }
  6833. var key, cur;
  6834. var elm = vnode.elm;
  6835. var oldProps = oldVnode.data.domProps || {};
  6836. var props = vnode.data.domProps || {};
  6837. // clone observed objects, as the user probably wants to mutate it
  6838. if (isDef(props.__ob__)) {
  6839. props = vnode.data.domProps = extend({}, props);
  6840. }
  6841. for (key in oldProps) {
  6842. if (isUndef(props[key])) {
  6843. elm[key] = '';
  6844. }
  6845. }
  6846. for (key in props) {
  6847. cur = props[key];
  6848. // ignore children if the node has textContent or innerHTML,
  6849. // as these will throw away existing DOM nodes and cause removal errors
  6850. // on subsequent patches (#3360)
  6851. if (key === 'textContent' || key === 'innerHTML') {
  6852. if (vnode.children) { vnode.children.length = 0; }
  6853. if (cur === oldProps[key]) { continue }
  6854. // #6601 work around Chrome version <= 55 bug where single textNode
  6855. // replaced by innerHTML/textContent retains its parentNode property
  6856. if (elm.childNodes.length === 1) {
  6857. elm.removeChild(elm.childNodes[0]);
  6858. }
  6859. }
  6860. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6861. // store value as _value as well since
  6862. // non-string values will be stringified
  6863. elm._value = cur;
  6864. // avoid resetting cursor position when value is the same
  6865. var strCur = isUndef(cur) ? '' : String(cur);
  6866. if (shouldUpdateValue(elm, strCur)) {
  6867. elm.value = strCur;
  6868. }
  6869. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6870. // IE doesn't support innerHTML for SVG elements
  6871. svgContainer = svgContainer || document.createElement('div');
  6872. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6873. var svg = svgContainer.firstChild;
  6874. while (elm.firstChild) {
  6875. elm.removeChild(elm.firstChild);
  6876. }
  6877. while (svg.firstChild) {
  6878. elm.appendChild(svg.firstChild);
  6879. }
  6880. } else if (
  6881. // skip the update if old and new VDOM state is the same.
  6882. // `value` is handled separately because the DOM value may be temporarily
  6883. // out of sync with VDOM state due to focus, composition and modifiers.
  6884. // This #4521 by skipping the unnecesarry `checked` update.
  6885. cur !== oldProps[key]
  6886. ) {
  6887. // some property updates can throw
  6888. // e.g. `value` on <progress> w/ non-finite value
  6889. try {
  6890. elm[key] = cur;
  6891. } catch (e) {}
  6892. }
  6893. }
  6894. }
  6895. // check platforms/web/util/attrs.js acceptValue
  6896. function shouldUpdateValue (elm, checkVal) {
  6897. return (!elm.composing && (
  6898. elm.tagName === 'OPTION' ||
  6899. isNotInFocusAndDirty(elm, checkVal) ||
  6900. isDirtyWithModifiers(elm, checkVal)
  6901. ))
  6902. }
  6903. function isNotInFocusAndDirty (elm, checkVal) {
  6904. // return true when textbox (.number and .trim) loses focus and its value is
  6905. // not equal to the updated value
  6906. var notInFocus = true;
  6907. // #6157
  6908. // work around IE bug when accessing document.activeElement in an iframe
  6909. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6910. return notInFocus && elm.value !== checkVal
  6911. }
  6912. function isDirtyWithModifiers (elm, newVal) {
  6913. var value = elm.value;
  6914. var modifiers = elm._vModifiers; // injected by v-model runtime
  6915. if (isDef(modifiers)) {
  6916. if (modifiers.number) {
  6917. return toNumber(value) !== toNumber(newVal)
  6918. }
  6919. if (modifiers.trim) {
  6920. return value.trim() !== newVal.trim()
  6921. }
  6922. }
  6923. return value !== newVal
  6924. }
  6925. var domProps = {
  6926. create: updateDOMProps,
  6927. update: updateDOMProps
  6928. };
  6929. /* */
  6930. var parseStyleText = cached(function (cssText) {
  6931. var res = {};
  6932. var listDelimiter = /;(?![^(]*\))/g;
  6933. var propertyDelimiter = /:(.+)/;
  6934. cssText.split(listDelimiter).forEach(function (item) {
  6935. if (item) {
  6936. var tmp = item.split(propertyDelimiter);
  6937. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6938. }
  6939. });
  6940. return res
  6941. });
  6942. // merge static and dynamic style data on the same vnode
  6943. function normalizeStyleData (data) {
  6944. var style = normalizeStyleBinding(data.style);
  6945. // static style is pre-processed into an object during compilation
  6946. // and is always a fresh object, so it's safe to merge into it
  6947. return data.staticStyle
  6948. ? extend(data.staticStyle, style)
  6949. : style
  6950. }
  6951. // normalize possible array / string values into Object
  6952. function normalizeStyleBinding (bindingStyle) {
  6953. if (Array.isArray(bindingStyle)) {
  6954. return toObject(bindingStyle)
  6955. }
  6956. if (typeof bindingStyle === 'string') {
  6957. return parseStyleText(bindingStyle)
  6958. }
  6959. return bindingStyle
  6960. }
  6961. /**
  6962. * parent component style should be after child's
  6963. * so that parent component's style could override it
  6964. */
  6965. function getStyle (vnode, checkChild) {
  6966. var res = {};
  6967. var styleData;
  6968. if (checkChild) {
  6969. var childNode = vnode;
  6970. while (childNode.componentInstance) {
  6971. childNode = childNode.componentInstance._vnode;
  6972. if (
  6973. childNode && childNode.data &&
  6974. (styleData = normalizeStyleData(childNode.data))
  6975. ) {
  6976. extend(res, styleData);
  6977. }
  6978. }
  6979. }
  6980. if ((styleData = normalizeStyleData(vnode.data))) {
  6981. extend(res, styleData);
  6982. }
  6983. var parentNode = vnode;
  6984. while ((parentNode = parentNode.parent)) {
  6985. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  6986. extend(res, styleData);
  6987. }
  6988. }
  6989. return res
  6990. }
  6991. /* */
  6992. var cssVarRE = /^--/;
  6993. var importantRE = /\s*!important$/;
  6994. var setProp = function (el, name, val) {
  6995. /* istanbul ignore if */
  6996. if (cssVarRE.test(name)) {
  6997. el.style.setProperty(name, val);
  6998. } else if (importantRE.test(val)) {
  6999. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  7000. } else {
  7001. var normalizedName = normalize(name);
  7002. if (Array.isArray(val)) {
  7003. // Support values array created by autoprefixer, e.g.
  7004. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  7005. // Set them one by one, and the browser will only set those it can recognize
  7006. for (var i = 0, len = val.length; i < len; i++) {
  7007. el.style[normalizedName] = val[i];
  7008. }
  7009. } else {
  7010. el.style[normalizedName] = val;
  7011. }
  7012. }
  7013. };
  7014. var vendorNames = ['Webkit', 'Moz', 'ms'];
  7015. var emptyStyle;
  7016. var normalize = cached(function (prop) {
  7017. emptyStyle = emptyStyle || document.createElement('div').style;
  7018. prop = camelize(prop);
  7019. if (prop !== 'filter' && (prop in emptyStyle)) {
  7020. return prop
  7021. }
  7022. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  7023. for (var i = 0; i < vendorNames.length; i++) {
  7024. var name = vendorNames[i] + capName;
  7025. if (name in emptyStyle) {
  7026. return name
  7027. }
  7028. }
  7029. });
  7030. function updateStyle (oldVnode, vnode) {
  7031. var data = vnode.data;
  7032. var oldData = oldVnode.data;
  7033. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7034. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7035. ) {
  7036. return
  7037. }
  7038. var cur, name;
  7039. var el = vnode.elm;
  7040. var oldStaticStyle = oldData.staticStyle;
  7041. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7042. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7043. var oldStyle = oldStaticStyle || oldStyleBinding;
  7044. var style = normalizeStyleBinding(vnode.data.style) || {};
  7045. // store normalized style under a different key for next diff
  7046. // make sure to clone it if it's reactive, since the user likely wants
  7047. // to mutate it.
  7048. vnode.data.normalizedStyle = isDef(style.__ob__)
  7049. ? extend({}, style)
  7050. : style;
  7051. var newStyle = getStyle(vnode, true);
  7052. for (name in oldStyle) {
  7053. if (isUndef(newStyle[name])) {
  7054. setProp(el, name, '');
  7055. }
  7056. }
  7057. for (name in newStyle) {
  7058. cur = newStyle[name];
  7059. if (cur !== oldStyle[name]) {
  7060. // ie9 setting to null has no effect, must use empty string
  7061. setProp(el, name, cur == null ? '' : cur);
  7062. }
  7063. }
  7064. }
  7065. var style = {
  7066. create: updateStyle,
  7067. update: updateStyle
  7068. };
  7069. /* */
  7070. var whitespaceRE = /\s+/;
  7071. /**
  7072. * Add class with compatibility for SVG since classList is not supported on
  7073. * SVG elements in IE
  7074. */
  7075. function addClass (el, cls) {
  7076. /* istanbul ignore if */
  7077. if (!cls || !(cls = cls.trim())) {
  7078. return
  7079. }
  7080. /* istanbul ignore else */
  7081. if (el.classList) {
  7082. if (cls.indexOf(' ') > -1) {
  7083. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  7084. } else {
  7085. el.classList.add(cls);
  7086. }
  7087. } else {
  7088. var cur = " " + (el.getAttribute('class') || '') + " ";
  7089. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7090. el.setAttribute('class', (cur + cls).trim());
  7091. }
  7092. }
  7093. }
  7094. /**
  7095. * Remove class with compatibility for SVG since classList is not supported on
  7096. * SVG elements in IE
  7097. */
  7098. function removeClass (el, cls) {
  7099. /* istanbul ignore if */
  7100. if (!cls || !(cls = cls.trim())) {
  7101. return
  7102. }
  7103. /* istanbul ignore else */
  7104. if (el.classList) {
  7105. if (cls.indexOf(' ') > -1) {
  7106. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  7107. } else {
  7108. el.classList.remove(cls);
  7109. }
  7110. if (!el.classList.length) {
  7111. el.removeAttribute('class');
  7112. }
  7113. } else {
  7114. var cur = " " + (el.getAttribute('class') || '') + " ";
  7115. var tar = ' ' + cls + ' ';
  7116. while (cur.indexOf(tar) >= 0) {
  7117. cur = cur.replace(tar, ' ');
  7118. }
  7119. cur = cur.trim();
  7120. if (cur) {
  7121. el.setAttribute('class', cur);
  7122. } else {
  7123. el.removeAttribute('class');
  7124. }
  7125. }
  7126. }
  7127. /* */
  7128. function resolveTransition (def$$1) {
  7129. if (!def$$1) {
  7130. return
  7131. }
  7132. /* istanbul ignore else */
  7133. if (typeof def$$1 === 'object') {
  7134. var res = {};
  7135. if (def$$1.css !== false) {
  7136. extend(res, autoCssTransition(def$$1.name || 'v'));
  7137. }
  7138. extend(res, def$$1);
  7139. return res
  7140. } else if (typeof def$$1 === 'string') {
  7141. return autoCssTransition(def$$1)
  7142. }
  7143. }
  7144. var autoCssTransition = cached(function (name) {
  7145. return {
  7146. enterClass: (name + "-enter"),
  7147. enterToClass: (name + "-enter-to"),
  7148. enterActiveClass: (name + "-enter-active"),
  7149. leaveClass: (name + "-leave"),
  7150. leaveToClass: (name + "-leave-to"),
  7151. leaveActiveClass: (name + "-leave-active")
  7152. }
  7153. });
  7154. var hasTransition = inBrowser && !isIE9;
  7155. var TRANSITION = 'transition';
  7156. var ANIMATION = 'animation';
  7157. // Transition property/event sniffing
  7158. var transitionProp = 'transition';
  7159. var transitionEndEvent = 'transitionend';
  7160. var animationProp = 'animation';
  7161. var animationEndEvent = 'animationend';
  7162. if (hasTransition) {
  7163. /* istanbul ignore if */
  7164. if (window.ontransitionend === undefined &&
  7165. window.onwebkittransitionend !== undefined
  7166. ) {
  7167. transitionProp = 'WebkitTransition';
  7168. transitionEndEvent = 'webkitTransitionEnd';
  7169. }
  7170. if (window.onanimationend === undefined &&
  7171. window.onwebkitanimationend !== undefined
  7172. ) {
  7173. animationProp = 'WebkitAnimation';
  7174. animationEndEvent = 'webkitAnimationEnd';
  7175. }
  7176. }
  7177. // binding to window is necessary to make hot reload work in IE in strict mode
  7178. var raf = inBrowser
  7179. ? window.requestAnimationFrame
  7180. ? window.requestAnimationFrame.bind(window)
  7181. : setTimeout
  7182. : /* istanbul ignore next */ function (fn) { return fn(); };
  7183. function nextFrame (fn) {
  7184. raf(function () {
  7185. raf(fn);
  7186. });
  7187. }
  7188. function addTransitionClass (el, cls) {
  7189. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7190. if (transitionClasses.indexOf(cls) < 0) {
  7191. transitionClasses.push(cls);
  7192. addClass(el, cls);
  7193. }
  7194. }
  7195. function removeTransitionClass (el, cls) {
  7196. if (el._transitionClasses) {
  7197. remove(el._transitionClasses, cls);
  7198. }
  7199. removeClass(el, cls);
  7200. }
  7201. function whenTransitionEnds (
  7202. el,
  7203. expectedType,
  7204. cb
  7205. ) {
  7206. var ref = getTransitionInfo(el, expectedType);
  7207. var type = ref.type;
  7208. var timeout = ref.timeout;
  7209. var propCount = ref.propCount;
  7210. if (!type) { return cb() }
  7211. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  7212. var ended = 0;
  7213. var end = function () {
  7214. el.removeEventListener(event, onEnd);
  7215. cb();
  7216. };
  7217. var onEnd = function (e) {
  7218. if (e.target === el) {
  7219. if (++ended >= propCount) {
  7220. end();
  7221. }
  7222. }
  7223. };
  7224. setTimeout(function () {
  7225. if (ended < propCount) {
  7226. end();
  7227. }
  7228. }, timeout + 1);
  7229. el.addEventListener(event, onEnd);
  7230. }
  7231. var transformRE = /\b(transform|all)(,|$)/;
  7232. function getTransitionInfo (el, expectedType) {
  7233. var styles = window.getComputedStyle(el);
  7234. // JSDOM may return undefined for transition properties
  7235. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  7236. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  7237. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  7238. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  7239. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  7240. var animationTimeout = getTimeout(animationDelays, animationDurations);
  7241. var type;
  7242. var timeout = 0;
  7243. var propCount = 0;
  7244. /* istanbul ignore if */
  7245. if (expectedType === TRANSITION) {
  7246. if (transitionTimeout > 0) {
  7247. type = TRANSITION;
  7248. timeout = transitionTimeout;
  7249. propCount = transitionDurations.length;
  7250. }
  7251. } else if (expectedType === ANIMATION) {
  7252. if (animationTimeout > 0) {
  7253. type = ANIMATION;
  7254. timeout = animationTimeout;
  7255. propCount = animationDurations.length;
  7256. }
  7257. } else {
  7258. timeout = Math.max(transitionTimeout, animationTimeout);
  7259. type = timeout > 0
  7260. ? transitionTimeout > animationTimeout
  7261. ? TRANSITION
  7262. : ANIMATION
  7263. : null;
  7264. propCount = type
  7265. ? type === TRANSITION
  7266. ? transitionDurations.length
  7267. : animationDurations.length
  7268. : 0;
  7269. }
  7270. var hasTransform =
  7271. type === TRANSITION &&
  7272. transformRE.test(styles[transitionProp + 'Property']);
  7273. return {
  7274. type: type,
  7275. timeout: timeout,
  7276. propCount: propCount,
  7277. hasTransform: hasTransform
  7278. }
  7279. }
  7280. function getTimeout (delays, durations) {
  7281. /* istanbul ignore next */
  7282. while (delays.length < durations.length) {
  7283. delays = delays.concat(delays);
  7284. }
  7285. return Math.max.apply(null, durations.map(function (d, i) {
  7286. return toMs(d) + toMs(delays[i])
  7287. }))
  7288. }
  7289. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  7290. // in a locale-dependent way, using a comma instead of a dot.
  7291. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  7292. // as a floor function) causing unexpected behaviors
  7293. function toMs (s) {
  7294. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  7295. }
  7296. /* */
  7297. function enter (vnode, toggleDisplay) {
  7298. var el = vnode.elm;
  7299. // call leave callback now
  7300. if (isDef(el._leaveCb)) {
  7301. el._leaveCb.cancelled = true;
  7302. el._leaveCb();
  7303. }
  7304. var data = resolveTransition(vnode.data.transition);
  7305. if (isUndef(data)) {
  7306. return
  7307. }
  7308. /* istanbul ignore if */
  7309. if (isDef(el._enterCb) || el.nodeType !== 1) {
  7310. return
  7311. }
  7312. var css = data.css;
  7313. var type = data.type;
  7314. var enterClass = data.enterClass;
  7315. var enterToClass = data.enterToClass;
  7316. var enterActiveClass = data.enterActiveClass;
  7317. var appearClass = data.appearClass;
  7318. var appearToClass = data.appearToClass;
  7319. var appearActiveClass = data.appearActiveClass;
  7320. var beforeEnter = data.beforeEnter;
  7321. var enter = data.enter;
  7322. var afterEnter = data.afterEnter;
  7323. var enterCancelled = data.enterCancelled;
  7324. var beforeAppear = data.beforeAppear;
  7325. var appear = data.appear;
  7326. var afterAppear = data.afterAppear;
  7327. var appearCancelled = data.appearCancelled;
  7328. var duration = data.duration;
  7329. // activeInstance will always be the <transition> component managing this
  7330. // transition. One edge case to check is when the <transition> is placed
  7331. // as the root node of a child component. In that case we need to check
  7332. // <transition>'s parent for appear check.
  7333. var context = activeInstance;
  7334. var transitionNode = activeInstance.$vnode;
  7335. while (transitionNode && transitionNode.parent) {
  7336. transitionNode = transitionNode.parent;
  7337. context = transitionNode.context;
  7338. }
  7339. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7340. if (isAppear && !appear && appear !== '') {
  7341. return
  7342. }
  7343. var startClass = isAppear && appearClass
  7344. ? appearClass
  7345. : enterClass;
  7346. var activeClass = isAppear && appearActiveClass
  7347. ? appearActiveClass
  7348. : enterActiveClass;
  7349. var toClass = isAppear && appearToClass
  7350. ? appearToClass
  7351. : enterToClass;
  7352. var beforeEnterHook = isAppear
  7353. ? (beforeAppear || beforeEnter)
  7354. : beforeEnter;
  7355. var enterHook = isAppear
  7356. ? (typeof appear === 'function' ? appear : enter)
  7357. : enter;
  7358. var afterEnterHook = isAppear
  7359. ? (afterAppear || afterEnter)
  7360. : afterEnter;
  7361. var enterCancelledHook = isAppear
  7362. ? (appearCancelled || enterCancelled)
  7363. : enterCancelled;
  7364. var explicitEnterDuration = toNumber(
  7365. isObject(duration)
  7366. ? duration.enter
  7367. : duration
  7368. );
  7369. if (explicitEnterDuration != null) {
  7370. checkDuration(explicitEnterDuration, 'enter', vnode);
  7371. }
  7372. var expectsCSS = css !== false && !isIE9;
  7373. var userWantsControl = getHookArgumentsLength(enterHook);
  7374. var cb = el._enterCb = once(function () {
  7375. if (expectsCSS) {
  7376. removeTransitionClass(el, toClass);
  7377. removeTransitionClass(el, activeClass);
  7378. }
  7379. if (cb.cancelled) {
  7380. if (expectsCSS) {
  7381. removeTransitionClass(el, startClass);
  7382. }
  7383. enterCancelledHook && enterCancelledHook(el);
  7384. } else {
  7385. afterEnterHook && afterEnterHook(el);
  7386. }
  7387. el._enterCb = null;
  7388. });
  7389. if (!vnode.data.show) {
  7390. // remove pending leave element on enter by injecting an insert hook
  7391. mergeVNodeHook(vnode, 'insert', function () {
  7392. var parent = el.parentNode;
  7393. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7394. if (pendingNode &&
  7395. pendingNode.tag === vnode.tag &&
  7396. pendingNode.elm._leaveCb
  7397. ) {
  7398. pendingNode.elm._leaveCb();
  7399. }
  7400. enterHook && enterHook(el, cb);
  7401. });
  7402. }
  7403. // start enter transition
  7404. beforeEnterHook && beforeEnterHook(el);
  7405. if (expectsCSS) {
  7406. addTransitionClass(el, startClass);
  7407. addTransitionClass(el, activeClass);
  7408. nextFrame(function () {
  7409. removeTransitionClass(el, startClass);
  7410. if (!cb.cancelled) {
  7411. addTransitionClass(el, toClass);
  7412. if (!userWantsControl) {
  7413. if (isValidDuration(explicitEnterDuration)) {
  7414. setTimeout(cb, explicitEnterDuration);
  7415. } else {
  7416. whenTransitionEnds(el, type, cb);
  7417. }
  7418. }
  7419. }
  7420. });
  7421. }
  7422. if (vnode.data.show) {
  7423. toggleDisplay && toggleDisplay();
  7424. enterHook && enterHook(el, cb);
  7425. }
  7426. if (!expectsCSS && !userWantsControl) {
  7427. cb();
  7428. }
  7429. }
  7430. function leave (vnode, rm) {
  7431. var el = vnode.elm;
  7432. // call enter callback now
  7433. if (isDef(el._enterCb)) {
  7434. el._enterCb.cancelled = true;
  7435. el._enterCb();
  7436. }
  7437. var data = resolveTransition(vnode.data.transition);
  7438. if (isUndef(data) || el.nodeType !== 1) {
  7439. return rm()
  7440. }
  7441. /* istanbul ignore if */
  7442. if (isDef(el._leaveCb)) {
  7443. return
  7444. }
  7445. var css = data.css;
  7446. var type = data.type;
  7447. var leaveClass = data.leaveClass;
  7448. var leaveToClass = data.leaveToClass;
  7449. var leaveActiveClass = data.leaveActiveClass;
  7450. var beforeLeave = data.beforeLeave;
  7451. var leave = data.leave;
  7452. var afterLeave = data.afterLeave;
  7453. var leaveCancelled = data.leaveCancelled;
  7454. var delayLeave = data.delayLeave;
  7455. var duration = data.duration;
  7456. var expectsCSS = css !== false && !isIE9;
  7457. var userWantsControl = getHookArgumentsLength(leave);
  7458. var explicitLeaveDuration = toNumber(
  7459. isObject(duration)
  7460. ? duration.leave
  7461. : duration
  7462. );
  7463. if (isDef(explicitLeaveDuration)) {
  7464. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7465. }
  7466. var cb = el._leaveCb = once(function () {
  7467. if (el.parentNode && el.parentNode._pending) {
  7468. el.parentNode._pending[vnode.key] = null;
  7469. }
  7470. if (expectsCSS) {
  7471. removeTransitionClass(el, leaveToClass);
  7472. removeTransitionClass(el, leaveActiveClass);
  7473. }
  7474. if (cb.cancelled) {
  7475. if (expectsCSS) {
  7476. removeTransitionClass(el, leaveClass);
  7477. }
  7478. leaveCancelled && leaveCancelled(el);
  7479. } else {
  7480. rm();
  7481. afterLeave && afterLeave(el);
  7482. }
  7483. el._leaveCb = null;
  7484. });
  7485. if (delayLeave) {
  7486. delayLeave(performLeave);
  7487. } else {
  7488. performLeave();
  7489. }
  7490. function performLeave () {
  7491. // the delayed leave may have already been cancelled
  7492. if (cb.cancelled) {
  7493. return
  7494. }
  7495. // record leaving element
  7496. if (!vnode.data.show && el.parentNode) {
  7497. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7498. }
  7499. beforeLeave && beforeLeave(el);
  7500. if (expectsCSS) {
  7501. addTransitionClass(el, leaveClass);
  7502. addTransitionClass(el, leaveActiveClass);
  7503. nextFrame(function () {
  7504. removeTransitionClass(el, leaveClass);
  7505. if (!cb.cancelled) {
  7506. addTransitionClass(el, leaveToClass);
  7507. if (!userWantsControl) {
  7508. if (isValidDuration(explicitLeaveDuration)) {
  7509. setTimeout(cb, explicitLeaveDuration);
  7510. } else {
  7511. whenTransitionEnds(el, type, cb);
  7512. }
  7513. }
  7514. }
  7515. });
  7516. }
  7517. leave && leave(el, cb);
  7518. if (!expectsCSS && !userWantsControl) {
  7519. cb();
  7520. }
  7521. }
  7522. }
  7523. // only used in dev mode
  7524. function checkDuration (val, name, vnode) {
  7525. if (typeof val !== 'number') {
  7526. warn(
  7527. "<transition> explicit " + name + " duration is not a valid number - " +
  7528. "got " + (JSON.stringify(val)) + ".",
  7529. vnode.context
  7530. );
  7531. } else if (isNaN(val)) {
  7532. warn(
  7533. "<transition> explicit " + name + " duration is NaN - " +
  7534. 'the duration expression might be incorrect.',
  7535. vnode.context
  7536. );
  7537. }
  7538. }
  7539. function isValidDuration (val) {
  7540. return typeof val === 'number' && !isNaN(val)
  7541. }
  7542. /**
  7543. * Normalize a transition hook's argument length. The hook may be:
  7544. * - a merged hook (invoker) with the original in .fns
  7545. * - a wrapped component method (check ._length)
  7546. * - a plain function (.length)
  7547. */
  7548. function getHookArgumentsLength (fn) {
  7549. if (isUndef(fn)) {
  7550. return false
  7551. }
  7552. var invokerFns = fn.fns;
  7553. if (isDef(invokerFns)) {
  7554. // invoker
  7555. return getHookArgumentsLength(
  7556. Array.isArray(invokerFns)
  7557. ? invokerFns[0]
  7558. : invokerFns
  7559. )
  7560. } else {
  7561. return (fn._length || fn.length) > 1
  7562. }
  7563. }
  7564. function _enter (_, vnode) {
  7565. if (vnode.data.show !== true) {
  7566. enter(vnode);
  7567. }
  7568. }
  7569. var transition = inBrowser ? {
  7570. create: _enter,
  7571. activate: _enter,
  7572. remove: function remove$$1 (vnode, rm) {
  7573. /* istanbul ignore else */
  7574. if (vnode.data.show !== true) {
  7575. leave(vnode, rm);
  7576. } else {
  7577. rm();
  7578. }
  7579. }
  7580. } : {};
  7581. var platformModules = [
  7582. attrs,
  7583. klass,
  7584. events,
  7585. domProps,
  7586. style,
  7587. transition
  7588. ];
  7589. /* */
  7590. // the directive module should be applied last, after all
  7591. // built-in modules have been applied.
  7592. var modules = platformModules.concat(baseModules);
  7593. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7594. /**
  7595. * Not type checking this file because flow doesn't like attaching
  7596. * properties to Elements.
  7597. */
  7598. /* istanbul ignore if */
  7599. if (isIE9) {
  7600. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7601. document.addEventListener('selectionchange', function () {
  7602. var el = document.activeElement;
  7603. if (el && el.vmodel) {
  7604. trigger(el, 'input');
  7605. }
  7606. });
  7607. }
  7608. var directive = {
  7609. inserted: function inserted (el, binding, vnode, oldVnode) {
  7610. if (vnode.tag === 'select') {
  7611. // #6903
  7612. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7613. mergeVNodeHook(vnode, 'postpatch', function () {
  7614. directive.componentUpdated(el, binding, vnode);
  7615. });
  7616. } else {
  7617. setSelected(el, binding, vnode.context);
  7618. }
  7619. el._vOptions = [].map.call(el.options, getValue);
  7620. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7621. el._vModifiers = binding.modifiers;
  7622. if (!binding.modifiers.lazy) {
  7623. el.addEventListener('compositionstart', onCompositionStart);
  7624. el.addEventListener('compositionend', onCompositionEnd);
  7625. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7626. // switching focus before confirming composition choice
  7627. // this also fixes the issue where some browsers e.g. iOS Chrome
  7628. // fires "change" instead of "input" on autocomplete.
  7629. el.addEventListener('change', onCompositionEnd);
  7630. /* istanbul ignore if */
  7631. if (isIE9) {
  7632. el.vmodel = true;
  7633. }
  7634. }
  7635. }
  7636. },
  7637. componentUpdated: function componentUpdated (el, binding, vnode) {
  7638. if (vnode.tag === 'select') {
  7639. setSelected(el, binding, vnode.context);
  7640. // in case the options rendered by v-for have changed,
  7641. // it's possible that the value is out-of-sync with the rendered options.
  7642. // detect such cases and filter out values that no longer has a matching
  7643. // option in the DOM.
  7644. var prevOptions = el._vOptions;
  7645. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7646. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7647. // trigger change event if
  7648. // no matching option found for at least one value
  7649. var needReset = el.multiple
  7650. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7651. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7652. if (needReset) {
  7653. trigger(el, 'change');
  7654. }
  7655. }
  7656. }
  7657. }
  7658. };
  7659. function setSelected (el, binding, vm) {
  7660. actuallySetSelected(el, binding, vm);
  7661. /* istanbul ignore if */
  7662. if (isIE || isEdge) {
  7663. setTimeout(function () {
  7664. actuallySetSelected(el, binding, vm);
  7665. }, 0);
  7666. }
  7667. }
  7668. function actuallySetSelected (el, binding, vm) {
  7669. var value = binding.value;
  7670. var isMultiple = el.multiple;
  7671. if (isMultiple && !Array.isArray(value)) {
  7672. warn(
  7673. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7674. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7675. vm
  7676. );
  7677. return
  7678. }
  7679. var selected, option;
  7680. for (var i = 0, l = el.options.length; i < l; i++) {
  7681. option = el.options[i];
  7682. if (isMultiple) {
  7683. selected = looseIndexOf(value, getValue(option)) > -1;
  7684. if (option.selected !== selected) {
  7685. option.selected = selected;
  7686. }
  7687. } else {
  7688. if (looseEqual(getValue(option), value)) {
  7689. if (el.selectedIndex !== i) {
  7690. el.selectedIndex = i;
  7691. }
  7692. return
  7693. }
  7694. }
  7695. }
  7696. if (!isMultiple) {
  7697. el.selectedIndex = -1;
  7698. }
  7699. }
  7700. function hasNoMatchingOption (value, options) {
  7701. return options.every(function (o) { return !looseEqual(o, value); })
  7702. }
  7703. function getValue (option) {
  7704. return '_value' in option
  7705. ? option._value
  7706. : option.value
  7707. }
  7708. function onCompositionStart (e) {
  7709. e.target.composing = true;
  7710. }
  7711. function onCompositionEnd (e) {
  7712. // prevent triggering an input event for no reason
  7713. if (!e.target.composing) { return }
  7714. e.target.composing = false;
  7715. trigger(e.target, 'input');
  7716. }
  7717. function trigger (el, type) {
  7718. var e = document.createEvent('HTMLEvents');
  7719. e.initEvent(type, true, true);
  7720. el.dispatchEvent(e);
  7721. }
  7722. /* */
  7723. // recursively search for possible transition defined inside the component root
  7724. function locateNode (vnode) {
  7725. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7726. ? locateNode(vnode.componentInstance._vnode)
  7727. : vnode
  7728. }
  7729. var show = {
  7730. bind: function bind (el, ref, vnode) {
  7731. var value = ref.value;
  7732. vnode = locateNode(vnode);
  7733. var transition$$1 = vnode.data && vnode.data.transition;
  7734. var originalDisplay = el.__vOriginalDisplay =
  7735. el.style.display === 'none' ? '' : el.style.display;
  7736. if (value && transition$$1) {
  7737. vnode.data.show = true;
  7738. enter(vnode, function () {
  7739. el.style.display = originalDisplay;
  7740. });
  7741. } else {
  7742. el.style.display = value ? originalDisplay : 'none';
  7743. }
  7744. },
  7745. update: function update (el, ref, vnode) {
  7746. var value = ref.value;
  7747. var oldValue = ref.oldValue;
  7748. /* istanbul ignore if */
  7749. if (!value === !oldValue) { return }
  7750. vnode = locateNode(vnode);
  7751. var transition$$1 = vnode.data && vnode.data.transition;
  7752. if (transition$$1) {
  7753. vnode.data.show = true;
  7754. if (value) {
  7755. enter(vnode, function () {
  7756. el.style.display = el.__vOriginalDisplay;
  7757. });
  7758. } else {
  7759. leave(vnode, function () {
  7760. el.style.display = 'none';
  7761. });
  7762. }
  7763. } else {
  7764. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7765. }
  7766. },
  7767. unbind: function unbind (
  7768. el,
  7769. binding,
  7770. vnode,
  7771. oldVnode,
  7772. isDestroy
  7773. ) {
  7774. if (!isDestroy) {
  7775. el.style.display = el.__vOriginalDisplay;
  7776. }
  7777. }
  7778. };
  7779. var platformDirectives = {
  7780. model: directive,
  7781. show: show
  7782. };
  7783. /* */
  7784. var transitionProps = {
  7785. name: String,
  7786. appear: Boolean,
  7787. css: Boolean,
  7788. mode: String,
  7789. type: String,
  7790. enterClass: String,
  7791. leaveClass: String,
  7792. enterToClass: String,
  7793. leaveToClass: String,
  7794. enterActiveClass: String,
  7795. leaveActiveClass: String,
  7796. appearClass: String,
  7797. appearActiveClass: String,
  7798. appearToClass: String,
  7799. duration: [Number, String, Object]
  7800. };
  7801. // in case the child is also an abstract component, e.g. <keep-alive>
  7802. // we want to recursively retrieve the real component to be rendered
  7803. function getRealChild (vnode) {
  7804. var compOptions = vnode && vnode.componentOptions;
  7805. if (compOptions && compOptions.Ctor.options.abstract) {
  7806. return getRealChild(getFirstComponentChild(compOptions.children))
  7807. } else {
  7808. return vnode
  7809. }
  7810. }
  7811. function extractTransitionData (comp) {
  7812. var data = {};
  7813. var options = comp.$options;
  7814. // props
  7815. for (var key in options.propsData) {
  7816. data[key] = comp[key];
  7817. }
  7818. // events.
  7819. // extract listeners and pass them directly to the transition methods
  7820. var listeners = options._parentListeners;
  7821. for (var key$1 in listeners) {
  7822. data[camelize(key$1)] = listeners[key$1];
  7823. }
  7824. return data
  7825. }
  7826. function placeholder (h, rawChild) {
  7827. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7828. return h('keep-alive', {
  7829. props: rawChild.componentOptions.propsData
  7830. })
  7831. }
  7832. }
  7833. function hasParentTransition (vnode) {
  7834. while ((vnode = vnode.parent)) {
  7835. if (vnode.data.transition) {
  7836. return true
  7837. }
  7838. }
  7839. }
  7840. function isSameChild (child, oldChild) {
  7841. return oldChild.key === child.key && oldChild.tag === child.tag
  7842. }
  7843. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7844. var isVShowDirective = function (d) { return d.name === 'show'; };
  7845. var Transition = {
  7846. name: 'transition',
  7847. props: transitionProps,
  7848. abstract: true,
  7849. render: function render (h) {
  7850. var this$1 = this;
  7851. var children = this.$slots.default;
  7852. if (!children) {
  7853. return
  7854. }
  7855. // filter out text nodes (possible whitespaces)
  7856. children = children.filter(isNotTextNode);
  7857. /* istanbul ignore if */
  7858. if (!children.length) {
  7859. return
  7860. }
  7861. // warn multiple elements
  7862. if (children.length > 1) {
  7863. warn(
  7864. '<transition> can only be used on a single element. Use ' +
  7865. '<transition-group> for lists.',
  7866. this.$parent
  7867. );
  7868. }
  7869. var mode = this.mode;
  7870. // warn invalid mode
  7871. if (mode && mode !== 'in-out' && mode !== 'out-in'
  7872. ) {
  7873. warn(
  7874. 'invalid <transition> mode: ' + mode,
  7875. this.$parent
  7876. );
  7877. }
  7878. var rawChild = children[0];
  7879. // if this is a component root node and the component's
  7880. // parent container node also has transition, skip.
  7881. if (hasParentTransition(this.$vnode)) {
  7882. return rawChild
  7883. }
  7884. // apply transition data to child
  7885. // use getRealChild() to ignore abstract components e.g. keep-alive
  7886. var child = getRealChild(rawChild);
  7887. /* istanbul ignore if */
  7888. if (!child) {
  7889. return rawChild
  7890. }
  7891. if (this._leaving) {
  7892. return placeholder(h, rawChild)
  7893. }
  7894. // ensure a key that is unique to the vnode type and to this transition
  7895. // component instance. This key will be used to remove pending leaving nodes
  7896. // during entering.
  7897. var id = "__transition-" + (this._uid) + "-";
  7898. child.key = child.key == null
  7899. ? child.isComment
  7900. ? id + 'comment'
  7901. : id + child.tag
  7902. : isPrimitive(child.key)
  7903. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7904. : child.key;
  7905. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7906. var oldRawChild = this._vnode;
  7907. var oldChild = getRealChild(oldRawChild);
  7908. // mark v-show
  7909. // so that the transition module can hand over the control to the directive
  7910. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7911. child.data.show = true;
  7912. }
  7913. if (
  7914. oldChild &&
  7915. oldChild.data &&
  7916. !isSameChild(child, oldChild) &&
  7917. !isAsyncPlaceholder(oldChild) &&
  7918. // #6687 component root is a comment node
  7919. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7920. ) {
  7921. // replace old child transition data with fresh one
  7922. // important for dynamic transitions!
  7923. var oldData = oldChild.data.transition = extend({}, data);
  7924. // handle transition mode
  7925. if (mode === 'out-in') {
  7926. // return placeholder node and queue update when leave finishes
  7927. this._leaving = true;
  7928. mergeVNodeHook(oldData, 'afterLeave', function () {
  7929. this$1._leaving = false;
  7930. this$1.$forceUpdate();
  7931. });
  7932. return placeholder(h, rawChild)
  7933. } else if (mode === 'in-out') {
  7934. if (isAsyncPlaceholder(child)) {
  7935. return oldRawChild
  7936. }
  7937. var delayedLeave;
  7938. var performLeave = function () { delayedLeave(); };
  7939. mergeVNodeHook(data, 'afterEnter', performLeave);
  7940. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7941. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7942. }
  7943. }
  7944. return rawChild
  7945. }
  7946. };
  7947. /* */
  7948. var props = extend({
  7949. tag: String,
  7950. moveClass: String
  7951. }, transitionProps);
  7952. delete props.mode;
  7953. var TransitionGroup = {
  7954. props: props,
  7955. beforeMount: function beforeMount () {
  7956. var this$1 = this;
  7957. var update = this._update;
  7958. this._update = function (vnode, hydrating) {
  7959. var restoreActiveInstance = setActiveInstance(this$1);
  7960. // force removing pass
  7961. this$1.__patch__(
  7962. this$1._vnode,
  7963. this$1.kept,
  7964. false, // hydrating
  7965. true // removeOnly (!important, avoids unnecessary moves)
  7966. );
  7967. this$1._vnode = this$1.kept;
  7968. restoreActiveInstance();
  7969. update.call(this$1, vnode, hydrating);
  7970. };
  7971. },
  7972. render: function render (h) {
  7973. var tag = this.tag || this.$vnode.data.tag || 'span';
  7974. var map = Object.create(null);
  7975. var prevChildren = this.prevChildren = this.children;
  7976. var rawChildren = this.$slots.default || [];
  7977. var children = this.children = [];
  7978. var transitionData = extractTransitionData(this);
  7979. for (var i = 0; i < rawChildren.length; i++) {
  7980. var c = rawChildren[i];
  7981. if (c.tag) {
  7982. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  7983. children.push(c);
  7984. map[c.key] = c
  7985. ;(c.data || (c.data = {})).transition = transitionData;
  7986. } else {
  7987. var opts = c.componentOptions;
  7988. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  7989. warn(("<transition-group> children must be keyed: <" + name + ">"));
  7990. }
  7991. }
  7992. }
  7993. if (prevChildren) {
  7994. var kept = [];
  7995. var removed = [];
  7996. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  7997. var c$1 = prevChildren[i$1];
  7998. c$1.data.transition = transitionData;
  7999. c$1.data.pos = c$1.elm.getBoundingClientRect();
  8000. if (map[c$1.key]) {
  8001. kept.push(c$1);
  8002. } else {
  8003. removed.push(c$1);
  8004. }
  8005. }
  8006. this.kept = h(tag, null, kept);
  8007. this.removed = removed;
  8008. }
  8009. return h(tag, null, children)
  8010. },
  8011. updated: function updated () {
  8012. var children = this.prevChildren;
  8013. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  8014. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  8015. return
  8016. }
  8017. // we divide the work into three loops to avoid mixing DOM reads and writes
  8018. // in each iteration - which helps prevent layout thrashing.
  8019. children.forEach(callPendingCbs);
  8020. children.forEach(recordPosition);
  8021. children.forEach(applyTranslation);
  8022. // force reflow to put everything in position
  8023. // assign to this to avoid being removed in tree-shaking
  8024. // $flow-disable-line
  8025. this._reflow = document.body.offsetHeight;
  8026. children.forEach(function (c) {
  8027. if (c.data.moved) {
  8028. var el = c.elm;
  8029. var s = el.style;
  8030. addTransitionClass(el, moveClass);
  8031. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8032. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  8033. if (e && e.target !== el) {
  8034. return
  8035. }
  8036. if (!e || /transform$/.test(e.propertyName)) {
  8037. el.removeEventListener(transitionEndEvent, cb);
  8038. el._moveCb = null;
  8039. removeTransitionClass(el, moveClass);
  8040. }
  8041. });
  8042. }
  8043. });
  8044. },
  8045. methods: {
  8046. hasMove: function hasMove (el, moveClass) {
  8047. /* istanbul ignore if */
  8048. if (!hasTransition) {
  8049. return false
  8050. }
  8051. /* istanbul ignore if */
  8052. if (this._hasMove) {
  8053. return this._hasMove
  8054. }
  8055. // Detect whether an element with the move class applied has
  8056. // CSS transitions. Since the element may be inside an entering
  8057. // transition at this very moment, we make a clone of it and remove
  8058. // all other transition classes applied to ensure only the move class
  8059. // is applied.
  8060. var clone = el.cloneNode();
  8061. if (el._transitionClasses) {
  8062. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  8063. }
  8064. addClass(clone, moveClass);
  8065. clone.style.display = 'none';
  8066. this.$el.appendChild(clone);
  8067. var info = getTransitionInfo(clone);
  8068. this.$el.removeChild(clone);
  8069. return (this._hasMove = info.hasTransform)
  8070. }
  8071. }
  8072. };
  8073. function callPendingCbs (c) {
  8074. /* istanbul ignore if */
  8075. if (c.elm._moveCb) {
  8076. c.elm._moveCb();
  8077. }
  8078. /* istanbul ignore if */
  8079. if (c.elm._enterCb) {
  8080. c.elm._enterCb();
  8081. }
  8082. }
  8083. function recordPosition (c) {
  8084. c.data.newPos = c.elm.getBoundingClientRect();
  8085. }
  8086. function applyTranslation (c) {
  8087. var oldPos = c.data.pos;
  8088. var newPos = c.data.newPos;
  8089. var dx = oldPos.left - newPos.left;
  8090. var dy = oldPos.top - newPos.top;
  8091. if (dx || dy) {
  8092. c.data.moved = true;
  8093. var s = c.elm.style;
  8094. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  8095. s.transitionDuration = '0s';
  8096. }
  8097. }
  8098. var platformComponents = {
  8099. Transition: Transition,
  8100. TransitionGroup: TransitionGroup
  8101. };
  8102. /* */
  8103. // install platform specific utils
  8104. Vue.config.mustUseProp = mustUseProp;
  8105. Vue.config.isReservedTag = isReservedTag;
  8106. Vue.config.isReservedAttr = isReservedAttr;
  8107. Vue.config.getTagNamespace = getTagNamespace;
  8108. Vue.config.isUnknownElement = isUnknownElement;
  8109. // install platform runtime directives & components
  8110. extend(Vue.options.directives, platformDirectives);
  8111. extend(Vue.options.components, platformComponents);
  8112. // install platform patch function
  8113. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  8114. // public mount method
  8115. Vue.prototype.$mount = function (
  8116. el,
  8117. hydrating
  8118. ) {
  8119. el = el && inBrowser ? query(el) : undefined;
  8120. return mountComponent(this, el, hydrating)
  8121. };
  8122. // devtools global hook
  8123. /* istanbul ignore next */
  8124. if (inBrowser) {
  8125. setTimeout(function () {
  8126. if (config.devtools) {
  8127. if (devtools) {
  8128. devtools.emit('init', Vue);
  8129. } else {
  8130. console[console.info ? 'info' : 'log'](
  8131. 'Download the Vue Devtools extension for a better development experience:\n' +
  8132. 'https://github.com/vuejs/vue-devtools'
  8133. );
  8134. }
  8135. }
  8136. if (config.productionTip !== false &&
  8137. typeof console !== 'undefined'
  8138. ) {
  8139. console[console.info ? 'info' : 'log'](
  8140. "You are running Vue in development mode.\n" +
  8141. "Make sure to turn on production mode when deploying for production.\n" +
  8142. "See more tips at https://vuejs.org/guide/deployment.html"
  8143. );
  8144. }
  8145. }, 0);
  8146. }
  8147. /* */
  8148. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  8149. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  8150. var buildRegex = cached(function (delimiters) {
  8151. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  8152. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  8153. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  8154. });
  8155. function parseText (
  8156. text,
  8157. delimiters
  8158. ) {
  8159. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  8160. if (!tagRE.test(text)) {
  8161. return
  8162. }
  8163. var tokens = [];
  8164. var rawTokens = [];
  8165. var lastIndex = tagRE.lastIndex = 0;
  8166. var match, index, tokenValue;
  8167. while ((match = tagRE.exec(text))) {
  8168. index = match.index;
  8169. // push text token
  8170. if (index > lastIndex) {
  8171. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  8172. tokens.push(JSON.stringify(tokenValue));
  8173. }
  8174. // tag token
  8175. var exp = parseFilters(match[1].trim());
  8176. tokens.push(("_s(" + exp + ")"));
  8177. rawTokens.push({ '@binding': exp });
  8178. lastIndex = index + match[0].length;
  8179. }
  8180. if (lastIndex < text.length) {
  8181. rawTokens.push(tokenValue = text.slice(lastIndex));
  8182. tokens.push(JSON.stringify(tokenValue));
  8183. }
  8184. return {
  8185. expression: tokens.join('+'),
  8186. tokens: rawTokens
  8187. }
  8188. }
  8189. /* */
  8190. function transformNode (el, options) {
  8191. var warn = options.warn || baseWarn;
  8192. var staticClass = getAndRemoveAttr(el, 'class');
  8193. if (staticClass) {
  8194. var res = parseText(staticClass, options.delimiters);
  8195. if (res) {
  8196. warn(
  8197. "class=\"" + staticClass + "\": " +
  8198. 'Interpolation inside attributes has been removed. ' +
  8199. 'Use v-bind or the colon shorthand instead. For example, ' +
  8200. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  8201. el.rawAttrsMap['class']
  8202. );
  8203. }
  8204. }
  8205. if (staticClass) {
  8206. el.staticClass = JSON.stringify(staticClass);
  8207. }
  8208. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  8209. if (classBinding) {
  8210. el.classBinding = classBinding;
  8211. }
  8212. }
  8213. function genData (el) {
  8214. var data = '';
  8215. if (el.staticClass) {
  8216. data += "staticClass:" + (el.staticClass) + ",";
  8217. }
  8218. if (el.classBinding) {
  8219. data += "class:" + (el.classBinding) + ",";
  8220. }
  8221. return data
  8222. }
  8223. var klass$1 = {
  8224. staticKeys: ['staticClass'],
  8225. transformNode: transformNode,
  8226. genData: genData
  8227. };
  8228. /* */
  8229. function transformNode$1 (el, options) {
  8230. var warn = options.warn || baseWarn;
  8231. var staticStyle = getAndRemoveAttr(el, 'style');
  8232. if (staticStyle) {
  8233. /* istanbul ignore if */
  8234. {
  8235. var res = parseText(staticStyle, options.delimiters);
  8236. if (res) {
  8237. warn(
  8238. "style=\"" + staticStyle + "\": " +
  8239. 'Interpolation inside attributes has been removed. ' +
  8240. 'Use v-bind or the colon shorthand instead. For example, ' +
  8241. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  8242. el.rawAttrsMap['style']
  8243. );
  8244. }
  8245. }
  8246. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  8247. }
  8248. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  8249. if (styleBinding) {
  8250. el.styleBinding = styleBinding;
  8251. }
  8252. }
  8253. function genData$1 (el) {
  8254. var data = '';
  8255. if (el.staticStyle) {
  8256. data += "staticStyle:" + (el.staticStyle) + ",";
  8257. }
  8258. if (el.styleBinding) {
  8259. data += "style:(" + (el.styleBinding) + "),";
  8260. }
  8261. return data
  8262. }
  8263. var style$1 = {
  8264. staticKeys: ['staticStyle'],
  8265. transformNode: transformNode$1,
  8266. genData: genData$1
  8267. };
  8268. /* */
  8269. var decoder;
  8270. var he = {
  8271. decode: function decode (html) {
  8272. decoder = decoder || document.createElement('div');
  8273. decoder.innerHTML = html;
  8274. return decoder.textContent
  8275. }
  8276. };
  8277. /* */
  8278. var isUnaryTag = makeMap(
  8279. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  8280. 'link,meta,param,source,track,wbr'
  8281. );
  8282. // Elements that you can, intentionally, leave open
  8283. // (and which close themselves)
  8284. var canBeLeftOpenTag = makeMap(
  8285. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  8286. );
  8287. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  8288. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  8289. var isNonPhrasingTag = makeMap(
  8290. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  8291. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  8292. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  8293. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  8294. 'title,tr,track'
  8295. );
  8296. /**
  8297. * Not type-checking this file because it's mostly vendor code.
  8298. */
  8299. // Regular Expressions for parsing tags and attributes
  8300. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8301. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8302. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + unicodeLetters + "]*";
  8303. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  8304. var startTagOpen = new RegExp(("^<" + qnameCapture));
  8305. var startTagClose = /^\s*(\/?)>/;
  8306. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  8307. var doctype = /^<!DOCTYPE [^>]+>/i;
  8308. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  8309. var comment = /^<!\--/;
  8310. var conditionalComment = /^<!\[/;
  8311. // Special Elements (can contain anything)
  8312. var isPlainTextElement = makeMap('script,style,textarea', true);
  8313. var reCache = {};
  8314. var decodingMap = {
  8315. '&lt;': '<',
  8316. '&gt;': '>',
  8317. '&quot;': '"',
  8318. '&amp;': '&',
  8319. '&#10;': '\n',
  8320. '&#9;': '\t',
  8321. '&#39;': "'"
  8322. };
  8323. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  8324. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  8325. // #5992
  8326. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8327. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  8328. function decodeAttr (value, shouldDecodeNewlines) {
  8329. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8330. return value.replace(re, function (match) { return decodingMap[match]; })
  8331. }
  8332. function parseHTML (html, options) {
  8333. var stack = [];
  8334. var expectHTML = options.expectHTML;
  8335. var isUnaryTag$$1 = options.isUnaryTag || no;
  8336. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8337. var index = 0;
  8338. var last, lastTag;
  8339. while (html) {
  8340. last = html;
  8341. // Make sure we're not in a plaintext content element like script/style
  8342. if (!lastTag || !isPlainTextElement(lastTag)) {
  8343. var textEnd = html.indexOf('<');
  8344. if (textEnd === 0) {
  8345. // Comment:
  8346. if (comment.test(html)) {
  8347. var commentEnd = html.indexOf('-->');
  8348. if (commentEnd >= 0) {
  8349. if (options.shouldKeepComment) {
  8350. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  8351. }
  8352. advance(commentEnd + 3);
  8353. continue
  8354. }
  8355. }
  8356. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8357. if (conditionalComment.test(html)) {
  8358. var conditionalEnd = html.indexOf(']>');
  8359. if (conditionalEnd >= 0) {
  8360. advance(conditionalEnd + 2);
  8361. continue
  8362. }
  8363. }
  8364. // Doctype:
  8365. var doctypeMatch = html.match(doctype);
  8366. if (doctypeMatch) {
  8367. advance(doctypeMatch[0].length);
  8368. continue
  8369. }
  8370. // End tag:
  8371. var endTagMatch = html.match(endTag);
  8372. if (endTagMatch) {
  8373. var curIndex = index;
  8374. advance(endTagMatch[0].length);
  8375. parseEndTag(endTagMatch[1], curIndex, index);
  8376. continue
  8377. }
  8378. // Start tag:
  8379. var startTagMatch = parseStartTag();
  8380. if (startTagMatch) {
  8381. handleStartTag(startTagMatch);
  8382. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8383. advance(1);
  8384. }
  8385. continue
  8386. }
  8387. }
  8388. var text = (void 0), rest = (void 0), next = (void 0);
  8389. if (textEnd >= 0) {
  8390. rest = html.slice(textEnd);
  8391. while (
  8392. !endTag.test(rest) &&
  8393. !startTagOpen.test(rest) &&
  8394. !comment.test(rest) &&
  8395. !conditionalComment.test(rest)
  8396. ) {
  8397. // < in plain text, be forgiving and treat it as text
  8398. next = rest.indexOf('<', 1);
  8399. if (next < 0) { break }
  8400. textEnd += next;
  8401. rest = html.slice(textEnd);
  8402. }
  8403. text = html.substring(0, textEnd);
  8404. }
  8405. if (textEnd < 0) {
  8406. text = html;
  8407. }
  8408. if (text) {
  8409. advance(text.length);
  8410. }
  8411. if (options.chars && text) {
  8412. options.chars(text, index - text.length, index);
  8413. }
  8414. } else {
  8415. var endTagLength = 0;
  8416. var stackedTag = lastTag.toLowerCase();
  8417. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8418. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8419. endTagLength = endTag.length;
  8420. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8421. text = text
  8422. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8423. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8424. }
  8425. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8426. text = text.slice(1);
  8427. }
  8428. if (options.chars) {
  8429. options.chars(text);
  8430. }
  8431. return ''
  8432. });
  8433. index += html.length - rest$1.length;
  8434. html = rest$1;
  8435. parseEndTag(stackedTag, index - endTagLength, index);
  8436. }
  8437. if (html === last) {
  8438. options.chars && options.chars(html);
  8439. if (!stack.length && options.warn) {
  8440. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  8441. }
  8442. break
  8443. }
  8444. }
  8445. // Clean up any remaining tags
  8446. parseEndTag();
  8447. function advance (n) {
  8448. index += n;
  8449. html = html.substring(n);
  8450. }
  8451. function parseStartTag () {
  8452. var start = html.match(startTagOpen);
  8453. if (start) {
  8454. var match = {
  8455. tagName: start[1],
  8456. attrs: [],
  8457. start: index
  8458. };
  8459. advance(start[0].length);
  8460. var end, attr;
  8461. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  8462. attr.start = index;
  8463. advance(attr[0].length);
  8464. attr.end = index;
  8465. match.attrs.push(attr);
  8466. }
  8467. if (end) {
  8468. match.unarySlash = end[1];
  8469. advance(end[0].length);
  8470. match.end = index;
  8471. return match
  8472. }
  8473. }
  8474. }
  8475. function handleStartTag (match) {
  8476. var tagName = match.tagName;
  8477. var unarySlash = match.unarySlash;
  8478. if (expectHTML) {
  8479. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8480. parseEndTag(lastTag);
  8481. }
  8482. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8483. parseEndTag(tagName);
  8484. }
  8485. }
  8486. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8487. var l = match.attrs.length;
  8488. var attrs = new Array(l);
  8489. for (var i = 0; i < l; i++) {
  8490. var args = match.attrs[i];
  8491. var value = args[3] || args[4] || args[5] || '';
  8492. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8493. ? options.shouldDecodeNewlinesForHref
  8494. : options.shouldDecodeNewlines;
  8495. attrs[i] = {
  8496. name: args[1],
  8497. value: decodeAttr(value, shouldDecodeNewlines)
  8498. };
  8499. if (options.outputSourceRange) {
  8500. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  8501. attrs[i].end = args.end;
  8502. }
  8503. }
  8504. if (!unary) {
  8505. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  8506. lastTag = tagName;
  8507. }
  8508. if (options.start) {
  8509. options.start(tagName, attrs, unary, match.start, match.end);
  8510. }
  8511. }
  8512. function parseEndTag (tagName, start, end) {
  8513. var pos, lowerCasedTagName;
  8514. if (start == null) { start = index; }
  8515. if (end == null) { end = index; }
  8516. // Find the closest opened tag of the same type
  8517. if (tagName) {
  8518. lowerCasedTagName = tagName.toLowerCase();
  8519. for (pos = stack.length - 1; pos >= 0; pos--) {
  8520. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8521. break
  8522. }
  8523. }
  8524. } else {
  8525. // If no tag name is provided, clean shop
  8526. pos = 0;
  8527. }
  8528. if (pos >= 0) {
  8529. // Close all the open elements, up the stack
  8530. for (var i = stack.length - 1; i >= pos; i--) {
  8531. if (i > pos || !tagName &&
  8532. options.warn
  8533. ) {
  8534. options.warn(
  8535. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  8536. { start: stack[i].start }
  8537. );
  8538. }
  8539. if (options.end) {
  8540. options.end(stack[i].tag, start, end);
  8541. }
  8542. }
  8543. // Remove the open elements from the stack
  8544. stack.length = pos;
  8545. lastTag = pos && stack[pos - 1].tag;
  8546. } else if (lowerCasedTagName === 'br') {
  8547. if (options.start) {
  8548. options.start(tagName, [], true, start, end);
  8549. }
  8550. } else if (lowerCasedTagName === 'p') {
  8551. if (options.start) {
  8552. options.start(tagName, [], false, start, end);
  8553. }
  8554. if (options.end) {
  8555. options.end(tagName, start, end);
  8556. }
  8557. }
  8558. }
  8559. }
  8560. /* */
  8561. var onRE = /^@|^v-on:/;
  8562. var dirRE = /^v-|^@|^:/;
  8563. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8564. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8565. var stripParensRE = /^\(|\)$/g;
  8566. var dynamicArgRE = /^\[.*\]$/;
  8567. var argRE = /:(.*)$/;
  8568. var bindRE = /^:|^\.|^v-bind:/;
  8569. var modifierRE = /\.[^.]+/g;
  8570. var slotRE = /^v-slot(:|$)|^#/;
  8571. var lineBreakRE = /[\r\n]/;
  8572. var whitespaceRE$1 = /\s+/g;
  8573. var invalidAttributeRE = /[\s"'<>\/=]/;
  8574. var decodeHTMLCached = cached(he.decode);
  8575. var emptySlotScopeToken = "_empty_";
  8576. // configurable state
  8577. var warn$2;
  8578. var delimiters;
  8579. var transforms;
  8580. var preTransforms;
  8581. var postTransforms;
  8582. var platformIsPreTag;
  8583. var platformMustUseProp;
  8584. var platformGetTagNamespace;
  8585. var maybeComponent;
  8586. function createASTElement (
  8587. tag,
  8588. attrs,
  8589. parent
  8590. ) {
  8591. return {
  8592. type: 1,
  8593. tag: tag,
  8594. attrsList: attrs,
  8595. attrsMap: makeAttrsMap(attrs),
  8596. rawAttrsMap: {},
  8597. parent: parent,
  8598. children: []
  8599. }
  8600. }
  8601. /**
  8602. * Convert HTML string to AST.
  8603. */
  8604. function parse (
  8605. template,
  8606. options
  8607. ) {
  8608. warn$2 = options.warn || baseWarn;
  8609. platformIsPreTag = options.isPreTag || no;
  8610. platformMustUseProp = options.mustUseProp || no;
  8611. platformGetTagNamespace = options.getTagNamespace || no;
  8612. var isReservedTag = options.isReservedTag || no;
  8613. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  8614. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8615. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8616. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8617. delimiters = options.delimiters;
  8618. var stack = [];
  8619. var preserveWhitespace = options.preserveWhitespace !== false;
  8620. var whitespaceOption = options.whitespace;
  8621. var root;
  8622. var currentParent;
  8623. var inVPre = false;
  8624. var inPre = false;
  8625. var warned = false;
  8626. function warnOnce (msg, range) {
  8627. if (!warned) {
  8628. warned = true;
  8629. warn$2(msg, range);
  8630. }
  8631. }
  8632. function closeElement (element) {
  8633. trimEndingWhitespace(element);
  8634. if (!inVPre && !element.processed) {
  8635. element = processElement(element, options);
  8636. }
  8637. // tree management
  8638. if (!stack.length && element !== root) {
  8639. // allow root elements with v-if, v-else-if and v-else
  8640. if (root.if && (element.elseif || element.else)) {
  8641. {
  8642. checkRootConstraints(element);
  8643. }
  8644. addIfCondition(root, {
  8645. exp: element.elseif,
  8646. block: element
  8647. });
  8648. } else {
  8649. warnOnce(
  8650. "Component template should contain exactly one root element. " +
  8651. "If you are using v-if on multiple elements, " +
  8652. "use v-else-if to chain them instead.",
  8653. { start: element.start }
  8654. );
  8655. }
  8656. }
  8657. if (currentParent && !element.forbidden) {
  8658. if (element.elseif || element.else) {
  8659. processIfConditions(element, currentParent);
  8660. } else {
  8661. if (element.slotScope) {
  8662. // scoped slot
  8663. // keep it in the children list so that v-else(-if) conditions can
  8664. // find it as the prev node.
  8665. var name = element.slotTarget || '"default"'
  8666. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8667. }
  8668. currentParent.children.push(element);
  8669. element.parent = currentParent;
  8670. }
  8671. }
  8672. // final children cleanup
  8673. // filter out scoped slots
  8674. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  8675. // remove trailing whitespace node again
  8676. trimEndingWhitespace(element);
  8677. // check pre state
  8678. if (element.pre) {
  8679. inVPre = false;
  8680. }
  8681. if (platformIsPreTag(element.tag)) {
  8682. inPre = false;
  8683. }
  8684. // apply post-transforms
  8685. for (var i = 0; i < postTransforms.length; i++) {
  8686. postTransforms[i](element, options);
  8687. }
  8688. }
  8689. function trimEndingWhitespace (el) {
  8690. // remove trailing whitespace node
  8691. if (!inPre) {
  8692. var lastNode;
  8693. while (
  8694. (lastNode = el.children[el.children.length - 1]) &&
  8695. lastNode.type === 3 &&
  8696. lastNode.text === ' '
  8697. ) {
  8698. el.children.pop();
  8699. }
  8700. }
  8701. }
  8702. function checkRootConstraints (el) {
  8703. if (el.tag === 'slot' || el.tag === 'template') {
  8704. warnOnce(
  8705. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8706. 'contain multiple nodes.',
  8707. { start: el.start }
  8708. );
  8709. }
  8710. if (el.attrsMap.hasOwnProperty('v-for')) {
  8711. warnOnce(
  8712. 'Cannot use v-for on stateful component root element because ' +
  8713. 'it renders multiple elements.',
  8714. el.rawAttrsMap['v-for']
  8715. );
  8716. }
  8717. }
  8718. parseHTML(template, {
  8719. warn: warn$2,
  8720. expectHTML: options.expectHTML,
  8721. isUnaryTag: options.isUnaryTag,
  8722. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8723. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8724. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8725. shouldKeepComment: options.comments,
  8726. outputSourceRange: options.outputSourceRange,
  8727. start: function start (tag, attrs, unary, start$1) {
  8728. // check namespace.
  8729. // inherit parent ns if there is one
  8730. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8731. // handle IE svg bug
  8732. /* istanbul ignore if */
  8733. if (isIE && ns === 'svg') {
  8734. attrs = guardIESVGBug(attrs);
  8735. }
  8736. var element = createASTElement(tag, attrs, currentParent);
  8737. if (ns) {
  8738. element.ns = ns;
  8739. }
  8740. {
  8741. if (options.outputSourceRange) {
  8742. element.start = start$1;
  8743. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  8744. cumulated[attr.name] = attr;
  8745. return cumulated
  8746. }, {});
  8747. }
  8748. attrs.forEach(function (attr) {
  8749. if (invalidAttributeRE.test(attr.name)) {
  8750. warn$2(
  8751. "Invalid dynamic argument expression: attribute names cannot contain " +
  8752. "spaces, quotes, <, >, / or =.",
  8753. {
  8754. start: attr.start + attr.name.indexOf("["),
  8755. end: attr.start + attr.name.length
  8756. }
  8757. );
  8758. }
  8759. });
  8760. }
  8761. if (isForbiddenTag(element) && !isServerRendering()) {
  8762. element.forbidden = true;
  8763. warn$2(
  8764. 'Templates should only be responsible for mapping the state to the ' +
  8765. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8766. "<" + tag + ">" + ', as they will not be parsed.',
  8767. { start: element.start }
  8768. );
  8769. }
  8770. // apply pre-transforms
  8771. for (var i = 0; i < preTransforms.length; i++) {
  8772. element = preTransforms[i](element, options) || element;
  8773. }
  8774. if (!inVPre) {
  8775. processPre(element);
  8776. if (element.pre) {
  8777. inVPre = true;
  8778. }
  8779. }
  8780. if (platformIsPreTag(element.tag)) {
  8781. inPre = true;
  8782. }
  8783. if (inVPre) {
  8784. processRawAttrs(element);
  8785. } else if (!element.processed) {
  8786. // structural directives
  8787. processFor(element);
  8788. processIf(element);
  8789. processOnce(element);
  8790. }
  8791. if (!root) {
  8792. root = element;
  8793. {
  8794. checkRootConstraints(root);
  8795. }
  8796. }
  8797. if (!unary) {
  8798. currentParent = element;
  8799. stack.push(element);
  8800. } else {
  8801. closeElement(element);
  8802. }
  8803. },
  8804. end: function end (tag, start, end$1) {
  8805. var element = stack[stack.length - 1];
  8806. // pop stack
  8807. stack.length -= 1;
  8808. currentParent = stack[stack.length - 1];
  8809. if (options.outputSourceRange) {
  8810. element.end = end$1;
  8811. }
  8812. closeElement(element);
  8813. },
  8814. chars: function chars (text, start, end) {
  8815. if (!currentParent) {
  8816. {
  8817. if (text === template) {
  8818. warnOnce(
  8819. 'Component template requires a root element, rather than just text.',
  8820. { start: start }
  8821. );
  8822. } else if ((text = text.trim())) {
  8823. warnOnce(
  8824. ("text \"" + text + "\" outside root element will be ignored."),
  8825. { start: start }
  8826. );
  8827. }
  8828. }
  8829. return
  8830. }
  8831. // IE textarea placeholder bug
  8832. /* istanbul ignore if */
  8833. if (isIE &&
  8834. currentParent.tag === 'textarea' &&
  8835. currentParent.attrsMap.placeholder === text
  8836. ) {
  8837. return
  8838. }
  8839. var children = currentParent.children;
  8840. if (inPre || text.trim()) {
  8841. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  8842. } else if (!children.length) {
  8843. // remove the whitespace-only node right after an opening tag
  8844. text = '';
  8845. } else if (whitespaceOption) {
  8846. if (whitespaceOption === 'condense') {
  8847. // in condense mode, remove the whitespace node if it contains
  8848. // line break, otherwise condense to a single space
  8849. text = lineBreakRE.test(text) ? '' : ' ';
  8850. } else {
  8851. text = ' ';
  8852. }
  8853. } else {
  8854. text = preserveWhitespace ? ' ' : '';
  8855. }
  8856. if (text) {
  8857. if (whitespaceOption === 'condense') {
  8858. // condense consecutive whitespaces into single space
  8859. text = text.replace(whitespaceRE$1, ' ');
  8860. }
  8861. var res;
  8862. var child;
  8863. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8864. child = {
  8865. type: 2,
  8866. expression: res.expression,
  8867. tokens: res.tokens,
  8868. text: text
  8869. };
  8870. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8871. child = {
  8872. type: 3,
  8873. text: text
  8874. };
  8875. }
  8876. if (child) {
  8877. if (options.outputSourceRange) {
  8878. child.start = start;
  8879. child.end = end;
  8880. }
  8881. children.push(child);
  8882. }
  8883. }
  8884. },
  8885. comment: function comment (text, start, end) {
  8886. // adding anyting as a sibling to the root node is forbidden
  8887. // comments should still be allowed, but ignored
  8888. if (currentParent) {
  8889. var child = {
  8890. type: 3,
  8891. text: text,
  8892. isComment: true
  8893. };
  8894. if (options.outputSourceRange) {
  8895. child.start = start;
  8896. child.end = end;
  8897. }
  8898. currentParent.children.push(child);
  8899. }
  8900. }
  8901. });
  8902. return root
  8903. }
  8904. function processPre (el) {
  8905. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8906. el.pre = true;
  8907. }
  8908. }
  8909. function processRawAttrs (el) {
  8910. var list = el.attrsList;
  8911. var len = list.length;
  8912. if (len) {
  8913. var attrs = el.attrs = new Array(len);
  8914. for (var i = 0; i < len; i++) {
  8915. attrs[i] = {
  8916. name: list[i].name,
  8917. value: JSON.stringify(list[i].value)
  8918. };
  8919. if (list[i].start != null) {
  8920. attrs[i].start = list[i].start;
  8921. attrs[i].end = list[i].end;
  8922. }
  8923. }
  8924. } else if (!el.pre) {
  8925. // non root node in pre blocks with no attributes
  8926. el.plain = true;
  8927. }
  8928. }
  8929. function processElement (
  8930. element,
  8931. options
  8932. ) {
  8933. processKey(element);
  8934. // determine whether this is a plain element after
  8935. // removing structural attributes
  8936. element.plain = (
  8937. !element.key &&
  8938. !element.scopedSlots &&
  8939. !element.attrsList.length
  8940. );
  8941. processRef(element);
  8942. processSlotContent(element);
  8943. processSlotOutlet(element);
  8944. processComponent(element);
  8945. for (var i = 0; i < transforms.length; i++) {
  8946. element = transforms[i](element, options) || element;
  8947. }
  8948. processAttrs(element);
  8949. return element
  8950. }
  8951. function processKey (el) {
  8952. var exp = getBindingAttr(el, 'key');
  8953. if (exp) {
  8954. {
  8955. if (el.tag === 'template') {
  8956. warn$2(
  8957. "<template> cannot be keyed. Place the key on real elements instead.",
  8958. getRawBindingAttr(el, 'key')
  8959. );
  8960. }
  8961. if (el.for) {
  8962. var iterator = el.iterator2 || el.iterator1;
  8963. var parent = el.parent;
  8964. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  8965. warn$2(
  8966. "Do not use v-for index as key on <transition-group> children, " +
  8967. "this is the same as not using keys.",
  8968. getRawBindingAttr(el, 'key'),
  8969. true /* tip */
  8970. );
  8971. }
  8972. }
  8973. }
  8974. el.key = exp;
  8975. }
  8976. }
  8977. function processRef (el) {
  8978. var ref = getBindingAttr(el, 'ref');
  8979. if (ref) {
  8980. el.ref = ref;
  8981. el.refInFor = checkInFor(el);
  8982. }
  8983. }
  8984. function processFor (el) {
  8985. var exp;
  8986. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  8987. var res = parseFor(exp);
  8988. if (res) {
  8989. extend(el, res);
  8990. } else {
  8991. warn$2(
  8992. ("Invalid v-for expression: " + exp),
  8993. el.rawAttrsMap['v-for']
  8994. );
  8995. }
  8996. }
  8997. }
  8998. function parseFor (exp) {
  8999. var inMatch = exp.match(forAliasRE);
  9000. if (!inMatch) { return }
  9001. var res = {};
  9002. res.for = inMatch[2].trim();
  9003. var alias = inMatch[1].trim().replace(stripParensRE, '');
  9004. var iteratorMatch = alias.match(forIteratorRE);
  9005. if (iteratorMatch) {
  9006. res.alias = alias.replace(forIteratorRE, '').trim();
  9007. res.iterator1 = iteratorMatch[1].trim();
  9008. if (iteratorMatch[2]) {
  9009. res.iterator2 = iteratorMatch[2].trim();
  9010. }
  9011. } else {
  9012. res.alias = alias;
  9013. }
  9014. return res
  9015. }
  9016. function processIf (el) {
  9017. var exp = getAndRemoveAttr(el, 'v-if');
  9018. if (exp) {
  9019. el.if = exp;
  9020. addIfCondition(el, {
  9021. exp: exp,
  9022. block: el
  9023. });
  9024. } else {
  9025. if (getAndRemoveAttr(el, 'v-else') != null) {
  9026. el.else = true;
  9027. }
  9028. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9029. if (elseif) {
  9030. el.elseif = elseif;
  9031. }
  9032. }
  9033. }
  9034. function processIfConditions (el, parent) {
  9035. var prev = findPrevElement(parent.children);
  9036. if (prev && prev.if) {
  9037. addIfCondition(prev, {
  9038. exp: el.elseif,
  9039. block: el
  9040. });
  9041. } else {
  9042. warn$2(
  9043. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  9044. "used on element <" + (el.tag) + "> without corresponding v-if.",
  9045. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  9046. );
  9047. }
  9048. }
  9049. function findPrevElement (children) {
  9050. var i = children.length;
  9051. while (i--) {
  9052. if (children[i].type === 1) {
  9053. return children[i]
  9054. } else {
  9055. if (children[i].text !== ' ') {
  9056. warn$2(
  9057. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  9058. "will be ignored.",
  9059. children[i]
  9060. );
  9061. }
  9062. children.pop();
  9063. }
  9064. }
  9065. }
  9066. function addIfCondition (el, condition) {
  9067. if (!el.ifConditions) {
  9068. el.ifConditions = [];
  9069. }
  9070. el.ifConditions.push(condition);
  9071. }
  9072. function processOnce (el) {
  9073. var once$$1 = getAndRemoveAttr(el, 'v-once');
  9074. if (once$$1 != null) {
  9075. el.once = true;
  9076. }
  9077. }
  9078. // handle content being passed to a component as slot,
  9079. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  9080. function processSlotContent (el) {
  9081. var slotScope;
  9082. if (el.tag === 'template') {
  9083. slotScope = getAndRemoveAttr(el, 'scope');
  9084. /* istanbul ignore if */
  9085. if (slotScope) {
  9086. warn$2(
  9087. "the \"scope\" attribute for scoped slots have been deprecated and " +
  9088. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  9089. "can also be used on plain elements in addition to <template> to " +
  9090. "denote scoped slots.",
  9091. el.rawAttrsMap['scope'],
  9092. true
  9093. );
  9094. }
  9095. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  9096. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  9097. /* istanbul ignore if */
  9098. if (el.attrsMap['v-for']) {
  9099. warn$2(
  9100. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  9101. "(v-for takes higher priority). Use a wrapper <template> for the " +
  9102. "scoped slot to make it clearer.",
  9103. el.rawAttrsMap['slot-scope'],
  9104. true
  9105. );
  9106. }
  9107. el.slotScope = slotScope;
  9108. }
  9109. // slot="xxx"
  9110. var slotTarget = getBindingAttr(el, 'slot');
  9111. if (slotTarget) {
  9112. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  9113. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  9114. // preserve slot as an attribute for native shadow DOM compat
  9115. // only for non-scoped slots.
  9116. if (el.tag !== 'template' && !el.slotScope) {
  9117. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  9118. }
  9119. }
  9120. // 2.6 v-slot syntax
  9121. {
  9122. if (el.tag === 'template') {
  9123. // v-slot on <template>
  9124. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  9125. if (slotBinding) {
  9126. {
  9127. if (el.slotTarget || el.slotScope) {
  9128. warn$2(
  9129. "Unexpected mixed usage of different slot syntaxes.",
  9130. el
  9131. );
  9132. }
  9133. if (el.parent && !maybeComponent(el.parent)) {
  9134. warn$2(
  9135. "<template v-slot> can only appear at the root level inside " +
  9136. "the receiving the component",
  9137. el
  9138. );
  9139. }
  9140. }
  9141. var ref = getSlotName(slotBinding);
  9142. var name = ref.name;
  9143. var dynamic = ref.dynamic;
  9144. el.slotTarget = name;
  9145. el.slotTargetDynamic = dynamic;
  9146. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  9147. }
  9148. } else {
  9149. // v-slot on component, denotes default slot
  9150. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  9151. if (slotBinding$1) {
  9152. {
  9153. if (!maybeComponent(el)) {
  9154. warn$2(
  9155. "v-slot can only be used on components or <template>.",
  9156. slotBinding$1
  9157. );
  9158. }
  9159. if (el.slotScope || el.slotTarget) {
  9160. warn$2(
  9161. "Unexpected mixed usage of different slot syntaxes.",
  9162. el
  9163. );
  9164. }
  9165. if (el.scopedSlots) {
  9166. warn$2(
  9167. "To avoid scope ambiguity, the default slot should also use " +
  9168. "<template> syntax when there are other named slots.",
  9169. slotBinding$1
  9170. );
  9171. }
  9172. }
  9173. // add the component's children to its default slot
  9174. var slots = el.scopedSlots || (el.scopedSlots = {});
  9175. var ref$1 = getSlotName(slotBinding$1);
  9176. var name$1 = ref$1.name;
  9177. var dynamic$1 = ref$1.dynamic;
  9178. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  9179. slotContainer.slotTarget = name$1;
  9180. slotContainer.slotTargetDynamic = dynamic$1;
  9181. slotContainer.children = el.children.filter(function (c) {
  9182. if (!c.slotScope) {
  9183. c.parent = slotContainer;
  9184. return true
  9185. }
  9186. });
  9187. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  9188. // remove children as they are returned from scopedSlots now
  9189. el.children = [];
  9190. // mark el non-plain so data gets generated
  9191. el.plain = false;
  9192. }
  9193. }
  9194. }
  9195. }
  9196. function getSlotName (binding) {
  9197. var name = binding.name.replace(slotRE, '');
  9198. if (!name) {
  9199. if (binding.name[0] !== '#') {
  9200. name = 'default';
  9201. } else {
  9202. warn$2(
  9203. "v-slot shorthand syntax requires a slot name.",
  9204. binding
  9205. );
  9206. }
  9207. }
  9208. return dynamicArgRE.test(name)
  9209. // dynamic [name]
  9210. ? { name: name.slice(1, -1), dynamic: true }
  9211. // static name
  9212. : { name: ("\"" + name + "\""), dynamic: false }
  9213. }
  9214. // handle <slot/> outlets
  9215. function processSlotOutlet (el) {
  9216. if (el.tag === 'slot') {
  9217. el.slotName = getBindingAttr(el, 'name');
  9218. if (el.key) {
  9219. warn$2(
  9220. "`key` does not work on <slot> because slots are abstract outlets " +
  9221. "and can possibly expand into multiple elements. " +
  9222. "Use the key on a wrapping element instead.",
  9223. getRawBindingAttr(el, 'key')
  9224. );
  9225. }
  9226. }
  9227. }
  9228. function processComponent (el) {
  9229. var binding;
  9230. if ((binding = getBindingAttr(el, 'is'))) {
  9231. el.component = binding;
  9232. }
  9233. if (getAndRemoveAttr(el, 'inline-template') != null) {
  9234. el.inlineTemplate = true;
  9235. }
  9236. }
  9237. function processAttrs (el) {
  9238. var list = el.attrsList;
  9239. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  9240. for (i = 0, l = list.length; i < l; i++) {
  9241. name = rawName = list[i].name;
  9242. value = list[i].value;
  9243. if (dirRE.test(name)) {
  9244. // mark element as dynamic
  9245. el.hasBindings = true;
  9246. // modifiers
  9247. modifiers = parseModifiers(name.replace(dirRE, ''));
  9248. // support .foo shorthand syntax for the .prop modifier
  9249. if (modifiers) {
  9250. name = name.replace(modifierRE, '');
  9251. }
  9252. if (bindRE.test(name)) { // v-bind
  9253. name = name.replace(bindRE, '');
  9254. value = parseFilters(value);
  9255. isDynamic = dynamicArgRE.test(name);
  9256. if (isDynamic) {
  9257. name = name.slice(1, -1);
  9258. }
  9259. if (
  9260. value.trim().length === 0
  9261. ) {
  9262. warn$2(
  9263. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  9264. );
  9265. }
  9266. if (modifiers) {
  9267. if (modifiers.prop && !isDynamic) {
  9268. name = camelize(name);
  9269. if (name === 'innerHtml') { name = 'innerHTML'; }
  9270. }
  9271. if (modifiers.camel && !isDynamic) {
  9272. name = camelize(name);
  9273. }
  9274. if (modifiers.sync) {
  9275. syncGen = genAssignmentCode(value, "$event");
  9276. if (!isDynamic) {
  9277. addHandler(
  9278. el,
  9279. ("update:" + (camelize(name))),
  9280. syncGen,
  9281. null,
  9282. false,
  9283. warn$2,
  9284. list[i]
  9285. );
  9286. if (hyphenate(name) !== camelize(name)) {
  9287. addHandler(
  9288. el,
  9289. ("update:" + (hyphenate(name))),
  9290. syncGen,
  9291. null,
  9292. false,
  9293. warn$2,
  9294. list[i]
  9295. );
  9296. }
  9297. } else {
  9298. // handler w/ dynamic event name
  9299. addHandler(
  9300. el,
  9301. ("\"update:\"+(" + name + ")"),
  9302. syncGen,
  9303. null,
  9304. false,
  9305. warn$2,
  9306. list[i],
  9307. true // dynamic
  9308. );
  9309. }
  9310. }
  9311. }
  9312. if ((modifiers && modifiers.prop) || (
  9313. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  9314. )) {
  9315. addProp(el, name, value, list[i], isDynamic);
  9316. } else {
  9317. addAttr(el, name, value, list[i], isDynamic);
  9318. }
  9319. } else if (onRE.test(name)) { // v-on
  9320. name = name.replace(onRE, '');
  9321. isDynamic = dynamicArgRE.test(name);
  9322. if (isDynamic) {
  9323. name = name.slice(1, -1);
  9324. }
  9325. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  9326. } else { // normal directives
  9327. name = name.replace(dirRE, '');
  9328. // parse arg
  9329. var argMatch = name.match(argRE);
  9330. var arg = argMatch && argMatch[1];
  9331. isDynamic = false;
  9332. if (arg) {
  9333. name = name.slice(0, -(arg.length + 1));
  9334. if (dynamicArgRE.test(arg)) {
  9335. arg = arg.slice(1, -1);
  9336. isDynamic = true;
  9337. }
  9338. }
  9339. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  9340. if (name === 'model') {
  9341. checkForAliasModel(el, value);
  9342. }
  9343. }
  9344. } else {
  9345. // literal attribute
  9346. {
  9347. var res = parseText(value, delimiters);
  9348. if (res) {
  9349. warn$2(
  9350. name + "=\"" + value + "\": " +
  9351. 'Interpolation inside attributes has been removed. ' +
  9352. 'Use v-bind or the colon shorthand instead. For example, ' +
  9353. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  9354. list[i]
  9355. );
  9356. }
  9357. }
  9358. addAttr(el, name, JSON.stringify(value), list[i]);
  9359. // #6887 firefox doesn't update muted state if set via attribute
  9360. // even immediately after element creation
  9361. if (!el.component &&
  9362. name === 'muted' &&
  9363. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  9364. addProp(el, name, 'true', list[i]);
  9365. }
  9366. }
  9367. }
  9368. }
  9369. function checkInFor (el) {
  9370. var parent = el;
  9371. while (parent) {
  9372. if (parent.for !== undefined) {
  9373. return true
  9374. }
  9375. parent = parent.parent;
  9376. }
  9377. return false
  9378. }
  9379. function parseModifiers (name) {
  9380. var match = name.match(modifierRE);
  9381. if (match) {
  9382. var ret = {};
  9383. match.forEach(function (m) { ret[m.slice(1)] = true; });
  9384. return ret
  9385. }
  9386. }
  9387. function makeAttrsMap (attrs) {
  9388. var map = {};
  9389. for (var i = 0, l = attrs.length; i < l; i++) {
  9390. if (
  9391. map[attrs[i].name] && !isIE && !isEdge
  9392. ) {
  9393. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  9394. }
  9395. map[attrs[i].name] = attrs[i].value;
  9396. }
  9397. return map
  9398. }
  9399. // for script (e.g. type="x/template") or style, do not decode content
  9400. function isTextTag (el) {
  9401. return el.tag === 'script' || el.tag === 'style'
  9402. }
  9403. function isForbiddenTag (el) {
  9404. return (
  9405. el.tag === 'style' ||
  9406. (el.tag === 'script' && (
  9407. !el.attrsMap.type ||
  9408. el.attrsMap.type === 'text/javascript'
  9409. ))
  9410. )
  9411. }
  9412. var ieNSBug = /^xmlns:NS\d+/;
  9413. var ieNSPrefix = /^NS\d+:/;
  9414. /* istanbul ignore next */
  9415. function guardIESVGBug (attrs) {
  9416. var res = [];
  9417. for (var i = 0; i < attrs.length; i++) {
  9418. var attr = attrs[i];
  9419. if (!ieNSBug.test(attr.name)) {
  9420. attr.name = attr.name.replace(ieNSPrefix, '');
  9421. res.push(attr);
  9422. }
  9423. }
  9424. return res
  9425. }
  9426. function checkForAliasModel (el, value) {
  9427. var _el = el;
  9428. while (_el) {
  9429. if (_el.for && _el.alias === value) {
  9430. warn$2(
  9431. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  9432. "You are binding v-model directly to a v-for iteration alias. " +
  9433. "This will not be able to modify the v-for source array because " +
  9434. "writing to the alias is like modifying a function local variable. " +
  9435. "Consider using an array of objects and use v-model on an object property instead.",
  9436. el.rawAttrsMap['v-model']
  9437. );
  9438. }
  9439. _el = _el.parent;
  9440. }
  9441. }
  9442. /* */
  9443. function preTransformNode (el, options) {
  9444. if (el.tag === 'input') {
  9445. var map = el.attrsMap;
  9446. if (!map['v-model']) {
  9447. return
  9448. }
  9449. var typeBinding;
  9450. if (map[':type'] || map['v-bind:type']) {
  9451. typeBinding = getBindingAttr(el, 'type');
  9452. }
  9453. if (!map.type && !typeBinding && map['v-bind']) {
  9454. typeBinding = "(" + (map['v-bind']) + ").type";
  9455. }
  9456. if (typeBinding) {
  9457. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  9458. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  9459. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  9460. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  9461. // 1. checkbox
  9462. var branch0 = cloneASTElement(el);
  9463. // process for on the main node
  9464. processFor(branch0);
  9465. addRawAttr(branch0, 'type', 'checkbox');
  9466. processElement(branch0, options);
  9467. branch0.processed = true; // prevent it from double-processed
  9468. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  9469. addIfCondition(branch0, {
  9470. exp: branch0.if,
  9471. block: branch0
  9472. });
  9473. // 2. add radio else-if condition
  9474. var branch1 = cloneASTElement(el);
  9475. getAndRemoveAttr(branch1, 'v-for', true);
  9476. addRawAttr(branch1, 'type', 'radio');
  9477. processElement(branch1, options);
  9478. addIfCondition(branch0, {
  9479. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  9480. block: branch1
  9481. });
  9482. // 3. other
  9483. var branch2 = cloneASTElement(el);
  9484. getAndRemoveAttr(branch2, 'v-for', true);
  9485. addRawAttr(branch2, ':type', typeBinding);
  9486. processElement(branch2, options);
  9487. addIfCondition(branch0, {
  9488. exp: ifCondition,
  9489. block: branch2
  9490. });
  9491. if (hasElse) {
  9492. branch0.else = true;
  9493. } else if (elseIfCondition) {
  9494. branch0.elseif = elseIfCondition;
  9495. }
  9496. return branch0
  9497. }
  9498. }
  9499. }
  9500. function cloneASTElement (el) {
  9501. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  9502. }
  9503. var model$1 = {
  9504. preTransformNode: preTransformNode
  9505. };
  9506. var modules$1 = [
  9507. klass$1,
  9508. style$1,
  9509. model$1
  9510. ];
  9511. /* */
  9512. function text (el, dir) {
  9513. if (dir.value) {
  9514. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  9515. }
  9516. }
  9517. /* */
  9518. function html (el, dir) {
  9519. if (dir.value) {
  9520. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  9521. }
  9522. }
  9523. var directives$1 = {
  9524. model: model,
  9525. text: text,
  9526. html: html
  9527. };
  9528. /* */
  9529. var baseOptions = {
  9530. expectHTML: true,
  9531. modules: modules$1,
  9532. directives: directives$1,
  9533. isPreTag: isPreTag,
  9534. isUnaryTag: isUnaryTag,
  9535. mustUseProp: mustUseProp,
  9536. canBeLeftOpenTag: canBeLeftOpenTag,
  9537. isReservedTag: isReservedTag,
  9538. getTagNamespace: getTagNamespace,
  9539. staticKeys: genStaticKeys(modules$1)
  9540. };
  9541. /* */
  9542. var isStaticKey;
  9543. var isPlatformReservedTag;
  9544. var genStaticKeysCached = cached(genStaticKeys$1);
  9545. /**
  9546. * Goal of the optimizer: walk the generated template AST tree
  9547. * and detect sub-trees that are purely static, i.e. parts of
  9548. * the DOM that never needs to change.
  9549. *
  9550. * Once we detect these sub-trees, we can:
  9551. *
  9552. * 1. Hoist them into constants, so that we no longer need to
  9553. * create fresh nodes for them on each re-render;
  9554. * 2. Completely skip them in the patching process.
  9555. */
  9556. function optimize (root, options) {
  9557. if (!root) { return }
  9558. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  9559. isPlatformReservedTag = options.isReservedTag || no;
  9560. // first pass: mark all non-static nodes.
  9561. markStatic$1(root);
  9562. // second pass: mark static roots.
  9563. markStaticRoots(root, false);
  9564. }
  9565. function genStaticKeys$1 (keys) {
  9566. return makeMap(
  9567. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  9568. (keys ? ',' + keys : '')
  9569. )
  9570. }
  9571. function markStatic$1 (node) {
  9572. node.static = isStatic(node);
  9573. if (node.type === 1) {
  9574. // do not make component slot content static. this avoids
  9575. // 1. components not able to mutate slot nodes
  9576. // 2. static slot content fails for hot-reloading
  9577. if (
  9578. !isPlatformReservedTag(node.tag) &&
  9579. node.tag !== 'slot' &&
  9580. node.attrsMap['inline-template'] == null
  9581. ) {
  9582. return
  9583. }
  9584. for (var i = 0, l = node.children.length; i < l; i++) {
  9585. var child = node.children[i];
  9586. markStatic$1(child);
  9587. if (!child.static) {
  9588. node.static = false;
  9589. }
  9590. }
  9591. if (node.ifConditions) {
  9592. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9593. var block = node.ifConditions[i$1].block;
  9594. markStatic$1(block);
  9595. if (!block.static) {
  9596. node.static = false;
  9597. }
  9598. }
  9599. }
  9600. }
  9601. }
  9602. function markStaticRoots (node, isInFor) {
  9603. if (node.type === 1) {
  9604. if (node.static || node.once) {
  9605. node.staticInFor = isInFor;
  9606. }
  9607. // For a node to qualify as a static root, it should have children that
  9608. // are not just static text. Otherwise the cost of hoisting out will
  9609. // outweigh the benefits and it's better off to just always render it fresh.
  9610. if (node.static && node.children.length && !(
  9611. node.children.length === 1 &&
  9612. node.children[0].type === 3
  9613. )) {
  9614. node.staticRoot = true;
  9615. return
  9616. } else {
  9617. node.staticRoot = false;
  9618. }
  9619. if (node.children) {
  9620. for (var i = 0, l = node.children.length; i < l; i++) {
  9621. markStaticRoots(node.children[i], isInFor || !!node.for);
  9622. }
  9623. }
  9624. if (node.ifConditions) {
  9625. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9626. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  9627. }
  9628. }
  9629. }
  9630. }
  9631. function isStatic (node) {
  9632. if (node.type === 2) { // expression
  9633. return false
  9634. }
  9635. if (node.type === 3) { // text
  9636. return true
  9637. }
  9638. return !!(node.pre || (
  9639. !node.hasBindings && // no dynamic bindings
  9640. !node.if && !node.for && // not v-if or v-for or v-else
  9641. !isBuiltInTag(node.tag) && // not a built-in
  9642. isPlatformReservedTag(node.tag) && // not a component
  9643. !isDirectChildOfTemplateFor(node) &&
  9644. Object.keys(node).every(isStaticKey)
  9645. ))
  9646. }
  9647. function isDirectChildOfTemplateFor (node) {
  9648. while (node.parent) {
  9649. node = node.parent;
  9650. if (node.tag !== 'template') {
  9651. return false
  9652. }
  9653. if (node.for) {
  9654. return true
  9655. }
  9656. }
  9657. return false
  9658. }
  9659. /* */
  9660. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  9661. var fnInvokeRE = /\([^)]*?\);*$/;
  9662. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  9663. // KeyboardEvent.keyCode aliases
  9664. var keyCodes = {
  9665. esc: 27,
  9666. tab: 9,
  9667. enter: 13,
  9668. space: 32,
  9669. up: 38,
  9670. left: 37,
  9671. right: 39,
  9672. down: 40,
  9673. 'delete': [8, 46]
  9674. };
  9675. // KeyboardEvent.key aliases
  9676. var keyNames = {
  9677. // #7880: IE11 and Edge use `Esc` for Escape key name.
  9678. esc: ['Esc', 'Escape'],
  9679. tab: 'Tab',
  9680. enter: 'Enter',
  9681. // #9112: IE11 uses `Spacebar` for Space key name.
  9682. space: [' ', 'Spacebar'],
  9683. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  9684. up: ['Up', 'ArrowUp'],
  9685. left: ['Left', 'ArrowLeft'],
  9686. right: ['Right', 'ArrowRight'],
  9687. down: ['Down', 'ArrowDown'],
  9688. // #9112: IE11 uses `Del` for Delete key name.
  9689. 'delete': ['Backspace', 'Delete', 'Del']
  9690. };
  9691. // #4868: modifiers that prevent the execution of the listener
  9692. // need to explicitly return null so that we can determine whether to remove
  9693. // the listener for .once
  9694. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  9695. var modifierCode = {
  9696. stop: '$event.stopPropagation();',
  9697. prevent: '$event.preventDefault();',
  9698. self: genGuard("$event.target !== $event.currentTarget"),
  9699. ctrl: genGuard("!$event.ctrlKey"),
  9700. shift: genGuard("!$event.shiftKey"),
  9701. alt: genGuard("!$event.altKey"),
  9702. meta: genGuard("!$event.metaKey"),
  9703. left: genGuard("'button' in $event && $event.button !== 0"),
  9704. middle: genGuard("'button' in $event && $event.button !== 1"),
  9705. right: genGuard("'button' in $event && $event.button !== 2")
  9706. };
  9707. function genHandlers (
  9708. events,
  9709. isNative
  9710. ) {
  9711. var prefix = isNative ? 'nativeOn:' : 'on:';
  9712. var staticHandlers = "";
  9713. var dynamicHandlers = "";
  9714. for (var name in events) {
  9715. var handlerCode = genHandler(events[name]);
  9716. if (events[name] && events[name].dynamic) {
  9717. dynamicHandlers += name + "," + handlerCode + ",";
  9718. } else {
  9719. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  9720. }
  9721. }
  9722. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  9723. if (dynamicHandlers) {
  9724. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  9725. } else {
  9726. return prefix + staticHandlers
  9727. }
  9728. }
  9729. function genHandler (handler) {
  9730. if (!handler) {
  9731. return 'function(){}'
  9732. }
  9733. if (Array.isArray(handler)) {
  9734. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  9735. }
  9736. var isMethodPath = simplePathRE.test(handler.value);
  9737. var isFunctionExpression = fnExpRE.test(handler.value);
  9738. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  9739. if (!handler.modifiers) {
  9740. if (isMethodPath || isFunctionExpression) {
  9741. return handler.value
  9742. }
  9743. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  9744. } else {
  9745. var code = '';
  9746. var genModifierCode = '';
  9747. var keys = [];
  9748. for (var key in handler.modifiers) {
  9749. if (modifierCode[key]) {
  9750. genModifierCode += modifierCode[key];
  9751. // left/right
  9752. if (keyCodes[key]) {
  9753. keys.push(key);
  9754. }
  9755. } else if (key === 'exact') {
  9756. var modifiers = (handler.modifiers);
  9757. genModifierCode += genGuard(
  9758. ['ctrl', 'shift', 'alt', 'meta']
  9759. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9760. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9761. .join('||')
  9762. );
  9763. } else {
  9764. keys.push(key);
  9765. }
  9766. }
  9767. if (keys.length) {
  9768. code += genKeyFilter(keys);
  9769. }
  9770. // Make sure modifiers like prevent and stop get executed after key filtering
  9771. if (genModifierCode) {
  9772. code += genModifierCode;
  9773. }
  9774. var handlerCode = isMethodPath
  9775. ? ("return " + (handler.value) + "($event)")
  9776. : isFunctionExpression
  9777. ? ("return (" + (handler.value) + ")($event)")
  9778. : isFunctionInvocation
  9779. ? ("return " + (handler.value))
  9780. : handler.value;
  9781. return ("function($event){" + code + handlerCode + "}")
  9782. }
  9783. }
  9784. function genKeyFilter (keys) {
  9785. return (
  9786. // make sure the key filters only apply to KeyboardEvents
  9787. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  9788. // key events that do not have keyCode property...
  9789. "if(!$event.type.indexOf('key')&&" +
  9790. (keys.map(genFilterCode).join('&&')) + ")return null;"
  9791. )
  9792. }
  9793. function genFilterCode (key) {
  9794. var keyVal = parseInt(key, 10);
  9795. if (keyVal) {
  9796. return ("$event.keyCode!==" + keyVal)
  9797. }
  9798. var keyCode = keyCodes[key];
  9799. var keyName = keyNames[key];
  9800. return (
  9801. "_k($event.keyCode," +
  9802. (JSON.stringify(key)) + "," +
  9803. (JSON.stringify(keyCode)) + "," +
  9804. "$event.key," +
  9805. "" + (JSON.stringify(keyName)) +
  9806. ")"
  9807. )
  9808. }
  9809. /* */
  9810. function on (el, dir) {
  9811. if (dir.modifiers) {
  9812. warn("v-on without argument does not support modifiers.");
  9813. }
  9814. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9815. }
  9816. /* */
  9817. function bind$1 (el, dir) {
  9818. el.wrapData = function (code) {
  9819. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9820. };
  9821. }
  9822. /* */
  9823. var baseDirectives = {
  9824. on: on,
  9825. bind: bind$1,
  9826. cloak: noop
  9827. };
  9828. /* */
  9829. var CodegenState = function CodegenState (options) {
  9830. this.options = options;
  9831. this.warn = options.warn || baseWarn;
  9832. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9833. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9834. this.directives = extend(extend({}, baseDirectives), options.directives);
  9835. var isReservedTag = options.isReservedTag || no;
  9836. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  9837. this.onceId = 0;
  9838. this.staticRenderFns = [];
  9839. this.pre = false;
  9840. };
  9841. function generate (
  9842. ast,
  9843. options
  9844. ) {
  9845. var state = new CodegenState(options);
  9846. var code = ast ? genElement(ast, state) : '_c("div")';
  9847. return {
  9848. render: ("with(this){return " + code + "}"),
  9849. staticRenderFns: state.staticRenderFns
  9850. }
  9851. }
  9852. function genElement (el, state) {
  9853. if (el.parent) {
  9854. el.pre = el.pre || el.parent.pre;
  9855. }
  9856. if (el.staticRoot && !el.staticProcessed) {
  9857. return genStatic(el, state)
  9858. } else if (el.once && !el.onceProcessed) {
  9859. return genOnce(el, state)
  9860. } else if (el.for && !el.forProcessed) {
  9861. return genFor(el, state)
  9862. } else if (el.if && !el.ifProcessed) {
  9863. return genIf(el, state)
  9864. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  9865. return genChildren(el, state) || 'void 0'
  9866. } else if (el.tag === 'slot') {
  9867. return genSlot(el, state)
  9868. } else {
  9869. // component or element
  9870. var code;
  9871. if (el.component) {
  9872. code = genComponent(el.component, el, state);
  9873. } else {
  9874. var data;
  9875. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  9876. data = genData$2(el, state);
  9877. }
  9878. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9879. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9880. }
  9881. // module transforms
  9882. for (var i = 0; i < state.transforms.length; i++) {
  9883. code = state.transforms[i](el, code);
  9884. }
  9885. return code
  9886. }
  9887. }
  9888. // hoist static sub-trees out
  9889. function genStatic (el, state) {
  9890. el.staticProcessed = true;
  9891. // Some elements (templates) need to behave differently inside of a v-pre
  9892. // node. All pre nodes are static roots, so we can use this as a location to
  9893. // wrap a state change and reset it upon exiting the pre node.
  9894. var originalPreState = state.pre;
  9895. if (el.pre) {
  9896. state.pre = el.pre;
  9897. }
  9898. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9899. state.pre = originalPreState;
  9900. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9901. }
  9902. // v-once
  9903. function genOnce (el, state) {
  9904. el.onceProcessed = true;
  9905. if (el.if && !el.ifProcessed) {
  9906. return genIf(el, state)
  9907. } else if (el.staticInFor) {
  9908. var key = '';
  9909. var parent = el.parent;
  9910. while (parent) {
  9911. if (parent.for) {
  9912. key = parent.key;
  9913. break
  9914. }
  9915. parent = parent.parent;
  9916. }
  9917. if (!key) {
  9918. state.warn(
  9919. "v-once can only be used inside v-for that is keyed. ",
  9920. el.rawAttrsMap['v-once']
  9921. );
  9922. return genElement(el, state)
  9923. }
  9924. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9925. } else {
  9926. return genStatic(el, state)
  9927. }
  9928. }
  9929. function genIf (
  9930. el,
  9931. state,
  9932. altGen,
  9933. altEmpty
  9934. ) {
  9935. el.ifProcessed = true; // avoid recursion
  9936. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  9937. }
  9938. function genIfConditions (
  9939. conditions,
  9940. state,
  9941. altGen,
  9942. altEmpty
  9943. ) {
  9944. if (!conditions.length) {
  9945. return altEmpty || '_e()'
  9946. }
  9947. var condition = conditions.shift();
  9948. if (condition.exp) {
  9949. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  9950. } else {
  9951. return ("" + (genTernaryExp(condition.block)))
  9952. }
  9953. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  9954. function genTernaryExp (el) {
  9955. return altGen
  9956. ? altGen(el, state)
  9957. : el.once
  9958. ? genOnce(el, state)
  9959. : genElement(el, state)
  9960. }
  9961. }
  9962. function genFor (
  9963. el,
  9964. state,
  9965. altGen,
  9966. altHelper
  9967. ) {
  9968. var exp = el.for;
  9969. var alias = el.alias;
  9970. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  9971. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  9972. if (state.maybeComponent(el) &&
  9973. el.tag !== 'slot' &&
  9974. el.tag !== 'template' &&
  9975. !el.key
  9976. ) {
  9977. state.warn(
  9978. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  9979. "v-for should have explicit keys. " +
  9980. "See https://vuejs.org/guide/list.html#key for more info.",
  9981. el.rawAttrsMap['v-for'],
  9982. true /* tip */
  9983. );
  9984. }
  9985. el.forProcessed = true; // avoid recursion
  9986. return (altHelper || '_l') + "((" + exp + ")," +
  9987. "function(" + alias + iterator1 + iterator2 + "){" +
  9988. "return " + ((altGen || genElement)(el, state)) +
  9989. '})'
  9990. }
  9991. function genData$2 (el, state) {
  9992. var data = '{';
  9993. // directives first.
  9994. // directives may mutate the el's other properties before they are generated.
  9995. var dirs = genDirectives(el, state);
  9996. if (dirs) { data += dirs + ','; }
  9997. // key
  9998. if (el.key) {
  9999. data += "key:" + (el.key) + ",";
  10000. }
  10001. // ref
  10002. if (el.ref) {
  10003. data += "ref:" + (el.ref) + ",";
  10004. }
  10005. if (el.refInFor) {
  10006. data += "refInFor:true,";
  10007. }
  10008. // pre
  10009. if (el.pre) {
  10010. data += "pre:true,";
  10011. }
  10012. // record original tag name for components using "is" attribute
  10013. if (el.component) {
  10014. data += "tag:\"" + (el.tag) + "\",";
  10015. }
  10016. // module data generation functions
  10017. for (var i = 0; i < state.dataGenFns.length; i++) {
  10018. data += state.dataGenFns[i](el);
  10019. }
  10020. // attributes
  10021. if (el.attrs) {
  10022. data += "attrs:" + (genProps(el.attrs)) + ",";
  10023. }
  10024. // DOM props
  10025. if (el.props) {
  10026. data += "domProps:" + (genProps(el.props)) + ",";
  10027. }
  10028. // event handlers
  10029. if (el.events) {
  10030. data += (genHandlers(el.events, false)) + ",";
  10031. }
  10032. if (el.nativeEvents) {
  10033. data += (genHandlers(el.nativeEvents, true)) + ",";
  10034. }
  10035. // slot target
  10036. // only for non-scoped slots
  10037. if (el.slotTarget && !el.slotScope) {
  10038. data += "slot:" + (el.slotTarget) + ",";
  10039. }
  10040. // scoped slots
  10041. if (el.scopedSlots) {
  10042. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  10043. }
  10044. // component v-model
  10045. if (el.model) {
  10046. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10047. }
  10048. // inline-template
  10049. if (el.inlineTemplate) {
  10050. var inlineTemplate = genInlineTemplate(el, state);
  10051. if (inlineTemplate) {
  10052. data += inlineTemplate + ",";
  10053. }
  10054. }
  10055. data = data.replace(/,$/, '') + '}';
  10056. // v-bind dynamic argument wrap
  10057. // v-bind with dynamic arguments must be applied using the same v-bind object
  10058. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  10059. if (el.dynamicAttrs) {
  10060. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  10061. }
  10062. // v-bind data wrap
  10063. if (el.wrapData) {
  10064. data = el.wrapData(data);
  10065. }
  10066. // v-on data wrap
  10067. if (el.wrapListeners) {
  10068. data = el.wrapListeners(data);
  10069. }
  10070. return data
  10071. }
  10072. function genDirectives (el, state) {
  10073. var dirs = el.directives;
  10074. if (!dirs) { return }
  10075. var res = 'directives:[';
  10076. var hasRuntime = false;
  10077. var i, l, dir, needRuntime;
  10078. for (i = 0, l = dirs.length; i < l; i++) {
  10079. dir = dirs[i];
  10080. needRuntime = true;
  10081. var gen = state.directives[dir.name];
  10082. if (gen) {
  10083. // compile-time directive that manipulates AST.
  10084. // returns true if it also needs a runtime counterpart.
  10085. needRuntime = !!gen(el, dir, state.warn);
  10086. }
  10087. if (needRuntime) {
  10088. hasRuntime = true;
  10089. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  10090. }
  10091. }
  10092. if (hasRuntime) {
  10093. return res.slice(0, -1) + ']'
  10094. }
  10095. }
  10096. function genInlineTemplate (el, state) {
  10097. var ast = el.children[0];
  10098. if (el.children.length !== 1 || ast.type !== 1) {
  10099. state.warn(
  10100. 'Inline-template components must have exactly one child element.',
  10101. { start: el.start }
  10102. );
  10103. }
  10104. if (ast && ast.type === 1) {
  10105. var inlineRenderFns = generate(ast, state.options);
  10106. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  10107. }
  10108. }
  10109. function genScopedSlots (
  10110. el,
  10111. slots,
  10112. state
  10113. ) {
  10114. // by default scoped slots are considered "stable", this allows child
  10115. // components with only scoped slots to skip forced updates from parent.
  10116. // but in some cases we have to bail-out of this optimization
  10117. // for example if the slot contains dynamic names, has v-if or v-for on them...
  10118. var needsForceUpdate = Object.keys(slots).some(function (key) {
  10119. var slot = slots[key];
  10120. return (
  10121. slot.slotTargetDynamic ||
  10122. slot.if ||
  10123. slot.for ||
  10124. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  10125. )
  10126. });
  10127. // #9534: if a component with scoped slots is inside a conditional branch,
  10128. // it's possible for the same component to be reused but with different
  10129. // compiled slot content. To avoid that, we generate a unique key based on
  10130. // the generated code of all the slot contents.
  10131. var needsKey = !!el.if;
  10132. // OR when it is inside another scoped slot or v-for (the reactivity may be
  10133. // disconnected due to the intermediate scope variable)
  10134. // #9438, #9506
  10135. // TODO: this can be further optimized by properly analyzing in-scope bindings
  10136. // and skip force updating ones that do not actually use scope variables.
  10137. if (!needsForceUpdate) {
  10138. var parent = el.parent;
  10139. while (parent) {
  10140. if (
  10141. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  10142. parent.for
  10143. ) {
  10144. needsForceUpdate = true;
  10145. break
  10146. }
  10147. if (parent.if) {
  10148. needsKey = true;
  10149. }
  10150. parent = parent.parent;
  10151. }
  10152. }
  10153. var generatedSlots = Object.keys(slots)
  10154. .map(function (key) { return genScopedSlot(slots[key], state); })
  10155. .join(',');
  10156. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  10157. }
  10158. function hash(str) {
  10159. var hash = 5381;
  10160. var i = str.length;
  10161. while(i) {
  10162. hash = (hash * 33) ^ str.charCodeAt(--i);
  10163. }
  10164. return hash >>> 0
  10165. }
  10166. function containsSlotChild (el) {
  10167. if (el.type === 1) {
  10168. if (el.tag === 'slot') {
  10169. return true
  10170. }
  10171. return el.children.some(containsSlotChild)
  10172. }
  10173. return false
  10174. }
  10175. function genScopedSlot (
  10176. el,
  10177. state
  10178. ) {
  10179. var isLegacySyntax = el.attrsMap['slot-scope'];
  10180. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  10181. return genIf(el, state, genScopedSlot, "null")
  10182. }
  10183. if (el.for && !el.forProcessed) {
  10184. return genFor(el, state, genScopedSlot)
  10185. }
  10186. var slotScope = el.slotScope === emptySlotScopeToken
  10187. ? ""
  10188. : String(el.slotScope);
  10189. var fn = "function(" + slotScope + "){" +
  10190. "return " + (el.tag === 'template'
  10191. ? el.if && isLegacySyntax
  10192. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  10193. : genChildren(el, state) || 'undefined'
  10194. : genElement(el, state)) + "}";
  10195. // reverse proxy v-slot without scope on this.$slots
  10196. var reverseProxy = slotScope ? "" : ",proxy:true";
  10197. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  10198. }
  10199. function genChildren (
  10200. el,
  10201. state,
  10202. checkSkip,
  10203. altGenElement,
  10204. altGenNode
  10205. ) {
  10206. var children = el.children;
  10207. if (children.length) {
  10208. var el$1 = children[0];
  10209. // optimize single v-for
  10210. if (children.length === 1 &&
  10211. el$1.for &&
  10212. el$1.tag !== 'template' &&
  10213. el$1.tag !== 'slot'
  10214. ) {
  10215. var normalizationType = checkSkip
  10216. ? state.maybeComponent(el$1) ? ",1" : ",0"
  10217. : "";
  10218. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10219. }
  10220. var normalizationType$1 = checkSkip
  10221. ? getNormalizationType(children, state.maybeComponent)
  10222. : 0;
  10223. var gen = altGenNode || genNode;
  10224. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10225. }
  10226. }
  10227. // determine the normalization needed for the children array.
  10228. // 0: no normalization needed
  10229. // 1: simple normalization needed (possible 1-level deep nested array)
  10230. // 2: full normalization needed
  10231. function getNormalizationType (
  10232. children,
  10233. maybeComponent
  10234. ) {
  10235. var res = 0;
  10236. for (var i = 0; i < children.length; i++) {
  10237. var el = children[i];
  10238. if (el.type !== 1) {
  10239. continue
  10240. }
  10241. if (needsNormalization(el) ||
  10242. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  10243. res = 2;
  10244. break
  10245. }
  10246. if (maybeComponent(el) ||
  10247. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  10248. res = 1;
  10249. }
  10250. }
  10251. return res
  10252. }
  10253. function needsNormalization (el) {
  10254. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10255. }
  10256. function genNode (node, state) {
  10257. if (node.type === 1) {
  10258. return genElement(node, state)
  10259. } else if (node.type === 3 && node.isComment) {
  10260. return genComment(node)
  10261. } else {
  10262. return genText(node)
  10263. }
  10264. }
  10265. function genText (text) {
  10266. return ("_v(" + (text.type === 2
  10267. ? text.expression // no need for () because already wrapped in _s()
  10268. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  10269. }
  10270. function genComment (comment) {
  10271. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  10272. }
  10273. function genSlot (el, state) {
  10274. var slotName = el.slotName || '"default"';
  10275. var children = genChildren(el, state);
  10276. var res = "_t(" + slotName + (children ? ("," + children) : '');
  10277. var attrs = el.attrs || el.dynamicAttrs
  10278. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  10279. // slot props are camelized
  10280. name: camelize(attr.name),
  10281. value: attr.value,
  10282. dynamic: attr.dynamic
  10283. }); }))
  10284. : null;
  10285. var bind$$1 = el.attrsMap['v-bind'];
  10286. if ((attrs || bind$$1) && !children) {
  10287. res += ",null";
  10288. }
  10289. if (attrs) {
  10290. res += "," + attrs;
  10291. }
  10292. if (bind$$1) {
  10293. res += (attrs ? '' : ',null') + "," + bind$$1;
  10294. }
  10295. return res + ')'
  10296. }
  10297. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  10298. function genComponent (
  10299. componentName,
  10300. el,
  10301. state
  10302. ) {
  10303. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10304. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  10305. }
  10306. function genProps (props) {
  10307. var staticProps = "";
  10308. var dynamicProps = "";
  10309. for (var i = 0; i < props.length; i++) {
  10310. var prop = props[i];
  10311. var value = transformSpecialNewlines(prop.value);
  10312. if (prop.dynamic) {
  10313. dynamicProps += (prop.name) + "," + value + ",";
  10314. } else {
  10315. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  10316. }
  10317. }
  10318. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  10319. if (dynamicProps) {
  10320. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  10321. } else {
  10322. return staticProps
  10323. }
  10324. }
  10325. // #3895, #4268
  10326. function transformSpecialNewlines (text) {
  10327. return text
  10328. .replace(/\u2028/g, '\\u2028')
  10329. .replace(/\u2029/g, '\\u2029')
  10330. }
  10331. /* */
  10332. // these keywords should not appear inside expressions, but operators like
  10333. // typeof, instanceof and in are allowed
  10334. var prohibitedKeywordRE = new RegExp('\\b' + (
  10335. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  10336. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  10337. 'extends,finally,continue,debugger,function,arguments'
  10338. ).split(',').join('\\b|\\b') + '\\b');
  10339. // these unary operators should not be used as property/method names
  10340. var unaryOperatorsRE = new RegExp('\\b' + (
  10341. 'delete,typeof,void'
  10342. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  10343. // strip strings in expressions
  10344. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  10345. // detect problematic expressions in a template
  10346. function detectErrors (ast, warn) {
  10347. if (ast) {
  10348. checkNode(ast, warn);
  10349. }
  10350. }
  10351. function checkNode (node, warn) {
  10352. if (node.type === 1) {
  10353. for (var name in node.attrsMap) {
  10354. if (dirRE.test(name)) {
  10355. var value = node.attrsMap[name];
  10356. if (value) {
  10357. var range = node.rawAttrsMap[name];
  10358. if (name === 'v-for') {
  10359. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  10360. } else if (onRE.test(name)) {
  10361. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  10362. } else {
  10363. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  10364. }
  10365. }
  10366. }
  10367. }
  10368. if (node.children) {
  10369. for (var i = 0; i < node.children.length; i++) {
  10370. checkNode(node.children[i], warn);
  10371. }
  10372. }
  10373. } else if (node.type === 2) {
  10374. checkExpression(node.expression, node.text, warn, node);
  10375. }
  10376. }
  10377. function checkEvent (exp, text, warn, range) {
  10378. var stipped = exp.replace(stripStringRE, '');
  10379. var keywordMatch = stipped.match(unaryOperatorsRE);
  10380. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  10381. warn(
  10382. "avoid using JavaScript unary operator as property name: " +
  10383. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  10384. range
  10385. );
  10386. }
  10387. checkExpression(exp, text, warn, range);
  10388. }
  10389. function checkFor (node, text, warn, range) {
  10390. checkExpression(node.for || '', text, warn, range);
  10391. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  10392. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  10393. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  10394. }
  10395. function checkIdentifier (
  10396. ident,
  10397. type,
  10398. text,
  10399. warn,
  10400. range
  10401. ) {
  10402. if (typeof ident === 'string') {
  10403. try {
  10404. new Function(("var " + ident + "=_"));
  10405. } catch (e) {
  10406. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  10407. }
  10408. }
  10409. }
  10410. function checkExpression (exp, text, warn, range) {
  10411. try {
  10412. new Function(("return " + exp));
  10413. } catch (e) {
  10414. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  10415. if (keywordMatch) {
  10416. warn(
  10417. "avoid using JavaScript keyword as property name: " +
  10418. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  10419. range
  10420. );
  10421. } else {
  10422. warn(
  10423. "invalid expression: " + (e.message) + " in\n\n" +
  10424. " " + exp + "\n\n" +
  10425. " Raw expression: " + (text.trim()) + "\n",
  10426. range
  10427. );
  10428. }
  10429. }
  10430. }
  10431. /* */
  10432. var range = 2;
  10433. function generateCodeFrame (
  10434. source,
  10435. start,
  10436. end
  10437. ) {
  10438. if ( start === void 0 ) start = 0;
  10439. if ( end === void 0 ) end = source.length;
  10440. var lines = source.split(/\r?\n/);
  10441. var count = 0;
  10442. var res = [];
  10443. for (var i = 0; i < lines.length; i++) {
  10444. count += lines[i].length + 1;
  10445. if (count >= start) {
  10446. for (var j = i - range; j <= i + range || end > count; j++) {
  10447. if (j < 0 || j >= lines.length) { continue }
  10448. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  10449. var lineLength = lines[j].length;
  10450. if (j === i) {
  10451. // push underline
  10452. var pad = start - (count - lineLength) + 1;
  10453. var length = end > count ? lineLength - pad : end - start;
  10454. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  10455. } else if (j > i) {
  10456. if (end > count) {
  10457. var length$1 = Math.min(end - count, lineLength);
  10458. res.push(" | " + repeat$1("^", length$1));
  10459. }
  10460. count += lineLength + 1;
  10461. }
  10462. }
  10463. break
  10464. }
  10465. }
  10466. return res.join('\n')
  10467. }
  10468. function repeat$1 (str, n) {
  10469. var result = '';
  10470. if (n > 0) {
  10471. while (true) { // eslint-disable-line
  10472. if (n & 1) { result += str; }
  10473. n >>>= 1;
  10474. if (n <= 0) { break }
  10475. str += str;
  10476. }
  10477. }
  10478. return result
  10479. }
  10480. /* */
  10481. function createFunction (code, errors) {
  10482. try {
  10483. return new Function(code)
  10484. } catch (err) {
  10485. errors.push({ err: err, code: code });
  10486. return noop
  10487. }
  10488. }
  10489. function createCompileToFunctionFn (compile) {
  10490. var cache = Object.create(null);
  10491. return function compileToFunctions (
  10492. template,
  10493. options,
  10494. vm
  10495. ) {
  10496. options = extend({}, options);
  10497. var warn$$1 = options.warn || warn;
  10498. delete options.warn;
  10499. /* istanbul ignore if */
  10500. {
  10501. // detect possible CSP restriction
  10502. try {
  10503. new Function('return 1');
  10504. } catch (e) {
  10505. if (e.toString().match(/unsafe-eval|CSP/)) {
  10506. warn$$1(
  10507. 'It seems you are using the standalone build of Vue.js in an ' +
  10508. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  10509. 'The template compiler cannot work in this environment. Consider ' +
  10510. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  10511. 'templates into render functions.'
  10512. );
  10513. }
  10514. }
  10515. }
  10516. // check cache
  10517. var key = options.delimiters
  10518. ? String(options.delimiters) + template
  10519. : template;
  10520. if (cache[key]) {
  10521. return cache[key]
  10522. }
  10523. // compile
  10524. var compiled = compile(template, options);
  10525. // check compilation errors/tips
  10526. {
  10527. if (compiled.errors && compiled.errors.length) {
  10528. if (options.outputSourceRange) {
  10529. compiled.errors.forEach(function (e) {
  10530. warn$$1(
  10531. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  10532. generateCodeFrame(template, e.start, e.end),
  10533. vm
  10534. );
  10535. });
  10536. } else {
  10537. warn$$1(
  10538. "Error compiling template:\n\n" + template + "\n\n" +
  10539. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  10540. vm
  10541. );
  10542. }
  10543. }
  10544. if (compiled.tips && compiled.tips.length) {
  10545. if (options.outputSourceRange) {
  10546. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  10547. } else {
  10548. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  10549. }
  10550. }
  10551. }
  10552. // turn code into functions
  10553. var res = {};
  10554. var fnGenErrors = [];
  10555. res.render = createFunction(compiled.render, fnGenErrors);
  10556. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  10557. return createFunction(code, fnGenErrors)
  10558. });
  10559. // check function generation errors.
  10560. // this should only happen if there is a bug in the compiler itself.
  10561. // mostly for codegen development use
  10562. /* istanbul ignore if */
  10563. {
  10564. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  10565. warn$$1(
  10566. "Failed to generate render function:\n\n" +
  10567. fnGenErrors.map(function (ref) {
  10568. var err = ref.err;
  10569. var code = ref.code;
  10570. return ((err.toString()) + " in\n\n" + code + "\n");
  10571. }).join('\n'),
  10572. vm
  10573. );
  10574. }
  10575. }
  10576. return (cache[key] = res)
  10577. }
  10578. }
  10579. /* */
  10580. function createCompilerCreator (baseCompile) {
  10581. return function createCompiler (baseOptions) {
  10582. function compile (
  10583. template,
  10584. options
  10585. ) {
  10586. var finalOptions = Object.create(baseOptions);
  10587. var errors = [];
  10588. var tips = [];
  10589. var warn = function (msg, range, tip) {
  10590. (tip ? tips : errors).push(msg);
  10591. };
  10592. if (options) {
  10593. if (options.outputSourceRange) {
  10594. // $flow-disable-line
  10595. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  10596. warn = function (msg, range, tip) {
  10597. var data = { msg: msg };
  10598. if (range) {
  10599. if (range.start != null) {
  10600. data.start = range.start + leadingSpaceLength;
  10601. }
  10602. if (range.end != null) {
  10603. data.end = range.end + leadingSpaceLength;
  10604. }
  10605. }
  10606. (tip ? tips : errors).push(data);
  10607. };
  10608. }
  10609. // merge custom modules
  10610. if (options.modules) {
  10611. finalOptions.modules =
  10612. (baseOptions.modules || []).concat(options.modules);
  10613. }
  10614. // merge custom directives
  10615. if (options.directives) {
  10616. finalOptions.directives = extend(
  10617. Object.create(baseOptions.directives || null),
  10618. options.directives
  10619. );
  10620. }
  10621. // copy other options
  10622. for (var key in options) {
  10623. if (key !== 'modules' && key !== 'directives') {
  10624. finalOptions[key] = options[key];
  10625. }
  10626. }
  10627. }
  10628. finalOptions.warn = warn;
  10629. var compiled = baseCompile(template.trim(), finalOptions);
  10630. {
  10631. detectErrors(compiled.ast, warn);
  10632. }
  10633. compiled.errors = errors;
  10634. compiled.tips = tips;
  10635. return compiled
  10636. }
  10637. return {
  10638. compile: compile,
  10639. compileToFunctions: createCompileToFunctionFn(compile)
  10640. }
  10641. }
  10642. }
  10643. /* */
  10644. // `createCompilerCreator` allows creating compilers that use alternative
  10645. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  10646. // Here we just export a default compiler using the default parts.
  10647. var createCompiler = createCompilerCreator(function baseCompile (
  10648. template,
  10649. options
  10650. ) {
  10651. var ast = parse(template.trim(), options);
  10652. if (options.optimize !== false) {
  10653. optimize(ast, options);
  10654. }
  10655. var code = generate(ast, options);
  10656. return {
  10657. ast: ast,
  10658. render: code.render,
  10659. staticRenderFns: code.staticRenderFns
  10660. }
  10661. });
  10662. /* */
  10663. var ref$1 = createCompiler(baseOptions);
  10664. var compile = ref$1.compile;
  10665. var compileToFunctions = ref$1.compileToFunctions;
  10666. /* */
  10667. // check whether current browser encodes a char inside attribute values
  10668. var div;
  10669. function getShouldDecode (href) {
  10670. div = div || document.createElement('div');
  10671. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  10672. return div.innerHTML.indexOf('&#10;') > 0
  10673. }
  10674. // #3663: IE encodes newlines inside attribute values while other browsers don't
  10675. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  10676. // #6828: chrome encodes content in a[href]
  10677. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  10678. /* */
  10679. var idToTemplate = cached(function (id) {
  10680. var el = query(id);
  10681. return el && el.innerHTML
  10682. });
  10683. var mount = Vue.prototype.$mount;
  10684. Vue.prototype.$mount = function (
  10685. el,
  10686. hydrating
  10687. ) {
  10688. el = el && query(el);
  10689. /* istanbul ignore if */
  10690. if (el === document.body || el === document.documentElement) {
  10691. warn(
  10692. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  10693. );
  10694. return this
  10695. }
  10696. var options = this.$options;
  10697. // resolve template/el and convert to render function
  10698. if (!options.render) {
  10699. var template = options.template;
  10700. if (template) {
  10701. if (typeof template === 'string') {
  10702. if (template.charAt(0) === '#') {
  10703. template = idToTemplate(template);
  10704. /* istanbul ignore if */
  10705. if (!template) {
  10706. warn(
  10707. ("Template element not found or is empty: " + (options.template)),
  10708. this
  10709. );
  10710. }
  10711. }
  10712. } else if (template.nodeType) {
  10713. template = template.innerHTML;
  10714. } else {
  10715. {
  10716. warn('invalid template option:' + template, this);
  10717. }
  10718. return this
  10719. }
  10720. } else if (el) {
  10721. template = getOuterHTML(el);
  10722. }
  10723. if (template) {
  10724. /* istanbul ignore if */
  10725. if (config.performance && mark) {
  10726. mark('compile');
  10727. }
  10728. var ref = compileToFunctions(template, {
  10729. outputSourceRange: "development" !== 'production',
  10730. shouldDecodeNewlines: shouldDecodeNewlines,
  10731. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  10732. delimiters: options.delimiters,
  10733. comments: options.comments
  10734. }, this);
  10735. var render = ref.render;
  10736. var staticRenderFns = ref.staticRenderFns;
  10737. options.render = render;
  10738. options.staticRenderFns = staticRenderFns;
  10739. /* istanbul ignore if */
  10740. if (config.performance && mark) {
  10741. mark('compile end');
  10742. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  10743. }
  10744. }
  10745. }
  10746. return mount.call(this, el, hydrating)
  10747. };
  10748. /**
  10749. * Get outerHTML of elements, taking care
  10750. * of SVG elements in IE as well.
  10751. */
  10752. function getOuterHTML (el) {
  10753. if (el.outerHTML) {
  10754. return el.outerHTML
  10755. } else {
  10756. var container = document.createElement('div');
  10757. container.appendChild(el.cloneNode(true));
  10758. return container.innerHTML
  10759. }
  10760. }
  10761. Vue.compile = compileToFunctions;
  10762. return Vue;
  10763. }));