vue.common.dev.js 313 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959
  1. /*!
  2. * Vue.js v2.6.12
  3. * (c) 2014-2020 Evan You
  4. * Released under the MIT License.
  5. */
  6. 'use strict';
  7. /* */
  8. var emptyObject = Object.freeze({});
  9. // These helpers produce better VM code in JS engines due to their
  10. // explicitness and function inlining.
  11. function isUndef (v) {
  12. return v === undefined || v === null
  13. }
  14. function isDef (v) {
  15. return v !== undefined && v !== null
  16. }
  17. function isTrue (v) {
  18. return v === true
  19. }
  20. function isFalse (v) {
  21. return v === false
  22. }
  23. /**
  24. * Check if value is primitive.
  25. */
  26. function isPrimitive (value) {
  27. return (
  28. typeof value === 'string' ||
  29. typeof value === 'number' ||
  30. // $flow-disable-line
  31. typeof value === 'symbol' ||
  32. typeof value === 'boolean'
  33. )
  34. }
  35. /**
  36. * Quick object check - this is primarily used to tell
  37. * Objects from primitive values when we know the value
  38. * is a JSON-compliant type.
  39. */
  40. function isObject (obj) {
  41. return obj !== null && typeof obj === 'object'
  42. }
  43. /**
  44. * Get the raw type string of a value, e.g., [object Object].
  45. */
  46. var _toString = Object.prototype.toString;
  47. function toRawType (value) {
  48. return _toString.call(value).slice(8, -1)
  49. }
  50. /**
  51. * Strict object type check. Only returns true
  52. * for plain JavaScript objects.
  53. */
  54. function isPlainObject (obj) {
  55. return _toString.call(obj) === '[object Object]'
  56. }
  57. function isRegExp (v) {
  58. return _toString.call(v) === '[object RegExp]'
  59. }
  60. /**
  61. * Check if val is a valid array index.
  62. */
  63. function isValidArrayIndex (val) {
  64. var n = parseFloat(String(val));
  65. return n >= 0 && Math.floor(n) === n && isFinite(val)
  66. }
  67. function isPromise (val) {
  68. return (
  69. isDef(val) &&
  70. typeof val.then === 'function' &&
  71. typeof val.catch === 'function'
  72. )
  73. }
  74. /**
  75. * Convert a value to a string that is actually rendered.
  76. */
  77. function toString (val) {
  78. return val == null
  79. ? ''
  80. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  81. ? JSON.stringify(val, null, 2)
  82. : String(val)
  83. }
  84. /**
  85. * Convert an input value to a number for persistence.
  86. * If the conversion fails, return original string.
  87. */
  88. function toNumber (val) {
  89. var n = parseFloat(val);
  90. return isNaN(n) ? val : n
  91. }
  92. /**
  93. * Make a map and return a function for checking if a key
  94. * is in that map.
  95. */
  96. function makeMap (
  97. str,
  98. expectsLowerCase
  99. ) {
  100. var map = Object.create(null);
  101. var list = str.split(',');
  102. for (var i = 0; i < list.length; i++) {
  103. map[list[i]] = true;
  104. }
  105. return expectsLowerCase
  106. ? function (val) { return map[val.toLowerCase()]; }
  107. : function (val) { return map[val]; }
  108. }
  109. /**
  110. * Check if a tag is a built-in tag.
  111. */
  112. var isBuiltInTag = makeMap('slot,component', true);
  113. /**
  114. * Check if an attribute is a reserved attribute.
  115. */
  116. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  117. /**
  118. * Remove an item from an array.
  119. */
  120. function remove (arr, item) {
  121. if (arr.length) {
  122. var index = arr.indexOf(item);
  123. if (index > -1) {
  124. return arr.splice(index, 1)
  125. }
  126. }
  127. }
  128. /**
  129. * Check whether an object has the property.
  130. */
  131. var hasOwnProperty = Object.prototype.hasOwnProperty;
  132. function hasOwn (obj, key) {
  133. return hasOwnProperty.call(obj, key)
  134. }
  135. /**
  136. * Create a cached version of a pure function.
  137. */
  138. function cached (fn) {
  139. var cache = Object.create(null);
  140. return (function cachedFn (str) {
  141. var hit = cache[str];
  142. return hit || (cache[str] = fn(str))
  143. })
  144. }
  145. /**
  146. * Camelize a hyphen-delimited string.
  147. */
  148. var camelizeRE = /-(\w)/g;
  149. var camelize = cached(function (str) {
  150. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  151. });
  152. /**
  153. * Capitalize a string.
  154. */
  155. var capitalize = cached(function (str) {
  156. return str.charAt(0).toUpperCase() + str.slice(1)
  157. });
  158. /**
  159. * Hyphenate a camelCase string.
  160. */
  161. var hyphenateRE = /\B([A-Z])/g;
  162. var hyphenate = cached(function (str) {
  163. return str.replace(hyphenateRE, '-$1').toLowerCase()
  164. });
  165. /**
  166. * Simple bind polyfill for environments that do not support it,
  167. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  168. * since native bind is now performant enough in most browsers.
  169. * But removing it would mean breaking code that was able to run in
  170. * PhantomJS 1.x, so this must be kept for backward compatibility.
  171. */
  172. /* istanbul ignore next */
  173. function polyfillBind (fn, ctx) {
  174. function boundFn (a) {
  175. var l = arguments.length;
  176. return l
  177. ? l > 1
  178. ? fn.apply(ctx, arguments)
  179. : fn.call(ctx, a)
  180. : fn.call(ctx)
  181. }
  182. boundFn._length = fn.length;
  183. return boundFn
  184. }
  185. function nativeBind (fn, ctx) {
  186. return fn.bind(ctx)
  187. }
  188. var bind = Function.prototype.bind
  189. ? nativeBind
  190. : polyfillBind;
  191. /**
  192. * Convert an Array-like object to a real Array.
  193. */
  194. function toArray (list, start) {
  195. start = start || 0;
  196. var i = list.length - start;
  197. var ret = new Array(i);
  198. while (i--) {
  199. ret[i] = list[i + start];
  200. }
  201. return ret
  202. }
  203. /**
  204. * Mix properties into target object.
  205. */
  206. function extend (to, _from) {
  207. for (var key in _from) {
  208. to[key] = _from[key];
  209. }
  210. return to
  211. }
  212. /**
  213. * Merge an Array of Objects into a single Object.
  214. */
  215. function toObject (arr) {
  216. var res = {};
  217. for (var i = 0; i < arr.length; i++) {
  218. if (arr[i]) {
  219. extend(res, arr[i]);
  220. }
  221. }
  222. return res
  223. }
  224. /* eslint-disable no-unused-vars */
  225. /**
  226. * Perform no operation.
  227. * Stubbing args to make Flow happy without leaving useless transpiled code
  228. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  229. */
  230. function noop (a, b, c) {}
  231. /**
  232. * Always return false.
  233. */
  234. var no = function (a, b, c) { return false; };
  235. /* eslint-enable no-unused-vars */
  236. /**
  237. * Return the same value.
  238. */
  239. var identity = function (_) { return _; };
  240. /**
  241. * Generate a string containing static keys from compiler modules.
  242. */
  243. function genStaticKeys (modules) {
  244. return modules.reduce(function (keys, m) {
  245. return keys.concat(m.staticKeys || [])
  246. }, []).join(',')
  247. }
  248. /**
  249. * Check if two values are loosely equal - that is,
  250. * if they are plain objects, do they have the same shape?
  251. */
  252. function looseEqual (a, b) {
  253. if (a === b) { return true }
  254. var isObjectA = isObject(a);
  255. var isObjectB = isObject(b);
  256. if (isObjectA && isObjectB) {
  257. try {
  258. var isArrayA = Array.isArray(a);
  259. var isArrayB = Array.isArray(b);
  260. if (isArrayA && isArrayB) {
  261. return a.length === b.length && a.every(function (e, i) {
  262. return looseEqual(e, b[i])
  263. })
  264. } else if (a instanceof Date && b instanceof Date) {
  265. return a.getTime() === b.getTime()
  266. } else if (!isArrayA && !isArrayB) {
  267. var keysA = Object.keys(a);
  268. var keysB = Object.keys(b);
  269. return keysA.length === keysB.length && keysA.every(function (key) {
  270. return looseEqual(a[key], b[key])
  271. })
  272. } else {
  273. /* istanbul ignore next */
  274. return false
  275. }
  276. } catch (e) {
  277. /* istanbul ignore next */
  278. return false
  279. }
  280. } else if (!isObjectA && !isObjectB) {
  281. return String(a) === String(b)
  282. } else {
  283. return false
  284. }
  285. }
  286. /**
  287. * Return the first index at which a loosely equal value can be
  288. * found in the array (if value is a plain object, the array must
  289. * contain an object of the same shape), or -1 if it is not present.
  290. */
  291. function looseIndexOf (arr, val) {
  292. for (var i = 0; i < arr.length; i++) {
  293. if (looseEqual(arr[i], val)) { return i }
  294. }
  295. return -1
  296. }
  297. /**
  298. * Ensure a function is called only once.
  299. */
  300. function once (fn) {
  301. var called = false;
  302. return function () {
  303. if (!called) {
  304. called = true;
  305. fn.apply(this, arguments);
  306. }
  307. }
  308. }
  309. var SSR_ATTR = 'data-server-rendered';
  310. var ASSET_TYPES = [
  311. 'component',
  312. 'directive',
  313. 'filter'
  314. ];
  315. var LIFECYCLE_HOOKS = [
  316. 'beforeCreate',
  317. 'created',
  318. 'beforeMount',
  319. 'mounted',
  320. 'beforeUpdate',
  321. 'updated',
  322. 'beforeDestroy',
  323. 'destroyed',
  324. 'activated',
  325. 'deactivated',
  326. 'errorCaptured',
  327. 'serverPrefetch'
  328. ];
  329. /* */
  330. var config = ({
  331. /**
  332. * Option merge strategies (used in core/util/options)
  333. */
  334. // $flow-disable-line
  335. optionMergeStrategies: Object.create(null),
  336. /**
  337. * Whether to suppress warnings.
  338. */
  339. silent: false,
  340. /**
  341. * Show production mode tip message on boot?
  342. */
  343. productionTip: "development" !== 'production',
  344. /**
  345. * Whether to enable devtools
  346. */
  347. devtools: "development" !== 'production',
  348. /**
  349. * Whether to record perf
  350. */
  351. performance: false,
  352. /**
  353. * Error handler for watcher errors
  354. */
  355. errorHandler: null,
  356. /**
  357. * Warn handler for watcher warns
  358. */
  359. warnHandler: null,
  360. /**
  361. * Ignore certain custom elements
  362. */
  363. ignoredElements: [],
  364. /**
  365. * Custom user key aliases for v-on
  366. */
  367. // $flow-disable-line
  368. keyCodes: Object.create(null),
  369. /**
  370. * Check if a tag is reserved so that it cannot be registered as a
  371. * component. This is platform-dependent and may be overwritten.
  372. */
  373. isReservedTag: no,
  374. /**
  375. * Check if an attribute is reserved so that it cannot be used as a component
  376. * prop. This is platform-dependent and may be overwritten.
  377. */
  378. isReservedAttr: no,
  379. /**
  380. * Check if a tag is an unknown element.
  381. * Platform-dependent.
  382. */
  383. isUnknownElement: no,
  384. /**
  385. * Get the namespace of an element
  386. */
  387. getTagNamespace: noop,
  388. /**
  389. * Parse the real tag name for the specific platform.
  390. */
  391. parsePlatformTagName: identity,
  392. /**
  393. * Check if an attribute must be bound using property, e.g. value
  394. * Platform-dependent.
  395. */
  396. mustUseProp: no,
  397. /**
  398. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  399. * This will significantly reduce performance if set to false.
  400. */
  401. async: true,
  402. /**
  403. * Exposed for legacy reasons
  404. */
  405. _lifecycleHooks: LIFECYCLE_HOOKS
  406. });
  407. /* */
  408. /**
  409. * unicode letters used for parsing html tags, component names and property paths.
  410. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  411. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  412. */
  413. var unicodeRegExp = /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/;
  414. /**
  415. * Check if a string starts with $ or _
  416. */
  417. function isReserved (str) {
  418. var c = (str + '').charCodeAt(0);
  419. return c === 0x24 || c === 0x5F
  420. }
  421. /**
  422. * Define a property.
  423. */
  424. function def (obj, key, val, enumerable) {
  425. Object.defineProperty(obj, key, {
  426. value: val,
  427. enumerable: !!enumerable,
  428. writable: true,
  429. configurable: true
  430. });
  431. }
  432. /**
  433. * Parse simple path.
  434. */
  435. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  436. function parsePath (path) {
  437. if (bailRE.test(path)) {
  438. return
  439. }
  440. var segments = path.split('.');
  441. return function (obj) {
  442. for (var i = 0; i < segments.length; i++) {
  443. if (!obj) { return }
  444. obj = obj[segments[i]];
  445. }
  446. return obj
  447. }
  448. }
  449. /* */
  450. // can we use __proto__?
  451. var hasProto = '__proto__' in {};
  452. // Browser environment sniffing
  453. var inBrowser = typeof window !== 'undefined';
  454. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  455. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  456. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  457. var isIE = UA && /msie|trident/.test(UA);
  458. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  459. var isEdge = UA && UA.indexOf('edge/') > 0;
  460. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  461. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  462. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  463. var isPhantomJS = UA && /phantomjs/.test(UA);
  464. var isFF = UA && UA.match(/firefox\/(\d+)/);
  465. // Firefox has a "watch" function on Object.prototype...
  466. var nativeWatch = ({}).watch;
  467. var supportsPassive = false;
  468. if (inBrowser) {
  469. try {
  470. var opts = {};
  471. Object.defineProperty(opts, 'passive', ({
  472. get: function get () {
  473. /* istanbul ignore next */
  474. supportsPassive = true;
  475. }
  476. })); // https://github.com/facebook/flow/issues/285
  477. window.addEventListener('test-passive', null, opts);
  478. } catch (e) {}
  479. }
  480. // this needs to be lazy-evaled because vue may be required before
  481. // vue-server-renderer can set VUE_ENV
  482. var _isServer;
  483. var isServerRendering = function () {
  484. if (_isServer === undefined) {
  485. /* istanbul ignore if */
  486. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  487. // detect presence of vue-server-renderer and avoid
  488. // Webpack shimming the process
  489. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  490. } else {
  491. _isServer = false;
  492. }
  493. }
  494. return _isServer
  495. };
  496. // detect devtools
  497. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  498. /* istanbul ignore next */
  499. function isNative (Ctor) {
  500. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  501. }
  502. var hasSymbol =
  503. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  504. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  505. var _Set;
  506. /* istanbul ignore if */ // $flow-disable-line
  507. if (typeof Set !== 'undefined' && isNative(Set)) {
  508. // use native Set when available.
  509. _Set = Set;
  510. } else {
  511. // a non-standard Set polyfill that only works with primitive keys.
  512. _Set = /*@__PURE__*/(function () {
  513. function Set () {
  514. this.set = Object.create(null);
  515. }
  516. Set.prototype.has = function has (key) {
  517. return this.set[key] === true
  518. };
  519. Set.prototype.add = function add (key) {
  520. this.set[key] = true;
  521. };
  522. Set.prototype.clear = function clear () {
  523. this.set = Object.create(null);
  524. };
  525. return Set;
  526. }());
  527. }
  528. /* */
  529. var warn = noop;
  530. var tip = noop;
  531. var generateComponentTrace = (noop); // work around flow check
  532. var formatComponentName = (noop);
  533. {
  534. var hasConsole = typeof console !== 'undefined';
  535. var classifyRE = /(?:^|[-_])(\w)/g;
  536. var classify = function (str) { return str
  537. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  538. .replace(/[-_]/g, ''); };
  539. warn = function (msg, vm) {
  540. var trace = vm ? generateComponentTrace(vm) : '';
  541. if (config.warnHandler) {
  542. config.warnHandler.call(null, msg, vm, trace);
  543. } else if (hasConsole && (!config.silent)) {
  544. console.error(("[Vue warn]: " + msg + trace));
  545. }
  546. };
  547. tip = function (msg, vm) {
  548. if (hasConsole && (!config.silent)) {
  549. console.warn("[Vue tip]: " + msg + (
  550. vm ? generateComponentTrace(vm) : ''
  551. ));
  552. }
  553. };
  554. formatComponentName = function (vm, includeFile) {
  555. if (vm.$root === vm) {
  556. return '<Root>'
  557. }
  558. var options = typeof vm === 'function' && vm.cid != null
  559. ? vm.options
  560. : vm._isVue
  561. ? vm.$options || vm.constructor.options
  562. : vm;
  563. var name = options.name || options._componentTag;
  564. var file = options.__file;
  565. if (!name && file) {
  566. var match = file.match(/([^/\\]+)\.vue$/);
  567. name = match && match[1];
  568. }
  569. return (
  570. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  571. (file && includeFile !== false ? (" at " + file) : '')
  572. )
  573. };
  574. var repeat = function (str, n) {
  575. var res = '';
  576. while (n) {
  577. if (n % 2 === 1) { res += str; }
  578. if (n > 1) { str += str; }
  579. n >>= 1;
  580. }
  581. return res
  582. };
  583. generateComponentTrace = function (vm) {
  584. if (vm._isVue && vm.$parent) {
  585. var tree = [];
  586. var currentRecursiveSequence = 0;
  587. while (vm) {
  588. if (tree.length > 0) {
  589. var last = tree[tree.length - 1];
  590. if (last.constructor === vm.constructor) {
  591. currentRecursiveSequence++;
  592. vm = vm.$parent;
  593. continue
  594. } else if (currentRecursiveSequence > 0) {
  595. tree[tree.length - 1] = [last, currentRecursiveSequence];
  596. currentRecursiveSequence = 0;
  597. }
  598. }
  599. tree.push(vm);
  600. vm = vm.$parent;
  601. }
  602. return '\n\nfound in\n\n' + tree
  603. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  604. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  605. : formatComponentName(vm))); })
  606. .join('\n')
  607. } else {
  608. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  609. }
  610. };
  611. }
  612. /* */
  613. var uid = 0;
  614. /**
  615. * A dep is an observable that can have multiple
  616. * directives subscribing to it.
  617. */
  618. var Dep = function Dep () {
  619. this.id = uid++;
  620. this.subs = [];
  621. };
  622. Dep.prototype.addSub = function addSub (sub) {
  623. this.subs.push(sub);
  624. };
  625. Dep.prototype.removeSub = function removeSub (sub) {
  626. remove(this.subs, sub);
  627. };
  628. Dep.prototype.depend = function depend () {
  629. if (Dep.target) {
  630. Dep.target.addDep(this);
  631. }
  632. };
  633. Dep.prototype.notify = function notify () {
  634. // stabilize the subscriber list first
  635. var subs = this.subs.slice();
  636. if (!config.async) {
  637. // subs aren't sorted in scheduler if not running async
  638. // we need to sort them now to make sure they fire in correct
  639. // order
  640. subs.sort(function (a, b) { return a.id - b.id; });
  641. }
  642. for (var i = 0, l = subs.length; i < l; i++) {
  643. subs[i].update();
  644. }
  645. };
  646. // The current target watcher being evaluated.
  647. // This is globally unique because only one watcher
  648. // can be evaluated at a time.
  649. Dep.target = null;
  650. var targetStack = [];
  651. function pushTarget (target) {
  652. targetStack.push(target);
  653. Dep.target = target;
  654. }
  655. function popTarget () {
  656. targetStack.pop();
  657. Dep.target = targetStack[targetStack.length - 1];
  658. }
  659. /* */
  660. var VNode = function VNode (
  661. tag,
  662. data,
  663. children,
  664. text,
  665. elm,
  666. context,
  667. componentOptions,
  668. asyncFactory
  669. ) {
  670. this.tag = tag;
  671. this.data = data;
  672. this.children = children;
  673. this.text = text;
  674. this.elm = elm;
  675. this.ns = undefined;
  676. this.context = context;
  677. this.fnContext = undefined;
  678. this.fnOptions = undefined;
  679. this.fnScopeId = undefined;
  680. this.key = data && data.key;
  681. this.componentOptions = componentOptions;
  682. this.componentInstance = undefined;
  683. this.parent = undefined;
  684. this.raw = false;
  685. this.isStatic = false;
  686. this.isRootInsert = true;
  687. this.isComment = false;
  688. this.isCloned = false;
  689. this.isOnce = false;
  690. this.asyncFactory = asyncFactory;
  691. this.asyncMeta = undefined;
  692. this.isAsyncPlaceholder = false;
  693. };
  694. var prototypeAccessors = { child: { configurable: true } };
  695. // DEPRECATED: alias for componentInstance for backwards compat.
  696. /* istanbul ignore next */
  697. prototypeAccessors.child.get = function () {
  698. return this.componentInstance
  699. };
  700. Object.defineProperties( VNode.prototype, prototypeAccessors );
  701. var createEmptyVNode = function (text) {
  702. if ( text === void 0 ) text = '';
  703. var node = new VNode();
  704. node.text = text;
  705. node.isComment = true;
  706. return node
  707. };
  708. function createTextVNode (val) {
  709. return new VNode(undefined, undefined, undefined, String(val))
  710. }
  711. // optimized shallow clone
  712. // used for static nodes and slot nodes because they may be reused across
  713. // multiple renders, cloning them avoids errors when DOM manipulations rely
  714. // on their elm reference.
  715. function cloneVNode (vnode) {
  716. var cloned = new VNode(
  717. vnode.tag,
  718. vnode.data,
  719. // #7975
  720. // clone children array to avoid mutating original in case of cloning
  721. // a child.
  722. vnode.children && vnode.children.slice(),
  723. vnode.text,
  724. vnode.elm,
  725. vnode.context,
  726. vnode.componentOptions,
  727. vnode.asyncFactory
  728. );
  729. cloned.ns = vnode.ns;
  730. cloned.isStatic = vnode.isStatic;
  731. cloned.key = vnode.key;
  732. cloned.isComment = vnode.isComment;
  733. cloned.fnContext = vnode.fnContext;
  734. cloned.fnOptions = vnode.fnOptions;
  735. cloned.fnScopeId = vnode.fnScopeId;
  736. cloned.asyncMeta = vnode.asyncMeta;
  737. cloned.isCloned = true;
  738. return cloned
  739. }
  740. /*
  741. * not type checking this file because flow doesn't play well with
  742. * dynamically accessing methods on Array prototype
  743. */
  744. var arrayProto = Array.prototype;
  745. var arrayMethods = Object.create(arrayProto);
  746. var methodsToPatch = [
  747. 'push',
  748. 'pop',
  749. 'shift',
  750. 'unshift',
  751. 'splice',
  752. 'sort',
  753. 'reverse'
  754. ];
  755. /**
  756. * Intercept mutating methods and emit events
  757. */
  758. methodsToPatch.forEach(function (method) {
  759. // cache original method
  760. var original = arrayProto[method];
  761. def(arrayMethods, method, function mutator () {
  762. var args = [], len = arguments.length;
  763. while ( len-- ) args[ len ] = arguments[ len ];
  764. var result = original.apply(this, args);
  765. var ob = this.__ob__;
  766. var inserted;
  767. switch (method) {
  768. case 'push':
  769. case 'unshift':
  770. inserted = args;
  771. break
  772. case 'splice':
  773. inserted = args.slice(2);
  774. break
  775. }
  776. if (inserted) { ob.observeArray(inserted); }
  777. // notify change
  778. ob.dep.notify();
  779. return result
  780. });
  781. });
  782. /* */
  783. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  784. /**
  785. * In some cases we may want to disable observation inside a component's
  786. * update computation.
  787. */
  788. var shouldObserve = true;
  789. function toggleObserving (value) {
  790. shouldObserve = value;
  791. }
  792. /**
  793. * Observer class that is attached to each observed
  794. * object. Once attached, the observer converts the target
  795. * object's property keys into getter/setters that
  796. * collect dependencies and dispatch updates.
  797. */
  798. var Observer = function Observer (value) {
  799. this.value = value;
  800. this.dep = new Dep();
  801. this.vmCount = 0;
  802. def(value, '__ob__', this);
  803. if (Array.isArray(value)) {
  804. if (hasProto) {
  805. protoAugment(value, arrayMethods);
  806. } else {
  807. copyAugment(value, arrayMethods, arrayKeys);
  808. }
  809. this.observeArray(value);
  810. } else {
  811. this.walk(value);
  812. }
  813. };
  814. /**
  815. * Walk through all properties and convert them into
  816. * getter/setters. This method should only be called when
  817. * value type is Object.
  818. */
  819. Observer.prototype.walk = function walk (obj) {
  820. var keys = Object.keys(obj);
  821. for (var i = 0; i < keys.length; i++) {
  822. defineReactive$$1(obj, keys[i]);
  823. }
  824. };
  825. /**
  826. * Observe a list of Array items.
  827. */
  828. Observer.prototype.observeArray = function observeArray (items) {
  829. for (var i = 0, l = items.length; i < l; i++) {
  830. observe(items[i]);
  831. }
  832. };
  833. // helpers
  834. /**
  835. * Augment a target Object or Array by intercepting
  836. * the prototype chain using __proto__
  837. */
  838. function protoAugment (target, src) {
  839. /* eslint-disable no-proto */
  840. target.__proto__ = src;
  841. /* eslint-enable no-proto */
  842. }
  843. /**
  844. * Augment a target Object or Array by defining
  845. * hidden properties.
  846. */
  847. /* istanbul ignore next */
  848. function copyAugment (target, src, keys) {
  849. for (var i = 0, l = keys.length; i < l; i++) {
  850. var key = keys[i];
  851. def(target, key, src[key]);
  852. }
  853. }
  854. /**
  855. * Attempt to create an observer instance for a value,
  856. * returns the new observer if successfully observed,
  857. * or the existing observer if the value already has one.
  858. */
  859. function observe (value, asRootData) {
  860. if (!isObject(value) || value instanceof VNode) {
  861. return
  862. }
  863. var ob;
  864. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  865. ob = value.__ob__;
  866. } else if (
  867. shouldObserve &&
  868. !isServerRendering() &&
  869. (Array.isArray(value) || isPlainObject(value)) &&
  870. Object.isExtensible(value) &&
  871. !value._isVue
  872. ) {
  873. ob = new Observer(value);
  874. }
  875. if (asRootData && ob) {
  876. ob.vmCount++;
  877. }
  878. return ob
  879. }
  880. /**
  881. * Define a reactive property on an Object.
  882. */
  883. function defineReactive$$1 (
  884. obj,
  885. key,
  886. val,
  887. customSetter,
  888. shallow
  889. ) {
  890. var dep = new Dep();
  891. var property = Object.getOwnPropertyDescriptor(obj, key);
  892. if (property && property.configurable === false) {
  893. return
  894. }
  895. // cater for pre-defined getter/setters
  896. var getter = property && property.get;
  897. var setter = property && property.set;
  898. if ((!getter || setter) && arguments.length === 2) {
  899. val = obj[key];
  900. }
  901. var childOb = !shallow && observe(val);
  902. Object.defineProperty(obj, key, {
  903. enumerable: true,
  904. configurable: true,
  905. get: function reactiveGetter () {
  906. var value = getter ? getter.call(obj) : val;
  907. if (Dep.target) {
  908. dep.depend();
  909. if (childOb) {
  910. childOb.dep.depend();
  911. if (Array.isArray(value)) {
  912. dependArray(value);
  913. }
  914. }
  915. }
  916. return value
  917. },
  918. set: function reactiveSetter (newVal) {
  919. var value = getter ? getter.call(obj) : val;
  920. /* eslint-disable no-self-compare */
  921. if (newVal === value || (newVal !== newVal && value !== value)) {
  922. return
  923. }
  924. /* eslint-enable no-self-compare */
  925. if (customSetter) {
  926. customSetter();
  927. }
  928. // #7981: for accessor properties without setter
  929. if (getter && !setter) { return }
  930. if (setter) {
  931. setter.call(obj, newVal);
  932. } else {
  933. val = newVal;
  934. }
  935. childOb = !shallow && observe(newVal);
  936. dep.notify();
  937. }
  938. });
  939. }
  940. /**
  941. * Set a property on an object. Adds the new property and
  942. * triggers change notification if the property doesn't
  943. * already exist.
  944. */
  945. function set (target, key, val) {
  946. if (isUndef(target) || isPrimitive(target)
  947. ) {
  948. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  949. }
  950. if (Array.isArray(target) && isValidArrayIndex(key)) {
  951. target.length = Math.max(target.length, key);
  952. target.splice(key, 1, val);
  953. return val
  954. }
  955. if (key in target && !(key in Object.prototype)) {
  956. target[key] = val;
  957. return val
  958. }
  959. var ob = (target).__ob__;
  960. if (target._isVue || (ob && ob.vmCount)) {
  961. warn(
  962. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  963. 'at runtime - declare it upfront in the data option.'
  964. );
  965. return val
  966. }
  967. if (!ob) {
  968. target[key] = val;
  969. return val
  970. }
  971. defineReactive$$1(ob.value, key, val);
  972. ob.dep.notify();
  973. return val
  974. }
  975. /**
  976. * Delete a property and trigger change if necessary.
  977. */
  978. function del (target, key) {
  979. if (isUndef(target) || isPrimitive(target)
  980. ) {
  981. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  982. }
  983. if (Array.isArray(target) && isValidArrayIndex(key)) {
  984. target.splice(key, 1);
  985. return
  986. }
  987. var ob = (target).__ob__;
  988. if (target._isVue || (ob && ob.vmCount)) {
  989. warn(
  990. 'Avoid deleting properties on a Vue instance or its root $data ' +
  991. '- just set it to null.'
  992. );
  993. return
  994. }
  995. if (!hasOwn(target, key)) {
  996. return
  997. }
  998. delete target[key];
  999. if (!ob) {
  1000. return
  1001. }
  1002. ob.dep.notify();
  1003. }
  1004. /**
  1005. * Collect dependencies on array elements when the array is touched, since
  1006. * we cannot intercept array element access like property getters.
  1007. */
  1008. function dependArray (value) {
  1009. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1010. e = value[i];
  1011. e && e.__ob__ && e.__ob__.dep.depend();
  1012. if (Array.isArray(e)) {
  1013. dependArray(e);
  1014. }
  1015. }
  1016. }
  1017. /* */
  1018. /**
  1019. * Option overwriting strategies are functions that handle
  1020. * how to merge a parent option value and a child option
  1021. * value into the final value.
  1022. */
  1023. var strats = config.optionMergeStrategies;
  1024. /**
  1025. * Options with restrictions
  1026. */
  1027. {
  1028. strats.el = strats.propsData = function (parent, child, vm, key) {
  1029. if (!vm) {
  1030. warn(
  1031. "option \"" + key + "\" can only be used during instance " +
  1032. 'creation with the `new` keyword.'
  1033. );
  1034. }
  1035. return defaultStrat(parent, child)
  1036. };
  1037. }
  1038. /**
  1039. * Helper that recursively merges two data objects together.
  1040. */
  1041. function mergeData (to, from) {
  1042. if (!from) { return to }
  1043. var key, toVal, fromVal;
  1044. var keys = hasSymbol
  1045. ? Reflect.ownKeys(from)
  1046. : Object.keys(from);
  1047. for (var i = 0; i < keys.length; i++) {
  1048. key = keys[i];
  1049. // in case the object is already observed...
  1050. if (key === '__ob__') { continue }
  1051. toVal = to[key];
  1052. fromVal = from[key];
  1053. if (!hasOwn(to, key)) {
  1054. set(to, key, fromVal);
  1055. } else if (
  1056. toVal !== fromVal &&
  1057. isPlainObject(toVal) &&
  1058. isPlainObject(fromVal)
  1059. ) {
  1060. mergeData(toVal, fromVal);
  1061. }
  1062. }
  1063. return to
  1064. }
  1065. /**
  1066. * Data
  1067. */
  1068. function mergeDataOrFn (
  1069. parentVal,
  1070. childVal,
  1071. vm
  1072. ) {
  1073. if (!vm) {
  1074. // in a Vue.extend merge, both should be functions
  1075. if (!childVal) {
  1076. return parentVal
  1077. }
  1078. if (!parentVal) {
  1079. return childVal
  1080. }
  1081. // when parentVal & childVal are both present,
  1082. // we need to return a function that returns the
  1083. // merged result of both functions... no need to
  1084. // check if parentVal is a function here because
  1085. // it has to be a function to pass previous merges.
  1086. return function mergedDataFn () {
  1087. return mergeData(
  1088. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1089. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1090. )
  1091. }
  1092. } else {
  1093. return function mergedInstanceDataFn () {
  1094. // instance merge
  1095. var instanceData = typeof childVal === 'function'
  1096. ? childVal.call(vm, vm)
  1097. : childVal;
  1098. var defaultData = typeof parentVal === 'function'
  1099. ? parentVal.call(vm, vm)
  1100. : parentVal;
  1101. if (instanceData) {
  1102. return mergeData(instanceData, defaultData)
  1103. } else {
  1104. return defaultData
  1105. }
  1106. }
  1107. }
  1108. }
  1109. strats.data = function (
  1110. parentVal,
  1111. childVal,
  1112. vm
  1113. ) {
  1114. if (!vm) {
  1115. if (childVal && typeof childVal !== 'function') {
  1116. warn(
  1117. 'The "data" option should be a function ' +
  1118. 'that returns a per-instance value in component ' +
  1119. 'definitions.',
  1120. vm
  1121. );
  1122. return parentVal
  1123. }
  1124. return mergeDataOrFn(parentVal, childVal)
  1125. }
  1126. return mergeDataOrFn(parentVal, childVal, vm)
  1127. };
  1128. /**
  1129. * Hooks and props are merged as arrays.
  1130. */
  1131. function mergeHook (
  1132. parentVal,
  1133. childVal
  1134. ) {
  1135. var res = childVal
  1136. ? parentVal
  1137. ? parentVal.concat(childVal)
  1138. : Array.isArray(childVal)
  1139. ? childVal
  1140. : [childVal]
  1141. : parentVal;
  1142. return res
  1143. ? dedupeHooks(res)
  1144. : res
  1145. }
  1146. function dedupeHooks (hooks) {
  1147. var res = [];
  1148. for (var i = 0; i < hooks.length; i++) {
  1149. if (res.indexOf(hooks[i]) === -1) {
  1150. res.push(hooks[i]);
  1151. }
  1152. }
  1153. return res
  1154. }
  1155. LIFECYCLE_HOOKS.forEach(function (hook) {
  1156. strats[hook] = mergeHook;
  1157. });
  1158. /**
  1159. * Assets
  1160. *
  1161. * When a vm is present (instance creation), we need to do
  1162. * a three-way merge between constructor options, instance
  1163. * options and parent options.
  1164. */
  1165. function mergeAssets (
  1166. parentVal,
  1167. childVal,
  1168. vm,
  1169. key
  1170. ) {
  1171. var res = Object.create(parentVal || null);
  1172. if (childVal) {
  1173. assertObjectType(key, childVal, vm);
  1174. return extend(res, childVal)
  1175. } else {
  1176. return res
  1177. }
  1178. }
  1179. ASSET_TYPES.forEach(function (type) {
  1180. strats[type + 's'] = mergeAssets;
  1181. });
  1182. /**
  1183. * Watchers.
  1184. *
  1185. * Watchers hashes should not overwrite one
  1186. * another, so we merge them as arrays.
  1187. */
  1188. strats.watch = function (
  1189. parentVal,
  1190. childVal,
  1191. vm,
  1192. key
  1193. ) {
  1194. // work around Firefox's Object.prototype.watch...
  1195. if (parentVal === nativeWatch) { parentVal = undefined; }
  1196. if (childVal === nativeWatch) { childVal = undefined; }
  1197. /* istanbul ignore if */
  1198. if (!childVal) { return Object.create(parentVal || null) }
  1199. {
  1200. assertObjectType(key, childVal, vm);
  1201. }
  1202. if (!parentVal) { return childVal }
  1203. var ret = {};
  1204. extend(ret, parentVal);
  1205. for (var key$1 in childVal) {
  1206. var parent = ret[key$1];
  1207. var child = childVal[key$1];
  1208. if (parent && !Array.isArray(parent)) {
  1209. parent = [parent];
  1210. }
  1211. ret[key$1] = parent
  1212. ? parent.concat(child)
  1213. : Array.isArray(child) ? child : [child];
  1214. }
  1215. return ret
  1216. };
  1217. /**
  1218. * Other object hashes.
  1219. */
  1220. strats.props =
  1221. strats.methods =
  1222. strats.inject =
  1223. strats.computed = function (
  1224. parentVal,
  1225. childVal,
  1226. vm,
  1227. key
  1228. ) {
  1229. if (childVal && "development" !== 'production') {
  1230. assertObjectType(key, childVal, vm);
  1231. }
  1232. if (!parentVal) { return childVal }
  1233. var ret = Object.create(null);
  1234. extend(ret, parentVal);
  1235. if (childVal) { extend(ret, childVal); }
  1236. return ret
  1237. };
  1238. strats.provide = mergeDataOrFn;
  1239. /**
  1240. * Default strategy.
  1241. */
  1242. var defaultStrat = function (parentVal, childVal) {
  1243. return childVal === undefined
  1244. ? parentVal
  1245. : childVal
  1246. };
  1247. /**
  1248. * Validate component names
  1249. */
  1250. function checkComponents (options) {
  1251. for (var key in options.components) {
  1252. validateComponentName(key);
  1253. }
  1254. }
  1255. function validateComponentName (name) {
  1256. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1257. warn(
  1258. 'Invalid component name: "' + name + '". Component names ' +
  1259. 'should conform to valid custom element name in html5 specification.'
  1260. );
  1261. }
  1262. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1263. warn(
  1264. 'Do not use built-in or reserved HTML elements as component ' +
  1265. 'id: ' + name
  1266. );
  1267. }
  1268. }
  1269. /**
  1270. * Ensure all props option syntax are normalized into the
  1271. * Object-based format.
  1272. */
  1273. function normalizeProps (options, vm) {
  1274. var props = options.props;
  1275. if (!props) { return }
  1276. var res = {};
  1277. var i, val, name;
  1278. if (Array.isArray(props)) {
  1279. i = props.length;
  1280. while (i--) {
  1281. val = props[i];
  1282. if (typeof val === 'string') {
  1283. name = camelize(val);
  1284. res[name] = { type: null };
  1285. } else {
  1286. warn('props must be strings when using array syntax.');
  1287. }
  1288. }
  1289. } else if (isPlainObject(props)) {
  1290. for (var key in props) {
  1291. val = props[key];
  1292. name = camelize(key);
  1293. res[name] = isPlainObject(val)
  1294. ? val
  1295. : { type: val };
  1296. }
  1297. } else {
  1298. warn(
  1299. "Invalid value for option \"props\": expected an Array or an Object, " +
  1300. "but got " + (toRawType(props)) + ".",
  1301. vm
  1302. );
  1303. }
  1304. options.props = res;
  1305. }
  1306. /**
  1307. * Normalize all injections into Object-based format
  1308. */
  1309. function normalizeInject (options, vm) {
  1310. var inject = options.inject;
  1311. if (!inject) { return }
  1312. var normalized = options.inject = {};
  1313. if (Array.isArray(inject)) {
  1314. for (var i = 0; i < inject.length; i++) {
  1315. normalized[inject[i]] = { from: inject[i] };
  1316. }
  1317. } else if (isPlainObject(inject)) {
  1318. for (var key in inject) {
  1319. var val = inject[key];
  1320. normalized[key] = isPlainObject(val)
  1321. ? extend({ from: key }, val)
  1322. : { from: val };
  1323. }
  1324. } else {
  1325. warn(
  1326. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1327. "but got " + (toRawType(inject)) + ".",
  1328. vm
  1329. );
  1330. }
  1331. }
  1332. /**
  1333. * Normalize raw function directives into object format.
  1334. */
  1335. function normalizeDirectives (options) {
  1336. var dirs = options.directives;
  1337. if (dirs) {
  1338. for (var key in dirs) {
  1339. var def$$1 = dirs[key];
  1340. if (typeof def$$1 === 'function') {
  1341. dirs[key] = { bind: def$$1, update: def$$1 };
  1342. }
  1343. }
  1344. }
  1345. }
  1346. function assertObjectType (name, value, vm) {
  1347. if (!isPlainObject(value)) {
  1348. warn(
  1349. "Invalid value for option \"" + name + "\": expected an Object, " +
  1350. "but got " + (toRawType(value)) + ".",
  1351. vm
  1352. );
  1353. }
  1354. }
  1355. /**
  1356. * Merge two option objects into a new one.
  1357. * Core utility used in both instantiation and inheritance.
  1358. */
  1359. function mergeOptions (
  1360. parent,
  1361. child,
  1362. vm
  1363. ) {
  1364. {
  1365. checkComponents(child);
  1366. }
  1367. if (typeof child === 'function') {
  1368. child = child.options;
  1369. }
  1370. normalizeProps(child, vm);
  1371. normalizeInject(child, vm);
  1372. normalizeDirectives(child);
  1373. // Apply extends and mixins on the child options,
  1374. // but only if it is a raw options object that isn't
  1375. // the result of another mergeOptions call.
  1376. // Only merged options has the _base property.
  1377. if (!child._base) {
  1378. if (child.extends) {
  1379. parent = mergeOptions(parent, child.extends, vm);
  1380. }
  1381. if (child.mixins) {
  1382. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1383. parent = mergeOptions(parent, child.mixins[i], vm);
  1384. }
  1385. }
  1386. }
  1387. var options = {};
  1388. var key;
  1389. for (key in parent) {
  1390. mergeField(key);
  1391. }
  1392. for (key in child) {
  1393. if (!hasOwn(parent, key)) {
  1394. mergeField(key);
  1395. }
  1396. }
  1397. function mergeField (key) {
  1398. var strat = strats[key] || defaultStrat;
  1399. options[key] = strat(parent[key], child[key], vm, key);
  1400. }
  1401. return options
  1402. }
  1403. /**
  1404. * Resolve an asset.
  1405. * This function is used because child instances need access
  1406. * to assets defined in its ancestor chain.
  1407. */
  1408. function resolveAsset (
  1409. options,
  1410. type,
  1411. id,
  1412. warnMissing
  1413. ) {
  1414. /* istanbul ignore if */
  1415. if (typeof id !== 'string') {
  1416. return
  1417. }
  1418. var assets = options[type];
  1419. // check local registration variations first
  1420. if (hasOwn(assets, id)) { return assets[id] }
  1421. var camelizedId = camelize(id);
  1422. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1423. var PascalCaseId = capitalize(camelizedId);
  1424. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1425. // fallback to prototype chain
  1426. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1427. if (warnMissing && !res) {
  1428. warn(
  1429. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1430. options
  1431. );
  1432. }
  1433. return res
  1434. }
  1435. /* */
  1436. function validateProp (
  1437. key,
  1438. propOptions,
  1439. propsData,
  1440. vm
  1441. ) {
  1442. var prop = propOptions[key];
  1443. var absent = !hasOwn(propsData, key);
  1444. var value = propsData[key];
  1445. // boolean casting
  1446. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1447. if (booleanIndex > -1) {
  1448. if (absent && !hasOwn(prop, 'default')) {
  1449. value = false;
  1450. } else if (value === '' || value === hyphenate(key)) {
  1451. // only cast empty string / same name to boolean if
  1452. // boolean has higher priority
  1453. var stringIndex = getTypeIndex(String, prop.type);
  1454. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1455. value = true;
  1456. }
  1457. }
  1458. }
  1459. // check default value
  1460. if (value === undefined) {
  1461. value = getPropDefaultValue(vm, prop, key);
  1462. // since the default value is a fresh copy,
  1463. // make sure to observe it.
  1464. var prevShouldObserve = shouldObserve;
  1465. toggleObserving(true);
  1466. observe(value);
  1467. toggleObserving(prevShouldObserve);
  1468. }
  1469. {
  1470. assertProp(prop, key, value, vm, absent);
  1471. }
  1472. return value
  1473. }
  1474. /**
  1475. * Get the default value of a prop.
  1476. */
  1477. function getPropDefaultValue (vm, prop, key) {
  1478. // no default, return undefined
  1479. if (!hasOwn(prop, 'default')) {
  1480. return undefined
  1481. }
  1482. var def = prop.default;
  1483. // warn against non-factory defaults for Object & Array
  1484. if (isObject(def)) {
  1485. warn(
  1486. 'Invalid default value for prop "' + key + '": ' +
  1487. 'Props with type Object/Array must use a factory function ' +
  1488. 'to return the default value.',
  1489. vm
  1490. );
  1491. }
  1492. // the raw prop value was also undefined from previous render,
  1493. // return previous default value to avoid unnecessary watcher trigger
  1494. if (vm && vm.$options.propsData &&
  1495. vm.$options.propsData[key] === undefined &&
  1496. vm._props[key] !== undefined
  1497. ) {
  1498. return vm._props[key]
  1499. }
  1500. // call factory function for non-Function types
  1501. // a value is Function if its prototype is function even across different execution context
  1502. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1503. ? def.call(vm)
  1504. : def
  1505. }
  1506. /**
  1507. * Assert whether a prop is valid.
  1508. */
  1509. function assertProp (
  1510. prop,
  1511. name,
  1512. value,
  1513. vm,
  1514. absent
  1515. ) {
  1516. if (prop.required && absent) {
  1517. warn(
  1518. 'Missing required prop: "' + name + '"',
  1519. vm
  1520. );
  1521. return
  1522. }
  1523. if (value == null && !prop.required) {
  1524. return
  1525. }
  1526. var type = prop.type;
  1527. var valid = !type || type === true;
  1528. var expectedTypes = [];
  1529. if (type) {
  1530. if (!Array.isArray(type)) {
  1531. type = [type];
  1532. }
  1533. for (var i = 0; i < type.length && !valid; i++) {
  1534. var assertedType = assertType(value, type[i]);
  1535. expectedTypes.push(assertedType.expectedType || '');
  1536. valid = assertedType.valid;
  1537. }
  1538. }
  1539. if (!valid) {
  1540. warn(
  1541. getInvalidTypeMessage(name, value, expectedTypes),
  1542. vm
  1543. );
  1544. return
  1545. }
  1546. var validator = prop.validator;
  1547. if (validator) {
  1548. if (!validator(value)) {
  1549. warn(
  1550. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1551. vm
  1552. );
  1553. }
  1554. }
  1555. }
  1556. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1557. function assertType (value, type) {
  1558. var valid;
  1559. var expectedType = getType(type);
  1560. if (simpleCheckRE.test(expectedType)) {
  1561. var t = typeof value;
  1562. valid = t === expectedType.toLowerCase();
  1563. // for primitive wrapper objects
  1564. if (!valid && t === 'object') {
  1565. valid = value instanceof type;
  1566. }
  1567. } else if (expectedType === 'Object') {
  1568. valid = isPlainObject(value);
  1569. } else if (expectedType === 'Array') {
  1570. valid = Array.isArray(value);
  1571. } else {
  1572. valid = value instanceof type;
  1573. }
  1574. return {
  1575. valid: valid,
  1576. expectedType: expectedType
  1577. }
  1578. }
  1579. /**
  1580. * Use function string name to check built-in types,
  1581. * because a simple equality check will fail when running
  1582. * across different vms / iframes.
  1583. */
  1584. function getType (fn) {
  1585. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1586. return match ? match[1] : ''
  1587. }
  1588. function isSameType (a, b) {
  1589. return getType(a) === getType(b)
  1590. }
  1591. function getTypeIndex (type, expectedTypes) {
  1592. if (!Array.isArray(expectedTypes)) {
  1593. return isSameType(expectedTypes, type) ? 0 : -1
  1594. }
  1595. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1596. if (isSameType(expectedTypes[i], type)) {
  1597. return i
  1598. }
  1599. }
  1600. return -1
  1601. }
  1602. function getInvalidTypeMessage (name, value, expectedTypes) {
  1603. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1604. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1605. var expectedType = expectedTypes[0];
  1606. var receivedType = toRawType(value);
  1607. var expectedValue = styleValue(value, expectedType);
  1608. var receivedValue = styleValue(value, receivedType);
  1609. // check if we need to specify expected value
  1610. if (expectedTypes.length === 1 &&
  1611. isExplicable(expectedType) &&
  1612. !isBoolean(expectedType, receivedType)) {
  1613. message += " with value " + expectedValue;
  1614. }
  1615. message += ", got " + receivedType + " ";
  1616. // check if we need to specify received value
  1617. if (isExplicable(receivedType)) {
  1618. message += "with value " + receivedValue + ".";
  1619. }
  1620. return message
  1621. }
  1622. function styleValue (value, type) {
  1623. if (type === 'String') {
  1624. return ("\"" + value + "\"")
  1625. } else if (type === 'Number') {
  1626. return ("" + (Number(value)))
  1627. } else {
  1628. return ("" + value)
  1629. }
  1630. }
  1631. function isExplicable (value) {
  1632. var explicitTypes = ['string', 'number', 'boolean'];
  1633. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1634. }
  1635. function isBoolean () {
  1636. var args = [], len = arguments.length;
  1637. while ( len-- ) args[ len ] = arguments[ len ];
  1638. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1639. }
  1640. /* */
  1641. function handleError (err, vm, info) {
  1642. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1643. // See: https://github.com/vuejs/vuex/issues/1505
  1644. pushTarget();
  1645. try {
  1646. if (vm) {
  1647. var cur = vm;
  1648. while ((cur = cur.$parent)) {
  1649. var hooks = cur.$options.errorCaptured;
  1650. if (hooks) {
  1651. for (var i = 0; i < hooks.length; i++) {
  1652. try {
  1653. var capture = hooks[i].call(cur, err, vm, info) === false;
  1654. if (capture) { return }
  1655. } catch (e) {
  1656. globalHandleError(e, cur, 'errorCaptured hook');
  1657. }
  1658. }
  1659. }
  1660. }
  1661. }
  1662. globalHandleError(err, vm, info);
  1663. } finally {
  1664. popTarget();
  1665. }
  1666. }
  1667. function invokeWithErrorHandling (
  1668. handler,
  1669. context,
  1670. args,
  1671. vm,
  1672. info
  1673. ) {
  1674. var res;
  1675. try {
  1676. res = args ? handler.apply(context, args) : handler.call(context);
  1677. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1678. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1679. // issue #9511
  1680. // avoid catch triggering multiple times when nested calls
  1681. res._handled = true;
  1682. }
  1683. } catch (e) {
  1684. handleError(e, vm, info);
  1685. }
  1686. return res
  1687. }
  1688. function globalHandleError (err, vm, info) {
  1689. if (config.errorHandler) {
  1690. try {
  1691. return config.errorHandler.call(null, err, vm, info)
  1692. } catch (e) {
  1693. // if the user intentionally throws the original error in the handler,
  1694. // do not log it twice
  1695. if (e !== err) {
  1696. logError(e, null, 'config.errorHandler');
  1697. }
  1698. }
  1699. }
  1700. logError(err, vm, info);
  1701. }
  1702. function logError (err, vm, info) {
  1703. {
  1704. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1705. }
  1706. /* istanbul ignore else */
  1707. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1708. console.error(err);
  1709. } else {
  1710. throw err
  1711. }
  1712. }
  1713. /* */
  1714. var isUsingMicroTask = false;
  1715. var callbacks = [];
  1716. var pending = false;
  1717. function flushCallbacks () {
  1718. pending = false;
  1719. var copies = callbacks.slice(0);
  1720. callbacks.length = 0;
  1721. for (var i = 0; i < copies.length; i++) {
  1722. copies[i]();
  1723. }
  1724. }
  1725. // Here we have async deferring wrappers using microtasks.
  1726. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1727. // However, it has subtle problems when state is changed right before repaint
  1728. // (e.g. #6813, out-in transitions).
  1729. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1730. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1731. // So we now use microtasks everywhere, again.
  1732. // A major drawback of this tradeoff is that there are some scenarios
  1733. // where microtasks have too high a priority and fire in between supposedly
  1734. // sequential events (e.g. #4521, #6690, which have workarounds)
  1735. // or even between bubbling of the same event (#6566).
  1736. var timerFunc;
  1737. // The nextTick behavior leverages the microtask queue, which can be accessed
  1738. // via either native Promise.then or MutationObserver.
  1739. // MutationObserver has wider support, however it is seriously bugged in
  1740. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1741. // completely stops working after triggering a few times... so, if native
  1742. // Promise is available, we will use it:
  1743. /* istanbul ignore next, $flow-disable-line */
  1744. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1745. var p = Promise.resolve();
  1746. timerFunc = function () {
  1747. p.then(flushCallbacks);
  1748. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1749. // it can get stuck in a weird state where callbacks are pushed into the
  1750. // microtask queue but the queue isn't being flushed, until the browser
  1751. // needs to do some other work, e.g. handle a timer. Therefore we can
  1752. // "force" the microtask queue to be flushed by adding an empty timer.
  1753. if (isIOS) { setTimeout(noop); }
  1754. };
  1755. isUsingMicroTask = true;
  1756. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1757. isNative(MutationObserver) ||
  1758. // PhantomJS and iOS 7.x
  1759. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1760. )) {
  1761. // Use MutationObserver where native Promise is not available,
  1762. // e.g. PhantomJS, iOS7, Android 4.4
  1763. // (#6466 MutationObserver is unreliable in IE11)
  1764. var counter = 1;
  1765. var observer = new MutationObserver(flushCallbacks);
  1766. var textNode = document.createTextNode(String(counter));
  1767. observer.observe(textNode, {
  1768. characterData: true
  1769. });
  1770. timerFunc = function () {
  1771. counter = (counter + 1) % 2;
  1772. textNode.data = String(counter);
  1773. };
  1774. isUsingMicroTask = true;
  1775. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1776. // Fallback to setImmediate.
  1777. // Technically it leverages the (macro) task queue,
  1778. // but it is still a better choice than setTimeout.
  1779. timerFunc = function () {
  1780. setImmediate(flushCallbacks);
  1781. };
  1782. } else {
  1783. // Fallback to setTimeout.
  1784. timerFunc = function () {
  1785. setTimeout(flushCallbacks, 0);
  1786. };
  1787. }
  1788. function nextTick (cb, ctx) {
  1789. var _resolve;
  1790. callbacks.push(function () {
  1791. if (cb) {
  1792. try {
  1793. cb.call(ctx);
  1794. } catch (e) {
  1795. handleError(e, ctx, 'nextTick');
  1796. }
  1797. } else if (_resolve) {
  1798. _resolve(ctx);
  1799. }
  1800. });
  1801. if (!pending) {
  1802. pending = true;
  1803. timerFunc();
  1804. }
  1805. // $flow-disable-line
  1806. if (!cb && typeof Promise !== 'undefined') {
  1807. return new Promise(function (resolve) {
  1808. _resolve = resolve;
  1809. })
  1810. }
  1811. }
  1812. /* */
  1813. var mark;
  1814. var measure;
  1815. {
  1816. var perf = inBrowser && window.performance;
  1817. /* istanbul ignore if */
  1818. if (
  1819. perf &&
  1820. perf.mark &&
  1821. perf.measure &&
  1822. perf.clearMarks &&
  1823. perf.clearMeasures
  1824. ) {
  1825. mark = function (tag) { return perf.mark(tag); };
  1826. measure = function (name, startTag, endTag) {
  1827. perf.measure(name, startTag, endTag);
  1828. perf.clearMarks(startTag);
  1829. perf.clearMarks(endTag);
  1830. // perf.clearMeasures(name)
  1831. };
  1832. }
  1833. }
  1834. /* not type checking this file because flow doesn't play well with Proxy */
  1835. var initProxy;
  1836. {
  1837. var allowedGlobals = makeMap(
  1838. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1839. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1840. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1841. 'require' // for Webpack/Browserify
  1842. );
  1843. var warnNonPresent = function (target, key) {
  1844. warn(
  1845. "Property or method \"" + key + "\" is not defined on the instance but " +
  1846. 'referenced during render. Make sure that this property is reactive, ' +
  1847. 'either in the data option, or for class-based components, by ' +
  1848. 'initializing the property. ' +
  1849. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  1850. target
  1851. );
  1852. };
  1853. var warnReservedPrefix = function (target, key) {
  1854. warn(
  1855. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  1856. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  1857. 'prevent conflicts with Vue internals. ' +
  1858. 'See: https://vuejs.org/v2/api/#data',
  1859. target
  1860. );
  1861. };
  1862. var hasProxy =
  1863. typeof Proxy !== 'undefined' && isNative(Proxy);
  1864. if (hasProxy) {
  1865. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  1866. config.keyCodes = new Proxy(config.keyCodes, {
  1867. set: function set (target, key, value) {
  1868. if (isBuiltInModifier(key)) {
  1869. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1870. return false
  1871. } else {
  1872. target[key] = value;
  1873. return true
  1874. }
  1875. }
  1876. });
  1877. }
  1878. var hasHandler = {
  1879. has: function has (target, key) {
  1880. var has = key in target;
  1881. var isAllowed = allowedGlobals(key) ||
  1882. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  1883. if (!has && !isAllowed) {
  1884. if (key in target.$data) { warnReservedPrefix(target, key); }
  1885. else { warnNonPresent(target, key); }
  1886. }
  1887. return has || !isAllowed
  1888. }
  1889. };
  1890. var getHandler = {
  1891. get: function get (target, key) {
  1892. if (typeof key === 'string' && !(key in target)) {
  1893. if (key in target.$data) { warnReservedPrefix(target, key); }
  1894. else { warnNonPresent(target, key); }
  1895. }
  1896. return target[key]
  1897. }
  1898. };
  1899. initProxy = function initProxy (vm) {
  1900. if (hasProxy) {
  1901. // determine which proxy handler to use
  1902. var options = vm.$options;
  1903. var handlers = options.render && options.render._withStripped
  1904. ? getHandler
  1905. : hasHandler;
  1906. vm._renderProxy = new Proxy(vm, handlers);
  1907. } else {
  1908. vm._renderProxy = vm;
  1909. }
  1910. };
  1911. }
  1912. /* */
  1913. var seenObjects = new _Set();
  1914. /**
  1915. * Recursively traverse an object to evoke all converted
  1916. * getters, so that every nested property inside the object
  1917. * is collected as a "deep" dependency.
  1918. */
  1919. function traverse (val) {
  1920. _traverse(val, seenObjects);
  1921. seenObjects.clear();
  1922. }
  1923. function _traverse (val, seen) {
  1924. var i, keys;
  1925. var isA = Array.isArray(val);
  1926. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  1927. return
  1928. }
  1929. if (val.__ob__) {
  1930. var depId = val.__ob__.dep.id;
  1931. if (seen.has(depId)) {
  1932. return
  1933. }
  1934. seen.add(depId);
  1935. }
  1936. if (isA) {
  1937. i = val.length;
  1938. while (i--) { _traverse(val[i], seen); }
  1939. } else {
  1940. keys = Object.keys(val);
  1941. i = keys.length;
  1942. while (i--) { _traverse(val[keys[i]], seen); }
  1943. }
  1944. }
  1945. /* */
  1946. var normalizeEvent = cached(function (name) {
  1947. var passive = name.charAt(0) === '&';
  1948. name = passive ? name.slice(1) : name;
  1949. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  1950. name = once$$1 ? name.slice(1) : name;
  1951. var capture = name.charAt(0) === '!';
  1952. name = capture ? name.slice(1) : name;
  1953. return {
  1954. name: name,
  1955. once: once$$1,
  1956. capture: capture,
  1957. passive: passive
  1958. }
  1959. });
  1960. function createFnInvoker (fns, vm) {
  1961. function invoker () {
  1962. var arguments$1 = arguments;
  1963. var fns = invoker.fns;
  1964. if (Array.isArray(fns)) {
  1965. var cloned = fns.slice();
  1966. for (var i = 0; i < cloned.length; i++) {
  1967. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  1968. }
  1969. } else {
  1970. // return handler return value for single handlers
  1971. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  1972. }
  1973. }
  1974. invoker.fns = fns;
  1975. return invoker
  1976. }
  1977. function updateListeners (
  1978. on,
  1979. oldOn,
  1980. add,
  1981. remove$$1,
  1982. createOnceHandler,
  1983. vm
  1984. ) {
  1985. var name, def$$1, cur, old, event;
  1986. for (name in on) {
  1987. def$$1 = cur = on[name];
  1988. old = oldOn[name];
  1989. event = normalizeEvent(name);
  1990. if (isUndef(cur)) {
  1991. warn(
  1992. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  1993. vm
  1994. );
  1995. } else if (isUndef(old)) {
  1996. if (isUndef(cur.fns)) {
  1997. cur = on[name] = createFnInvoker(cur, vm);
  1998. }
  1999. if (isTrue(event.once)) {
  2000. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  2001. }
  2002. add(event.name, cur, event.capture, event.passive, event.params);
  2003. } else if (cur !== old) {
  2004. old.fns = cur;
  2005. on[name] = old;
  2006. }
  2007. }
  2008. for (name in oldOn) {
  2009. if (isUndef(on[name])) {
  2010. event = normalizeEvent(name);
  2011. remove$$1(event.name, oldOn[name], event.capture);
  2012. }
  2013. }
  2014. }
  2015. /* */
  2016. function mergeVNodeHook (def, hookKey, hook) {
  2017. if (def instanceof VNode) {
  2018. def = def.data.hook || (def.data.hook = {});
  2019. }
  2020. var invoker;
  2021. var oldHook = def[hookKey];
  2022. function wrappedHook () {
  2023. hook.apply(this, arguments);
  2024. // important: remove merged hook to ensure it's called only once
  2025. // and prevent memory leak
  2026. remove(invoker.fns, wrappedHook);
  2027. }
  2028. if (isUndef(oldHook)) {
  2029. // no existing hook
  2030. invoker = createFnInvoker([wrappedHook]);
  2031. } else {
  2032. /* istanbul ignore if */
  2033. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2034. // already a merged invoker
  2035. invoker = oldHook;
  2036. invoker.fns.push(wrappedHook);
  2037. } else {
  2038. // existing plain hook
  2039. invoker = createFnInvoker([oldHook, wrappedHook]);
  2040. }
  2041. }
  2042. invoker.merged = true;
  2043. def[hookKey] = invoker;
  2044. }
  2045. /* */
  2046. function extractPropsFromVNodeData (
  2047. data,
  2048. Ctor,
  2049. tag
  2050. ) {
  2051. // we are only extracting raw values here.
  2052. // validation and default values are handled in the child
  2053. // component itself.
  2054. var propOptions = Ctor.options.props;
  2055. if (isUndef(propOptions)) {
  2056. return
  2057. }
  2058. var res = {};
  2059. var attrs = data.attrs;
  2060. var props = data.props;
  2061. if (isDef(attrs) || isDef(props)) {
  2062. for (var key in propOptions) {
  2063. var altKey = hyphenate(key);
  2064. {
  2065. var keyInLowerCase = key.toLowerCase();
  2066. if (
  2067. key !== keyInLowerCase &&
  2068. attrs && hasOwn(attrs, keyInLowerCase)
  2069. ) {
  2070. tip(
  2071. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2072. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2073. " \"" + key + "\". " +
  2074. "Note that HTML attributes are case-insensitive and camelCased " +
  2075. "props need to use their kebab-case equivalents when using in-DOM " +
  2076. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2077. );
  2078. }
  2079. }
  2080. checkProp(res, props, key, altKey, true) ||
  2081. checkProp(res, attrs, key, altKey, false);
  2082. }
  2083. }
  2084. return res
  2085. }
  2086. function checkProp (
  2087. res,
  2088. hash,
  2089. key,
  2090. altKey,
  2091. preserve
  2092. ) {
  2093. if (isDef(hash)) {
  2094. if (hasOwn(hash, key)) {
  2095. res[key] = hash[key];
  2096. if (!preserve) {
  2097. delete hash[key];
  2098. }
  2099. return true
  2100. } else if (hasOwn(hash, altKey)) {
  2101. res[key] = hash[altKey];
  2102. if (!preserve) {
  2103. delete hash[altKey];
  2104. }
  2105. return true
  2106. }
  2107. }
  2108. return false
  2109. }
  2110. /* */
  2111. // The template compiler attempts to minimize the need for normalization by
  2112. // statically analyzing the template at compile time.
  2113. //
  2114. // For plain HTML markup, normalization can be completely skipped because the
  2115. // generated render function is guaranteed to return Array<VNode>. There are
  2116. // two cases where extra normalization is needed:
  2117. // 1. When the children contains components - because a functional component
  2118. // may return an Array instead of a single root. In this case, just a simple
  2119. // normalization is needed - if any child is an Array, we flatten the whole
  2120. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2121. // because functional components already normalize their own children.
  2122. function simpleNormalizeChildren (children) {
  2123. for (var i = 0; i < children.length; i++) {
  2124. if (Array.isArray(children[i])) {
  2125. return Array.prototype.concat.apply([], children)
  2126. }
  2127. }
  2128. return children
  2129. }
  2130. // 2. When the children contains constructs that always generated nested Arrays,
  2131. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2132. // with hand-written render functions / JSX. In such cases a full normalization
  2133. // is needed to cater to all possible types of children values.
  2134. function normalizeChildren (children) {
  2135. return isPrimitive(children)
  2136. ? [createTextVNode(children)]
  2137. : Array.isArray(children)
  2138. ? normalizeArrayChildren(children)
  2139. : undefined
  2140. }
  2141. function isTextNode (node) {
  2142. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2143. }
  2144. function normalizeArrayChildren (children, nestedIndex) {
  2145. var res = [];
  2146. var i, c, lastIndex, last;
  2147. for (i = 0; i < children.length; i++) {
  2148. c = children[i];
  2149. if (isUndef(c) || typeof c === 'boolean') { continue }
  2150. lastIndex = res.length - 1;
  2151. last = res[lastIndex];
  2152. // nested
  2153. if (Array.isArray(c)) {
  2154. if (c.length > 0) {
  2155. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2156. // merge adjacent text nodes
  2157. if (isTextNode(c[0]) && isTextNode(last)) {
  2158. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2159. c.shift();
  2160. }
  2161. res.push.apply(res, c);
  2162. }
  2163. } else if (isPrimitive(c)) {
  2164. if (isTextNode(last)) {
  2165. // merge adjacent text nodes
  2166. // this is necessary for SSR hydration because text nodes are
  2167. // essentially merged when rendered to HTML strings
  2168. res[lastIndex] = createTextVNode(last.text + c);
  2169. } else if (c !== '') {
  2170. // convert primitive to vnode
  2171. res.push(createTextVNode(c));
  2172. }
  2173. } else {
  2174. if (isTextNode(c) && isTextNode(last)) {
  2175. // merge adjacent text nodes
  2176. res[lastIndex] = createTextVNode(last.text + c.text);
  2177. } else {
  2178. // default key for nested array children (likely generated by v-for)
  2179. if (isTrue(children._isVList) &&
  2180. isDef(c.tag) &&
  2181. isUndef(c.key) &&
  2182. isDef(nestedIndex)) {
  2183. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2184. }
  2185. res.push(c);
  2186. }
  2187. }
  2188. }
  2189. return res
  2190. }
  2191. /* */
  2192. function initProvide (vm) {
  2193. var provide = vm.$options.provide;
  2194. if (provide) {
  2195. vm._provided = typeof provide === 'function'
  2196. ? provide.call(vm)
  2197. : provide;
  2198. }
  2199. }
  2200. function initInjections (vm) {
  2201. var result = resolveInject(vm.$options.inject, vm);
  2202. if (result) {
  2203. toggleObserving(false);
  2204. Object.keys(result).forEach(function (key) {
  2205. /* istanbul ignore else */
  2206. {
  2207. defineReactive$$1(vm, key, result[key], function () {
  2208. warn(
  2209. "Avoid mutating an injected value directly since the changes will be " +
  2210. "overwritten whenever the provided component re-renders. " +
  2211. "injection being mutated: \"" + key + "\"",
  2212. vm
  2213. );
  2214. });
  2215. }
  2216. });
  2217. toggleObserving(true);
  2218. }
  2219. }
  2220. function resolveInject (inject, vm) {
  2221. if (inject) {
  2222. // inject is :any because flow is not smart enough to figure out cached
  2223. var result = Object.create(null);
  2224. var keys = hasSymbol
  2225. ? Reflect.ownKeys(inject)
  2226. : Object.keys(inject);
  2227. for (var i = 0; i < keys.length; i++) {
  2228. var key = keys[i];
  2229. // #6574 in case the inject object is observed...
  2230. if (key === '__ob__') { continue }
  2231. var provideKey = inject[key].from;
  2232. var source = vm;
  2233. while (source) {
  2234. if (source._provided && hasOwn(source._provided, provideKey)) {
  2235. result[key] = source._provided[provideKey];
  2236. break
  2237. }
  2238. source = source.$parent;
  2239. }
  2240. if (!source) {
  2241. if ('default' in inject[key]) {
  2242. var provideDefault = inject[key].default;
  2243. result[key] = typeof provideDefault === 'function'
  2244. ? provideDefault.call(vm)
  2245. : provideDefault;
  2246. } else {
  2247. warn(("Injection \"" + key + "\" not found"), vm);
  2248. }
  2249. }
  2250. }
  2251. return result
  2252. }
  2253. }
  2254. /* */
  2255. /**
  2256. * Runtime helper for resolving raw children VNodes into a slot object.
  2257. */
  2258. function resolveSlots (
  2259. children,
  2260. context
  2261. ) {
  2262. if (!children || !children.length) {
  2263. return {}
  2264. }
  2265. var slots = {};
  2266. for (var i = 0, l = children.length; i < l; i++) {
  2267. var child = children[i];
  2268. var data = child.data;
  2269. // remove slot attribute if the node is resolved as a Vue slot node
  2270. if (data && data.attrs && data.attrs.slot) {
  2271. delete data.attrs.slot;
  2272. }
  2273. // named slots should only be respected if the vnode was rendered in the
  2274. // same context.
  2275. if ((child.context === context || child.fnContext === context) &&
  2276. data && data.slot != null
  2277. ) {
  2278. var name = data.slot;
  2279. var slot = (slots[name] || (slots[name] = []));
  2280. if (child.tag === 'template') {
  2281. slot.push.apply(slot, child.children || []);
  2282. } else {
  2283. slot.push(child);
  2284. }
  2285. } else {
  2286. (slots.default || (slots.default = [])).push(child);
  2287. }
  2288. }
  2289. // ignore slots that contains only whitespace
  2290. for (var name$1 in slots) {
  2291. if (slots[name$1].every(isWhitespace)) {
  2292. delete slots[name$1];
  2293. }
  2294. }
  2295. return slots
  2296. }
  2297. function isWhitespace (node) {
  2298. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2299. }
  2300. /* */
  2301. function normalizeScopedSlots (
  2302. slots,
  2303. normalSlots,
  2304. prevSlots
  2305. ) {
  2306. var res;
  2307. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2308. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2309. var key = slots && slots.$key;
  2310. if (!slots) {
  2311. res = {};
  2312. } else if (slots._normalized) {
  2313. // fast path 1: child component re-render only, parent did not change
  2314. return slots._normalized
  2315. } else if (
  2316. isStable &&
  2317. prevSlots &&
  2318. prevSlots !== emptyObject &&
  2319. key === prevSlots.$key &&
  2320. !hasNormalSlots &&
  2321. !prevSlots.$hasNormal
  2322. ) {
  2323. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2324. // only need to normalize once
  2325. return prevSlots
  2326. } else {
  2327. res = {};
  2328. for (var key$1 in slots) {
  2329. if (slots[key$1] && key$1[0] !== '$') {
  2330. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2331. }
  2332. }
  2333. }
  2334. // expose normal slots on scopedSlots
  2335. for (var key$2 in normalSlots) {
  2336. if (!(key$2 in res)) {
  2337. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2338. }
  2339. }
  2340. // avoriaz seems to mock a non-extensible $scopedSlots object
  2341. // and when that is passed down this would cause an error
  2342. if (slots && Object.isExtensible(slots)) {
  2343. (slots)._normalized = res;
  2344. }
  2345. def(res, '$stable', isStable);
  2346. def(res, '$key', key);
  2347. def(res, '$hasNormal', hasNormalSlots);
  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 && (
  2357. res.length === 0 ||
  2358. (res.length === 1 && res[0].isComment) // #9658
  2359. ) ? undefined
  2360. : res
  2361. };
  2362. // this is a slot using the new v-slot syntax without scope. although it is
  2363. // compiled as a scoped slot, render fn users would expect it to be present
  2364. // on this.$slots because the usage is semantically a normal slot.
  2365. if (fn.proxy) {
  2366. Object.defineProperty(normalSlots, key, {
  2367. get: normalized,
  2368. enumerable: true,
  2369. configurable: true
  2370. });
  2371. }
  2372. return normalized
  2373. }
  2374. function proxyNormalSlot(slots, key) {
  2375. return function () { return slots[key]; }
  2376. }
  2377. /* */
  2378. /**
  2379. * Runtime helper for rendering v-for lists.
  2380. */
  2381. function renderList (
  2382. val,
  2383. render
  2384. ) {
  2385. var ret, i, l, keys, key;
  2386. if (Array.isArray(val) || typeof val === 'string') {
  2387. ret = new Array(val.length);
  2388. for (i = 0, l = val.length; i < l; i++) {
  2389. ret[i] = render(val[i], i);
  2390. }
  2391. } else if (typeof val === 'number') {
  2392. ret = new Array(val);
  2393. for (i = 0; i < val; i++) {
  2394. ret[i] = render(i + 1, i);
  2395. }
  2396. } else if (isObject(val)) {
  2397. if (hasSymbol && val[Symbol.iterator]) {
  2398. ret = [];
  2399. var iterator = val[Symbol.iterator]();
  2400. var result = iterator.next();
  2401. while (!result.done) {
  2402. ret.push(render(result.value, ret.length));
  2403. result = iterator.next();
  2404. }
  2405. } else {
  2406. keys = Object.keys(val);
  2407. ret = new Array(keys.length);
  2408. for (i = 0, l = keys.length; i < l; i++) {
  2409. key = keys[i];
  2410. ret[i] = render(val[key], key, i);
  2411. }
  2412. }
  2413. }
  2414. if (!isDef(ret)) {
  2415. ret = [];
  2416. }
  2417. (ret)._isVList = true;
  2418. return ret
  2419. }
  2420. /* */
  2421. /**
  2422. * Runtime helper for rendering <slot>
  2423. */
  2424. function renderSlot (
  2425. name,
  2426. fallback,
  2427. props,
  2428. bindObject
  2429. ) {
  2430. var scopedSlotFn = this.$scopedSlots[name];
  2431. var nodes;
  2432. if (scopedSlotFn) { // scoped slot
  2433. props = props || {};
  2434. if (bindObject) {
  2435. if (!isObject(bindObject)) {
  2436. warn(
  2437. 'slot v-bind without argument expects an Object',
  2438. this
  2439. );
  2440. }
  2441. props = extend(extend({}, bindObject), props);
  2442. }
  2443. nodes = scopedSlotFn(props) || fallback;
  2444. } else {
  2445. nodes = this.$slots[name] || fallback;
  2446. }
  2447. var target = props && props.slot;
  2448. if (target) {
  2449. return this.$createElement('template', { slot: target }, nodes)
  2450. } else {
  2451. return nodes
  2452. }
  2453. }
  2454. /* */
  2455. /**
  2456. * Runtime helper for resolving filters
  2457. */
  2458. function resolveFilter (id) {
  2459. return resolveAsset(this.$options, 'filters', id, true) || identity
  2460. }
  2461. /* */
  2462. function isKeyNotMatch (expect, actual) {
  2463. if (Array.isArray(expect)) {
  2464. return expect.indexOf(actual) === -1
  2465. } else {
  2466. return expect !== actual
  2467. }
  2468. }
  2469. /**
  2470. * Runtime helper for checking keyCodes from config.
  2471. * exposed as Vue.prototype._k
  2472. * passing in eventKeyName as last argument separately for backwards compat
  2473. */
  2474. function checkKeyCodes (
  2475. eventKeyCode,
  2476. key,
  2477. builtInKeyCode,
  2478. eventKeyName,
  2479. builtInKeyName
  2480. ) {
  2481. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2482. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2483. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2484. } else if (mappedKeyCode) {
  2485. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2486. } else if (eventKeyName) {
  2487. return hyphenate(eventKeyName) !== key
  2488. }
  2489. }
  2490. /* */
  2491. /**
  2492. * Runtime helper for merging v-bind="object" into a VNode's data.
  2493. */
  2494. function bindObjectProps (
  2495. data,
  2496. tag,
  2497. value,
  2498. asProp,
  2499. isSync
  2500. ) {
  2501. if (value) {
  2502. if (!isObject(value)) {
  2503. warn(
  2504. 'v-bind without argument expects an Object or Array value',
  2505. this
  2506. );
  2507. } else {
  2508. if (Array.isArray(value)) {
  2509. value = toObject(value);
  2510. }
  2511. var hash;
  2512. var loop = function ( key ) {
  2513. if (
  2514. key === 'class' ||
  2515. key === 'style' ||
  2516. isReservedAttribute(key)
  2517. ) {
  2518. hash = data;
  2519. } else {
  2520. var type = data.attrs && data.attrs.type;
  2521. hash = asProp || config.mustUseProp(tag, type, key)
  2522. ? data.domProps || (data.domProps = {})
  2523. : data.attrs || (data.attrs = {});
  2524. }
  2525. var camelizedKey = camelize(key);
  2526. var hyphenatedKey = hyphenate(key);
  2527. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2528. hash[key] = value[key];
  2529. if (isSync) {
  2530. var on = data.on || (data.on = {});
  2531. on[("update:" + key)] = function ($event) {
  2532. value[key] = $event;
  2533. };
  2534. }
  2535. }
  2536. };
  2537. for (var key in value) loop( key );
  2538. }
  2539. }
  2540. return data
  2541. }
  2542. /* */
  2543. /**
  2544. * Runtime helper for rendering static trees.
  2545. */
  2546. function renderStatic (
  2547. index,
  2548. isInFor
  2549. ) {
  2550. var cached = this._staticTrees || (this._staticTrees = []);
  2551. var tree = cached[index];
  2552. // if has already-rendered static tree and not inside v-for,
  2553. // we can reuse the same tree.
  2554. if (tree && !isInFor) {
  2555. return tree
  2556. }
  2557. // otherwise, render a fresh tree.
  2558. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2559. this._renderProxy,
  2560. null,
  2561. this // for render fns generated for functional component templates
  2562. );
  2563. markStatic(tree, ("__static__" + index), false);
  2564. return tree
  2565. }
  2566. /**
  2567. * Runtime helper for v-once.
  2568. * Effectively it means marking the node as static with a unique key.
  2569. */
  2570. function markOnce (
  2571. tree,
  2572. index,
  2573. key
  2574. ) {
  2575. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2576. return tree
  2577. }
  2578. function markStatic (
  2579. tree,
  2580. key,
  2581. isOnce
  2582. ) {
  2583. if (Array.isArray(tree)) {
  2584. for (var i = 0; i < tree.length; i++) {
  2585. if (tree[i] && typeof tree[i] !== 'string') {
  2586. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2587. }
  2588. }
  2589. } else {
  2590. markStaticNode(tree, key, isOnce);
  2591. }
  2592. }
  2593. function markStaticNode (node, key, isOnce) {
  2594. node.isStatic = true;
  2595. node.key = key;
  2596. node.isOnce = isOnce;
  2597. }
  2598. /* */
  2599. function bindObjectListeners (data, value) {
  2600. if (value) {
  2601. if (!isPlainObject(value)) {
  2602. warn(
  2603. 'v-on without argument expects an Object value',
  2604. this
  2605. );
  2606. } else {
  2607. var on = data.on = data.on ? extend({}, data.on) : {};
  2608. for (var key in value) {
  2609. var existing = on[key];
  2610. var ours = value[key];
  2611. on[key] = existing ? [].concat(existing, ours) : ours;
  2612. }
  2613. }
  2614. }
  2615. return data
  2616. }
  2617. /* */
  2618. function resolveScopedSlots (
  2619. fns, // see flow/vnode
  2620. res,
  2621. // the following are added in 2.6
  2622. hasDynamicKeys,
  2623. contentHashKey
  2624. ) {
  2625. res = res || { $stable: !hasDynamicKeys };
  2626. for (var i = 0; i < fns.length; i++) {
  2627. var slot = fns[i];
  2628. if (Array.isArray(slot)) {
  2629. resolveScopedSlots(slot, res, hasDynamicKeys);
  2630. } else if (slot) {
  2631. // marker for reverse proxying v-slot without scope on this.$slots
  2632. if (slot.proxy) {
  2633. slot.fn.proxy = true;
  2634. }
  2635. res[slot.key] = slot.fn;
  2636. }
  2637. }
  2638. if (contentHashKey) {
  2639. (res).$key = contentHashKey;
  2640. }
  2641. return res
  2642. }
  2643. /* */
  2644. function bindDynamicKeys (baseObj, values) {
  2645. for (var i = 0; i < values.length; i += 2) {
  2646. var key = values[i];
  2647. if (typeof key === 'string' && key) {
  2648. baseObj[values[i]] = values[i + 1];
  2649. } else if (key !== '' && key !== null) {
  2650. // null is a special value for explicitly removing a binding
  2651. warn(
  2652. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2653. this
  2654. );
  2655. }
  2656. }
  2657. return baseObj
  2658. }
  2659. // helper to dynamically append modifier runtime markers to event names.
  2660. // ensure only append when value is already string, otherwise it will be cast
  2661. // to string and cause the type check to miss.
  2662. function prependModifier (value, symbol) {
  2663. return typeof value === 'string' ? symbol + value : value
  2664. }
  2665. /* */
  2666. function installRenderHelpers (target) {
  2667. target._o = markOnce;
  2668. target._n = toNumber;
  2669. target._s = toString;
  2670. target._l = renderList;
  2671. target._t = renderSlot;
  2672. target._q = looseEqual;
  2673. target._i = looseIndexOf;
  2674. target._m = renderStatic;
  2675. target._f = resolveFilter;
  2676. target._k = checkKeyCodes;
  2677. target._b = bindObjectProps;
  2678. target._v = createTextVNode;
  2679. target._e = createEmptyVNode;
  2680. target._u = resolveScopedSlots;
  2681. target._g = bindObjectListeners;
  2682. target._d = bindDynamicKeys;
  2683. target._p = prependModifier;
  2684. }
  2685. /* */
  2686. function FunctionalRenderContext (
  2687. data,
  2688. props,
  2689. children,
  2690. parent,
  2691. Ctor
  2692. ) {
  2693. var this$1 = this;
  2694. var options = Ctor.options;
  2695. // ensure the createElement function in functional components
  2696. // gets a unique context - this is necessary for correct named slot check
  2697. var contextVm;
  2698. if (hasOwn(parent, '_uid')) {
  2699. contextVm = Object.create(parent);
  2700. // $flow-disable-line
  2701. contextVm._original = parent;
  2702. } else {
  2703. // the context vm passed in is a functional context as well.
  2704. // in this case we want to make sure we are able to get a hold to the
  2705. // real context instance.
  2706. contextVm = parent;
  2707. // $flow-disable-line
  2708. parent = parent._original;
  2709. }
  2710. var isCompiled = isTrue(options._compiled);
  2711. var needNormalization = !isCompiled;
  2712. this.data = data;
  2713. this.props = props;
  2714. this.children = children;
  2715. this.parent = parent;
  2716. this.listeners = data.on || emptyObject;
  2717. this.injections = resolveInject(options.inject, parent);
  2718. this.slots = function () {
  2719. if (!this$1.$slots) {
  2720. normalizeScopedSlots(
  2721. data.scopedSlots,
  2722. this$1.$slots = resolveSlots(children, parent)
  2723. );
  2724. }
  2725. return this$1.$slots
  2726. };
  2727. Object.defineProperty(this, 'scopedSlots', ({
  2728. enumerable: true,
  2729. get: function get () {
  2730. return normalizeScopedSlots(data.scopedSlots, this.slots())
  2731. }
  2732. }));
  2733. // support for compiled functional template
  2734. if (isCompiled) {
  2735. // exposing $options for renderStatic()
  2736. this.$options = options;
  2737. // pre-resolve slots for renderSlot()
  2738. this.$slots = this.slots();
  2739. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  2740. }
  2741. if (options._scopeId) {
  2742. this._c = function (a, b, c, d) {
  2743. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  2744. if (vnode && !Array.isArray(vnode)) {
  2745. vnode.fnScopeId = options._scopeId;
  2746. vnode.fnContext = parent;
  2747. }
  2748. return vnode
  2749. };
  2750. } else {
  2751. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  2752. }
  2753. }
  2754. installRenderHelpers(FunctionalRenderContext.prototype);
  2755. function createFunctionalComponent (
  2756. Ctor,
  2757. propsData,
  2758. data,
  2759. contextVm,
  2760. children
  2761. ) {
  2762. var options = Ctor.options;
  2763. var props = {};
  2764. var propOptions = options.props;
  2765. if (isDef(propOptions)) {
  2766. for (var key in propOptions) {
  2767. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  2768. }
  2769. } else {
  2770. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  2771. if (isDef(data.props)) { mergeProps(props, data.props); }
  2772. }
  2773. var renderContext = new FunctionalRenderContext(
  2774. data,
  2775. props,
  2776. children,
  2777. contextVm,
  2778. Ctor
  2779. );
  2780. var vnode = options.render.call(null, renderContext._c, renderContext);
  2781. if (vnode instanceof VNode) {
  2782. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  2783. } else if (Array.isArray(vnode)) {
  2784. var vnodes = normalizeChildren(vnode) || [];
  2785. var res = new Array(vnodes.length);
  2786. for (var i = 0; i < vnodes.length; i++) {
  2787. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  2788. }
  2789. return res
  2790. }
  2791. }
  2792. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  2793. // #7817 clone node before setting fnContext, otherwise if the node is reused
  2794. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  2795. // that should not be matched to match.
  2796. var clone = cloneVNode(vnode);
  2797. clone.fnContext = contextVm;
  2798. clone.fnOptions = options;
  2799. {
  2800. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  2801. }
  2802. if (data.slot) {
  2803. (clone.data || (clone.data = {})).slot = data.slot;
  2804. }
  2805. return clone
  2806. }
  2807. function mergeProps (to, from) {
  2808. for (var key in from) {
  2809. to[camelize(key)] = from[key];
  2810. }
  2811. }
  2812. /* */
  2813. /* */
  2814. /* */
  2815. /* */
  2816. // inline hooks to be invoked on component VNodes during patch
  2817. var componentVNodeHooks = {
  2818. init: function init (vnode, hydrating) {
  2819. if (
  2820. vnode.componentInstance &&
  2821. !vnode.componentInstance._isDestroyed &&
  2822. vnode.data.keepAlive
  2823. ) {
  2824. // kept-alive components, treat as a patch
  2825. var mountedNode = vnode; // work around flow
  2826. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  2827. } else {
  2828. var child = vnode.componentInstance = createComponentInstanceForVnode(
  2829. vnode,
  2830. activeInstance
  2831. );
  2832. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2833. }
  2834. },
  2835. prepatch: function prepatch (oldVnode, vnode) {
  2836. var options = vnode.componentOptions;
  2837. var child = vnode.componentInstance = oldVnode.componentInstance;
  2838. updateChildComponent(
  2839. child,
  2840. options.propsData, // updated props
  2841. options.listeners, // updated listeners
  2842. vnode, // new parent vnode
  2843. options.children // new children
  2844. );
  2845. },
  2846. insert: function insert (vnode) {
  2847. var context = vnode.context;
  2848. var componentInstance = vnode.componentInstance;
  2849. if (!componentInstance._isMounted) {
  2850. componentInstance._isMounted = true;
  2851. callHook(componentInstance, 'mounted');
  2852. }
  2853. if (vnode.data.keepAlive) {
  2854. if (context._isMounted) {
  2855. // vue-router#1212
  2856. // During updates, a kept-alive component's child components may
  2857. // change, so directly walking the tree here may call activated hooks
  2858. // on incorrect children. Instead we push them into a queue which will
  2859. // be processed after the whole patch process ended.
  2860. queueActivatedComponent(componentInstance);
  2861. } else {
  2862. activateChildComponent(componentInstance, true /* direct */);
  2863. }
  2864. }
  2865. },
  2866. destroy: function destroy (vnode) {
  2867. var componentInstance = vnode.componentInstance;
  2868. if (!componentInstance._isDestroyed) {
  2869. if (!vnode.data.keepAlive) {
  2870. componentInstance.$destroy();
  2871. } else {
  2872. deactivateChildComponent(componentInstance, true /* direct */);
  2873. }
  2874. }
  2875. }
  2876. };
  2877. var hooksToMerge = Object.keys(componentVNodeHooks);
  2878. function createComponent (
  2879. Ctor,
  2880. data,
  2881. context,
  2882. children,
  2883. tag
  2884. ) {
  2885. if (isUndef(Ctor)) {
  2886. return
  2887. }
  2888. var baseCtor = context.$options._base;
  2889. // plain options object: turn it into a constructor
  2890. if (isObject(Ctor)) {
  2891. Ctor = baseCtor.extend(Ctor);
  2892. }
  2893. // if at this stage it's not a constructor or an async component factory,
  2894. // reject.
  2895. if (typeof Ctor !== 'function') {
  2896. {
  2897. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2898. }
  2899. return
  2900. }
  2901. // async component
  2902. var asyncFactory;
  2903. if (isUndef(Ctor.cid)) {
  2904. asyncFactory = Ctor;
  2905. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  2906. if (Ctor === undefined) {
  2907. // return a placeholder node for async component, which is rendered
  2908. // as a comment node but preserves all the raw information for the node.
  2909. // the information will be used for async server-rendering and hydration.
  2910. return createAsyncPlaceholder(
  2911. asyncFactory,
  2912. data,
  2913. context,
  2914. children,
  2915. tag
  2916. )
  2917. }
  2918. }
  2919. data = data || {};
  2920. // resolve constructor options in case global mixins are applied after
  2921. // component constructor creation
  2922. resolveConstructorOptions(Ctor);
  2923. // transform component v-model data into props & events
  2924. if (isDef(data.model)) {
  2925. transformModel(Ctor.options, data);
  2926. }
  2927. // extract props
  2928. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  2929. // functional component
  2930. if (isTrue(Ctor.options.functional)) {
  2931. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2932. }
  2933. // extract listeners, since these needs to be treated as
  2934. // child component listeners instead of DOM listeners
  2935. var listeners = data.on;
  2936. // replace with listeners with .native modifier
  2937. // so it gets processed during parent component patch.
  2938. data.on = data.nativeOn;
  2939. if (isTrue(Ctor.options.abstract)) {
  2940. // abstract components do not keep anything
  2941. // other than props & listeners & slot
  2942. // work around flow
  2943. var slot = data.slot;
  2944. data = {};
  2945. if (slot) {
  2946. data.slot = slot;
  2947. }
  2948. }
  2949. // install component management hooks onto the placeholder node
  2950. installComponentHooks(data);
  2951. // return a placeholder vnode
  2952. var name = Ctor.options.name || tag;
  2953. var vnode = new VNode(
  2954. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2955. data, undefined, undefined, undefined, context,
  2956. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  2957. asyncFactory
  2958. );
  2959. return vnode
  2960. }
  2961. function createComponentInstanceForVnode (
  2962. vnode, // we know it's MountedComponentVNode but flow doesn't
  2963. parent // activeInstance in lifecycle state
  2964. ) {
  2965. var options = {
  2966. _isComponent: true,
  2967. _parentVnode: vnode,
  2968. parent: parent
  2969. };
  2970. // check inline-template render functions
  2971. var inlineTemplate = vnode.data.inlineTemplate;
  2972. if (isDef(inlineTemplate)) {
  2973. options.render = inlineTemplate.render;
  2974. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2975. }
  2976. return new vnode.componentOptions.Ctor(options)
  2977. }
  2978. function installComponentHooks (data) {
  2979. var hooks = data.hook || (data.hook = {});
  2980. for (var i = 0; i < hooksToMerge.length; i++) {
  2981. var key = hooksToMerge[i];
  2982. var existing = hooks[key];
  2983. var toMerge = componentVNodeHooks[key];
  2984. if (existing !== toMerge && !(existing && existing._merged)) {
  2985. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  2986. }
  2987. }
  2988. }
  2989. function mergeHook$1 (f1, f2) {
  2990. var merged = function (a, b) {
  2991. // flow complains about extra args which is why we use any
  2992. f1(a, b);
  2993. f2(a, b);
  2994. };
  2995. merged._merged = true;
  2996. return merged
  2997. }
  2998. // transform component v-model info (value and callback) into
  2999. // prop and event handler respectively.
  3000. function transformModel (options, data) {
  3001. var prop = (options.model && options.model.prop) || 'value';
  3002. var event = (options.model && options.model.event) || 'input'
  3003. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3004. var on = data.on || (data.on = {});
  3005. var existing = on[event];
  3006. var callback = data.model.callback;
  3007. if (isDef(existing)) {
  3008. if (
  3009. Array.isArray(existing)
  3010. ? existing.indexOf(callback) === -1
  3011. : existing !== callback
  3012. ) {
  3013. on[event] = [callback].concat(existing);
  3014. }
  3015. } else {
  3016. on[event] = callback;
  3017. }
  3018. }
  3019. /* */
  3020. var SIMPLE_NORMALIZE = 1;
  3021. var ALWAYS_NORMALIZE = 2;
  3022. // wrapper function for providing a more flexible interface
  3023. // without getting yelled at by flow
  3024. function createElement (
  3025. context,
  3026. tag,
  3027. data,
  3028. children,
  3029. normalizationType,
  3030. alwaysNormalize
  3031. ) {
  3032. if (Array.isArray(data) || isPrimitive(data)) {
  3033. normalizationType = children;
  3034. children = data;
  3035. data = undefined;
  3036. }
  3037. if (isTrue(alwaysNormalize)) {
  3038. normalizationType = ALWAYS_NORMALIZE;
  3039. }
  3040. return _createElement(context, tag, data, children, normalizationType)
  3041. }
  3042. function _createElement (
  3043. context,
  3044. tag,
  3045. data,
  3046. children,
  3047. normalizationType
  3048. ) {
  3049. if (isDef(data) && isDef((data).__ob__)) {
  3050. warn(
  3051. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3052. 'Always create fresh vnode data objects in each render!',
  3053. context
  3054. );
  3055. return createEmptyVNode()
  3056. }
  3057. // object syntax in v-bind
  3058. if (isDef(data) && isDef(data.is)) {
  3059. tag = data.is;
  3060. }
  3061. if (!tag) {
  3062. // in case of component :is set to falsy value
  3063. return createEmptyVNode()
  3064. }
  3065. // warn against non-primitive key
  3066. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3067. ) {
  3068. {
  3069. warn(
  3070. 'Avoid using non-primitive value as key, ' +
  3071. 'use string/number value instead.',
  3072. context
  3073. );
  3074. }
  3075. }
  3076. // support single function children as default scoped slot
  3077. if (Array.isArray(children) &&
  3078. typeof children[0] === 'function'
  3079. ) {
  3080. data = data || {};
  3081. data.scopedSlots = { default: children[0] };
  3082. children.length = 0;
  3083. }
  3084. if (normalizationType === ALWAYS_NORMALIZE) {
  3085. children = normalizeChildren(children);
  3086. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3087. children = simpleNormalizeChildren(children);
  3088. }
  3089. var vnode, ns;
  3090. if (typeof tag === 'string') {
  3091. var Ctor;
  3092. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3093. if (config.isReservedTag(tag)) {
  3094. // platform built-in elements
  3095. if (isDef(data) && isDef(data.nativeOn)) {
  3096. warn(
  3097. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  3098. context
  3099. );
  3100. }
  3101. vnode = new VNode(
  3102. config.parsePlatformTagName(tag), data, children,
  3103. undefined, undefined, context
  3104. );
  3105. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3106. // component
  3107. vnode = createComponent(Ctor, data, context, children, tag);
  3108. } else {
  3109. // unknown or unlisted namespaced elements
  3110. // check at runtime because it may get assigned a namespace when its
  3111. // parent normalizes children
  3112. vnode = new VNode(
  3113. tag, data, children,
  3114. undefined, undefined, context
  3115. );
  3116. }
  3117. } else {
  3118. // direct component options / constructor
  3119. vnode = createComponent(tag, data, context, children);
  3120. }
  3121. if (Array.isArray(vnode)) {
  3122. return vnode
  3123. } else if (isDef(vnode)) {
  3124. if (isDef(ns)) { applyNS(vnode, ns); }
  3125. if (isDef(data)) { registerDeepBindings(data); }
  3126. return vnode
  3127. } else {
  3128. return createEmptyVNode()
  3129. }
  3130. }
  3131. function applyNS (vnode, ns, force) {
  3132. vnode.ns = ns;
  3133. if (vnode.tag === 'foreignObject') {
  3134. // use default namespace inside foreignObject
  3135. ns = undefined;
  3136. force = true;
  3137. }
  3138. if (isDef(vnode.children)) {
  3139. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3140. var child = vnode.children[i];
  3141. if (isDef(child.tag) && (
  3142. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3143. applyNS(child, ns, force);
  3144. }
  3145. }
  3146. }
  3147. }
  3148. // ref #5318
  3149. // necessary to ensure parent re-render when deep bindings like :style and
  3150. // :class are used on slot nodes
  3151. function registerDeepBindings (data) {
  3152. if (isObject(data.style)) {
  3153. traverse(data.style);
  3154. }
  3155. if (isObject(data.class)) {
  3156. traverse(data.class);
  3157. }
  3158. }
  3159. /* */
  3160. function initRender (vm) {
  3161. vm._vnode = null; // the root of the child tree
  3162. vm._staticTrees = null; // v-once cached trees
  3163. var options = vm.$options;
  3164. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3165. var renderContext = parentVnode && parentVnode.context;
  3166. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3167. vm.$scopedSlots = emptyObject;
  3168. // bind the createElement fn to this instance
  3169. // so that we get proper render context inside it.
  3170. // args order: tag, data, children, normalizationType, alwaysNormalize
  3171. // internal version is used by render functions compiled from templates
  3172. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3173. // normalization is always applied for the public version, used in
  3174. // user-written render functions.
  3175. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3176. // $attrs & $listeners are exposed for easier HOC creation.
  3177. // they need to be reactive so that HOCs using them are always updated
  3178. var parentData = parentVnode && parentVnode.data;
  3179. /* istanbul ignore else */
  3180. {
  3181. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3182. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3183. }, true);
  3184. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3185. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3186. }, true);
  3187. }
  3188. }
  3189. var currentRenderingInstance = null;
  3190. function renderMixin (Vue) {
  3191. // install runtime convenience helpers
  3192. installRenderHelpers(Vue.prototype);
  3193. Vue.prototype.$nextTick = function (fn) {
  3194. return nextTick(fn, this)
  3195. };
  3196. Vue.prototype._render = function () {
  3197. var vm = this;
  3198. var ref = vm.$options;
  3199. var render = ref.render;
  3200. var _parentVnode = ref._parentVnode;
  3201. if (_parentVnode) {
  3202. vm.$scopedSlots = normalizeScopedSlots(
  3203. _parentVnode.data.scopedSlots,
  3204. vm.$slots,
  3205. vm.$scopedSlots
  3206. );
  3207. }
  3208. // set parent vnode. this allows render functions to have access
  3209. // to the data on the placeholder node.
  3210. vm.$vnode = _parentVnode;
  3211. // render self
  3212. var vnode;
  3213. try {
  3214. // There's no need to maintain a stack because all render fns are called
  3215. // separately from one another. Nested component's render fns are called
  3216. // when parent component is patched.
  3217. currentRenderingInstance = vm;
  3218. vnode = render.call(vm._renderProxy, vm.$createElement);
  3219. } catch (e) {
  3220. handleError(e, vm, "render");
  3221. // return error render result,
  3222. // or previous vnode to prevent render error causing blank component
  3223. /* istanbul ignore else */
  3224. if (vm.$options.renderError) {
  3225. try {
  3226. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3227. } catch (e) {
  3228. handleError(e, vm, "renderError");
  3229. vnode = vm._vnode;
  3230. }
  3231. } else {
  3232. vnode = vm._vnode;
  3233. }
  3234. } finally {
  3235. currentRenderingInstance = null;
  3236. }
  3237. // if the returned array contains only a single node, allow it
  3238. if (Array.isArray(vnode) && vnode.length === 1) {
  3239. vnode = vnode[0];
  3240. }
  3241. // return empty vnode in case the render function errored out
  3242. if (!(vnode instanceof VNode)) {
  3243. if (Array.isArray(vnode)) {
  3244. warn(
  3245. 'Multiple root nodes returned from render function. Render function ' +
  3246. 'should return a single root node.',
  3247. vm
  3248. );
  3249. }
  3250. vnode = createEmptyVNode();
  3251. }
  3252. // set parent
  3253. vnode.parent = _parentVnode;
  3254. return vnode
  3255. };
  3256. }
  3257. /* */
  3258. function ensureCtor (comp, base) {
  3259. if (
  3260. comp.__esModule ||
  3261. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3262. ) {
  3263. comp = comp.default;
  3264. }
  3265. return isObject(comp)
  3266. ? base.extend(comp)
  3267. : comp
  3268. }
  3269. function createAsyncPlaceholder (
  3270. factory,
  3271. data,
  3272. context,
  3273. children,
  3274. tag
  3275. ) {
  3276. var node = createEmptyVNode();
  3277. node.asyncFactory = factory;
  3278. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3279. return node
  3280. }
  3281. function resolveAsyncComponent (
  3282. factory,
  3283. baseCtor
  3284. ) {
  3285. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3286. return factory.errorComp
  3287. }
  3288. if (isDef(factory.resolved)) {
  3289. return factory.resolved
  3290. }
  3291. var owner = currentRenderingInstance;
  3292. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3293. // already pending
  3294. factory.owners.push(owner);
  3295. }
  3296. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3297. return factory.loadingComp
  3298. }
  3299. if (owner && !isDef(factory.owners)) {
  3300. var owners = factory.owners = [owner];
  3301. var sync = true;
  3302. var timerLoading = null;
  3303. var timerTimeout = null
  3304. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3305. var forceRender = function (renderCompleted) {
  3306. for (var i = 0, l = owners.length; i < l; i++) {
  3307. (owners[i]).$forceUpdate();
  3308. }
  3309. if (renderCompleted) {
  3310. owners.length = 0;
  3311. if (timerLoading !== null) {
  3312. clearTimeout(timerLoading);
  3313. timerLoading = null;
  3314. }
  3315. if (timerTimeout !== null) {
  3316. clearTimeout(timerTimeout);
  3317. timerTimeout = null;
  3318. }
  3319. }
  3320. };
  3321. var resolve = once(function (res) {
  3322. // cache resolved
  3323. factory.resolved = ensureCtor(res, baseCtor);
  3324. // invoke callbacks only if this is not a synchronous resolve
  3325. // (async resolves are shimmed as synchronous during SSR)
  3326. if (!sync) {
  3327. forceRender(true);
  3328. } else {
  3329. owners.length = 0;
  3330. }
  3331. });
  3332. var reject = once(function (reason) {
  3333. warn(
  3334. "Failed to resolve async component: " + (String(factory)) +
  3335. (reason ? ("\nReason: " + reason) : '')
  3336. );
  3337. if (isDef(factory.errorComp)) {
  3338. factory.error = true;
  3339. forceRender(true);
  3340. }
  3341. });
  3342. var res = factory(resolve, reject);
  3343. if (isObject(res)) {
  3344. if (isPromise(res)) {
  3345. // () => Promise
  3346. if (isUndef(factory.resolved)) {
  3347. res.then(resolve, reject);
  3348. }
  3349. } else if (isPromise(res.component)) {
  3350. res.component.then(resolve, reject);
  3351. if (isDef(res.error)) {
  3352. factory.errorComp = ensureCtor(res.error, baseCtor);
  3353. }
  3354. if (isDef(res.loading)) {
  3355. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3356. if (res.delay === 0) {
  3357. factory.loading = true;
  3358. } else {
  3359. timerLoading = setTimeout(function () {
  3360. timerLoading = null;
  3361. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3362. factory.loading = true;
  3363. forceRender(false);
  3364. }
  3365. }, res.delay || 200);
  3366. }
  3367. }
  3368. if (isDef(res.timeout)) {
  3369. timerTimeout = setTimeout(function () {
  3370. timerTimeout = null;
  3371. if (isUndef(factory.resolved)) {
  3372. reject(
  3373. "timeout (" + (res.timeout) + "ms)"
  3374. );
  3375. }
  3376. }, res.timeout);
  3377. }
  3378. }
  3379. }
  3380. sync = false;
  3381. // return in case resolved synchronously
  3382. return factory.loading
  3383. ? factory.loadingComp
  3384. : factory.resolved
  3385. }
  3386. }
  3387. /* */
  3388. function isAsyncPlaceholder (node) {
  3389. return node.isComment && node.asyncFactory
  3390. }
  3391. /* */
  3392. function getFirstComponentChild (children) {
  3393. if (Array.isArray(children)) {
  3394. for (var i = 0; i < children.length; i++) {
  3395. var c = children[i];
  3396. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3397. return c
  3398. }
  3399. }
  3400. }
  3401. }
  3402. /* */
  3403. /* */
  3404. function initEvents (vm) {
  3405. vm._events = Object.create(null);
  3406. vm._hasHookEvent = false;
  3407. // init parent attached events
  3408. var listeners = vm.$options._parentListeners;
  3409. if (listeners) {
  3410. updateComponentListeners(vm, listeners);
  3411. }
  3412. }
  3413. var target;
  3414. function add (event, fn) {
  3415. target.$on(event, fn);
  3416. }
  3417. function remove$1 (event, fn) {
  3418. target.$off(event, fn);
  3419. }
  3420. function createOnceHandler (event, fn) {
  3421. var _target = target;
  3422. return function onceHandler () {
  3423. var res = fn.apply(null, arguments);
  3424. if (res !== null) {
  3425. _target.$off(event, onceHandler);
  3426. }
  3427. }
  3428. }
  3429. function updateComponentListeners (
  3430. vm,
  3431. listeners,
  3432. oldListeners
  3433. ) {
  3434. target = vm;
  3435. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3436. target = undefined;
  3437. }
  3438. function eventsMixin (Vue) {
  3439. var hookRE = /^hook:/;
  3440. Vue.prototype.$on = function (event, fn) {
  3441. var vm = this;
  3442. if (Array.isArray(event)) {
  3443. for (var i = 0, l = event.length; i < l; i++) {
  3444. vm.$on(event[i], fn);
  3445. }
  3446. } else {
  3447. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3448. // optimize hook:event cost by using a boolean flag marked at registration
  3449. // instead of a hash lookup
  3450. if (hookRE.test(event)) {
  3451. vm._hasHookEvent = true;
  3452. }
  3453. }
  3454. return vm
  3455. };
  3456. Vue.prototype.$once = function (event, fn) {
  3457. var vm = this;
  3458. function on () {
  3459. vm.$off(event, on);
  3460. fn.apply(vm, arguments);
  3461. }
  3462. on.fn = fn;
  3463. vm.$on(event, on);
  3464. return vm
  3465. };
  3466. Vue.prototype.$off = function (event, fn) {
  3467. var vm = this;
  3468. // all
  3469. if (!arguments.length) {
  3470. vm._events = Object.create(null);
  3471. return vm
  3472. }
  3473. // array of events
  3474. if (Array.isArray(event)) {
  3475. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3476. vm.$off(event[i$1], fn);
  3477. }
  3478. return vm
  3479. }
  3480. // specific event
  3481. var cbs = vm._events[event];
  3482. if (!cbs) {
  3483. return vm
  3484. }
  3485. if (!fn) {
  3486. vm._events[event] = null;
  3487. return vm
  3488. }
  3489. // specific handler
  3490. var cb;
  3491. var i = cbs.length;
  3492. while (i--) {
  3493. cb = cbs[i];
  3494. if (cb === fn || cb.fn === fn) {
  3495. cbs.splice(i, 1);
  3496. break
  3497. }
  3498. }
  3499. return vm
  3500. };
  3501. Vue.prototype.$emit = function (event) {
  3502. var vm = this;
  3503. {
  3504. var lowerCaseEvent = event.toLowerCase();
  3505. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3506. tip(
  3507. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3508. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3509. "Note that HTML attributes are case-insensitive and you cannot use " +
  3510. "v-on to listen to camelCase events when using in-DOM templates. " +
  3511. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3512. );
  3513. }
  3514. }
  3515. var cbs = vm._events[event];
  3516. if (cbs) {
  3517. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3518. var args = toArray(arguments, 1);
  3519. var info = "event handler for \"" + event + "\"";
  3520. for (var i = 0, l = cbs.length; i < l; i++) {
  3521. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3522. }
  3523. }
  3524. return vm
  3525. };
  3526. }
  3527. /* */
  3528. var activeInstance = null;
  3529. var isUpdatingChildComponent = false;
  3530. function setActiveInstance(vm) {
  3531. var prevActiveInstance = activeInstance;
  3532. activeInstance = vm;
  3533. return function () {
  3534. activeInstance = prevActiveInstance;
  3535. }
  3536. }
  3537. function initLifecycle (vm) {
  3538. var options = vm.$options;
  3539. // locate first non-abstract parent
  3540. var parent = options.parent;
  3541. if (parent && !options.abstract) {
  3542. while (parent.$options.abstract && parent.$parent) {
  3543. parent = parent.$parent;
  3544. }
  3545. parent.$children.push(vm);
  3546. }
  3547. vm.$parent = parent;
  3548. vm.$root = parent ? parent.$root : vm;
  3549. vm.$children = [];
  3550. vm.$refs = {};
  3551. vm._watcher = null;
  3552. vm._inactive = null;
  3553. vm._directInactive = false;
  3554. vm._isMounted = false;
  3555. vm._isDestroyed = false;
  3556. vm._isBeingDestroyed = false;
  3557. }
  3558. function lifecycleMixin (Vue) {
  3559. Vue.prototype._update = function (vnode, hydrating) {
  3560. var vm = this;
  3561. var prevEl = vm.$el;
  3562. var prevVnode = vm._vnode;
  3563. var restoreActiveInstance = setActiveInstance(vm);
  3564. vm._vnode = vnode;
  3565. // Vue.prototype.__patch__ is injected in entry points
  3566. // based on the rendering backend used.
  3567. if (!prevVnode) {
  3568. // initial render
  3569. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3570. } else {
  3571. // updates
  3572. vm.$el = vm.__patch__(prevVnode, vnode);
  3573. }
  3574. restoreActiveInstance();
  3575. // update __vue__ reference
  3576. if (prevEl) {
  3577. prevEl.__vue__ = null;
  3578. }
  3579. if (vm.$el) {
  3580. vm.$el.__vue__ = vm;
  3581. }
  3582. // if parent is an HOC, update its $el as well
  3583. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3584. vm.$parent.$el = vm.$el;
  3585. }
  3586. // updated hook is called by the scheduler to ensure that children are
  3587. // updated in a parent's updated hook.
  3588. };
  3589. Vue.prototype.$forceUpdate = function () {
  3590. var vm = this;
  3591. if (vm._watcher) {
  3592. vm._watcher.update();
  3593. }
  3594. };
  3595. Vue.prototype.$destroy = function () {
  3596. var vm = this;
  3597. if (vm._isBeingDestroyed) {
  3598. return
  3599. }
  3600. callHook(vm, 'beforeDestroy');
  3601. vm._isBeingDestroyed = true;
  3602. // remove self from parent
  3603. var parent = vm.$parent;
  3604. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3605. remove(parent.$children, vm);
  3606. }
  3607. // teardown watchers
  3608. if (vm._watcher) {
  3609. vm._watcher.teardown();
  3610. }
  3611. var i = vm._watchers.length;
  3612. while (i--) {
  3613. vm._watchers[i].teardown();
  3614. }
  3615. // remove reference from data ob
  3616. // frozen object may not have observer.
  3617. if (vm._data.__ob__) {
  3618. vm._data.__ob__.vmCount--;
  3619. }
  3620. // call the last hook...
  3621. vm._isDestroyed = true;
  3622. // invoke destroy hooks on current rendered tree
  3623. vm.__patch__(vm._vnode, null);
  3624. // fire destroyed hook
  3625. callHook(vm, 'destroyed');
  3626. // turn off all instance listeners.
  3627. vm.$off();
  3628. // remove __vue__ reference
  3629. if (vm.$el) {
  3630. vm.$el.__vue__ = null;
  3631. }
  3632. // release circular reference (#6759)
  3633. if (vm.$vnode) {
  3634. vm.$vnode.parent = null;
  3635. }
  3636. };
  3637. }
  3638. function mountComponent (
  3639. vm,
  3640. el,
  3641. hydrating
  3642. ) {
  3643. vm.$el = el;
  3644. if (!vm.$options.render) {
  3645. vm.$options.render = createEmptyVNode;
  3646. {
  3647. /* istanbul ignore if */
  3648. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  3649. vm.$options.el || el) {
  3650. warn(
  3651. 'You are using the runtime-only build of Vue where the template ' +
  3652. 'compiler is not available. Either pre-compile the templates into ' +
  3653. 'render functions, or use the compiler-included build.',
  3654. vm
  3655. );
  3656. } else {
  3657. warn(
  3658. 'Failed to mount component: template or render function not defined.',
  3659. vm
  3660. );
  3661. }
  3662. }
  3663. }
  3664. callHook(vm, 'beforeMount');
  3665. var updateComponent;
  3666. /* istanbul ignore if */
  3667. if (config.performance && mark) {
  3668. updateComponent = function () {
  3669. var name = vm._name;
  3670. var id = vm._uid;
  3671. var startTag = "vue-perf-start:" + id;
  3672. var endTag = "vue-perf-end:" + id;
  3673. mark(startTag);
  3674. var vnode = vm._render();
  3675. mark(endTag);
  3676. measure(("vue " + name + " render"), startTag, endTag);
  3677. mark(startTag);
  3678. vm._update(vnode, hydrating);
  3679. mark(endTag);
  3680. measure(("vue " + name + " patch"), startTag, endTag);
  3681. };
  3682. } else {
  3683. updateComponent = function () {
  3684. vm._update(vm._render(), hydrating);
  3685. };
  3686. }
  3687. // we set this to vm._watcher inside the watcher's constructor
  3688. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  3689. // component's mounted hook), which relies on vm._watcher being already defined
  3690. new Watcher(vm, updateComponent, noop, {
  3691. before: function before () {
  3692. if (vm._isMounted && !vm._isDestroyed) {
  3693. callHook(vm, 'beforeUpdate');
  3694. }
  3695. }
  3696. }, true /* isRenderWatcher */);
  3697. hydrating = false;
  3698. // manually mounted instance, call mounted on self
  3699. // mounted is called for render-created child components in its inserted hook
  3700. if (vm.$vnode == null) {
  3701. vm._isMounted = true;
  3702. callHook(vm, 'mounted');
  3703. }
  3704. return vm
  3705. }
  3706. function updateChildComponent (
  3707. vm,
  3708. propsData,
  3709. listeners,
  3710. parentVnode,
  3711. renderChildren
  3712. ) {
  3713. {
  3714. isUpdatingChildComponent = true;
  3715. }
  3716. // determine whether component has slot children
  3717. // we need to do this before overwriting $options._renderChildren.
  3718. // check if there are dynamic scopedSlots (hand-written or compiled but with
  3719. // dynamic slot names). Static scoped slots compiled from template has the
  3720. // "$stable" marker.
  3721. var newScopedSlots = parentVnode.data.scopedSlots;
  3722. var oldScopedSlots = vm.$scopedSlots;
  3723. var hasDynamicScopedSlot = !!(
  3724. (newScopedSlots && !newScopedSlots.$stable) ||
  3725. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  3726. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  3727. );
  3728. // Any static slot children from the parent may have changed during parent's
  3729. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  3730. // update is necessary to ensure correctness.
  3731. var needsForceUpdate = !!(
  3732. renderChildren || // has new static slots
  3733. vm.$options._renderChildren || // has old static slots
  3734. hasDynamicScopedSlot
  3735. );
  3736. vm.$options._parentVnode = parentVnode;
  3737. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  3738. if (vm._vnode) { // update child tree's parent
  3739. vm._vnode.parent = parentVnode;
  3740. }
  3741. vm.$options._renderChildren = renderChildren;
  3742. // update $attrs and $listeners hash
  3743. // these are also reactive so they may trigger child update if the child
  3744. // used them during render
  3745. vm.$attrs = parentVnode.data.attrs || emptyObject;
  3746. vm.$listeners = listeners || emptyObject;
  3747. // update props
  3748. if (propsData && vm.$options.props) {
  3749. toggleObserving(false);
  3750. var props = vm._props;
  3751. var propKeys = vm.$options._propKeys || [];
  3752. for (var i = 0; i < propKeys.length; i++) {
  3753. var key = propKeys[i];
  3754. var propOptions = vm.$options.props; // wtf flow?
  3755. props[key] = validateProp(key, propOptions, propsData, vm);
  3756. }
  3757. toggleObserving(true);
  3758. // keep a copy of raw propsData
  3759. vm.$options.propsData = propsData;
  3760. }
  3761. // update listeners
  3762. listeners = listeners || emptyObject;
  3763. var oldListeners = vm.$options._parentListeners;
  3764. vm.$options._parentListeners = listeners;
  3765. updateComponentListeners(vm, listeners, oldListeners);
  3766. // resolve slots + force update if has children
  3767. if (needsForceUpdate) {
  3768. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  3769. vm.$forceUpdate();
  3770. }
  3771. {
  3772. isUpdatingChildComponent = false;
  3773. }
  3774. }
  3775. function isInInactiveTree (vm) {
  3776. while (vm && (vm = vm.$parent)) {
  3777. if (vm._inactive) { return true }
  3778. }
  3779. return false
  3780. }
  3781. function activateChildComponent (vm, direct) {
  3782. if (direct) {
  3783. vm._directInactive = false;
  3784. if (isInInactiveTree(vm)) {
  3785. return
  3786. }
  3787. } else if (vm._directInactive) {
  3788. return
  3789. }
  3790. if (vm._inactive || vm._inactive === null) {
  3791. vm._inactive = false;
  3792. for (var i = 0; i < vm.$children.length; i++) {
  3793. activateChildComponent(vm.$children[i]);
  3794. }
  3795. callHook(vm, 'activated');
  3796. }
  3797. }
  3798. function deactivateChildComponent (vm, direct) {
  3799. if (direct) {
  3800. vm._directInactive = true;
  3801. if (isInInactiveTree(vm)) {
  3802. return
  3803. }
  3804. }
  3805. if (!vm._inactive) {
  3806. vm._inactive = true;
  3807. for (var i = 0; i < vm.$children.length; i++) {
  3808. deactivateChildComponent(vm.$children[i]);
  3809. }
  3810. callHook(vm, 'deactivated');
  3811. }
  3812. }
  3813. function callHook (vm, hook) {
  3814. // #7573 disable dep collection when invoking lifecycle hooks
  3815. pushTarget();
  3816. var handlers = vm.$options[hook];
  3817. var info = hook + " hook";
  3818. if (handlers) {
  3819. for (var i = 0, j = handlers.length; i < j; i++) {
  3820. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  3821. }
  3822. }
  3823. if (vm._hasHookEvent) {
  3824. vm.$emit('hook:' + hook);
  3825. }
  3826. popTarget();
  3827. }
  3828. /* */
  3829. var MAX_UPDATE_COUNT = 100;
  3830. var queue = [];
  3831. var activatedChildren = [];
  3832. var has = {};
  3833. var circular = {};
  3834. var waiting = false;
  3835. var flushing = false;
  3836. var index = 0;
  3837. /**
  3838. * Reset the scheduler's state.
  3839. */
  3840. function resetSchedulerState () {
  3841. index = queue.length = activatedChildren.length = 0;
  3842. has = {};
  3843. {
  3844. circular = {};
  3845. }
  3846. waiting = flushing = false;
  3847. }
  3848. // Async edge case #6566 requires saving the timestamp when event listeners are
  3849. // attached. However, calling performance.now() has a perf overhead especially
  3850. // if the page has thousands of event listeners. Instead, we take a timestamp
  3851. // every time the scheduler flushes and use that for all event listeners
  3852. // attached during that flush.
  3853. var currentFlushTimestamp = 0;
  3854. // Async edge case fix requires storing an event listener's attach timestamp.
  3855. var getNow = Date.now;
  3856. // Determine what event timestamp the browser is using. Annoyingly, the
  3857. // timestamp can either be hi-res (relative to page load) or low-res
  3858. // (relative to UNIX epoch), so in order to compare time we have to use the
  3859. // same timestamp type when saving the flush timestamp.
  3860. // All IE versions use low-res event timestamps, and have problematic clock
  3861. // implementations (#9632)
  3862. if (inBrowser && !isIE) {
  3863. var performance = window.performance;
  3864. if (
  3865. performance &&
  3866. typeof performance.now === 'function' &&
  3867. getNow() > document.createEvent('Event').timeStamp
  3868. ) {
  3869. // if the event timestamp, although evaluated AFTER the Date.now(), is
  3870. // smaller than it, it means the event is using a hi-res timestamp,
  3871. // and we need to use the hi-res version for event listener timestamps as
  3872. // well.
  3873. getNow = function () { return performance.now(); };
  3874. }
  3875. }
  3876. /**
  3877. * Flush both queues and run the watchers.
  3878. */
  3879. function flushSchedulerQueue () {
  3880. currentFlushTimestamp = getNow();
  3881. flushing = true;
  3882. var watcher, id;
  3883. // Sort queue before flush.
  3884. // This ensures that:
  3885. // 1. Components are updated from parent to child. (because parent is always
  3886. // created before the child)
  3887. // 2. A component's user watchers are run before its render watcher (because
  3888. // user watchers are created before the render watcher)
  3889. // 3. If a component is destroyed during a parent component's watcher run,
  3890. // its watchers can be skipped.
  3891. queue.sort(function (a, b) { return a.id - b.id; });
  3892. // do not cache length because more watchers might be pushed
  3893. // as we run existing watchers
  3894. for (index = 0; index < queue.length; index++) {
  3895. watcher = queue[index];
  3896. if (watcher.before) {
  3897. watcher.before();
  3898. }
  3899. id = watcher.id;
  3900. has[id] = null;
  3901. watcher.run();
  3902. // in dev build, check and stop circular updates.
  3903. if (has[id] != null) {
  3904. circular[id] = (circular[id] || 0) + 1;
  3905. if (circular[id] > MAX_UPDATE_COUNT) {
  3906. warn(
  3907. 'You may have an infinite update loop ' + (
  3908. watcher.user
  3909. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  3910. : "in a component render function."
  3911. ),
  3912. watcher.vm
  3913. );
  3914. break
  3915. }
  3916. }
  3917. }
  3918. // keep copies of post queues before resetting state
  3919. var activatedQueue = activatedChildren.slice();
  3920. var updatedQueue = queue.slice();
  3921. resetSchedulerState();
  3922. // call component updated and activated hooks
  3923. callActivatedHooks(activatedQueue);
  3924. callUpdatedHooks(updatedQueue);
  3925. // devtool hook
  3926. /* istanbul ignore if */
  3927. if (devtools && config.devtools) {
  3928. devtools.emit('flush');
  3929. }
  3930. }
  3931. function callUpdatedHooks (queue) {
  3932. var i = queue.length;
  3933. while (i--) {
  3934. var watcher = queue[i];
  3935. var vm = watcher.vm;
  3936. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  3937. callHook(vm, 'updated');
  3938. }
  3939. }
  3940. }
  3941. /**
  3942. * Queue a kept-alive component that was activated during patch.
  3943. * The queue will be processed after the entire tree has been patched.
  3944. */
  3945. function queueActivatedComponent (vm) {
  3946. // setting _inactive to false here so that a render function can
  3947. // rely on checking whether it's in an inactive tree (e.g. router-view)
  3948. vm._inactive = false;
  3949. activatedChildren.push(vm);
  3950. }
  3951. function callActivatedHooks (queue) {
  3952. for (var i = 0; i < queue.length; i++) {
  3953. queue[i]._inactive = true;
  3954. activateChildComponent(queue[i], true /* true */);
  3955. }
  3956. }
  3957. /**
  3958. * Push a watcher into the watcher queue.
  3959. * Jobs with duplicate IDs will be skipped unless it's
  3960. * pushed when the queue is being flushed.
  3961. */
  3962. function queueWatcher (watcher) {
  3963. var id = watcher.id;
  3964. if (has[id] == null) {
  3965. has[id] = true;
  3966. if (!flushing) {
  3967. queue.push(watcher);
  3968. } else {
  3969. // if already flushing, splice the watcher based on its id
  3970. // if already past its id, it will be run next immediately.
  3971. var i = queue.length - 1;
  3972. while (i > index && queue[i].id > watcher.id) {
  3973. i--;
  3974. }
  3975. queue.splice(i + 1, 0, watcher);
  3976. }
  3977. // queue the flush
  3978. if (!waiting) {
  3979. waiting = true;
  3980. if (!config.async) {
  3981. flushSchedulerQueue();
  3982. return
  3983. }
  3984. nextTick(flushSchedulerQueue);
  3985. }
  3986. }
  3987. }
  3988. /* */
  3989. var uid$2 = 0;
  3990. /**
  3991. * A watcher parses an expression, collects dependencies,
  3992. * and fires callback when the expression value changes.
  3993. * This is used for both the $watch() api and directives.
  3994. */
  3995. var Watcher = function Watcher (
  3996. vm,
  3997. expOrFn,
  3998. cb,
  3999. options,
  4000. isRenderWatcher
  4001. ) {
  4002. this.vm = vm;
  4003. if (isRenderWatcher) {
  4004. vm._watcher = this;
  4005. }
  4006. vm._watchers.push(this);
  4007. // options
  4008. if (options) {
  4009. this.deep = !!options.deep;
  4010. this.user = !!options.user;
  4011. this.lazy = !!options.lazy;
  4012. this.sync = !!options.sync;
  4013. this.before = options.before;
  4014. } else {
  4015. this.deep = this.user = this.lazy = this.sync = false;
  4016. }
  4017. this.cb = cb;
  4018. this.id = ++uid$2; // uid for batching
  4019. this.active = true;
  4020. this.dirty = this.lazy; // for lazy watchers
  4021. this.deps = [];
  4022. this.newDeps = [];
  4023. this.depIds = new _Set();
  4024. this.newDepIds = new _Set();
  4025. this.expression = expOrFn.toString();
  4026. // parse expression for getter
  4027. if (typeof expOrFn === 'function') {
  4028. this.getter = expOrFn;
  4029. } else {
  4030. this.getter = parsePath(expOrFn);
  4031. if (!this.getter) {
  4032. this.getter = noop;
  4033. warn(
  4034. "Failed watching path: \"" + expOrFn + "\" " +
  4035. 'Watcher only accepts simple dot-delimited paths. ' +
  4036. 'For full control, use a function instead.',
  4037. vm
  4038. );
  4039. }
  4040. }
  4041. this.value = this.lazy
  4042. ? undefined
  4043. : this.get();
  4044. };
  4045. /**
  4046. * Evaluate the getter, and re-collect dependencies.
  4047. */
  4048. Watcher.prototype.get = function get () {
  4049. pushTarget(this);
  4050. var value;
  4051. var vm = this.vm;
  4052. try {
  4053. value = this.getter.call(vm, vm);
  4054. } catch (e) {
  4055. if (this.user) {
  4056. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4057. } else {
  4058. throw e
  4059. }
  4060. } finally {
  4061. // "touch" every property so they are all tracked as
  4062. // dependencies for deep watching
  4063. if (this.deep) {
  4064. traverse(value);
  4065. }
  4066. popTarget();
  4067. this.cleanupDeps();
  4068. }
  4069. return value
  4070. };
  4071. /**
  4072. * Add a dependency to this directive.
  4073. */
  4074. Watcher.prototype.addDep = function addDep (dep) {
  4075. var id = dep.id;
  4076. if (!this.newDepIds.has(id)) {
  4077. this.newDepIds.add(id);
  4078. this.newDeps.push(dep);
  4079. if (!this.depIds.has(id)) {
  4080. dep.addSub(this);
  4081. }
  4082. }
  4083. };
  4084. /**
  4085. * Clean up for dependency collection.
  4086. */
  4087. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4088. var i = this.deps.length;
  4089. while (i--) {
  4090. var dep = this.deps[i];
  4091. if (!this.newDepIds.has(dep.id)) {
  4092. dep.removeSub(this);
  4093. }
  4094. }
  4095. var tmp = this.depIds;
  4096. this.depIds = this.newDepIds;
  4097. this.newDepIds = tmp;
  4098. this.newDepIds.clear();
  4099. tmp = this.deps;
  4100. this.deps = this.newDeps;
  4101. this.newDeps = tmp;
  4102. this.newDeps.length = 0;
  4103. };
  4104. /**
  4105. * Subscriber interface.
  4106. * Will be called when a dependency changes.
  4107. */
  4108. Watcher.prototype.update = function update () {
  4109. /* istanbul ignore else */
  4110. if (this.lazy) {
  4111. this.dirty = true;
  4112. } else if (this.sync) {
  4113. this.run();
  4114. } else {
  4115. queueWatcher(this);
  4116. }
  4117. };
  4118. /**
  4119. * Scheduler job interface.
  4120. * Will be called by the scheduler.
  4121. */
  4122. Watcher.prototype.run = function run () {
  4123. if (this.active) {
  4124. var value = this.get();
  4125. if (
  4126. value !== this.value ||
  4127. // Deep watchers and watchers on Object/Arrays should fire even
  4128. // when the value is the same, because the value may
  4129. // have mutated.
  4130. isObject(value) ||
  4131. this.deep
  4132. ) {
  4133. // set new value
  4134. var oldValue = this.value;
  4135. this.value = value;
  4136. if (this.user) {
  4137. try {
  4138. this.cb.call(this.vm, value, oldValue);
  4139. } catch (e) {
  4140. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4141. }
  4142. } else {
  4143. this.cb.call(this.vm, value, oldValue);
  4144. }
  4145. }
  4146. }
  4147. };
  4148. /**
  4149. * Evaluate the value of the watcher.
  4150. * This only gets called for lazy watchers.
  4151. */
  4152. Watcher.prototype.evaluate = function evaluate () {
  4153. this.value = this.get();
  4154. this.dirty = false;
  4155. };
  4156. /**
  4157. * Depend on all deps collected by this watcher.
  4158. */
  4159. Watcher.prototype.depend = function depend () {
  4160. var i = this.deps.length;
  4161. while (i--) {
  4162. this.deps[i].depend();
  4163. }
  4164. };
  4165. /**
  4166. * Remove self from all dependencies' subscriber list.
  4167. */
  4168. Watcher.prototype.teardown = function teardown () {
  4169. if (this.active) {
  4170. // remove self from vm's watcher list
  4171. // this is a somewhat expensive operation so we skip it
  4172. // if the vm is being destroyed.
  4173. if (!this.vm._isBeingDestroyed) {
  4174. remove(this.vm._watchers, this);
  4175. }
  4176. var i = this.deps.length;
  4177. while (i--) {
  4178. this.deps[i].removeSub(this);
  4179. }
  4180. this.active = false;
  4181. }
  4182. };
  4183. /* */
  4184. var sharedPropertyDefinition = {
  4185. enumerable: true,
  4186. configurable: true,
  4187. get: noop,
  4188. set: noop
  4189. };
  4190. function proxy (target, sourceKey, key) {
  4191. sharedPropertyDefinition.get = function proxyGetter () {
  4192. return this[sourceKey][key]
  4193. };
  4194. sharedPropertyDefinition.set = function proxySetter (val) {
  4195. this[sourceKey][key] = val;
  4196. };
  4197. Object.defineProperty(target, key, sharedPropertyDefinition);
  4198. }
  4199. function initState (vm) {
  4200. vm._watchers = [];
  4201. var opts = vm.$options;
  4202. if (opts.props) { initProps(vm, opts.props); }
  4203. if (opts.methods) { initMethods(vm, opts.methods); }
  4204. if (opts.data) {
  4205. initData(vm);
  4206. } else {
  4207. observe(vm._data = {}, true /* asRootData */);
  4208. }
  4209. if (opts.computed) { initComputed(vm, opts.computed); }
  4210. if (opts.watch && opts.watch !== nativeWatch) {
  4211. initWatch(vm, opts.watch);
  4212. }
  4213. }
  4214. function initProps (vm, propsOptions) {
  4215. var propsData = vm.$options.propsData || {};
  4216. var props = vm._props = {};
  4217. // cache prop keys so that future props updates can iterate using Array
  4218. // instead of dynamic object key enumeration.
  4219. var keys = vm.$options._propKeys = [];
  4220. var isRoot = !vm.$parent;
  4221. // root instance props should be converted
  4222. if (!isRoot) {
  4223. toggleObserving(false);
  4224. }
  4225. var loop = function ( key ) {
  4226. keys.push(key);
  4227. var value = validateProp(key, propsOptions, propsData, vm);
  4228. /* istanbul ignore else */
  4229. {
  4230. var hyphenatedKey = hyphenate(key);
  4231. if (isReservedAttribute(hyphenatedKey) ||
  4232. config.isReservedAttr(hyphenatedKey)) {
  4233. warn(
  4234. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4235. vm
  4236. );
  4237. }
  4238. defineReactive$$1(props, key, value, function () {
  4239. if (!isRoot && !isUpdatingChildComponent) {
  4240. warn(
  4241. "Avoid mutating a prop directly since the value will be " +
  4242. "overwritten whenever the parent component re-renders. " +
  4243. "Instead, use a data or computed property based on the prop's " +
  4244. "value. Prop being mutated: \"" + key + "\"",
  4245. vm
  4246. );
  4247. }
  4248. });
  4249. }
  4250. // static props are already proxied on the component's prototype
  4251. // during Vue.extend(). We only need to proxy props defined at
  4252. // instantiation here.
  4253. if (!(key in vm)) {
  4254. proxy(vm, "_props", key);
  4255. }
  4256. };
  4257. for (var key in propsOptions) loop( key );
  4258. toggleObserving(true);
  4259. }
  4260. function initData (vm) {
  4261. var data = vm.$options.data;
  4262. data = vm._data = typeof data === 'function'
  4263. ? getData(data, vm)
  4264. : data || {};
  4265. if (!isPlainObject(data)) {
  4266. data = {};
  4267. warn(
  4268. 'data functions should return an object:\n' +
  4269. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4270. vm
  4271. );
  4272. }
  4273. // proxy data on instance
  4274. var keys = Object.keys(data);
  4275. var props = vm.$options.props;
  4276. var methods = vm.$options.methods;
  4277. var i = keys.length;
  4278. while (i--) {
  4279. var key = keys[i];
  4280. {
  4281. if (methods && hasOwn(methods, key)) {
  4282. warn(
  4283. ("Method \"" + key + "\" has already been defined as a data property."),
  4284. vm
  4285. );
  4286. }
  4287. }
  4288. if (props && hasOwn(props, key)) {
  4289. warn(
  4290. "The data property \"" + key + "\" is already declared as a prop. " +
  4291. "Use prop default value instead.",
  4292. vm
  4293. );
  4294. } else if (!isReserved(key)) {
  4295. proxy(vm, "_data", key);
  4296. }
  4297. }
  4298. // observe data
  4299. observe(data, true /* asRootData */);
  4300. }
  4301. function getData (data, vm) {
  4302. // #7573 disable dep collection when invoking data getters
  4303. pushTarget();
  4304. try {
  4305. return data.call(vm, vm)
  4306. } catch (e) {
  4307. handleError(e, vm, "data()");
  4308. return {}
  4309. } finally {
  4310. popTarget();
  4311. }
  4312. }
  4313. var computedWatcherOptions = { lazy: true };
  4314. function initComputed (vm, computed) {
  4315. // $flow-disable-line
  4316. var watchers = vm._computedWatchers = Object.create(null);
  4317. // computed properties are just getters during SSR
  4318. var isSSR = isServerRendering();
  4319. for (var key in computed) {
  4320. var userDef = computed[key];
  4321. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4322. if (getter == null) {
  4323. warn(
  4324. ("Getter is missing for computed property \"" + key + "\"."),
  4325. vm
  4326. );
  4327. }
  4328. if (!isSSR) {
  4329. // create internal watcher for the computed property.
  4330. watchers[key] = new Watcher(
  4331. vm,
  4332. getter || noop,
  4333. noop,
  4334. computedWatcherOptions
  4335. );
  4336. }
  4337. // component-defined computed properties are already defined on the
  4338. // component prototype. We only need to define computed properties defined
  4339. // at instantiation here.
  4340. if (!(key in vm)) {
  4341. defineComputed(vm, key, userDef);
  4342. } else {
  4343. if (key in vm.$data) {
  4344. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4345. } else if (vm.$options.props && key in vm.$options.props) {
  4346. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4347. }
  4348. }
  4349. }
  4350. }
  4351. function defineComputed (
  4352. target,
  4353. key,
  4354. userDef
  4355. ) {
  4356. var shouldCache = !isServerRendering();
  4357. if (typeof userDef === 'function') {
  4358. sharedPropertyDefinition.get = shouldCache
  4359. ? createComputedGetter(key)
  4360. : createGetterInvoker(userDef);
  4361. sharedPropertyDefinition.set = noop;
  4362. } else {
  4363. sharedPropertyDefinition.get = userDef.get
  4364. ? shouldCache && userDef.cache !== false
  4365. ? createComputedGetter(key)
  4366. : createGetterInvoker(userDef.get)
  4367. : noop;
  4368. sharedPropertyDefinition.set = userDef.set || noop;
  4369. }
  4370. if (sharedPropertyDefinition.set === noop) {
  4371. sharedPropertyDefinition.set = function () {
  4372. warn(
  4373. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4374. this
  4375. );
  4376. };
  4377. }
  4378. Object.defineProperty(target, key, sharedPropertyDefinition);
  4379. }
  4380. function createComputedGetter (key) {
  4381. return function computedGetter () {
  4382. var watcher = this._computedWatchers && this._computedWatchers[key];
  4383. if (watcher) {
  4384. if (watcher.dirty) {
  4385. watcher.evaluate();
  4386. }
  4387. if (Dep.target) {
  4388. watcher.depend();
  4389. }
  4390. return watcher.value
  4391. }
  4392. }
  4393. }
  4394. function createGetterInvoker(fn) {
  4395. return function computedGetter () {
  4396. return fn.call(this, this)
  4397. }
  4398. }
  4399. function initMethods (vm, methods) {
  4400. var props = vm.$options.props;
  4401. for (var key in methods) {
  4402. {
  4403. if (typeof methods[key] !== 'function') {
  4404. warn(
  4405. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4406. "Did you reference the function correctly?",
  4407. vm
  4408. );
  4409. }
  4410. if (props && hasOwn(props, key)) {
  4411. warn(
  4412. ("Method \"" + key + "\" has already been defined as a prop."),
  4413. vm
  4414. );
  4415. }
  4416. if ((key in vm) && isReserved(key)) {
  4417. warn(
  4418. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4419. "Avoid defining component methods that start with _ or $."
  4420. );
  4421. }
  4422. }
  4423. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4424. }
  4425. }
  4426. function initWatch (vm, watch) {
  4427. for (var key in watch) {
  4428. var handler = watch[key];
  4429. if (Array.isArray(handler)) {
  4430. for (var i = 0; i < handler.length; i++) {
  4431. createWatcher(vm, key, handler[i]);
  4432. }
  4433. } else {
  4434. createWatcher(vm, key, handler);
  4435. }
  4436. }
  4437. }
  4438. function createWatcher (
  4439. vm,
  4440. expOrFn,
  4441. handler,
  4442. options
  4443. ) {
  4444. if (isPlainObject(handler)) {
  4445. options = handler;
  4446. handler = handler.handler;
  4447. }
  4448. if (typeof handler === 'string') {
  4449. handler = vm[handler];
  4450. }
  4451. return vm.$watch(expOrFn, handler, options)
  4452. }
  4453. function stateMixin (Vue) {
  4454. // flow somehow has problems with directly declared definition object
  4455. // when using Object.defineProperty, so we have to procedurally build up
  4456. // the object here.
  4457. var dataDef = {};
  4458. dataDef.get = function () { return this._data };
  4459. var propsDef = {};
  4460. propsDef.get = function () { return this._props };
  4461. {
  4462. dataDef.set = function () {
  4463. warn(
  4464. 'Avoid replacing instance root $data. ' +
  4465. 'Use nested data properties instead.',
  4466. this
  4467. );
  4468. };
  4469. propsDef.set = function () {
  4470. warn("$props is readonly.", this);
  4471. };
  4472. }
  4473. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4474. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4475. Vue.prototype.$set = set;
  4476. Vue.prototype.$delete = del;
  4477. Vue.prototype.$watch = function (
  4478. expOrFn,
  4479. cb,
  4480. options
  4481. ) {
  4482. var vm = this;
  4483. if (isPlainObject(cb)) {
  4484. return createWatcher(vm, expOrFn, cb, options)
  4485. }
  4486. options = options || {};
  4487. options.user = true;
  4488. var watcher = new Watcher(vm, expOrFn, cb, options);
  4489. if (options.immediate) {
  4490. try {
  4491. cb.call(vm, watcher.value);
  4492. } catch (error) {
  4493. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4494. }
  4495. }
  4496. return function unwatchFn () {
  4497. watcher.teardown();
  4498. }
  4499. };
  4500. }
  4501. /* */
  4502. var uid$3 = 0;
  4503. function initMixin (Vue) {
  4504. Vue.prototype._init = function (options) {
  4505. var vm = this;
  4506. // a uid
  4507. vm._uid = uid$3++;
  4508. var startTag, endTag;
  4509. /* istanbul ignore if */
  4510. if (config.performance && mark) {
  4511. startTag = "vue-perf-start:" + (vm._uid);
  4512. endTag = "vue-perf-end:" + (vm._uid);
  4513. mark(startTag);
  4514. }
  4515. // a flag to avoid this being observed
  4516. vm._isVue = true;
  4517. // merge options
  4518. if (options && options._isComponent) {
  4519. // optimize internal component instantiation
  4520. // since dynamic options merging is pretty slow, and none of the
  4521. // internal component options needs special treatment.
  4522. initInternalComponent(vm, options);
  4523. } else {
  4524. vm.$options = mergeOptions(
  4525. resolveConstructorOptions(vm.constructor),
  4526. options || {},
  4527. vm
  4528. );
  4529. }
  4530. /* istanbul ignore else */
  4531. {
  4532. initProxy(vm);
  4533. }
  4534. // expose real self
  4535. vm._self = vm;
  4536. initLifecycle(vm);
  4537. initEvents(vm);
  4538. initRender(vm);
  4539. callHook(vm, 'beforeCreate');
  4540. initInjections(vm); // resolve injections before data/props
  4541. initState(vm);
  4542. initProvide(vm); // resolve provide after data/props
  4543. callHook(vm, 'created');
  4544. /* istanbul ignore if */
  4545. if (config.performance && mark) {
  4546. vm._name = formatComponentName(vm, false);
  4547. mark(endTag);
  4548. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  4549. }
  4550. if (vm.$options.el) {
  4551. vm.$mount(vm.$options.el);
  4552. }
  4553. };
  4554. }
  4555. function initInternalComponent (vm, options) {
  4556. var opts = vm.$options = Object.create(vm.constructor.options);
  4557. // doing this because it's faster than dynamic enumeration.
  4558. var parentVnode = options._parentVnode;
  4559. opts.parent = options.parent;
  4560. opts._parentVnode = parentVnode;
  4561. var vnodeComponentOptions = parentVnode.componentOptions;
  4562. opts.propsData = vnodeComponentOptions.propsData;
  4563. opts._parentListeners = vnodeComponentOptions.listeners;
  4564. opts._renderChildren = vnodeComponentOptions.children;
  4565. opts._componentTag = vnodeComponentOptions.tag;
  4566. if (options.render) {
  4567. opts.render = options.render;
  4568. opts.staticRenderFns = options.staticRenderFns;
  4569. }
  4570. }
  4571. function resolveConstructorOptions (Ctor) {
  4572. var options = Ctor.options;
  4573. if (Ctor.super) {
  4574. var superOptions = resolveConstructorOptions(Ctor.super);
  4575. var cachedSuperOptions = Ctor.superOptions;
  4576. if (superOptions !== cachedSuperOptions) {
  4577. // super option changed,
  4578. // need to resolve new options.
  4579. Ctor.superOptions = superOptions;
  4580. // check if there are any late-modified/attached options (#4976)
  4581. var modifiedOptions = resolveModifiedOptions(Ctor);
  4582. // update base extend options
  4583. if (modifiedOptions) {
  4584. extend(Ctor.extendOptions, modifiedOptions);
  4585. }
  4586. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  4587. if (options.name) {
  4588. options.components[options.name] = Ctor;
  4589. }
  4590. }
  4591. }
  4592. return options
  4593. }
  4594. function resolveModifiedOptions (Ctor) {
  4595. var modified;
  4596. var latest = Ctor.options;
  4597. var sealed = Ctor.sealedOptions;
  4598. for (var key in latest) {
  4599. if (latest[key] !== sealed[key]) {
  4600. if (!modified) { modified = {}; }
  4601. modified[key] = latest[key];
  4602. }
  4603. }
  4604. return modified
  4605. }
  4606. function Vue (options) {
  4607. if (!(this instanceof Vue)
  4608. ) {
  4609. warn('Vue is a constructor and should be called with the `new` keyword');
  4610. }
  4611. this._init(options);
  4612. }
  4613. initMixin(Vue);
  4614. stateMixin(Vue);
  4615. eventsMixin(Vue);
  4616. lifecycleMixin(Vue);
  4617. renderMixin(Vue);
  4618. /* */
  4619. function initUse (Vue) {
  4620. Vue.use = function (plugin) {
  4621. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  4622. if (installedPlugins.indexOf(plugin) > -1) {
  4623. return this
  4624. }
  4625. // additional parameters
  4626. var args = toArray(arguments, 1);
  4627. args.unshift(this);
  4628. if (typeof plugin.install === 'function') {
  4629. plugin.install.apply(plugin, args);
  4630. } else if (typeof plugin === 'function') {
  4631. plugin.apply(null, args);
  4632. }
  4633. installedPlugins.push(plugin);
  4634. return this
  4635. };
  4636. }
  4637. /* */
  4638. function initMixin$1 (Vue) {
  4639. Vue.mixin = function (mixin) {
  4640. this.options = mergeOptions(this.options, mixin);
  4641. return this
  4642. };
  4643. }
  4644. /* */
  4645. function initExtend (Vue) {
  4646. /**
  4647. * Each instance constructor, including Vue, has a unique
  4648. * cid. This enables us to create wrapped "child
  4649. * constructors" for prototypal inheritance and cache them.
  4650. */
  4651. Vue.cid = 0;
  4652. var cid = 1;
  4653. /**
  4654. * Class inheritance
  4655. */
  4656. Vue.extend = function (extendOptions) {
  4657. extendOptions = extendOptions || {};
  4658. var Super = this;
  4659. var SuperId = Super.cid;
  4660. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  4661. if (cachedCtors[SuperId]) {
  4662. return cachedCtors[SuperId]
  4663. }
  4664. var name = extendOptions.name || Super.options.name;
  4665. if (name) {
  4666. validateComponentName(name);
  4667. }
  4668. var Sub = function VueComponent (options) {
  4669. this._init(options);
  4670. };
  4671. Sub.prototype = Object.create(Super.prototype);
  4672. Sub.prototype.constructor = Sub;
  4673. Sub.cid = cid++;
  4674. Sub.options = mergeOptions(
  4675. Super.options,
  4676. extendOptions
  4677. );
  4678. Sub['super'] = Super;
  4679. // For props and computed properties, we define the proxy getters on
  4680. // the Vue instances at extension time, on the extended prototype. This
  4681. // avoids Object.defineProperty calls for each instance created.
  4682. if (Sub.options.props) {
  4683. initProps$1(Sub);
  4684. }
  4685. if (Sub.options.computed) {
  4686. initComputed$1(Sub);
  4687. }
  4688. // allow further extension/mixin/plugin usage
  4689. Sub.extend = Super.extend;
  4690. Sub.mixin = Super.mixin;
  4691. Sub.use = Super.use;
  4692. // create asset registers, so extended classes
  4693. // can have their private assets too.
  4694. ASSET_TYPES.forEach(function (type) {
  4695. Sub[type] = Super[type];
  4696. });
  4697. // enable recursive self-lookup
  4698. if (name) {
  4699. Sub.options.components[name] = Sub;
  4700. }
  4701. // keep a reference to the super options at extension time.
  4702. // later at instantiation we can check if Super's options have
  4703. // been updated.
  4704. Sub.superOptions = Super.options;
  4705. Sub.extendOptions = extendOptions;
  4706. Sub.sealedOptions = extend({}, Sub.options);
  4707. // cache constructor
  4708. cachedCtors[SuperId] = Sub;
  4709. return Sub
  4710. };
  4711. }
  4712. function initProps$1 (Comp) {
  4713. var props = Comp.options.props;
  4714. for (var key in props) {
  4715. proxy(Comp.prototype, "_props", key);
  4716. }
  4717. }
  4718. function initComputed$1 (Comp) {
  4719. var computed = Comp.options.computed;
  4720. for (var key in computed) {
  4721. defineComputed(Comp.prototype, key, computed[key]);
  4722. }
  4723. }
  4724. /* */
  4725. function initAssetRegisters (Vue) {
  4726. /**
  4727. * Create asset registration methods.
  4728. */
  4729. ASSET_TYPES.forEach(function (type) {
  4730. Vue[type] = function (
  4731. id,
  4732. definition
  4733. ) {
  4734. if (!definition) {
  4735. return this.options[type + 's'][id]
  4736. } else {
  4737. /* istanbul ignore if */
  4738. if (type === 'component') {
  4739. validateComponentName(id);
  4740. }
  4741. if (type === 'component' && isPlainObject(definition)) {
  4742. definition.name = definition.name || id;
  4743. definition = this.options._base.extend(definition);
  4744. }
  4745. if (type === 'directive' && typeof definition === 'function') {
  4746. definition = { bind: definition, update: definition };
  4747. }
  4748. this.options[type + 's'][id] = definition;
  4749. return definition
  4750. }
  4751. };
  4752. });
  4753. }
  4754. /* */
  4755. function getComponentName (opts) {
  4756. return opts && (opts.Ctor.options.name || opts.tag)
  4757. }
  4758. function matches (pattern, name) {
  4759. if (Array.isArray(pattern)) {
  4760. return pattern.indexOf(name) > -1
  4761. } else if (typeof pattern === 'string') {
  4762. return pattern.split(',').indexOf(name) > -1
  4763. } else if (isRegExp(pattern)) {
  4764. return pattern.test(name)
  4765. }
  4766. /* istanbul ignore next */
  4767. return false
  4768. }
  4769. function pruneCache (keepAliveInstance, filter) {
  4770. var cache = keepAliveInstance.cache;
  4771. var keys = keepAliveInstance.keys;
  4772. var _vnode = keepAliveInstance._vnode;
  4773. for (var key in cache) {
  4774. var cachedNode = cache[key];
  4775. if (cachedNode) {
  4776. var name = getComponentName(cachedNode.componentOptions);
  4777. if (name && !filter(name)) {
  4778. pruneCacheEntry(cache, key, keys, _vnode);
  4779. }
  4780. }
  4781. }
  4782. }
  4783. function pruneCacheEntry (
  4784. cache,
  4785. key,
  4786. keys,
  4787. current
  4788. ) {
  4789. var cached$$1 = cache[key];
  4790. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  4791. cached$$1.componentInstance.$destroy();
  4792. }
  4793. cache[key] = null;
  4794. remove(keys, key);
  4795. }
  4796. var patternTypes = [String, RegExp, Array];
  4797. var KeepAlive = {
  4798. name: 'keep-alive',
  4799. abstract: true,
  4800. props: {
  4801. include: patternTypes,
  4802. exclude: patternTypes,
  4803. max: [String, Number]
  4804. },
  4805. created: function created () {
  4806. this.cache = Object.create(null);
  4807. this.keys = [];
  4808. },
  4809. destroyed: function destroyed () {
  4810. for (var key in this.cache) {
  4811. pruneCacheEntry(this.cache, key, this.keys);
  4812. }
  4813. },
  4814. mounted: function mounted () {
  4815. var this$1 = this;
  4816. this.$watch('include', function (val) {
  4817. pruneCache(this$1, function (name) { return matches(val, name); });
  4818. });
  4819. this.$watch('exclude', function (val) {
  4820. pruneCache(this$1, function (name) { return !matches(val, name); });
  4821. });
  4822. },
  4823. render: function render () {
  4824. var slot = this.$slots.default;
  4825. var vnode = getFirstComponentChild(slot);
  4826. var componentOptions = vnode && vnode.componentOptions;
  4827. if (componentOptions) {
  4828. // check pattern
  4829. var name = getComponentName(componentOptions);
  4830. var ref = this;
  4831. var include = ref.include;
  4832. var exclude = ref.exclude;
  4833. if (
  4834. // not included
  4835. (include && (!name || !matches(include, name))) ||
  4836. // excluded
  4837. (exclude && name && matches(exclude, name))
  4838. ) {
  4839. return vnode
  4840. }
  4841. var ref$1 = this;
  4842. var cache = ref$1.cache;
  4843. var keys = ref$1.keys;
  4844. var key = vnode.key == null
  4845. // same constructor may get registered as different local components
  4846. // so cid alone is not enough (#3269)
  4847. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  4848. : vnode.key;
  4849. if (cache[key]) {
  4850. vnode.componentInstance = cache[key].componentInstance;
  4851. // make current key freshest
  4852. remove(keys, key);
  4853. keys.push(key);
  4854. } else {
  4855. cache[key] = vnode;
  4856. keys.push(key);
  4857. // prune oldest entry
  4858. if (this.max && keys.length > parseInt(this.max)) {
  4859. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  4860. }
  4861. }
  4862. vnode.data.keepAlive = true;
  4863. }
  4864. return vnode || (slot && slot[0])
  4865. }
  4866. };
  4867. var builtInComponents = {
  4868. KeepAlive: KeepAlive
  4869. };
  4870. /* */
  4871. function initGlobalAPI (Vue) {
  4872. // config
  4873. var configDef = {};
  4874. configDef.get = function () { return config; };
  4875. {
  4876. configDef.set = function () {
  4877. warn(
  4878. 'Do not replace the Vue.config object, set individual fields instead.'
  4879. );
  4880. };
  4881. }
  4882. Object.defineProperty(Vue, 'config', configDef);
  4883. // exposed util methods.
  4884. // NOTE: these are not considered part of the public API - avoid relying on
  4885. // them unless you are aware of the risk.
  4886. Vue.util = {
  4887. warn: warn,
  4888. extend: extend,
  4889. mergeOptions: mergeOptions,
  4890. defineReactive: defineReactive$$1
  4891. };
  4892. Vue.set = set;
  4893. Vue.delete = del;
  4894. Vue.nextTick = nextTick;
  4895. // 2.6 explicit observable API
  4896. Vue.observable = function (obj) {
  4897. observe(obj);
  4898. return obj
  4899. };
  4900. Vue.options = Object.create(null);
  4901. ASSET_TYPES.forEach(function (type) {
  4902. Vue.options[type + 's'] = Object.create(null);
  4903. });
  4904. // this is used to identify the "base" constructor to extend all plain-object
  4905. // components with in Weex's multi-instance scenarios.
  4906. Vue.options._base = Vue;
  4907. extend(Vue.options.components, builtInComponents);
  4908. initUse(Vue);
  4909. initMixin$1(Vue);
  4910. initExtend(Vue);
  4911. initAssetRegisters(Vue);
  4912. }
  4913. initGlobalAPI(Vue);
  4914. Object.defineProperty(Vue.prototype, '$isServer', {
  4915. get: isServerRendering
  4916. });
  4917. Object.defineProperty(Vue.prototype, '$ssrContext', {
  4918. get: function get () {
  4919. /* istanbul ignore next */
  4920. return this.$vnode && this.$vnode.ssrContext
  4921. }
  4922. });
  4923. // expose FunctionalRenderContext for ssr runtime helper installation
  4924. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  4925. value: FunctionalRenderContext
  4926. });
  4927. Vue.version = '2.6.12';
  4928. /* */
  4929. // these are reserved for web because they are directly compiled away
  4930. // during template compilation
  4931. var isReservedAttr = makeMap('style,class');
  4932. // attributes that should be using props for binding
  4933. var acceptValue = makeMap('input,textarea,option,select,progress');
  4934. var mustUseProp = function (tag, type, attr) {
  4935. return (
  4936. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  4937. (attr === 'selected' && tag === 'option') ||
  4938. (attr === 'checked' && tag === 'input') ||
  4939. (attr === 'muted' && tag === 'video')
  4940. )
  4941. };
  4942. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  4943. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  4944. var convertEnumeratedValue = function (key, value) {
  4945. return isFalsyAttrValue(value) || value === 'false'
  4946. ? 'false'
  4947. // allow arbitrary string value for contenteditable
  4948. : key === 'contenteditable' && isValidContentEditableValue(value)
  4949. ? value
  4950. : 'true'
  4951. };
  4952. var isBooleanAttr = makeMap(
  4953. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  4954. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  4955. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  4956. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  4957. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  4958. 'truespeed,typemustmatch,visible'
  4959. );
  4960. var xlinkNS = 'http://www.w3.org/1999/xlink';
  4961. var isXlink = function (name) {
  4962. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  4963. };
  4964. var getXlinkProp = function (name) {
  4965. return isXlink(name) ? name.slice(6, name.length) : ''
  4966. };
  4967. var isFalsyAttrValue = function (val) {
  4968. return val == null || val === false
  4969. };
  4970. /* */
  4971. function genClassForVnode (vnode) {
  4972. var data = vnode.data;
  4973. var parentNode = vnode;
  4974. var childNode = vnode;
  4975. while (isDef(childNode.componentInstance)) {
  4976. childNode = childNode.componentInstance._vnode;
  4977. if (childNode && childNode.data) {
  4978. data = mergeClassData(childNode.data, data);
  4979. }
  4980. }
  4981. while (isDef(parentNode = parentNode.parent)) {
  4982. if (parentNode && parentNode.data) {
  4983. data = mergeClassData(data, parentNode.data);
  4984. }
  4985. }
  4986. return renderClass(data.staticClass, data.class)
  4987. }
  4988. function mergeClassData (child, parent) {
  4989. return {
  4990. staticClass: concat(child.staticClass, parent.staticClass),
  4991. class: isDef(child.class)
  4992. ? [child.class, parent.class]
  4993. : parent.class
  4994. }
  4995. }
  4996. function renderClass (
  4997. staticClass,
  4998. dynamicClass
  4999. ) {
  5000. if (isDef(staticClass) || isDef(dynamicClass)) {
  5001. return concat(staticClass, stringifyClass(dynamicClass))
  5002. }
  5003. /* istanbul ignore next */
  5004. return ''
  5005. }
  5006. function concat (a, b) {
  5007. return a ? b ? (a + ' ' + b) : a : (b || '')
  5008. }
  5009. function stringifyClass (value) {
  5010. if (Array.isArray(value)) {
  5011. return stringifyArray(value)
  5012. }
  5013. if (isObject(value)) {
  5014. return stringifyObject(value)
  5015. }
  5016. if (typeof value === 'string') {
  5017. return value
  5018. }
  5019. /* istanbul ignore next */
  5020. return ''
  5021. }
  5022. function stringifyArray (value) {
  5023. var res = '';
  5024. var stringified;
  5025. for (var i = 0, l = value.length; i < l; i++) {
  5026. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5027. if (res) { res += ' '; }
  5028. res += stringified;
  5029. }
  5030. }
  5031. return res
  5032. }
  5033. function stringifyObject (value) {
  5034. var res = '';
  5035. for (var key in value) {
  5036. if (value[key]) {
  5037. if (res) { res += ' '; }
  5038. res += key;
  5039. }
  5040. }
  5041. return res
  5042. }
  5043. /* */
  5044. var namespaceMap = {
  5045. svg: 'http://www.w3.org/2000/svg',
  5046. math: 'http://www.w3.org/1998/Math/MathML'
  5047. };
  5048. var isHTMLTag = makeMap(
  5049. 'html,body,base,head,link,meta,style,title,' +
  5050. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5051. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5052. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5053. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5054. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5055. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5056. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5057. 'output,progress,select,textarea,' +
  5058. 'details,dialog,menu,menuitem,summary,' +
  5059. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5060. );
  5061. // this map is intentionally selective, only covering SVG elements that may
  5062. // contain child elements.
  5063. var isSVG = makeMap(
  5064. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5065. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5066. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5067. true
  5068. );
  5069. var isPreTag = function (tag) { return tag === 'pre'; };
  5070. var isReservedTag = function (tag) {
  5071. return isHTMLTag(tag) || isSVG(tag)
  5072. };
  5073. function getTagNamespace (tag) {
  5074. if (isSVG(tag)) {
  5075. return 'svg'
  5076. }
  5077. // basic support for MathML
  5078. // note it doesn't support other MathML elements being component roots
  5079. if (tag === 'math') {
  5080. return 'math'
  5081. }
  5082. }
  5083. var unknownElementCache = Object.create(null);
  5084. function isUnknownElement (tag) {
  5085. /* istanbul ignore if */
  5086. if (!inBrowser) {
  5087. return true
  5088. }
  5089. if (isReservedTag(tag)) {
  5090. return false
  5091. }
  5092. tag = tag.toLowerCase();
  5093. /* istanbul ignore if */
  5094. if (unknownElementCache[tag] != null) {
  5095. return unknownElementCache[tag]
  5096. }
  5097. var el = document.createElement(tag);
  5098. if (tag.indexOf('-') > -1) {
  5099. // http://stackoverflow.com/a/28210364/1070244
  5100. return (unknownElementCache[tag] = (
  5101. el.constructor === window.HTMLUnknownElement ||
  5102. el.constructor === window.HTMLElement
  5103. ))
  5104. } else {
  5105. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5106. }
  5107. }
  5108. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5109. /* */
  5110. /**
  5111. * Query an element selector if it's not an element already.
  5112. */
  5113. function query (el) {
  5114. if (typeof el === 'string') {
  5115. var selected = document.querySelector(el);
  5116. if (!selected) {
  5117. warn(
  5118. 'Cannot find element: ' + el
  5119. );
  5120. return document.createElement('div')
  5121. }
  5122. return selected
  5123. } else {
  5124. return el
  5125. }
  5126. }
  5127. /* */
  5128. function createElement$1 (tagName, vnode) {
  5129. var elm = document.createElement(tagName);
  5130. if (tagName !== 'select') {
  5131. return elm
  5132. }
  5133. // false or null will remove the attribute but undefined will not
  5134. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5135. elm.setAttribute('multiple', 'multiple');
  5136. }
  5137. return elm
  5138. }
  5139. function createElementNS (namespace, tagName) {
  5140. return document.createElementNS(namespaceMap[namespace], tagName)
  5141. }
  5142. function createTextNode (text) {
  5143. return document.createTextNode(text)
  5144. }
  5145. function createComment (text) {
  5146. return document.createComment(text)
  5147. }
  5148. function insertBefore (parentNode, newNode, referenceNode) {
  5149. parentNode.insertBefore(newNode, referenceNode);
  5150. }
  5151. function removeChild (node, child) {
  5152. node.removeChild(child);
  5153. }
  5154. function appendChild (node, child) {
  5155. node.appendChild(child);
  5156. }
  5157. function parentNode (node) {
  5158. return node.parentNode
  5159. }
  5160. function nextSibling (node) {
  5161. return node.nextSibling
  5162. }
  5163. function tagName (node) {
  5164. return node.tagName
  5165. }
  5166. function setTextContent (node, text) {
  5167. node.textContent = text;
  5168. }
  5169. function setStyleScope (node, scopeId) {
  5170. node.setAttribute(scopeId, '');
  5171. }
  5172. var nodeOps = /*#__PURE__*/Object.freeze({
  5173. createElement: createElement$1,
  5174. createElementNS: createElementNS,
  5175. createTextNode: createTextNode,
  5176. createComment: createComment,
  5177. insertBefore: insertBefore,
  5178. removeChild: removeChild,
  5179. appendChild: appendChild,
  5180. parentNode: parentNode,
  5181. nextSibling: nextSibling,
  5182. tagName: tagName,
  5183. setTextContent: setTextContent,
  5184. setStyleScope: setStyleScope
  5185. });
  5186. /* */
  5187. var ref = {
  5188. create: function create (_, vnode) {
  5189. registerRef(vnode);
  5190. },
  5191. update: function update (oldVnode, vnode) {
  5192. if (oldVnode.data.ref !== vnode.data.ref) {
  5193. registerRef(oldVnode, true);
  5194. registerRef(vnode);
  5195. }
  5196. },
  5197. destroy: function destroy (vnode) {
  5198. registerRef(vnode, true);
  5199. }
  5200. };
  5201. function registerRef (vnode, isRemoval) {
  5202. var key = vnode.data.ref;
  5203. if (!isDef(key)) { return }
  5204. var vm = vnode.context;
  5205. var ref = vnode.componentInstance || vnode.elm;
  5206. var refs = vm.$refs;
  5207. if (isRemoval) {
  5208. if (Array.isArray(refs[key])) {
  5209. remove(refs[key], ref);
  5210. } else if (refs[key] === ref) {
  5211. refs[key] = undefined;
  5212. }
  5213. } else {
  5214. if (vnode.data.refInFor) {
  5215. if (!Array.isArray(refs[key])) {
  5216. refs[key] = [ref];
  5217. } else if (refs[key].indexOf(ref) < 0) {
  5218. // $flow-disable-line
  5219. refs[key].push(ref);
  5220. }
  5221. } else {
  5222. refs[key] = ref;
  5223. }
  5224. }
  5225. }
  5226. /**
  5227. * Virtual DOM patching algorithm based on Snabbdom by
  5228. * Simon Friis Vindum (@paldepind)
  5229. * Licensed under the MIT License
  5230. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5231. *
  5232. * modified by Evan You (@yyx990803)
  5233. *
  5234. * Not type-checking this because this file is perf-critical and the cost
  5235. * of making flow understand it is not worth it.
  5236. */
  5237. var emptyNode = new VNode('', {}, []);
  5238. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5239. function sameVnode (a, b) {
  5240. return (
  5241. a.key === b.key && (
  5242. (
  5243. a.tag === b.tag &&
  5244. a.isComment === b.isComment &&
  5245. isDef(a.data) === isDef(b.data) &&
  5246. sameInputType(a, b)
  5247. ) || (
  5248. isTrue(a.isAsyncPlaceholder) &&
  5249. a.asyncFactory === b.asyncFactory &&
  5250. isUndef(b.asyncFactory.error)
  5251. )
  5252. )
  5253. )
  5254. }
  5255. function sameInputType (a, b) {
  5256. if (a.tag !== 'input') { return true }
  5257. var i;
  5258. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5259. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5260. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5261. }
  5262. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5263. var i, key;
  5264. var map = {};
  5265. for (i = beginIdx; i <= endIdx; ++i) {
  5266. key = children[i].key;
  5267. if (isDef(key)) { map[key] = i; }
  5268. }
  5269. return map
  5270. }
  5271. function createPatchFunction (backend) {
  5272. var i, j;
  5273. var cbs = {};
  5274. var modules = backend.modules;
  5275. var nodeOps = backend.nodeOps;
  5276. for (i = 0; i < hooks.length; ++i) {
  5277. cbs[hooks[i]] = [];
  5278. for (j = 0; j < modules.length; ++j) {
  5279. if (isDef(modules[j][hooks[i]])) {
  5280. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5281. }
  5282. }
  5283. }
  5284. function emptyNodeAt (elm) {
  5285. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5286. }
  5287. function createRmCb (childElm, listeners) {
  5288. function remove$$1 () {
  5289. if (--remove$$1.listeners === 0) {
  5290. removeNode(childElm);
  5291. }
  5292. }
  5293. remove$$1.listeners = listeners;
  5294. return remove$$1
  5295. }
  5296. function removeNode (el) {
  5297. var parent = nodeOps.parentNode(el);
  5298. // element may have already been removed due to v-html / v-text
  5299. if (isDef(parent)) {
  5300. nodeOps.removeChild(parent, el);
  5301. }
  5302. }
  5303. function isUnknownElement$$1 (vnode, inVPre) {
  5304. return (
  5305. !inVPre &&
  5306. !vnode.ns &&
  5307. !(
  5308. config.ignoredElements.length &&
  5309. config.ignoredElements.some(function (ignore) {
  5310. return isRegExp(ignore)
  5311. ? ignore.test(vnode.tag)
  5312. : ignore === vnode.tag
  5313. })
  5314. ) &&
  5315. config.isUnknownElement(vnode.tag)
  5316. )
  5317. }
  5318. var creatingElmInVPre = 0;
  5319. function createElm (
  5320. vnode,
  5321. insertedVnodeQueue,
  5322. parentElm,
  5323. refElm,
  5324. nested,
  5325. ownerArray,
  5326. index
  5327. ) {
  5328. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5329. // This vnode was used in a previous render!
  5330. // now it's used as a new node, overwriting its elm would cause
  5331. // potential patch errors down the road when it's used as an insertion
  5332. // reference node. Instead, we clone the node on-demand before creating
  5333. // associated DOM element for it.
  5334. vnode = ownerArray[index] = cloneVNode(vnode);
  5335. }
  5336. vnode.isRootInsert = !nested; // for transition enter check
  5337. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5338. return
  5339. }
  5340. var data = vnode.data;
  5341. var children = vnode.children;
  5342. var tag = vnode.tag;
  5343. if (isDef(tag)) {
  5344. {
  5345. if (data && data.pre) {
  5346. creatingElmInVPre++;
  5347. }
  5348. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5349. warn(
  5350. 'Unknown custom element: <' + tag + '> - did you ' +
  5351. 'register the component correctly? For recursive components, ' +
  5352. 'make sure to provide the "name" option.',
  5353. vnode.context
  5354. );
  5355. }
  5356. }
  5357. vnode.elm = vnode.ns
  5358. ? nodeOps.createElementNS(vnode.ns, tag)
  5359. : nodeOps.createElement(tag, vnode);
  5360. setScope(vnode);
  5361. /* istanbul ignore if */
  5362. {
  5363. createChildren(vnode, children, insertedVnodeQueue);
  5364. if (isDef(data)) {
  5365. invokeCreateHooks(vnode, insertedVnodeQueue);
  5366. }
  5367. insert(parentElm, vnode.elm, refElm);
  5368. }
  5369. if (data && data.pre) {
  5370. creatingElmInVPre--;
  5371. }
  5372. } else if (isTrue(vnode.isComment)) {
  5373. vnode.elm = nodeOps.createComment(vnode.text);
  5374. insert(parentElm, vnode.elm, refElm);
  5375. } else {
  5376. vnode.elm = nodeOps.createTextNode(vnode.text);
  5377. insert(parentElm, vnode.elm, refElm);
  5378. }
  5379. }
  5380. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5381. var i = vnode.data;
  5382. if (isDef(i)) {
  5383. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5384. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5385. i(vnode, false /* hydrating */);
  5386. }
  5387. // after calling the init hook, if the vnode is a child component
  5388. // it should've created a child instance and mounted it. the child
  5389. // component also has set the placeholder vnode's elm.
  5390. // in that case we can just return the element and be done.
  5391. if (isDef(vnode.componentInstance)) {
  5392. initComponent(vnode, insertedVnodeQueue);
  5393. insert(parentElm, vnode.elm, refElm);
  5394. if (isTrue(isReactivated)) {
  5395. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5396. }
  5397. return true
  5398. }
  5399. }
  5400. }
  5401. function initComponent (vnode, insertedVnodeQueue) {
  5402. if (isDef(vnode.data.pendingInsert)) {
  5403. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5404. vnode.data.pendingInsert = null;
  5405. }
  5406. vnode.elm = vnode.componentInstance.$el;
  5407. if (isPatchable(vnode)) {
  5408. invokeCreateHooks(vnode, insertedVnodeQueue);
  5409. setScope(vnode);
  5410. } else {
  5411. // empty component root.
  5412. // skip all element-related modules except for ref (#3455)
  5413. registerRef(vnode);
  5414. // make sure to invoke the insert hook
  5415. insertedVnodeQueue.push(vnode);
  5416. }
  5417. }
  5418. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5419. var i;
  5420. // hack for #4339: a reactivated component with inner transition
  5421. // does not trigger because the inner node's created hooks are not called
  5422. // again. It's not ideal to involve module-specific logic in here but
  5423. // there doesn't seem to be a better way to do it.
  5424. var innerNode = vnode;
  5425. while (innerNode.componentInstance) {
  5426. innerNode = innerNode.componentInstance._vnode;
  5427. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  5428. for (i = 0; i < cbs.activate.length; ++i) {
  5429. cbs.activate[i](emptyNode, innerNode);
  5430. }
  5431. insertedVnodeQueue.push(innerNode);
  5432. break
  5433. }
  5434. }
  5435. // unlike a newly created component,
  5436. // a reactivated keep-alive component doesn't insert itself
  5437. insert(parentElm, vnode.elm, refElm);
  5438. }
  5439. function insert (parent, elm, ref$$1) {
  5440. if (isDef(parent)) {
  5441. if (isDef(ref$$1)) {
  5442. if (nodeOps.parentNode(ref$$1) === parent) {
  5443. nodeOps.insertBefore(parent, elm, ref$$1);
  5444. }
  5445. } else {
  5446. nodeOps.appendChild(parent, elm);
  5447. }
  5448. }
  5449. }
  5450. function createChildren (vnode, children, insertedVnodeQueue) {
  5451. if (Array.isArray(children)) {
  5452. {
  5453. checkDuplicateKeys(children);
  5454. }
  5455. for (var i = 0; i < children.length; ++i) {
  5456. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  5457. }
  5458. } else if (isPrimitive(vnode.text)) {
  5459. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  5460. }
  5461. }
  5462. function isPatchable (vnode) {
  5463. while (vnode.componentInstance) {
  5464. vnode = vnode.componentInstance._vnode;
  5465. }
  5466. return isDef(vnode.tag)
  5467. }
  5468. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  5469. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5470. cbs.create[i$1](emptyNode, vnode);
  5471. }
  5472. i = vnode.data.hook; // Reuse variable
  5473. if (isDef(i)) {
  5474. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  5475. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  5476. }
  5477. }
  5478. // set scope id attribute for scoped CSS.
  5479. // this is implemented as a special case to avoid the overhead
  5480. // of going through the normal attribute patching process.
  5481. function setScope (vnode) {
  5482. var i;
  5483. if (isDef(i = vnode.fnScopeId)) {
  5484. nodeOps.setStyleScope(vnode.elm, i);
  5485. } else {
  5486. var ancestor = vnode;
  5487. while (ancestor) {
  5488. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  5489. nodeOps.setStyleScope(vnode.elm, i);
  5490. }
  5491. ancestor = ancestor.parent;
  5492. }
  5493. }
  5494. // for slot content they should also get the scopeId from the host instance.
  5495. if (isDef(i = activeInstance) &&
  5496. i !== vnode.context &&
  5497. i !== vnode.fnContext &&
  5498. isDef(i = i.$options._scopeId)
  5499. ) {
  5500. nodeOps.setStyleScope(vnode.elm, i);
  5501. }
  5502. }
  5503. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  5504. for (; startIdx <= endIdx; ++startIdx) {
  5505. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  5506. }
  5507. }
  5508. function invokeDestroyHook (vnode) {
  5509. var i, j;
  5510. var data = vnode.data;
  5511. if (isDef(data)) {
  5512. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  5513. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  5514. }
  5515. if (isDef(i = vnode.children)) {
  5516. for (j = 0; j < vnode.children.length; ++j) {
  5517. invokeDestroyHook(vnode.children[j]);
  5518. }
  5519. }
  5520. }
  5521. function removeVnodes (vnodes, startIdx, endIdx) {
  5522. for (; startIdx <= endIdx; ++startIdx) {
  5523. var ch = vnodes[startIdx];
  5524. if (isDef(ch)) {
  5525. if (isDef(ch.tag)) {
  5526. removeAndInvokeRemoveHook(ch);
  5527. invokeDestroyHook(ch);
  5528. } else { // Text node
  5529. removeNode(ch.elm);
  5530. }
  5531. }
  5532. }
  5533. }
  5534. function removeAndInvokeRemoveHook (vnode, rm) {
  5535. if (isDef(rm) || isDef(vnode.data)) {
  5536. var i;
  5537. var listeners = cbs.remove.length + 1;
  5538. if (isDef(rm)) {
  5539. // we have a recursively passed down rm callback
  5540. // increase the listeners count
  5541. rm.listeners += listeners;
  5542. } else {
  5543. // directly removing
  5544. rm = createRmCb(vnode.elm, listeners);
  5545. }
  5546. // recursively invoke hooks on child component root node
  5547. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  5548. removeAndInvokeRemoveHook(i, rm);
  5549. }
  5550. for (i = 0; i < cbs.remove.length; ++i) {
  5551. cbs.remove[i](vnode, rm);
  5552. }
  5553. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  5554. i(vnode, rm);
  5555. } else {
  5556. rm();
  5557. }
  5558. } else {
  5559. removeNode(vnode.elm);
  5560. }
  5561. }
  5562. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  5563. var oldStartIdx = 0;
  5564. var newStartIdx = 0;
  5565. var oldEndIdx = oldCh.length - 1;
  5566. var oldStartVnode = oldCh[0];
  5567. var oldEndVnode = oldCh[oldEndIdx];
  5568. var newEndIdx = newCh.length - 1;
  5569. var newStartVnode = newCh[0];
  5570. var newEndVnode = newCh[newEndIdx];
  5571. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  5572. // removeOnly is a special flag used only by <transition-group>
  5573. // to ensure removed elements stay in correct relative positions
  5574. // during leaving transitions
  5575. var canMove = !removeOnly;
  5576. {
  5577. checkDuplicateKeys(newCh);
  5578. }
  5579. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  5580. if (isUndef(oldStartVnode)) {
  5581. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  5582. } else if (isUndef(oldEndVnode)) {
  5583. oldEndVnode = oldCh[--oldEndIdx];
  5584. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  5585. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5586. oldStartVnode = oldCh[++oldStartIdx];
  5587. newStartVnode = newCh[++newStartIdx];
  5588. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  5589. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5590. oldEndVnode = oldCh[--oldEndIdx];
  5591. newEndVnode = newCh[--newEndIdx];
  5592. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  5593. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  5594. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  5595. oldStartVnode = oldCh[++oldStartIdx];
  5596. newEndVnode = newCh[--newEndIdx];
  5597. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  5598. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5599. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  5600. oldEndVnode = oldCh[--oldEndIdx];
  5601. newStartVnode = newCh[++newStartIdx];
  5602. } else {
  5603. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  5604. idxInOld = isDef(newStartVnode.key)
  5605. ? oldKeyToIdx[newStartVnode.key]
  5606. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  5607. if (isUndef(idxInOld)) { // New element
  5608. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5609. } else {
  5610. vnodeToMove = oldCh[idxInOld];
  5611. if (sameVnode(vnodeToMove, newStartVnode)) {
  5612. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  5613. oldCh[idxInOld] = undefined;
  5614. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  5615. } else {
  5616. // same key but different element. treat as new element
  5617. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  5618. }
  5619. }
  5620. newStartVnode = newCh[++newStartIdx];
  5621. }
  5622. }
  5623. if (oldStartIdx > oldEndIdx) {
  5624. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  5625. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  5626. } else if (newStartIdx > newEndIdx) {
  5627. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  5628. }
  5629. }
  5630. function checkDuplicateKeys (children) {
  5631. var seenKeys = {};
  5632. for (var i = 0; i < children.length; i++) {
  5633. var vnode = children[i];
  5634. var key = vnode.key;
  5635. if (isDef(key)) {
  5636. if (seenKeys[key]) {
  5637. warn(
  5638. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  5639. vnode.context
  5640. );
  5641. } else {
  5642. seenKeys[key] = true;
  5643. }
  5644. }
  5645. }
  5646. }
  5647. function findIdxInOld (node, oldCh, start, end) {
  5648. for (var i = start; i < end; i++) {
  5649. var c = oldCh[i];
  5650. if (isDef(c) && sameVnode(node, c)) { return i }
  5651. }
  5652. }
  5653. function patchVnode (
  5654. oldVnode,
  5655. vnode,
  5656. insertedVnodeQueue,
  5657. ownerArray,
  5658. index,
  5659. removeOnly
  5660. ) {
  5661. if (oldVnode === vnode) {
  5662. return
  5663. }
  5664. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5665. // clone reused vnode
  5666. vnode = ownerArray[index] = cloneVNode(vnode);
  5667. }
  5668. var elm = vnode.elm = oldVnode.elm;
  5669. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  5670. if (isDef(vnode.asyncFactory.resolved)) {
  5671. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  5672. } else {
  5673. vnode.isAsyncPlaceholder = true;
  5674. }
  5675. return
  5676. }
  5677. // reuse element for static trees.
  5678. // note we only do this if the vnode is cloned -
  5679. // if the new node is not cloned it means the render functions have been
  5680. // reset by the hot-reload-api and we need to do a proper re-render.
  5681. if (isTrue(vnode.isStatic) &&
  5682. isTrue(oldVnode.isStatic) &&
  5683. vnode.key === oldVnode.key &&
  5684. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  5685. ) {
  5686. vnode.componentInstance = oldVnode.componentInstance;
  5687. return
  5688. }
  5689. var i;
  5690. var data = vnode.data;
  5691. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  5692. i(oldVnode, vnode);
  5693. }
  5694. var oldCh = oldVnode.children;
  5695. var ch = vnode.children;
  5696. if (isDef(data) && isPatchable(vnode)) {
  5697. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  5698. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  5699. }
  5700. if (isUndef(vnode.text)) {
  5701. if (isDef(oldCh) && isDef(ch)) {
  5702. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  5703. } else if (isDef(ch)) {
  5704. {
  5705. checkDuplicateKeys(ch);
  5706. }
  5707. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  5708. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  5709. } else if (isDef(oldCh)) {
  5710. removeVnodes(oldCh, 0, oldCh.length - 1);
  5711. } else if (isDef(oldVnode.text)) {
  5712. nodeOps.setTextContent(elm, '');
  5713. }
  5714. } else if (oldVnode.text !== vnode.text) {
  5715. nodeOps.setTextContent(elm, vnode.text);
  5716. }
  5717. if (isDef(data)) {
  5718. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  5719. }
  5720. }
  5721. function invokeInsertHook (vnode, queue, initial) {
  5722. // delay insert hooks for component root nodes, invoke them after the
  5723. // element is really inserted
  5724. if (isTrue(initial) && isDef(vnode.parent)) {
  5725. vnode.parent.data.pendingInsert = queue;
  5726. } else {
  5727. for (var i = 0; i < queue.length; ++i) {
  5728. queue[i].data.hook.insert(queue[i]);
  5729. }
  5730. }
  5731. }
  5732. var hydrationBailed = false;
  5733. // list of modules that can skip create hook during hydration because they
  5734. // are already rendered on the client or has no need for initialization
  5735. // Note: style is excluded because it relies on initial clone for future
  5736. // deep updates (#7063).
  5737. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  5738. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  5739. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  5740. var i;
  5741. var tag = vnode.tag;
  5742. var data = vnode.data;
  5743. var children = vnode.children;
  5744. inVPre = inVPre || (data && data.pre);
  5745. vnode.elm = elm;
  5746. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  5747. vnode.isAsyncPlaceholder = true;
  5748. return true
  5749. }
  5750. // assert node match
  5751. {
  5752. if (!assertNodeMatch(elm, vnode, inVPre)) {
  5753. return false
  5754. }
  5755. }
  5756. if (isDef(data)) {
  5757. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  5758. if (isDef(i = vnode.componentInstance)) {
  5759. // child component. it should have hydrated its own tree.
  5760. initComponent(vnode, insertedVnodeQueue);
  5761. return true
  5762. }
  5763. }
  5764. if (isDef(tag)) {
  5765. if (isDef(children)) {
  5766. // empty element, allow client to pick up and populate children
  5767. if (!elm.hasChildNodes()) {
  5768. createChildren(vnode, children, insertedVnodeQueue);
  5769. } else {
  5770. // v-html and domProps: innerHTML
  5771. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  5772. if (i !== elm.innerHTML) {
  5773. /* istanbul ignore if */
  5774. if (typeof console !== 'undefined' &&
  5775. !hydrationBailed
  5776. ) {
  5777. hydrationBailed = true;
  5778. console.warn('Parent: ', elm);
  5779. console.warn('server innerHTML: ', i);
  5780. console.warn('client innerHTML: ', elm.innerHTML);
  5781. }
  5782. return false
  5783. }
  5784. } else {
  5785. // iterate and compare children lists
  5786. var childrenMatch = true;
  5787. var childNode = elm.firstChild;
  5788. for (var i$1 = 0; i$1 < children.length; i$1++) {
  5789. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  5790. childrenMatch = false;
  5791. break
  5792. }
  5793. childNode = childNode.nextSibling;
  5794. }
  5795. // if childNode is not null, it means the actual childNodes list is
  5796. // longer than the virtual children list.
  5797. if (!childrenMatch || childNode) {
  5798. /* istanbul ignore if */
  5799. if (typeof console !== 'undefined' &&
  5800. !hydrationBailed
  5801. ) {
  5802. hydrationBailed = true;
  5803. console.warn('Parent: ', elm);
  5804. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  5805. }
  5806. return false
  5807. }
  5808. }
  5809. }
  5810. }
  5811. if (isDef(data)) {
  5812. var fullInvoke = false;
  5813. for (var key in data) {
  5814. if (!isRenderedModule(key)) {
  5815. fullInvoke = true;
  5816. invokeCreateHooks(vnode, insertedVnodeQueue);
  5817. break
  5818. }
  5819. }
  5820. if (!fullInvoke && data['class']) {
  5821. // ensure collecting deps for deep class bindings for future updates
  5822. traverse(data['class']);
  5823. }
  5824. }
  5825. } else if (elm.data !== vnode.text) {
  5826. elm.data = vnode.text;
  5827. }
  5828. return true
  5829. }
  5830. function assertNodeMatch (node, vnode, inVPre) {
  5831. if (isDef(vnode.tag)) {
  5832. return vnode.tag.indexOf('vue-component') === 0 || (
  5833. !isUnknownElement$$1(vnode, inVPre) &&
  5834. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  5835. )
  5836. } else {
  5837. return node.nodeType === (vnode.isComment ? 8 : 3)
  5838. }
  5839. }
  5840. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  5841. if (isUndef(vnode)) {
  5842. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  5843. return
  5844. }
  5845. var isInitialPatch = false;
  5846. var insertedVnodeQueue = [];
  5847. if (isUndef(oldVnode)) {
  5848. // empty mount (likely as component), create new root element
  5849. isInitialPatch = true;
  5850. createElm(vnode, insertedVnodeQueue);
  5851. } else {
  5852. var isRealElement = isDef(oldVnode.nodeType);
  5853. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  5854. // patch existing root node
  5855. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  5856. } else {
  5857. if (isRealElement) {
  5858. // mounting to a real element
  5859. // check if this is server-rendered content and if we can perform
  5860. // a successful hydration.
  5861. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  5862. oldVnode.removeAttribute(SSR_ATTR);
  5863. hydrating = true;
  5864. }
  5865. if (isTrue(hydrating)) {
  5866. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  5867. invokeInsertHook(vnode, insertedVnodeQueue, true);
  5868. return oldVnode
  5869. } else {
  5870. warn(
  5871. 'The client-side rendered virtual DOM tree is not matching ' +
  5872. 'server-rendered content. This is likely caused by incorrect ' +
  5873. 'HTML markup, for example nesting block-level elements inside ' +
  5874. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  5875. 'full client-side render.'
  5876. );
  5877. }
  5878. }
  5879. // either not server-rendered, or hydration failed.
  5880. // create an empty node and replace it
  5881. oldVnode = emptyNodeAt(oldVnode);
  5882. }
  5883. // replacing existing element
  5884. var oldElm = oldVnode.elm;
  5885. var parentElm = nodeOps.parentNode(oldElm);
  5886. // create new node
  5887. createElm(
  5888. vnode,
  5889. insertedVnodeQueue,
  5890. // extremely rare edge case: do not insert if old element is in a
  5891. // leaving transition. Only happens when combining transition +
  5892. // keep-alive + HOCs. (#4590)
  5893. oldElm._leaveCb ? null : parentElm,
  5894. nodeOps.nextSibling(oldElm)
  5895. );
  5896. // update parent placeholder node element, recursively
  5897. if (isDef(vnode.parent)) {
  5898. var ancestor = vnode.parent;
  5899. var patchable = isPatchable(vnode);
  5900. while (ancestor) {
  5901. for (var i = 0; i < cbs.destroy.length; ++i) {
  5902. cbs.destroy[i](ancestor);
  5903. }
  5904. ancestor.elm = vnode.elm;
  5905. if (patchable) {
  5906. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  5907. cbs.create[i$1](emptyNode, ancestor);
  5908. }
  5909. // #6513
  5910. // invoke insert hooks that may have been merged by create hooks.
  5911. // e.g. for directives that uses the "inserted" hook.
  5912. var insert = ancestor.data.hook.insert;
  5913. if (insert.merged) {
  5914. // start at index 1 to avoid re-invoking component mounted hook
  5915. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  5916. insert.fns[i$2]();
  5917. }
  5918. }
  5919. } else {
  5920. registerRef(ancestor);
  5921. }
  5922. ancestor = ancestor.parent;
  5923. }
  5924. }
  5925. // destroy old node
  5926. if (isDef(parentElm)) {
  5927. removeVnodes([oldVnode], 0, 0);
  5928. } else if (isDef(oldVnode.tag)) {
  5929. invokeDestroyHook(oldVnode);
  5930. }
  5931. }
  5932. }
  5933. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  5934. return vnode.elm
  5935. }
  5936. }
  5937. /* */
  5938. var directives = {
  5939. create: updateDirectives,
  5940. update: updateDirectives,
  5941. destroy: function unbindDirectives (vnode) {
  5942. updateDirectives(vnode, emptyNode);
  5943. }
  5944. };
  5945. function updateDirectives (oldVnode, vnode) {
  5946. if (oldVnode.data.directives || vnode.data.directives) {
  5947. _update(oldVnode, vnode);
  5948. }
  5949. }
  5950. function _update (oldVnode, vnode) {
  5951. var isCreate = oldVnode === emptyNode;
  5952. var isDestroy = vnode === emptyNode;
  5953. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  5954. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  5955. var dirsWithInsert = [];
  5956. var dirsWithPostpatch = [];
  5957. var key, oldDir, dir;
  5958. for (key in newDirs) {
  5959. oldDir = oldDirs[key];
  5960. dir = newDirs[key];
  5961. if (!oldDir) {
  5962. // new directive, bind
  5963. callHook$1(dir, 'bind', vnode, oldVnode);
  5964. if (dir.def && dir.def.inserted) {
  5965. dirsWithInsert.push(dir);
  5966. }
  5967. } else {
  5968. // existing directive, update
  5969. dir.oldValue = oldDir.value;
  5970. dir.oldArg = oldDir.arg;
  5971. callHook$1(dir, 'update', vnode, oldVnode);
  5972. if (dir.def && dir.def.componentUpdated) {
  5973. dirsWithPostpatch.push(dir);
  5974. }
  5975. }
  5976. }
  5977. if (dirsWithInsert.length) {
  5978. var callInsert = function () {
  5979. for (var i = 0; i < dirsWithInsert.length; i++) {
  5980. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  5981. }
  5982. };
  5983. if (isCreate) {
  5984. mergeVNodeHook(vnode, 'insert', callInsert);
  5985. } else {
  5986. callInsert();
  5987. }
  5988. }
  5989. if (dirsWithPostpatch.length) {
  5990. mergeVNodeHook(vnode, 'postpatch', function () {
  5991. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  5992. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  5993. }
  5994. });
  5995. }
  5996. if (!isCreate) {
  5997. for (key in oldDirs) {
  5998. if (!newDirs[key]) {
  5999. // no longer present, unbind
  6000. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6001. }
  6002. }
  6003. }
  6004. }
  6005. var emptyModifiers = Object.create(null);
  6006. function normalizeDirectives$1 (
  6007. dirs,
  6008. vm
  6009. ) {
  6010. var res = Object.create(null);
  6011. if (!dirs) {
  6012. // $flow-disable-line
  6013. return res
  6014. }
  6015. var i, dir;
  6016. for (i = 0; i < dirs.length; i++) {
  6017. dir = dirs[i];
  6018. if (!dir.modifiers) {
  6019. // $flow-disable-line
  6020. dir.modifiers = emptyModifiers;
  6021. }
  6022. res[getRawDirName(dir)] = dir;
  6023. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6024. }
  6025. // $flow-disable-line
  6026. return res
  6027. }
  6028. function getRawDirName (dir) {
  6029. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6030. }
  6031. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6032. var fn = dir.def && dir.def[hook];
  6033. if (fn) {
  6034. try {
  6035. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6036. } catch (e) {
  6037. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6038. }
  6039. }
  6040. }
  6041. var baseModules = [
  6042. ref,
  6043. directives
  6044. ];
  6045. /* */
  6046. function updateAttrs (oldVnode, vnode) {
  6047. var opts = vnode.componentOptions;
  6048. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6049. return
  6050. }
  6051. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6052. return
  6053. }
  6054. var key, cur, old;
  6055. var elm = vnode.elm;
  6056. var oldAttrs = oldVnode.data.attrs || {};
  6057. var attrs = vnode.data.attrs || {};
  6058. // clone observed objects, as the user probably wants to mutate it
  6059. if (isDef(attrs.__ob__)) {
  6060. attrs = vnode.data.attrs = extend({}, attrs);
  6061. }
  6062. for (key in attrs) {
  6063. cur = attrs[key];
  6064. old = oldAttrs[key];
  6065. if (old !== cur) {
  6066. setAttr(elm, key, cur);
  6067. }
  6068. }
  6069. // #4391: in IE9, setting type can reset value for input[type=radio]
  6070. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6071. /* istanbul ignore if */
  6072. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6073. setAttr(elm, 'value', attrs.value);
  6074. }
  6075. for (key in oldAttrs) {
  6076. if (isUndef(attrs[key])) {
  6077. if (isXlink(key)) {
  6078. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6079. } else if (!isEnumeratedAttr(key)) {
  6080. elm.removeAttribute(key);
  6081. }
  6082. }
  6083. }
  6084. }
  6085. function setAttr (el, key, value) {
  6086. if (el.tagName.indexOf('-') > -1) {
  6087. baseSetAttr(el, key, value);
  6088. } else if (isBooleanAttr(key)) {
  6089. // set attribute for blank value
  6090. // e.g. <option disabled>Select one</option>
  6091. if (isFalsyAttrValue(value)) {
  6092. el.removeAttribute(key);
  6093. } else {
  6094. // technically allowfullscreen is a boolean attribute for <iframe>,
  6095. // but Flash expects a value of "true" when used on <embed> tag
  6096. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6097. ? 'true'
  6098. : key;
  6099. el.setAttribute(key, value);
  6100. }
  6101. } else if (isEnumeratedAttr(key)) {
  6102. el.setAttribute(key, convertEnumeratedValue(key, value));
  6103. } else if (isXlink(key)) {
  6104. if (isFalsyAttrValue(value)) {
  6105. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6106. } else {
  6107. el.setAttributeNS(xlinkNS, key, value);
  6108. }
  6109. } else {
  6110. baseSetAttr(el, key, value);
  6111. }
  6112. }
  6113. function baseSetAttr (el, key, value) {
  6114. if (isFalsyAttrValue(value)) {
  6115. el.removeAttribute(key);
  6116. } else {
  6117. // #7138: IE10 & 11 fires input event when setting placeholder on
  6118. // <textarea>... block the first input event and remove the blocker
  6119. // immediately.
  6120. /* istanbul ignore if */
  6121. if (
  6122. isIE && !isIE9 &&
  6123. el.tagName === 'TEXTAREA' &&
  6124. key === 'placeholder' && value !== '' && !el.__ieph
  6125. ) {
  6126. var blocker = function (e) {
  6127. e.stopImmediatePropagation();
  6128. el.removeEventListener('input', blocker);
  6129. };
  6130. el.addEventListener('input', blocker);
  6131. // $flow-disable-line
  6132. el.__ieph = true; /* IE placeholder patched */
  6133. }
  6134. el.setAttribute(key, value);
  6135. }
  6136. }
  6137. var attrs = {
  6138. create: updateAttrs,
  6139. update: updateAttrs
  6140. };
  6141. /* */
  6142. function updateClass (oldVnode, vnode) {
  6143. var el = vnode.elm;
  6144. var data = vnode.data;
  6145. var oldData = oldVnode.data;
  6146. if (
  6147. isUndef(data.staticClass) &&
  6148. isUndef(data.class) && (
  6149. isUndef(oldData) || (
  6150. isUndef(oldData.staticClass) &&
  6151. isUndef(oldData.class)
  6152. )
  6153. )
  6154. ) {
  6155. return
  6156. }
  6157. var cls = genClassForVnode(vnode);
  6158. // handle transition classes
  6159. var transitionClass = el._transitionClasses;
  6160. if (isDef(transitionClass)) {
  6161. cls = concat(cls, stringifyClass(transitionClass));
  6162. }
  6163. // set the class
  6164. if (cls !== el._prevClass) {
  6165. el.setAttribute('class', cls);
  6166. el._prevClass = cls;
  6167. }
  6168. }
  6169. var klass = {
  6170. create: updateClass,
  6171. update: updateClass
  6172. };
  6173. /* */
  6174. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6175. function parseFilters (exp) {
  6176. var inSingle = false;
  6177. var inDouble = false;
  6178. var inTemplateString = false;
  6179. var inRegex = false;
  6180. var curly = 0;
  6181. var square = 0;
  6182. var paren = 0;
  6183. var lastFilterIndex = 0;
  6184. var c, prev, i, expression, filters;
  6185. for (i = 0; i < exp.length; i++) {
  6186. prev = c;
  6187. c = exp.charCodeAt(i);
  6188. if (inSingle) {
  6189. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  6190. } else if (inDouble) {
  6191. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  6192. } else if (inTemplateString) {
  6193. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  6194. } else if (inRegex) {
  6195. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  6196. } else if (
  6197. c === 0x7C && // pipe
  6198. exp.charCodeAt(i + 1) !== 0x7C &&
  6199. exp.charCodeAt(i - 1) !== 0x7C &&
  6200. !curly && !square && !paren
  6201. ) {
  6202. if (expression === undefined) {
  6203. // first filter, end of expression
  6204. lastFilterIndex = i + 1;
  6205. expression = exp.slice(0, i).trim();
  6206. } else {
  6207. pushFilter();
  6208. }
  6209. } else {
  6210. switch (c) {
  6211. case 0x22: inDouble = true; break // "
  6212. case 0x27: inSingle = true; break // '
  6213. case 0x60: inTemplateString = true; break // `
  6214. case 0x28: paren++; break // (
  6215. case 0x29: paren--; break // )
  6216. case 0x5B: square++; break // [
  6217. case 0x5D: square--; break // ]
  6218. case 0x7B: curly++; break // {
  6219. case 0x7D: curly--; break // }
  6220. }
  6221. if (c === 0x2f) { // /
  6222. var j = i - 1;
  6223. var p = (void 0);
  6224. // find first non-whitespace prev char
  6225. for (; j >= 0; j--) {
  6226. p = exp.charAt(j);
  6227. if (p !== ' ') { break }
  6228. }
  6229. if (!p || !validDivisionCharRE.test(p)) {
  6230. inRegex = true;
  6231. }
  6232. }
  6233. }
  6234. }
  6235. if (expression === undefined) {
  6236. expression = exp.slice(0, i).trim();
  6237. } else if (lastFilterIndex !== 0) {
  6238. pushFilter();
  6239. }
  6240. function pushFilter () {
  6241. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6242. lastFilterIndex = i + 1;
  6243. }
  6244. if (filters) {
  6245. for (i = 0; i < filters.length; i++) {
  6246. expression = wrapFilter(expression, filters[i]);
  6247. }
  6248. }
  6249. return expression
  6250. }
  6251. function wrapFilter (exp, filter) {
  6252. var i = filter.indexOf('(');
  6253. if (i < 0) {
  6254. // _f: resolveFilter
  6255. return ("_f(\"" + filter + "\")(" + exp + ")")
  6256. } else {
  6257. var name = filter.slice(0, i);
  6258. var args = filter.slice(i + 1);
  6259. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6260. }
  6261. }
  6262. /* */
  6263. /* eslint-disable no-unused-vars */
  6264. function baseWarn (msg, range) {
  6265. console.error(("[Vue compiler]: " + msg));
  6266. }
  6267. /* eslint-enable no-unused-vars */
  6268. function pluckModuleFunction (
  6269. modules,
  6270. key
  6271. ) {
  6272. return modules
  6273. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6274. : []
  6275. }
  6276. function addProp (el, name, value, range, dynamic) {
  6277. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6278. el.plain = false;
  6279. }
  6280. function addAttr (el, name, value, range, dynamic) {
  6281. var attrs = dynamic
  6282. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  6283. : (el.attrs || (el.attrs = []));
  6284. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6285. el.plain = false;
  6286. }
  6287. // add a raw attr (use this in preTransforms)
  6288. function addRawAttr (el, name, value, range) {
  6289. el.attrsMap[name] = value;
  6290. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  6291. }
  6292. function addDirective (
  6293. el,
  6294. name,
  6295. rawName,
  6296. value,
  6297. arg,
  6298. isDynamicArg,
  6299. modifiers,
  6300. range
  6301. ) {
  6302. (el.directives || (el.directives = [])).push(rangeSetItem({
  6303. name: name,
  6304. rawName: rawName,
  6305. value: value,
  6306. arg: arg,
  6307. isDynamicArg: isDynamicArg,
  6308. modifiers: modifiers
  6309. }, range));
  6310. el.plain = false;
  6311. }
  6312. function prependModifierMarker (symbol, name, dynamic) {
  6313. return dynamic
  6314. ? ("_p(" + name + ",\"" + symbol + "\")")
  6315. : symbol + name // mark the event as captured
  6316. }
  6317. function addHandler (
  6318. el,
  6319. name,
  6320. value,
  6321. modifiers,
  6322. important,
  6323. warn,
  6324. range,
  6325. dynamic
  6326. ) {
  6327. modifiers = modifiers || emptyObject;
  6328. // warn prevent and passive modifier
  6329. /* istanbul ignore if */
  6330. if (
  6331. warn &&
  6332. modifiers.prevent && modifiers.passive
  6333. ) {
  6334. warn(
  6335. 'passive and prevent can\'t be used together. ' +
  6336. 'Passive handler can\'t prevent default event.',
  6337. range
  6338. );
  6339. }
  6340. // normalize click.right and click.middle since they don't actually fire
  6341. // this is technically browser-specific, but at least for now browsers are
  6342. // the only target envs that have right/middle clicks.
  6343. if (modifiers.right) {
  6344. if (dynamic) {
  6345. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  6346. } else if (name === 'click') {
  6347. name = 'contextmenu';
  6348. delete modifiers.right;
  6349. }
  6350. } else if (modifiers.middle) {
  6351. if (dynamic) {
  6352. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  6353. } else if (name === 'click') {
  6354. name = 'mouseup';
  6355. }
  6356. }
  6357. // check capture modifier
  6358. if (modifiers.capture) {
  6359. delete modifiers.capture;
  6360. name = prependModifierMarker('!', name, dynamic);
  6361. }
  6362. if (modifiers.once) {
  6363. delete modifiers.once;
  6364. name = prependModifierMarker('~', name, dynamic);
  6365. }
  6366. /* istanbul ignore if */
  6367. if (modifiers.passive) {
  6368. delete modifiers.passive;
  6369. name = prependModifierMarker('&', name, dynamic);
  6370. }
  6371. var events;
  6372. if (modifiers.native) {
  6373. delete modifiers.native;
  6374. events = el.nativeEvents || (el.nativeEvents = {});
  6375. } else {
  6376. events = el.events || (el.events = {});
  6377. }
  6378. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  6379. if (modifiers !== emptyObject) {
  6380. newHandler.modifiers = modifiers;
  6381. }
  6382. var handlers = events[name];
  6383. /* istanbul ignore if */
  6384. if (Array.isArray(handlers)) {
  6385. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  6386. } else if (handlers) {
  6387. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  6388. } else {
  6389. events[name] = newHandler;
  6390. }
  6391. el.plain = false;
  6392. }
  6393. function getRawBindingAttr (
  6394. el,
  6395. name
  6396. ) {
  6397. return el.rawAttrsMap[':' + name] ||
  6398. el.rawAttrsMap['v-bind:' + name] ||
  6399. el.rawAttrsMap[name]
  6400. }
  6401. function getBindingAttr (
  6402. el,
  6403. name,
  6404. getStatic
  6405. ) {
  6406. var dynamicValue =
  6407. getAndRemoveAttr(el, ':' + name) ||
  6408. getAndRemoveAttr(el, 'v-bind:' + name);
  6409. if (dynamicValue != null) {
  6410. return parseFilters(dynamicValue)
  6411. } else if (getStatic !== false) {
  6412. var staticValue = getAndRemoveAttr(el, name);
  6413. if (staticValue != null) {
  6414. return JSON.stringify(staticValue)
  6415. }
  6416. }
  6417. }
  6418. // note: this only removes the attr from the Array (attrsList) so that it
  6419. // doesn't get processed by processAttrs.
  6420. // By default it does NOT remove it from the map (attrsMap) because the map is
  6421. // needed during codegen.
  6422. function getAndRemoveAttr (
  6423. el,
  6424. name,
  6425. removeFromMap
  6426. ) {
  6427. var val;
  6428. if ((val = el.attrsMap[name]) != null) {
  6429. var list = el.attrsList;
  6430. for (var i = 0, l = list.length; i < l; i++) {
  6431. if (list[i].name === name) {
  6432. list.splice(i, 1);
  6433. break
  6434. }
  6435. }
  6436. }
  6437. if (removeFromMap) {
  6438. delete el.attrsMap[name];
  6439. }
  6440. return val
  6441. }
  6442. function getAndRemoveAttrByRegex (
  6443. el,
  6444. name
  6445. ) {
  6446. var list = el.attrsList;
  6447. for (var i = 0, l = list.length; i < l; i++) {
  6448. var attr = list[i];
  6449. if (name.test(attr.name)) {
  6450. list.splice(i, 1);
  6451. return attr
  6452. }
  6453. }
  6454. }
  6455. function rangeSetItem (
  6456. item,
  6457. range
  6458. ) {
  6459. if (range) {
  6460. if (range.start != null) {
  6461. item.start = range.start;
  6462. }
  6463. if (range.end != null) {
  6464. item.end = range.end;
  6465. }
  6466. }
  6467. return item
  6468. }
  6469. /* */
  6470. /**
  6471. * Cross-platform code generation for component v-model
  6472. */
  6473. function genComponentModel (
  6474. el,
  6475. value,
  6476. modifiers
  6477. ) {
  6478. var ref = modifiers || {};
  6479. var number = ref.number;
  6480. var trim = ref.trim;
  6481. var baseValueExpression = '$$v';
  6482. var valueExpression = baseValueExpression;
  6483. if (trim) {
  6484. valueExpression =
  6485. "(typeof " + baseValueExpression + " === 'string'" +
  6486. "? " + baseValueExpression + ".trim()" +
  6487. ": " + baseValueExpression + ")";
  6488. }
  6489. if (number) {
  6490. valueExpression = "_n(" + valueExpression + ")";
  6491. }
  6492. var assignment = genAssignmentCode(value, valueExpression);
  6493. el.model = {
  6494. value: ("(" + value + ")"),
  6495. expression: JSON.stringify(value),
  6496. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  6497. };
  6498. }
  6499. /**
  6500. * Cross-platform codegen helper for generating v-model value assignment code.
  6501. */
  6502. function genAssignmentCode (
  6503. value,
  6504. assignment
  6505. ) {
  6506. var res = parseModel(value);
  6507. if (res.key === null) {
  6508. return (value + "=" + assignment)
  6509. } else {
  6510. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  6511. }
  6512. }
  6513. /**
  6514. * Parse a v-model expression into a base path and a final key segment.
  6515. * Handles both dot-path and possible square brackets.
  6516. *
  6517. * Possible cases:
  6518. *
  6519. * - test
  6520. * - test[key]
  6521. * - test[test1[key]]
  6522. * - test["a"][key]
  6523. * - xxx.test[a[a].test1[key]]
  6524. * - test.xxx.a["asa"][test1[key]]
  6525. *
  6526. */
  6527. var len, str, chr, index$1, expressionPos, expressionEndPos;
  6528. function parseModel (val) {
  6529. // Fix https://github.com/vuejs/vue/pull/7730
  6530. // allow v-model="obj.val " (trailing whitespace)
  6531. val = val.trim();
  6532. len = val.length;
  6533. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  6534. index$1 = val.lastIndexOf('.');
  6535. if (index$1 > -1) {
  6536. return {
  6537. exp: val.slice(0, index$1),
  6538. key: '"' + val.slice(index$1 + 1) + '"'
  6539. }
  6540. } else {
  6541. return {
  6542. exp: val,
  6543. key: null
  6544. }
  6545. }
  6546. }
  6547. str = val;
  6548. index$1 = expressionPos = expressionEndPos = 0;
  6549. while (!eof()) {
  6550. chr = next();
  6551. /* istanbul ignore if */
  6552. if (isStringStart(chr)) {
  6553. parseString(chr);
  6554. } else if (chr === 0x5B) {
  6555. parseBracket(chr);
  6556. }
  6557. }
  6558. return {
  6559. exp: val.slice(0, expressionPos),
  6560. key: val.slice(expressionPos + 1, expressionEndPos)
  6561. }
  6562. }
  6563. function next () {
  6564. return str.charCodeAt(++index$1)
  6565. }
  6566. function eof () {
  6567. return index$1 >= len
  6568. }
  6569. function isStringStart (chr) {
  6570. return chr === 0x22 || chr === 0x27
  6571. }
  6572. function parseBracket (chr) {
  6573. var inBracket = 1;
  6574. expressionPos = index$1;
  6575. while (!eof()) {
  6576. chr = next();
  6577. if (isStringStart(chr)) {
  6578. parseString(chr);
  6579. continue
  6580. }
  6581. if (chr === 0x5B) { inBracket++; }
  6582. if (chr === 0x5D) { inBracket--; }
  6583. if (inBracket === 0) {
  6584. expressionEndPos = index$1;
  6585. break
  6586. }
  6587. }
  6588. }
  6589. function parseString (chr) {
  6590. var stringQuote = chr;
  6591. while (!eof()) {
  6592. chr = next();
  6593. if (chr === stringQuote) {
  6594. break
  6595. }
  6596. }
  6597. }
  6598. /* */
  6599. var warn$1;
  6600. // in some cases, the event used has to be determined at runtime
  6601. // so we used some reserved tokens during compile.
  6602. var RANGE_TOKEN = '__r';
  6603. var CHECKBOX_RADIO_TOKEN = '__c';
  6604. function model (
  6605. el,
  6606. dir,
  6607. _warn
  6608. ) {
  6609. warn$1 = _warn;
  6610. var value = dir.value;
  6611. var modifiers = dir.modifiers;
  6612. var tag = el.tag;
  6613. var type = el.attrsMap.type;
  6614. {
  6615. // inputs with type="file" are read only and setting the input's
  6616. // value will throw an error.
  6617. if (tag === 'input' && type === 'file') {
  6618. warn$1(
  6619. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  6620. "File inputs are read only. Use a v-on:change listener instead.",
  6621. el.rawAttrsMap['v-model']
  6622. );
  6623. }
  6624. }
  6625. if (el.component) {
  6626. genComponentModel(el, value, modifiers);
  6627. // component v-model doesn't need extra runtime
  6628. return false
  6629. } else if (tag === 'select') {
  6630. genSelect(el, value, modifiers);
  6631. } else if (tag === 'input' && type === 'checkbox') {
  6632. genCheckboxModel(el, value, modifiers);
  6633. } else if (tag === 'input' && type === 'radio') {
  6634. genRadioModel(el, value, modifiers);
  6635. } else if (tag === 'input' || tag === 'textarea') {
  6636. genDefaultModel(el, value, modifiers);
  6637. } else if (!config.isReservedTag(tag)) {
  6638. genComponentModel(el, value, modifiers);
  6639. // component v-model doesn't need extra runtime
  6640. return false
  6641. } else {
  6642. warn$1(
  6643. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6644. "v-model is not supported on this element type. " +
  6645. 'If you are working with contenteditable, it\'s recommended to ' +
  6646. 'wrap a library dedicated for that purpose inside a custom component.',
  6647. el.rawAttrsMap['v-model']
  6648. );
  6649. }
  6650. // ensure runtime directive metadata
  6651. return true
  6652. }
  6653. function genCheckboxModel (
  6654. el,
  6655. value,
  6656. modifiers
  6657. ) {
  6658. var number = modifiers && modifiers.number;
  6659. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6660. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  6661. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  6662. addProp(el, 'checked',
  6663. "Array.isArray(" + value + ")" +
  6664. "?_i(" + value + "," + valueBinding + ")>-1" + (
  6665. trueValueBinding === 'true'
  6666. ? (":(" + value + ")")
  6667. : (":_q(" + value + "," + trueValueBinding + ")")
  6668. )
  6669. );
  6670. addHandler(el, 'change',
  6671. "var $$a=" + value + "," +
  6672. '$$el=$event.target,' +
  6673. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  6674. 'if(Array.isArray($$a)){' +
  6675. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  6676. '$$i=_i($$a,$$v);' +
  6677. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  6678. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  6679. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  6680. null, true
  6681. );
  6682. }
  6683. function genRadioModel (
  6684. el,
  6685. value,
  6686. modifiers
  6687. ) {
  6688. var number = modifiers && modifiers.number;
  6689. var valueBinding = getBindingAttr(el, 'value') || 'null';
  6690. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  6691. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  6692. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  6693. }
  6694. function genSelect (
  6695. el,
  6696. value,
  6697. modifiers
  6698. ) {
  6699. var number = modifiers && modifiers.number;
  6700. var selectedVal = "Array.prototype.filter" +
  6701. ".call($event.target.options,function(o){return o.selected})" +
  6702. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  6703. "return " + (number ? '_n(val)' : 'val') + "})";
  6704. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  6705. var code = "var $$selectedVal = " + selectedVal + ";";
  6706. code = code + " " + (genAssignmentCode(value, assignment));
  6707. addHandler(el, 'change', code, null, true);
  6708. }
  6709. function genDefaultModel (
  6710. el,
  6711. value,
  6712. modifiers
  6713. ) {
  6714. var type = el.attrsMap.type;
  6715. // warn if v-bind:value conflicts with v-model
  6716. // except for inputs with v-bind:type
  6717. {
  6718. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  6719. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  6720. if (value$1 && !typeBinding) {
  6721. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  6722. warn$1(
  6723. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  6724. 'because the latter already expands to a value binding internally',
  6725. el.rawAttrsMap[binding]
  6726. );
  6727. }
  6728. }
  6729. var ref = modifiers || {};
  6730. var lazy = ref.lazy;
  6731. var number = ref.number;
  6732. var trim = ref.trim;
  6733. var needCompositionGuard = !lazy && type !== 'range';
  6734. var event = lazy
  6735. ? 'change'
  6736. : type === 'range'
  6737. ? RANGE_TOKEN
  6738. : 'input';
  6739. var valueExpression = '$event.target.value';
  6740. if (trim) {
  6741. valueExpression = "$event.target.value.trim()";
  6742. }
  6743. if (number) {
  6744. valueExpression = "_n(" + valueExpression + ")";
  6745. }
  6746. var code = genAssignmentCode(value, valueExpression);
  6747. if (needCompositionGuard) {
  6748. code = "if($event.target.composing)return;" + code;
  6749. }
  6750. addProp(el, 'value', ("(" + value + ")"));
  6751. addHandler(el, event, code, null, true);
  6752. if (trim || number) {
  6753. addHandler(el, 'blur', '$forceUpdate()');
  6754. }
  6755. }
  6756. /* */
  6757. // normalize v-model event tokens that can only be determined at runtime.
  6758. // it's important to place the event as the first in the array because
  6759. // the whole point is ensuring the v-model callback gets called before
  6760. // user-attached handlers.
  6761. function normalizeEvents (on) {
  6762. /* istanbul ignore if */
  6763. if (isDef(on[RANGE_TOKEN])) {
  6764. // IE input[type=range] only supports `change` event
  6765. var event = isIE ? 'change' : 'input';
  6766. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  6767. delete on[RANGE_TOKEN];
  6768. }
  6769. // This was originally intended to fix #4521 but no longer necessary
  6770. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  6771. /* istanbul ignore if */
  6772. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  6773. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  6774. delete on[CHECKBOX_RADIO_TOKEN];
  6775. }
  6776. }
  6777. var target$1;
  6778. function createOnceHandler$1 (event, handler, capture) {
  6779. var _target = target$1; // save current target element in closure
  6780. return function onceHandler () {
  6781. var res = handler.apply(null, arguments);
  6782. if (res !== null) {
  6783. remove$2(event, onceHandler, capture, _target);
  6784. }
  6785. }
  6786. }
  6787. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  6788. // implementation and does not fire microtasks in between event propagation, so
  6789. // safe to exclude.
  6790. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  6791. function add$1 (
  6792. name,
  6793. handler,
  6794. capture,
  6795. passive
  6796. ) {
  6797. // async edge case #6566: inner click event triggers patch, event handler
  6798. // attached to outer element during patch, and triggered again. This
  6799. // happens because browsers fire microtask ticks between event propagation.
  6800. // the solution is simple: we save the timestamp when a handler is attached,
  6801. // and the handler would only fire if the event passed to it was fired
  6802. // AFTER it was attached.
  6803. if (useMicrotaskFix) {
  6804. var attachedTimestamp = currentFlushTimestamp;
  6805. var original = handler;
  6806. handler = original._wrapper = function (e) {
  6807. if (
  6808. // no bubbling, should always fire.
  6809. // this is just a safety net in case event.timeStamp is unreliable in
  6810. // certain weird environments...
  6811. e.target === e.currentTarget ||
  6812. // event is fired after handler attachment
  6813. e.timeStamp >= attachedTimestamp ||
  6814. // bail for environments that have buggy event.timeStamp implementations
  6815. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  6816. // #9681 QtWebEngine event.timeStamp is negative value
  6817. e.timeStamp <= 0 ||
  6818. // #9448 bail if event is fired in another document in a multi-page
  6819. // electron/nw.js app, since event.timeStamp will be using a different
  6820. // starting reference
  6821. e.target.ownerDocument !== document
  6822. ) {
  6823. return original.apply(this, arguments)
  6824. }
  6825. };
  6826. }
  6827. target$1.addEventListener(
  6828. name,
  6829. handler,
  6830. supportsPassive
  6831. ? { capture: capture, passive: passive }
  6832. : capture
  6833. );
  6834. }
  6835. function remove$2 (
  6836. name,
  6837. handler,
  6838. capture,
  6839. _target
  6840. ) {
  6841. (_target || target$1).removeEventListener(
  6842. name,
  6843. handler._wrapper || handler,
  6844. capture
  6845. );
  6846. }
  6847. function updateDOMListeners (oldVnode, vnode) {
  6848. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  6849. return
  6850. }
  6851. var on = vnode.data.on || {};
  6852. var oldOn = oldVnode.data.on || {};
  6853. target$1 = vnode.elm;
  6854. normalizeEvents(on);
  6855. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  6856. target$1 = undefined;
  6857. }
  6858. var events = {
  6859. create: updateDOMListeners,
  6860. update: updateDOMListeners
  6861. };
  6862. /* */
  6863. var svgContainer;
  6864. function updateDOMProps (oldVnode, vnode) {
  6865. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  6866. return
  6867. }
  6868. var key, cur;
  6869. var elm = vnode.elm;
  6870. var oldProps = oldVnode.data.domProps || {};
  6871. var props = vnode.data.domProps || {};
  6872. // clone observed objects, as the user probably wants to mutate it
  6873. if (isDef(props.__ob__)) {
  6874. props = vnode.data.domProps = extend({}, props);
  6875. }
  6876. for (key in oldProps) {
  6877. if (!(key in props)) {
  6878. elm[key] = '';
  6879. }
  6880. }
  6881. for (key in props) {
  6882. cur = props[key];
  6883. // ignore children if the node has textContent or innerHTML,
  6884. // as these will throw away existing DOM nodes and cause removal errors
  6885. // on subsequent patches (#3360)
  6886. if (key === 'textContent' || key === 'innerHTML') {
  6887. if (vnode.children) { vnode.children.length = 0; }
  6888. if (cur === oldProps[key]) { continue }
  6889. // #6601 work around Chrome version <= 55 bug where single textNode
  6890. // replaced by innerHTML/textContent retains its parentNode property
  6891. if (elm.childNodes.length === 1) {
  6892. elm.removeChild(elm.childNodes[0]);
  6893. }
  6894. }
  6895. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  6896. // store value as _value as well since
  6897. // non-string values will be stringified
  6898. elm._value = cur;
  6899. // avoid resetting cursor position when value is the same
  6900. var strCur = isUndef(cur) ? '' : String(cur);
  6901. if (shouldUpdateValue(elm, strCur)) {
  6902. elm.value = strCur;
  6903. }
  6904. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  6905. // IE doesn't support innerHTML for SVG elements
  6906. svgContainer = svgContainer || document.createElement('div');
  6907. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  6908. var svg = svgContainer.firstChild;
  6909. while (elm.firstChild) {
  6910. elm.removeChild(elm.firstChild);
  6911. }
  6912. while (svg.firstChild) {
  6913. elm.appendChild(svg.firstChild);
  6914. }
  6915. } else if (
  6916. // skip the update if old and new VDOM state is the same.
  6917. // `value` is handled separately because the DOM value may be temporarily
  6918. // out of sync with VDOM state due to focus, composition and modifiers.
  6919. // This #4521 by skipping the unnecessary `checked` update.
  6920. cur !== oldProps[key]
  6921. ) {
  6922. // some property updates can throw
  6923. // e.g. `value` on <progress> w/ non-finite value
  6924. try {
  6925. elm[key] = cur;
  6926. } catch (e) {}
  6927. }
  6928. }
  6929. }
  6930. // check platforms/web/util/attrs.js acceptValue
  6931. function shouldUpdateValue (elm, checkVal) {
  6932. return (!elm.composing && (
  6933. elm.tagName === 'OPTION' ||
  6934. isNotInFocusAndDirty(elm, checkVal) ||
  6935. isDirtyWithModifiers(elm, checkVal)
  6936. ))
  6937. }
  6938. function isNotInFocusAndDirty (elm, checkVal) {
  6939. // return true when textbox (.number and .trim) loses focus and its value is
  6940. // not equal to the updated value
  6941. var notInFocus = true;
  6942. // #6157
  6943. // work around IE bug when accessing document.activeElement in an iframe
  6944. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  6945. return notInFocus && elm.value !== checkVal
  6946. }
  6947. function isDirtyWithModifiers (elm, newVal) {
  6948. var value = elm.value;
  6949. var modifiers = elm._vModifiers; // injected by v-model runtime
  6950. if (isDef(modifiers)) {
  6951. if (modifiers.number) {
  6952. return toNumber(value) !== toNumber(newVal)
  6953. }
  6954. if (modifiers.trim) {
  6955. return value.trim() !== newVal.trim()
  6956. }
  6957. }
  6958. return value !== newVal
  6959. }
  6960. var domProps = {
  6961. create: updateDOMProps,
  6962. update: updateDOMProps
  6963. };
  6964. /* */
  6965. var parseStyleText = cached(function (cssText) {
  6966. var res = {};
  6967. var listDelimiter = /;(?![^(]*\))/g;
  6968. var propertyDelimiter = /:(.+)/;
  6969. cssText.split(listDelimiter).forEach(function (item) {
  6970. if (item) {
  6971. var tmp = item.split(propertyDelimiter);
  6972. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  6973. }
  6974. });
  6975. return res
  6976. });
  6977. // merge static and dynamic style data on the same vnode
  6978. function normalizeStyleData (data) {
  6979. var style = normalizeStyleBinding(data.style);
  6980. // static style is pre-processed into an object during compilation
  6981. // and is always a fresh object, so it's safe to merge into it
  6982. return data.staticStyle
  6983. ? extend(data.staticStyle, style)
  6984. : style
  6985. }
  6986. // normalize possible array / string values into Object
  6987. function normalizeStyleBinding (bindingStyle) {
  6988. if (Array.isArray(bindingStyle)) {
  6989. return toObject(bindingStyle)
  6990. }
  6991. if (typeof bindingStyle === 'string') {
  6992. return parseStyleText(bindingStyle)
  6993. }
  6994. return bindingStyle
  6995. }
  6996. /**
  6997. * parent component style should be after child's
  6998. * so that parent component's style could override it
  6999. */
  7000. function getStyle (vnode, checkChild) {
  7001. var res = {};
  7002. var styleData;
  7003. if (checkChild) {
  7004. var childNode = vnode;
  7005. while (childNode.componentInstance) {
  7006. childNode = childNode.componentInstance._vnode;
  7007. if (
  7008. childNode && childNode.data &&
  7009. (styleData = normalizeStyleData(childNode.data))
  7010. ) {
  7011. extend(res, styleData);
  7012. }
  7013. }
  7014. }
  7015. if ((styleData = normalizeStyleData(vnode.data))) {
  7016. extend(res, styleData);
  7017. }
  7018. var parentNode = vnode;
  7019. while ((parentNode = parentNode.parent)) {
  7020. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  7021. extend(res, styleData);
  7022. }
  7023. }
  7024. return res
  7025. }
  7026. /* */
  7027. var cssVarRE = /^--/;
  7028. var importantRE = /\s*!important$/;
  7029. var setProp = function (el, name, val) {
  7030. /* istanbul ignore if */
  7031. if (cssVarRE.test(name)) {
  7032. el.style.setProperty(name, val);
  7033. } else if (importantRE.test(val)) {
  7034. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  7035. } else {
  7036. var normalizedName = normalize(name);
  7037. if (Array.isArray(val)) {
  7038. // Support values array created by autoprefixer, e.g.
  7039. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  7040. // Set them one by one, and the browser will only set those it can recognize
  7041. for (var i = 0, len = val.length; i < len; i++) {
  7042. el.style[normalizedName] = val[i];
  7043. }
  7044. } else {
  7045. el.style[normalizedName] = val;
  7046. }
  7047. }
  7048. };
  7049. var vendorNames = ['Webkit', 'Moz', 'ms'];
  7050. var emptyStyle;
  7051. var normalize = cached(function (prop) {
  7052. emptyStyle = emptyStyle || document.createElement('div').style;
  7053. prop = camelize(prop);
  7054. if (prop !== 'filter' && (prop in emptyStyle)) {
  7055. return prop
  7056. }
  7057. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  7058. for (var i = 0; i < vendorNames.length; i++) {
  7059. var name = vendorNames[i] + capName;
  7060. if (name in emptyStyle) {
  7061. return name
  7062. }
  7063. }
  7064. });
  7065. function updateStyle (oldVnode, vnode) {
  7066. var data = vnode.data;
  7067. var oldData = oldVnode.data;
  7068. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7069. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7070. ) {
  7071. return
  7072. }
  7073. var cur, name;
  7074. var el = vnode.elm;
  7075. var oldStaticStyle = oldData.staticStyle;
  7076. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7077. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7078. var oldStyle = oldStaticStyle || oldStyleBinding;
  7079. var style = normalizeStyleBinding(vnode.data.style) || {};
  7080. // store normalized style under a different key for next diff
  7081. // make sure to clone it if it's reactive, since the user likely wants
  7082. // to mutate it.
  7083. vnode.data.normalizedStyle = isDef(style.__ob__)
  7084. ? extend({}, style)
  7085. : style;
  7086. var newStyle = getStyle(vnode, true);
  7087. for (name in oldStyle) {
  7088. if (isUndef(newStyle[name])) {
  7089. setProp(el, name, '');
  7090. }
  7091. }
  7092. for (name in newStyle) {
  7093. cur = newStyle[name];
  7094. if (cur !== oldStyle[name]) {
  7095. // ie9 setting to null has no effect, must use empty string
  7096. setProp(el, name, cur == null ? '' : cur);
  7097. }
  7098. }
  7099. }
  7100. var style = {
  7101. create: updateStyle,
  7102. update: updateStyle
  7103. };
  7104. /* */
  7105. var whitespaceRE = /\s+/;
  7106. /**
  7107. * Add class with compatibility for SVG since classList is not supported on
  7108. * SVG elements in IE
  7109. */
  7110. function addClass (el, cls) {
  7111. /* istanbul ignore if */
  7112. if (!cls || !(cls = cls.trim())) {
  7113. return
  7114. }
  7115. /* istanbul ignore else */
  7116. if (el.classList) {
  7117. if (cls.indexOf(' ') > -1) {
  7118. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  7119. } else {
  7120. el.classList.add(cls);
  7121. }
  7122. } else {
  7123. var cur = " " + (el.getAttribute('class') || '') + " ";
  7124. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7125. el.setAttribute('class', (cur + cls).trim());
  7126. }
  7127. }
  7128. }
  7129. /**
  7130. * Remove class with compatibility for SVG since classList is not supported on
  7131. * SVG elements in IE
  7132. */
  7133. function removeClass (el, cls) {
  7134. /* istanbul ignore if */
  7135. if (!cls || !(cls = cls.trim())) {
  7136. return
  7137. }
  7138. /* istanbul ignore else */
  7139. if (el.classList) {
  7140. if (cls.indexOf(' ') > -1) {
  7141. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  7142. } else {
  7143. el.classList.remove(cls);
  7144. }
  7145. if (!el.classList.length) {
  7146. el.removeAttribute('class');
  7147. }
  7148. } else {
  7149. var cur = " " + (el.getAttribute('class') || '') + " ";
  7150. var tar = ' ' + cls + ' ';
  7151. while (cur.indexOf(tar) >= 0) {
  7152. cur = cur.replace(tar, ' ');
  7153. }
  7154. cur = cur.trim();
  7155. if (cur) {
  7156. el.setAttribute('class', cur);
  7157. } else {
  7158. el.removeAttribute('class');
  7159. }
  7160. }
  7161. }
  7162. /* */
  7163. function resolveTransition (def$$1) {
  7164. if (!def$$1) {
  7165. return
  7166. }
  7167. /* istanbul ignore else */
  7168. if (typeof def$$1 === 'object') {
  7169. var res = {};
  7170. if (def$$1.css !== false) {
  7171. extend(res, autoCssTransition(def$$1.name || 'v'));
  7172. }
  7173. extend(res, def$$1);
  7174. return res
  7175. } else if (typeof def$$1 === 'string') {
  7176. return autoCssTransition(def$$1)
  7177. }
  7178. }
  7179. var autoCssTransition = cached(function (name) {
  7180. return {
  7181. enterClass: (name + "-enter"),
  7182. enterToClass: (name + "-enter-to"),
  7183. enterActiveClass: (name + "-enter-active"),
  7184. leaveClass: (name + "-leave"),
  7185. leaveToClass: (name + "-leave-to"),
  7186. leaveActiveClass: (name + "-leave-active")
  7187. }
  7188. });
  7189. var hasTransition = inBrowser && !isIE9;
  7190. var TRANSITION = 'transition';
  7191. var ANIMATION = 'animation';
  7192. // Transition property/event sniffing
  7193. var transitionProp = 'transition';
  7194. var transitionEndEvent = 'transitionend';
  7195. var animationProp = 'animation';
  7196. var animationEndEvent = 'animationend';
  7197. if (hasTransition) {
  7198. /* istanbul ignore if */
  7199. if (window.ontransitionend === undefined &&
  7200. window.onwebkittransitionend !== undefined
  7201. ) {
  7202. transitionProp = 'WebkitTransition';
  7203. transitionEndEvent = 'webkitTransitionEnd';
  7204. }
  7205. if (window.onanimationend === undefined &&
  7206. window.onwebkitanimationend !== undefined
  7207. ) {
  7208. animationProp = 'WebkitAnimation';
  7209. animationEndEvent = 'webkitAnimationEnd';
  7210. }
  7211. }
  7212. // binding to window is necessary to make hot reload work in IE in strict mode
  7213. var raf = inBrowser
  7214. ? window.requestAnimationFrame
  7215. ? window.requestAnimationFrame.bind(window)
  7216. : setTimeout
  7217. : /* istanbul ignore next */ function (fn) { return fn(); };
  7218. function nextFrame (fn) {
  7219. raf(function () {
  7220. raf(fn);
  7221. });
  7222. }
  7223. function addTransitionClass (el, cls) {
  7224. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7225. if (transitionClasses.indexOf(cls) < 0) {
  7226. transitionClasses.push(cls);
  7227. addClass(el, cls);
  7228. }
  7229. }
  7230. function removeTransitionClass (el, cls) {
  7231. if (el._transitionClasses) {
  7232. remove(el._transitionClasses, cls);
  7233. }
  7234. removeClass(el, cls);
  7235. }
  7236. function whenTransitionEnds (
  7237. el,
  7238. expectedType,
  7239. cb
  7240. ) {
  7241. var ref = getTransitionInfo(el, expectedType);
  7242. var type = ref.type;
  7243. var timeout = ref.timeout;
  7244. var propCount = ref.propCount;
  7245. if (!type) { return cb() }
  7246. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  7247. var ended = 0;
  7248. var end = function () {
  7249. el.removeEventListener(event, onEnd);
  7250. cb();
  7251. };
  7252. var onEnd = function (e) {
  7253. if (e.target === el) {
  7254. if (++ended >= propCount) {
  7255. end();
  7256. }
  7257. }
  7258. };
  7259. setTimeout(function () {
  7260. if (ended < propCount) {
  7261. end();
  7262. }
  7263. }, timeout + 1);
  7264. el.addEventListener(event, onEnd);
  7265. }
  7266. var transformRE = /\b(transform|all)(,|$)/;
  7267. function getTransitionInfo (el, expectedType) {
  7268. var styles = window.getComputedStyle(el);
  7269. // JSDOM may return undefined for transition properties
  7270. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  7271. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  7272. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  7273. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  7274. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  7275. var animationTimeout = getTimeout(animationDelays, animationDurations);
  7276. var type;
  7277. var timeout = 0;
  7278. var propCount = 0;
  7279. /* istanbul ignore if */
  7280. if (expectedType === TRANSITION) {
  7281. if (transitionTimeout > 0) {
  7282. type = TRANSITION;
  7283. timeout = transitionTimeout;
  7284. propCount = transitionDurations.length;
  7285. }
  7286. } else if (expectedType === ANIMATION) {
  7287. if (animationTimeout > 0) {
  7288. type = ANIMATION;
  7289. timeout = animationTimeout;
  7290. propCount = animationDurations.length;
  7291. }
  7292. } else {
  7293. timeout = Math.max(transitionTimeout, animationTimeout);
  7294. type = timeout > 0
  7295. ? transitionTimeout > animationTimeout
  7296. ? TRANSITION
  7297. : ANIMATION
  7298. : null;
  7299. propCount = type
  7300. ? type === TRANSITION
  7301. ? transitionDurations.length
  7302. : animationDurations.length
  7303. : 0;
  7304. }
  7305. var hasTransform =
  7306. type === TRANSITION &&
  7307. transformRE.test(styles[transitionProp + 'Property']);
  7308. return {
  7309. type: type,
  7310. timeout: timeout,
  7311. propCount: propCount,
  7312. hasTransform: hasTransform
  7313. }
  7314. }
  7315. function getTimeout (delays, durations) {
  7316. /* istanbul ignore next */
  7317. while (delays.length < durations.length) {
  7318. delays = delays.concat(delays);
  7319. }
  7320. return Math.max.apply(null, durations.map(function (d, i) {
  7321. return toMs(d) + toMs(delays[i])
  7322. }))
  7323. }
  7324. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  7325. // in a locale-dependent way, using a comma instead of a dot.
  7326. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  7327. // as a floor function) causing unexpected behaviors
  7328. function toMs (s) {
  7329. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  7330. }
  7331. /* */
  7332. function enter (vnode, toggleDisplay) {
  7333. var el = vnode.elm;
  7334. // call leave callback now
  7335. if (isDef(el._leaveCb)) {
  7336. el._leaveCb.cancelled = true;
  7337. el._leaveCb();
  7338. }
  7339. var data = resolveTransition(vnode.data.transition);
  7340. if (isUndef(data)) {
  7341. return
  7342. }
  7343. /* istanbul ignore if */
  7344. if (isDef(el._enterCb) || el.nodeType !== 1) {
  7345. return
  7346. }
  7347. var css = data.css;
  7348. var type = data.type;
  7349. var enterClass = data.enterClass;
  7350. var enterToClass = data.enterToClass;
  7351. var enterActiveClass = data.enterActiveClass;
  7352. var appearClass = data.appearClass;
  7353. var appearToClass = data.appearToClass;
  7354. var appearActiveClass = data.appearActiveClass;
  7355. var beforeEnter = data.beforeEnter;
  7356. var enter = data.enter;
  7357. var afterEnter = data.afterEnter;
  7358. var enterCancelled = data.enterCancelled;
  7359. var beforeAppear = data.beforeAppear;
  7360. var appear = data.appear;
  7361. var afterAppear = data.afterAppear;
  7362. var appearCancelled = data.appearCancelled;
  7363. var duration = data.duration;
  7364. // activeInstance will always be the <transition> component managing this
  7365. // transition. One edge case to check is when the <transition> is placed
  7366. // as the root node of a child component. In that case we need to check
  7367. // <transition>'s parent for appear check.
  7368. var context = activeInstance;
  7369. var transitionNode = activeInstance.$vnode;
  7370. while (transitionNode && transitionNode.parent) {
  7371. context = transitionNode.context;
  7372. transitionNode = transitionNode.parent;
  7373. }
  7374. var isAppear = !context._isMounted || !vnode.isRootInsert;
  7375. if (isAppear && !appear && appear !== '') {
  7376. return
  7377. }
  7378. var startClass = isAppear && appearClass
  7379. ? appearClass
  7380. : enterClass;
  7381. var activeClass = isAppear && appearActiveClass
  7382. ? appearActiveClass
  7383. : enterActiveClass;
  7384. var toClass = isAppear && appearToClass
  7385. ? appearToClass
  7386. : enterToClass;
  7387. var beforeEnterHook = isAppear
  7388. ? (beforeAppear || beforeEnter)
  7389. : beforeEnter;
  7390. var enterHook = isAppear
  7391. ? (typeof appear === 'function' ? appear : enter)
  7392. : enter;
  7393. var afterEnterHook = isAppear
  7394. ? (afterAppear || afterEnter)
  7395. : afterEnter;
  7396. var enterCancelledHook = isAppear
  7397. ? (appearCancelled || enterCancelled)
  7398. : enterCancelled;
  7399. var explicitEnterDuration = toNumber(
  7400. isObject(duration)
  7401. ? duration.enter
  7402. : duration
  7403. );
  7404. if (explicitEnterDuration != null) {
  7405. checkDuration(explicitEnterDuration, 'enter', vnode);
  7406. }
  7407. var expectsCSS = css !== false && !isIE9;
  7408. var userWantsControl = getHookArgumentsLength(enterHook);
  7409. var cb = el._enterCb = once(function () {
  7410. if (expectsCSS) {
  7411. removeTransitionClass(el, toClass);
  7412. removeTransitionClass(el, activeClass);
  7413. }
  7414. if (cb.cancelled) {
  7415. if (expectsCSS) {
  7416. removeTransitionClass(el, startClass);
  7417. }
  7418. enterCancelledHook && enterCancelledHook(el);
  7419. } else {
  7420. afterEnterHook && afterEnterHook(el);
  7421. }
  7422. el._enterCb = null;
  7423. });
  7424. if (!vnode.data.show) {
  7425. // remove pending leave element on enter by injecting an insert hook
  7426. mergeVNodeHook(vnode, 'insert', function () {
  7427. var parent = el.parentNode;
  7428. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  7429. if (pendingNode &&
  7430. pendingNode.tag === vnode.tag &&
  7431. pendingNode.elm._leaveCb
  7432. ) {
  7433. pendingNode.elm._leaveCb();
  7434. }
  7435. enterHook && enterHook(el, cb);
  7436. });
  7437. }
  7438. // start enter transition
  7439. beforeEnterHook && beforeEnterHook(el);
  7440. if (expectsCSS) {
  7441. addTransitionClass(el, startClass);
  7442. addTransitionClass(el, activeClass);
  7443. nextFrame(function () {
  7444. removeTransitionClass(el, startClass);
  7445. if (!cb.cancelled) {
  7446. addTransitionClass(el, toClass);
  7447. if (!userWantsControl) {
  7448. if (isValidDuration(explicitEnterDuration)) {
  7449. setTimeout(cb, explicitEnterDuration);
  7450. } else {
  7451. whenTransitionEnds(el, type, cb);
  7452. }
  7453. }
  7454. }
  7455. });
  7456. }
  7457. if (vnode.data.show) {
  7458. toggleDisplay && toggleDisplay();
  7459. enterHook && enterHook(el, cb);
  7460. }
  7461. if (!expectsCSS && !userWantsControl) {
  7462. cb();
  7463. }
  7464. }
  7465. function leave (vnode, rm) {
  7466. var el = vnode.elm;
  7467. // call enter callback now
  7468. if (isDef(el._enterCb)) {
  7469. el._enterCb.cancelled = true;
  7470. el._enterCb();
  7471. }
  7472. var data = resolveTransition(vnode.data.transition);
  7473. if (isUndef(data) || el.nodeType !== 1) {
  7474. return rm()
  7475. }
  7476. /* istanbul ignore if */
  7477. if (isDef(el._leaveCb)) {
  7478. return
  7479. }
  7480. var css = data.css;
  7481. var type = data.type;
  7482. var leaveClass = data.leaveClass;
  7483. var leaveToClass = data.leaveToClass;
  7484. var leaveActiveClass = data.leaveActiveClass;
  7485. var beforeLeave = data.beforeLeave;
  7486. var leave = data.leave;
  7487. var afterLeave = data.afterLeave;
  7488. var leaveCancelled = data.leaveCancelled;
  7489. var delayLeave = data.delayLeave;
  7490. var duration = data.duration;
  7491. var expectsCSS = css !== false && !isIE9;
  7492. var userWantsControl = getHookArgumentsLength(leave);
  7493. var explicitLeaveDuration = toNumber(
  7494. isObject(duration)
  7495. ? duration.leave
  7496. : duration
  7497. );
  7498. if (isDef(explicitLeaveDuration)) {
  7499. checkDuration(explicitLeaveDuration, 'leave', vnode);
  7500. }
  7501. var cb = el._leaveCb = once(function () {
  7502. if (el.parentNode && el.parentNode._pending) {
  7503. el.parentNode._pending[vnode.key] = null;
  7504. }
  7505. if (expectsCSS) {
  7506. removeTransitionClass(el, leaveToClass);
  7507. removeTransitionClass(el, leaveActiveClass);
  7508. }
  7509. if (cb.cancelled) {
  7510. if (expectsCSS) {
  7511. removeTransitionClass(el, leaveClass);
  7512. }
  7513. leaveCancelled && leaveCancelled(el);
  7514. } else {
  7515. rm();
  7516. afterLeave && afterLeave(el);
  7517. }
  7518. el._leaveCb = null;
  7519. });
  7520. if (delayLeave) {
  7521. delayLeave(performLeave);
  7522. } else {
  7523. performLeave();
  7524. }
  7525. function performLeave () {
  7526. // the delayed leave may have already been cancelled
  7527. if (cb.cancelled) {
  7528. return
  7529. }
  7530. // record leaving element
  7531. if (!vnode.data.show && el.parentNode) {
  7532. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  7533. }
  7534. beforeLeave && beforeLeave(el);
  7535. if (expectsCSS) {
  7536. addTransitionClass(el, leaveClass);
  7537. addTransitionClass(el, leaveActiveClass);
  7538. nextFrame(function () {
  7539. removeTransitionClass(el, leaveClass);
  7540. if (!cb.cancelled) {
  7541. addTransitionClass(el, leaveToClass);
  7542. if (!userWantsControl) {
  7543. if (isValidDuration(explicitLeaveDuration)) {
  7544. setTimeout(cb, explicitLeaveDuration);
  7545. } else {
  7546. whenTransitionEnds(el, type, cb);
  7547. }
  7548. }
  7549. }
  7550. });
  7551. }
  7552. leave && leave(el, cb);
  7553. if (!expectsCSS && !userWantsControl) {
  7554. cb();
  7555. }
  7556. }
  7557. }
  7558. // only used in dev mode
  7559. function checkDuration (val, name, vnode) {
  7560. if (typeof val !== 'number') {
  7561. warn(
  7562. "<transition> explicit " + name + " duration is not a valid number - " +
  7563. "got " + (JSON.stringify(val)) + ".",
  7564. vnode.context
  7565. );
  7566. } else if (isNaN(val)) {
  7567. warn(
  7568. "<transition> explicit " + name + " duration is NaN - " +
  7569. 'the duration expression might be incorrect.',
  7570. vnode.context
  7571. );
  7572. }
  7573. }
  7574. function isValidDuration (val) {
  7575. return typeof val === 'number' && !isNaN(val)
  7576. }
  7577. /**
  7578. * Normalize a transition hook's argument length. The hook may be:
  7579. * - a merged hook (invoker) with the original in .fns
  7580. * - a wrapped component method (check ._length)
  7581. * - a plain function (.length)
  7582. */
  7583. function getHookArgumentsLength (fn) {
  7584. if (isUndef(fn)) {
  7585. return false
  7586. }
  7587. var invokerFns = fn.fns;
  7588. if (isDef(invokerFns)) {
  7589. // invoker
  7590. return getHookArgumentsLength(
  7591. Array.isArray(invokerFns)
  7592. ? invokerFns[0]
  7593. : invokerFns
  7594. )
  7595. } else {
  7596. return (fn._length || fn.length) > 1
  7597. }
  7598. }
  7599. function _enter (_, vnode) {
  7600. if (vnode.data.show !== true) {
  7601. enter(vnode);
  7602. }
  7603. }
  7604. var transition = inBrowser ? {
  7605. create: _enter,
  7606. activate: _enter,
  7607. remove: function remove$$1 (vnode, rm) {
  7608. /* istanbul ignore else */
  7609. if (vnode.data.show !== true) {
  7610. leave(vnode, rm);
  7611. } else {
  7612. rm();
  7613. }
  7614. }
  7615. } : {};
  7616. var platformModules = [
  7617. attrs,
  7618. klass,
  7619. events,
  7620. domProps,
  7621. style,
  7622. transition
  7623. ];
  7624. /* */
  7625. // the directive module should be applied last, after all
  7626. // built-in modules have been applied.
  7627. var modules = platformModules.concat(baseModules);
  7628. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  7629. /**
  7630. * Not type checking this file because flow doesn't like attaching
  7631. * properties to Elements.
  7632. */
  7633. /* istanbul ignore if */
  7634. if (isIE9) {
  7635. // http://www.matts411.com/post/internet-explorer-9-oninput/
  7636. document.addEventListener('selectionchange', function () {
  7637. var el = document.activeElement;
  7638. if (el && el.vmodel) {
  7639. trigger(el, 'input');
  7640. }
  7641. });
  7642. }
  7643. var directive = {
  7644. inserted: function inserted (el, binding, vnode, oldVnode) {
  7645. if (vnode.tag === 'select') {
  7646. // #6903
  7647. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  7648. mergeVNodeHook(vnode, 'postpatch', function () {
  7649. directive.componentUpdated(el, binding, vnode);
  7650. });
  7651. } else {
  7652. setSelected(el, binding, vnode.context);
  7653. }
  7654. el._vOptions = [].map.call(el.options, getValue);
  7655. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  7656. el._vModifiers = binding.modifiers;
  7657. if (!binding.modifiers.lazy) {
  7658. el.addEventListener('compositionstart', onCompositionStart);
  7659. el.addEventListener('compositionend', onCompositionEnd);
  7660. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  7661. // switching focus before confirming composition choice
  7662. // this also fixes the issue where some browsers e.g. iOS Chrome
  7663. // fires "change" instead of "input" on autocomplete.
  7664. el.addEventListener('change', onCompositionEnd);
  7665. /* istanbul ignore if */
  7666. if (isIE9) {
  7667. el.vmodel = true;
  7668. }
  7669. }
  7670. }
  7671. },
  7672. componentUpdated: function componentUpdated (el, binding, vnode) {
  7673. if (vnode.tag === 'select') {
  7674. setSelected(el, binding, vnode.context);
  7675. // in case the options rendered by v-for have changed,
  7676. // it's possible that the value is out-of-sync with the rendered options.
  7677. // detect such cases and filter out values that no longer has a matching
  7678. // option in the DOM.
  7679. var prevOptions = el._vOptions;
  7680. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  7681. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  7682. // trigger change event if
  7683. // no matching option found for at least one value
  7684. var needReset = el.multiple
  7685. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  7686. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  7687. if (needReset) {
  7688. trigger(el, 'change');
  7689. }
  7690. }
  7691. }
  7692. }
  7693. };
  7694. function setSelected (el, binding, vm) {
  7695. actuallySetSelected(el, binding, vm);
  7696. /* istanbul ignore if */
  7697. if (isIE || isEdge) {
  7698. setTimeout(function () {
  7699. actuallySetSelected(el, binding, vm);
  7700. }, 0);
  7701. }
  7702. }
  7703. function actuallySetSelected (el, binding, vm) {
  7704. var value = binding.value;
  7705. var isMultiple = el.multiple;
  7706. if (isMultiple && !Array.isArray(value)) {
  7707. warn(
  7708. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  7709. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  7710. vm
  7711. );
  7712. return
  7713. }
  7714. var selected, option;
  7715. for (var i = 0, l = el.options.length; i < l; i++) {
  7716. option = el.options[i];
  7717. if (isMultiple) {
  7718. selected = looseIndexOf(value, getValue(option)) > -1;
  7719. if (option.selected !== selected) {
  7720. option.selected = selected;
  7721. }
  7722. } else {
  7723. if (looseEqual(getValue(option), value)) {
  7724. if (el.selectedIndex !== i) {
  7725. el.selectedIndex = i;
  7726. }
  7727. return
  7728. }
  7729. }
  7730. }
  7731. if (!isMultiple) {
  7732. el.selectedIndex = -1;
  7733. }
  7734. }
  7735. function hasNoMatchingOption (value, options) {
  7736. return options.every(function (o) { return !looseEqual(o, value); })
  7737. }
  7738. function getValue (option) {
  7739. return '_value' in option
  7740. ? option._value
  7741. : option.value
  7742. }
  7743. function onCompositionStart (e) {
  7744. e.target.composing = true;
  7745. }
  7746. function onCompositionEnd (e) {
  7747. // prevent triggering an input event for no reason
  7748. if (!e.target.composing) { return }
  7749. e.target.composing = false;
  7750. trigger(e.target, 'input');
  7751. }
  7752. function trigger (el, type) {
  7753. var e = document.createEvent('HTMLEvents');
  7754. e.initEvent(type, true, true);
  7755. el.dispatchEvent(e);
  7756. }
  7757. /* */
  7758. // recursively search for possible transition defined inside the component root
  7759. function locateNode (vnode) {
  7760. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  7761. ? locateNode(vnode.componentInstance._vnode)
  7762. : vnode
  7763. }
  7764. var show = {
  7765. bind: function bind (el, ref, vnode) {
  7766. var value = ref.value;
  7767. vnode = locateNode(vnode);
  7768. var transition$$1 = vnode.data && vnode.data.transition;
  7769. var originalDisplay = el.__vOriginalDisplay =
  7770. el.style.display === 'none' ? '' : el.style.display;
  7771. if (value && transition$$1) {
  7772. vnode.data.show = true;
  7773. enter(vnode, function () {
  7774. el.style.display = originalDisplay;
  7775. });
  7776. } else {
  7777. el.style.display = value ? originalDisplay : 'none';
  7778. }
  7779. },
  7780. update: function update (el, ref, vnode) {
  7781. var value = ref.value;
  7782. var oldValue = ref.oldValue;
  7783. /* istanbul ignore if */
  7784. if (!value === !oldValue) { return }
  7785. vnode = locateNode(vnode);
  7786. var transition$$1 = vnode.data && vnode.data.transition;
  7787. if (transition$$1) {
  7788. vnode.data.show = true;
  7789. if (value) {
  7790. enter(vnode, function () {
  7791. el.style.display = el.__vOriginalDisplay;
  7792. });
  7793. } else {
  7794. leave(vnode, function () {
  7795. el.style.display = 'none';
  7796. });
  7797. }
  7798. } else {
  7799. el.style.display = value ? el.__vOriginalDisplay : 'none';
  7800. }
  7801. },
  7802. unbind: function unbind (
  7803. el,
  7804. binding,
  7805. vnode,
  7806. oldVnode,
  7807. isDestroy
  7808. ) {
  7809. if (!isDestroy) {
  7810. el.style.display = el.__vOriginalDisplay;
  7811. }
  7812. }
  7813. };
  7814. var platformDirectives = {
  7815. model: directive,
  7816. show: show
  7817. };
  7818. /* */
  7819. var transitionProps = {
  7820. name: String,
  7821. appear: Boolean,
  7822. css: Boolean,
  7823. mode: String,
  7824. type: String,
  7825. enterClass: String,
  7826. leaveClass: String,
  7827. enterToClass: String,
  7828. leaveToClass: String,
  7829. enterActiveClass: String,
  7830. leaveActiveClass: String,
  7831. appearClass: String,
  7832. appearActiveClass: String,
  7833. appearToClass: String,
  7834. duration: [Number, String, Object]
  7835. };
  7836. // in case the child is also an abstract component, e.g. <keep-alive>
  7837. // we want to recursively retrieve the real component to be rendered
  7838. function getRealChild (vnode) {
  7839. var compOptions = vnode && vnode.componentOptions;
  7840. if (compOptions && compOptions.Ctor.options.abstract) {
  7841. return getRealChild(getFirstComponentChild(compOptions.children))
  7842. } else {
  7843. return vnode
  7844. }
  7845. }
  7846. function extractTransitionData (comp) {
  7847. var data = {};
  7848. var options = comp.$options;
  7849. // props
  7850. for (var key in options.propsData) {
  7851. data[key] = comp[key];
  7852. }
  7853. // events.
  7854. // extract listeners and pass them directly to the transition methods
  7855. var listeners = options._parentListeners;
  7856. for (var key$1 in listeners) {
  7857. data[camelize(key$1)] = listeners[key$1];
  7858. }
  7859. return data
  7860. }
  7861. function placeholder (h, rawChild) {
  7862. if (/\d-keep-alive$/.test(rawChild.tag)) {
  7863. return h('keep-alive', {
  7864. props: rawChild.componentOptions.propsData
  7865. })
  7866. }
  7867. }
  7868. function hasParentTransition (vnode) {
  7869. while ((vnode = vnode.parent)) {
  7870. if (vnode.data.transition) {
  7871. return true
  7872. }
  7873. }
  7874. }
  7875. function isSameChild (child, oldChild) {
  7876. return oldChild.key === child.key && oldChild.tag === child.tag
  7877. }
  7878. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  7879. var isVShowDirective = function (d) { return d.name === 'show'; };
  7880. var Transition = {
  7881. name: 'transition',
  7882. props: transitionProps,
  7883. abstract: true,
  7884. render: function render (h) {
  7885. var this$1 = this;
  7886. var children = this.$slots.default;
  7887. if (!children) {
  7888. return
  7889. }
  7890. // filter out text nodes (possible whitespaces)
  7891. children = children.filter(isNotTextNode);
  7892. /* istanbul ignore if */
  7893. if (!children.length) {
  7894. return
  7895. }
  7896. // warn multiple elements
  7897. if (children.length > 1) {
  7898. warn(
  7899. '<transition> can only be used on a single element. Use ' +
  7900. '<transition-group> for lists.',
  7901. this.$parent
  7902. );
  7903. }
  7904. var mode = this.mode;
  7905. // warn invalid mode
  7906. if (mode && mode !== 'in-out' && mode !== 'out-in'
  7907. ) {
  7908. warn(
  7909. 'invalid <transition> mode: ' + mode,
  7910. this.$parent
  7911. );
  7912. }
  7913. var rawChild = children[0];
  7914. // if this is a component root node and the component's
  7915. // parent container node also has transition, skip.
  7916. if (hasParentTransition(this.$vnode)) {
  7917. return rawChild
  7918. }
  7919. // apply transition data to child
  7920. // use getRealChild() to ignore abstract components e.g. keep-alive
  7921. var child = getRealChild(rawChild);
  7922. /* istanbul ignore if */
  7923. if (!child) {
  7924. return rawChild
  7925. }
  7926. if (this._leaving) {
  7927. return placeholder(h, rawChild)
  7928. }
  7929. // ensure a key that is unique to the vnode type and to this transition
  7930. // component instance. This key will be used to remove pending leaving nodes
  7931. // during entering.
  7932. var id = "__transition-" + (this._uid) + "-";
  7933. child.key = child.key == null
  7934. ? child.isComment
  7935. ? id + 'comment'
  7936. : id + child.tag
  7937. : isPrimitive(child.key)
  7938. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  7939. : child.key;
  7940. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  7941. var oldRawChild = this._vnode;
  7942. var oldChild = getRealChild(oldRawChild);
  7943. // mark v-show
  7944. // so that the transition module can hand over the control to the directive
  7945. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  7946. child.data.show = true;
  7947. }
  7948. if (
  7949. oldChild &&
  7950. oldChild.data &&
  7951. !isSameChild(child, oldChild) &&
  7952. !isAsyncPlaceholder(oldChild) &&
  7953. // #6687 component root is a comment node
  7954. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  7955. ) {
  7956. // replace old child transition data with fresh one
  7957. // important for dynamic transitions!
  7958. var oldData = oldChild.data.transition = extend({}, data);
  7959. // handle transition mode
  7960. if (mode === 'out-in') {
  7961. // return placeholder node and queue update when leave finishes
  7962. this._leaving = true;
  7963. mergeVNodeHook(oldData, 'afterLeave', function () {
  7964. this$1._leaving = false;
  7965. this$1.$forceUpdate();
  7966. });
  7967. return placeholder(h, rawChild)
  7968. } else if (mode === 'in-out') {
  7969. if (isAsyncPlaceholder(child)) {
  7970. return oldRawChild
  7971. }
  7972. var delayedLeave;
  7973. var performLeave = function () { delayedLeave(); };
  7974. mergeVNodeHook(data, 'afterEnter', performLeave);
  7975. mergeVNodeHook(data, 'enterCancelled', performLeave);
  7976. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  7977. }
  7978. }
  7979. return rawChild
  7980. }
  7981. };
  7982. /* */
  7983. var props = extend({
  7984. tag: String,
  7985. moveClass: String
  7986. }, transitionProps);
  7987. delete props.mode;
  7988. var TransitionGroup = {
  7989. props: props,
  7990. beforeMount: function beforeMount () {
  7991. var this$1 = this;
  7992. var update = this._update;
  7993. this._update = function (vnode, hydrating) {
  7994. var restoreActiveInstance = setActiveInstance(this$1);
  7995. // force removing pass
  7996. this$1.__patch__(
  7997. this$1._vnode,
  7998. this$1.kept,
  7999. false, // hydrating
  8000. true // removeOnly (!important, avoids unnecessary moves)
  8001. );
  8002. this$1._vnode = this$1.kept;
  8003. restoreActiveInstance();
  8004. update.call(this$1, vnode, hydrating);
  8005. };
  8006. },
  8007. render: function render (h) {
  8008. var tag = this.tag || this.$vnode.data.tag || 'span';
  8009. var map = Object.create(null);
  8010. var prevChildren = this.prevChildren = this.children;
  8011. var rawChildren = this.$slots.default || [];
  8012. var children = this.children = [];
  8013. var transitionData = extractTransitionData(this);
  8014. for (var i = 0; i < rawChildren.length; i++) {
  8015. var c = rawChildren[i];
  8016. if (c.tag) {
  8017. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  8018. children.push(c);
  8019. map[c.key] = c
  8020. ;(c.data || (c.data = {})).transition = transitionData;
  8021. } else {
  8022. var opts = c.componentOptions;
  8023. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  8024. warn(("<transition-group> children must be keyed: <" + name + ">"));
  8025. }
  8026. }
  8027. }
  8028. if (prevChildren) {
  8029. var kept = [];
  8030. var removed = [];
  8031. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  8032. var c$1 = prevChildren[i$1];
  8033. c$1.data.transition = transitionData;
  8034. c$1.data.pos = c$1.elm.getBoundingClientRect();
  8035. if (map[c$1.key]) {
  8036. kept.push(c$1);
  8037. } else {
  8038. removed.push(c$1);
  8039. }
  8040. }
  8041. this.kept = h(tag, null, kept);
  8042. this.removed = removed;
  8043. }
  8044. return h(tag, null, children)
  8045. },
  8046. updated: function updated () {
  8047. var children = this.prevChildren;
  8048. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  8049. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  8050. return
  8051. }
  8052. // we divide the work into three loops to avoid mixing DOM reads and writes
  8053. // in each iteration - which helps prevent layout thrashing.
  8054. children.forEach(callPendingCbs);
  8055. children.forEach(recordPosition);
  8056. children.forEach(applyTranslation);
  8057. // force reflow to put everything in position
  8058. // assign to this to avoid being removed in tree-shaking
  8059. // $flow-disable-line
  8060. this._reflow = document.body.offsetHeight;
  8061. children.forEach(function (c) {
  8062. if (c.data.moved) {
  8063. var el = c.elm;
  8064. var s = el.style;
  8065. addTransitionClass(el, moveClass);
  8066. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8067. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  8068. if (e && e.target !== el) {
  8069. return
  8070. }
  8071. if (!e || /transform$/.test(e.propertyName)) {
  8072. el.removeEventListener(transitionEndEvent, cb);
  8073. el._moveCb = null;
  8074. removeTransitionClass(el, moveClass);
  8075. }
  8076. });
  8077. }
  8078. });
  8079. },
  8080. methods: {
  8081. hasMove: function hasMove (el, moveClass) {
  8082. /* istanbul ignore if */
  8083. if (!hasTransition) {
  8084. return false
  8085. }
  8086. /* istanbul ignore if */
  8087. if (this._hasMove) {
  8088. return this._hasMove
  8089. }
  8090. // Detect whether an element with the move class applied has
  8091. // CSS transitions. Since the element may be inside an entering
  8092. // transition at this very moment, we make a clone of it and remove
  8093. // all other transition classes applied to ensure only the move class
  8094. // is applied.
  8095. var clone = el.cloneNode();
  8096. if (el._transitionClasses) {
  8097. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  8098. }
  8099. addClass(clone, moveClass);
  8100. clone.style.display = 'none';
  8101. this.$el.appendChild(clone);
  8102. var info = getTransitionInfo(clone);
  8103. this.$el.removeChild(clone);
  8104. return (this._hasMove = info.hasTransform)
  8105. }
  8106. }
  8107. };
  8108. function callPendingCbs (c) {
  8109. /* istanbul ignore if */
  8110. if (c.elm._moveCb) {
  8111. c.elm._moveCb();
  8112. }
  8113. /* istanbul ignore if */
  8114. if (c.elm._enterCb) {
  8115. c.elm._enterCb();
  8116. }
  8117. }
  8118. function recordPosition (c) {
  8119. c.data.newPos = c.elm.getBoundingClientRect();
  8120. }
  8121. function applyTranslation (c) {
  8122. var oldPos = c.data.pos;
  8123. var newPos = c.data.newPos;
  8124. var dx = oldPos.left - newPos.left;
  8125. var dy = oldPos.top - newPos.top;
  8126. if (dx || dy) {
  8127. c.data.moved = true;
  8128. var s = c.elm.style;
  8129. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  8130. s.transitionDuration = '0s';
  8131. }
  8132. }
  8133. var platformComponents = {
  8134. Transition: Transition,
  8135. TransitionGroup: TransitionGroup
  8136. };
  8137. /* */
  8138. // install platform specific utils
  8139. Vue.config.mustUseProp = mustUseProp;
  8140. Vue.config.isReservedTag = isReservedTag;
  8141. Vue.config.isReservedAttr = isReservedAttr;
  8142. Vue.config.getTagNamespace = getTagNamespace;
  8143. Vue.config.isUnknownElement = isUnknownElement;
  8144. // install platform runtime directives & components
  8145. extend(Vue.options.directives, platformDirectives);
  8146. extend(Vue.options.components, platformComponents);
  8147. // install platform patch function
  8148. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  8149. // public mount method
  8150. Vue.prototype.$mount = function (
  8151. el,
  8152. hydrating
  8153. ) {
  8154. el = el && inBrowser ? query(el) : undefined;
  8155. return mountComponent(this, el, hydrating)
  8156. };
  8157. // devtools global hook
  8158. /* istanbul ignore next */
  8159. if (inBrowser) {
  8160. setTimeout(function () {
  8161. if (config.devtools) {
  8162. if (devtools) {
  8163. devtools.emit('init', Vue);
  8164. } else {
  8165. console[console.info ? 'info' : 'log'](
  8166. 'Download the Vue Devtools extension for a better development experience:\n' +
  8167. 'https://github.com/vuejs/vue-devtools'
  8168. );
  8169. }
  8170. }
  8171. if (config.productionTip !== false &&
  8172. typeof console !== 'undefined'
  8173. ) {
  8174. console[console.info ? 'info' : 'log'](
  8175. "You are running Vue in development mode.\n" +
  8176. "Make sure to turn on production mode when deploying for production.\n" +
  8177. "See more tips at https://vuejs.org/guide/deployment.html"
  8178. );
  8179. }
  8180. }, 0);
  8181. }
  8182. /* */
  8183. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  8184. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  8185. var buildRegex = cached(function (delimiters) {
  8186. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  8187. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  8188. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  8189. });
  8190. function parseText (
  8191. text,
  8192. delimiters
  8193. ) {
  8194. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  8195. if (!tagRE.test(text)) {
  8196. return
  8197. }
  8198. var tokens = [];
  8199. var rawTokens = [];
  8200. var lastIndex = tagRE.lastIndex = 0;
  8201. var match, index, tokenValue;
  8202. while ((match = tagRE.exec(text))) {
  8203. index = match.index;
  8204. // push text token
  8205. if (index > lastIndex) {
  8206. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  8207. tokens.push(JSON.stringify(tokenValue));
  8208. }
  8209. // tag token
  8210. var exp = parseFilters(match[1].trim());
  8211. tokens.push(("_s(" + exp + ")"));
  8212. rawTokens.push({ '@binding': exp });
  8213. lastIndex = index + match[0].length;
  8214. }
  8215. if (lastIndex < text.length) {
  8216. rawTokens.push(tokenValue = text.slice(lastIndex));
  8217. tokens.push(JSON.stringify(tokenValue));
  8218. }
  8219. return {
  8220. expression: tokens.join('+'),
  8221. tokens: rawTokens
  8222. }
  8223. }
  8224. /* */
  8225. function transformNode (el, options) {
  8226. var warn = options.warn || baseWarn;
  8227. var staticClass = getAndRemoveAttr(el, 'class');
  8228. if (staticClass) {
  8229. var res = parseText(staticClass, options.delimiters);
  8230. if (res) {
  8231. warn(
  8232. "class=\"" + staticClass + "\": " +
  8233. 'Interpolation inside attributes has been removed. ' +
  8234. 'Use v-bind or the colon shorthand instead. For example, ' +
  8235. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  8236. el.rawAttrsMap['class']
  8237. );
  8238. }
  8239. }
  8240. if (staticClass) {
  8241. el.staticClass = JSON.stringify(staticClass);
  8242. }
  8243. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  8244. if (classBinding) {
  8245. el.classBinding = classBinding;
  8246. }
  8247. }
  8248. function genData (el) {
  8249. var data = '';
  8250. if (el.staticClass) {
  8251. data += "staticClass:" + (el.staticClass) + ",";
  8252. }
  8253. if (el.classBinding) {
  8254. data += "class:" + (el.classBinding) + ",";
  8255. }
  8256. return data
  8257. }
  8258. var klass$1 = {
  8259. staticKeys: ['staticClass'],
  8260. transformNode: transformNode,
  8261. genData: genData
  8262. };
  8263. /* */
  8264. function transformNode$1 (el, options) {
  8265. var warn = options.warn || baseWarn;
  8266. var staticStyle = getAndRemoveAttr(el, 'style');
  8267. if (staticStyle) {
  8268. /* istanbul ignore if */
  8269. {
  8270. var res = parseText(staticStyle, options.delimiters);
  8271. if (res) {
  8272. warn(
  8273. "style=\"" + staticStyle + "\": " +
  8274. 'Interpolation inside attributes has been removed. ' +
  8275. 'Use v-bind or the colon shorthand instead. For example, ' +
  8276. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  8277. el.rawAttrsMap['style']
  8278. );
  8279. }
  8280. }
  8281. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  8282. }
  8283. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  8284. if (styleBinding) {
  8285. el.styleBinding = styleBinding;
  8286. }
  8287. }
  8288. function genData$1 (el) {
  8289. var data = '';
  8290. if (el.staticStyle) {
  8291. data += "staticStyle:" + (el.staticStyle) + ",";
  8292. }
  8293. if (el.styleBinding) {
  8294. data += "style:(" + (el.styleBinding) + "),";
  8295. }
  8296. return data
  8297. }
  8298. var style$1 = {
  8299. staticKeys: ['staticStyle'],
  8300. transformNode: transformNode$1,
  8301. genData: genData$1
  8302. };
  8303. /* */
  8304. var decoder;
  8305. var he = {
  8306. decode: function decode (html) {
  8307. decoder = decoder || document.createElement('div');
  8308. decoder.innerHTML = html;
  8309. return decoder.textContent
  8310. }
  8311. };
  8312. /* */
  8313. var isUnaryTag = makeMap(
  8314. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  8315. 'link,meta,param,source,track,wbr'
  8316. );
  8317. // Elements that you can, intentionally, leave open
  8318. // (and which close themselves)
  8319. var canBeLeftOpenTag = makeMap(
  8320. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  8321. );
  8322. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  8323. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  8324. var isNonPhrasingTag = makeMap(
  8325. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  8326. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  8327. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  8328. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  8329. 'title,tr,track'
  8330. );
  8331. /**
  8332. * Not type-checking this file because it's mostly vendor code.
  8333. */
  8334. // Regular Expressions for parsing tags and attributes
  8335. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8336. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  8337. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  8338. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  8339. var startTagOpen = new RegExp(("^<" + qnameCapture));
  8340. var startTagClose = /^\s*(\/?)>/;
  8341. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  8342. var doctype = /^<!DOCTYPE [^>]+>/i;
  8343. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  8344. var comment = /^<!\--/;
  8345. var conditionalComment = /^<!\[/;
  8346. // Special Elements (can contain anything)
  8347. var isPlainTextElement = makeMap('script,style,textarea', true);
  8348. var reCache = {};
  8349. var decodingMap = {
  8350. '&lt;': '<',
  8351. '&gt;': '>',
  8352. '&quot;': '"',
  8353. '&amp;': '&',
  8354. '&#10;': '\n',
  8355. '&#9;': '\t',
  8356. '&#39;': "'"
  8357. };
  8358. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  8359. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  8360. // #5992
  8361. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  8362. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  8363. function decodeAttr (value, shouldDecodeNewlines) {
  8364. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  8365. return value.replace(re, function (match) { return decodingMap[match]; })
  8366. }
  8367. function parseHTML (html, options) {
  8368. var stack = [];
  8369. var expectHTML = options.expectHTML;
  8370. var isUnaryTag$$1 = options.isUnaryTag || no;
  8371. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  8372. var index = 0;
  8373. var last, lastTag;
  8374. while (html) {
  8375. last = html;
  8376. // Make sure we're not in a plaintext content element like script/style
  8377. if (!lastTag || !isPlainTextElement(lastTag)) {
  8378. var textEnd = html.indexOf('<');
  8379. if (textEnd === 0) {
  8380. // Comment:
  8381. if (comment.test(html)) {
  8382. var commentEnd = html.indexOf('-->');
  8383. if (commentEnd >= 0) {
  8384. if (options.shouldKeepComment) {
  8385. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  8386. }
  8387. advance(commentEnd + 3);
  8388. continue
  8389. }
  8390. }
  8391. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  8392. if (conditionalComment.test(html)) {
  8393. var conditionalEnd = html.indexOf(']>');
  8394. if (conditionalEnd >= 0) {
  8395. advance(conditionalEnd + 2);
  8396. continue
  8397. }
  8398. }
  8399. // Doctype:
  8400. var doctypeMatch = html.match(doctype);
  8401. if (doctypeMatch) {
  8402. advance(doctypeMatch[0].length);
  8403. continue
  8404. }
  8405. // End tag:
  8406. var endTagMatch = html.match(endTag);
  8407. if (endTagMatch) {
  8408. var curIndex = index;
  8409. advance(endTagMatch[0].length);
  8410. parseEndTag(endTagMatch[1], curIndex, index);
  8411. continue
  8412. }
  8413. // Start tag:
  8414. var startTagMatch = parseStartTag();
  8415. if (startTagMatch) {
  8416. handleStartTag(startTagMatch);
  8417. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  8418. advance(1);
  8419. }
  8420. continue
  8421. }
  8422. }
  8423. var text = (void 0), rest = (void 0), next = (void 0);
  8424. if (textEnd >= 0) {
  8425. rest = html.slice(textEnd);
  8426. while (
  8427. !endTag.test(rest) &&
  8428. !startTagOpen.test(rest) &&
  8429. !comment.test(rest) &&
  8430. !conditionalComment.test(rest)
  8431. ) {
  8432. // < in plain text, be forgiving and treat it as text
  8433. next = rest.indexOf('<', 1);
  8434. if (next < 0) { break }
  8435. textEnd += next;
  8436. rest = html.slice(textEnd);
  8437. }
  8438. text = html.substring(0, textEnd);
  8439. }
  8440. if (textEnd < 0) {
  8441. text = html;
  8442. }
  8443. if (text) {
  8444. advance(text.length);
  8445. }
  8446. if (options.chars && text) {
  8447. options.chars(text, index - text.length, index);
  8448. }
  8449. } else {
  8450. var endTagLength = 0;
  8451. var stackedTag = lastTag.toLowerCase();
  8452. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  8453. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  8454. endTagLength = endTag.length;
  8455. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  8456. text = text
  8457. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  8458. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  8459. }
  8460. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  8461. text = text.slice(1);
  8462. }
  8463. if (options.chars) {
  8464. options.chars(text);
  8465. }
  8466. return ''
  8467. });
  8468. index += html.length - rest$1.length;
  8469. html = rest$1;
  8470. parseEndTag(stackedTag, index - endTagLength, index);
  8471. }
  8472. if (html === last) {
  8473. options.chars && options.chars(html);
  8474. if (!stack.length && options.warn) {
  8475. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  8476. }
  8477. break
  8478. }
  8479. }
  8480. // Clean up any remaining tags
  8481. parseEndTag();
  8482. function advance (n) {
  8483. index += n;
  8484. html = html.substring(n);
  8485. }
  8486. function parseStartTag () {
  8487. var start = html.match(startTagOpen);
  8488. if (start) {
  8489. var match = {
  8490. tagName: start[1],
  8491. attrs: [],
  8492. start: index
  8493. };
  8494. advance(start[0].length);
  8495. var end, attr;
  8496. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  8497. attr.start = index;
  8498. advance(attr[0].length);
  8499. attr.end = index;
  8500. match.attrs.push(attr);
  8501. }
  8502. if (end) {
  8503. match.unarySlash = end[1];
  8504. advance(end[0].length);
  8505. match.end = index;
  8506. return match
  8507. }
  8508. }
  8509. }
  8510. function handleStartTag (match) {
  8511. var tagName = match.tagName;
  8512. var unarySlash = match.unarySlash;
  8513. if (expectHTML) {
  8514. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  8515. parseEndTag(lastTag);
  8516. }
  8517. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  8518. parseEndTag(tagName);
  8519. }
  8520. }
  8521. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  8522. var l = match.attrs.length;
  8523. var attrs = new Array(l);
  8524. for (var i = 0; i < l; i++) {
  8525. var args = match.attrs[i];
  8526. var value = args[3] || args[4] || args[5] || '';
  8527. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  8528. ? options.shouldDecodeNewlinesForHref
  8529. : options.shouldDecodeNewlines;
  8530. attrs[i] = {
  8531. name: args[1],
  8532. value: decodeAttr(value, shouldDecodeNewlines)
  8533. };
  8534. if (options.outputSourceRange) {
  8535. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  8536. attrs[i].end = args.end;
  8537. }
  8538. }
  8539. if (!unary) {
  8540. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  8541. lastTag = tagName;
  8542. }
  8543. if (options.start) {
  8544. options.start(tagName, attrs, unary, match.start, match.end);
  8545. }
  8546. }
  8547. function parseEndTag (tagName, start, end) {
  8548. var pos, lowerCasedTagName;
  8549. if (start == null) { start = index; }
  8550. if (end == null) { end = index; }
  8551. // Find the closest opened tag of the same type
  8552. if (tagName) {
  8553. lowerCasedTagName = tagName.toLowerCase();
  8554. for (pos = stack.length - 1; pos >= 0; pos--) {
  8555. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  8556. break
  8557. }
  8558. }
  8559. } else {
  8560. // If no tag name is provided, clean shop
  8561. pos = 0;
  8562. }
  8563. if (pos >= 0) {
  8564. // Close all the open elements, up the stack
  8565. for (var i = stack.length - 1; i >= pos; i--) {
  8566. if (i > pos || !tagName &&
  8567. options.warn
  8568. ) {
  8569. options.warn(
  8570. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  8571. { start: stack[i].start, end: stack[i].end }
  8572. );
  8573. }
  8574. if (options.end) {
  8575. options.end(stack[i].tag, start, end);
  8576. }
  8577. }
  8578. // Remove the open elements from the stack
  8579. stack.length = pos;
  8580. lastTag = pos && stack[pos - 1].tag;
  8581. } else if (lowerCasedTagName === 'br') {
  8582. if (options.start) {
  8583. options.start(tagName, [], true, start, end);
  8584. }
  8585. } else if (lowerCasedTagName === 'p') {
  8586. if (options.start) {
  8587. options.start(tagName, [], false, start, end);
  8588. }
  8589. if (options.end) {
  8590. options.end(tagName, start, end);
  8591. }
  8592. }
  8593. }
  8594. }
  8595. /* */
  8596. var onRE = /^@|^v-on:/;
  8597. var dirRE = /^v-|^@|^:|^#/;
  8598. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  8599. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  8600. var stripParensRE = /^\(|\)$/g;
  8601. var dynamicArgRE = /^\[.*\]$/;
  8602. var argRE = /:(.*)$/;
  8603. var bindRE = /^:|^\.|^v-bind:/;
  8604. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  8605. var slotRE = /^v-slot(:|$)|^#/;
  8606. var lineBreakRE = /[\r\n]/;
  8607. var whitespaceRE$1 = /\s+/g;
  8608. var invalidAttributeRE = /[\s"'<>\/=]/;
  8609. var decodeHTMLCached = cached(he.decode);
  8610. var emptySlotScopeToken = "_empty_";
  8611. // configurable state
  8612. var warn$2;
  8613. var delimiters;
  8614. var transforms;
  8615. var preTransforms;
  8616. var postTransforms;
  8617. var platformIsPreTag;
  8618. var platformMustUseProp;
  8619. var platformGetTagNamespace;
  8620. var maybeComponent;
  8621. function createASTElement (
  8622. tag,
  8623. attrs,
  8624. parent
  8625. ) {
  8626. return {
  8627. type: 1,
  8628. tag: tag,
  8629. attrsList: attrs,
  8630. attrsMap: makeAttrsMap(attrs),
  8631. rawAttrsMap: {},
  8632. parent: parent,
  8633. children: []
  8634. }
  8635. }
  8636. /**
  8637. * Convert HTML string to AST.
  8638. */
  8639. function parse (
  8640. template,
  8641. options
  8642. ) {
  8643. warn$2 = options.warn || baseWarn;
  8644. platformIsPreTag = options.isPreTag || no;
  8645. platformMustUseProp = options.mustUseProp || no;
  8646. platformGetTagNamespace = options.getTagNamespace || no;
  8647. var isReservedTag = options.isReservedTag || no;
  8648. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  8649. transforms = pluckModuleFunction(options.modules, 'transformNode');
  8650. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  8651. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  8652. delimiters = options.delimiters;
  8653. var stack = [];
  8654. var preserveWhitespace = options.preserveWhitespace !== false;
  8655. var whitespaceOption = options.whitespace;
  8656. var root;
  8657. var currentParent;
  8658. var inVPre = false;
  8659. var inPre = false;
  8660. var warned = false;
  8661. function warnOnce (msg, range) {
  8662. if (!warned) {
  8663. warned = true;
  8664. warn$2(msg, range);
  8665. }
  8666. }
  8667. function closeElement (element) {
  8668. trimEndingWhitespace(element);
  8669. if (!inVPre && !element.processed) {
  8670. element = processElement(element, options);
  8671. }
  8672. // tree management
  8673. if (!stack.length && element !== root) {
  8674. // allow root elements with v-if, v-else-if and v-else
  8675. if (root.if && (element.elseif || element.else)) {
  8676. {
  8677. checkRootConstraints(element);
  8678. }
  8679. addIfCondition(root, {
  8680. exp: element.elseif,
  8681. block: element
  8682. });
  8683. } else {
  8684. warnOnce(
  8685. "Component template should contain exactly one root element. " +
  8686. "If you are using v-if on multiple elements, " +
  8687. "use v-else-if to chain them instead.",
  8688. { start: element.start }
  8689. );
  8690. }
  8691. }
  8692. if (currentParent && !element.forbidden) {
  8693. if (element.elseif || element.else) {
  8694. processIfConditions(element, currentParent);
  8695. } else {
  8696. if (element.slotScope) {
  8697. // scoped slot
  8698. // keep it in the children list so that v-else(-if) conditions can
  8699. // find it as the prev node.
  8700. var name = element.slotTarget || '"default"'
  8701. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  8702. }
  8703. currentParent.children.push(element);
  8704. element.parent = currentParent;
  8705. }
  8706. }
  8707. // final children cleanup
  8708. // filter out scoped slots
  8709. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  8710. // remove trailing whitespace node again
  8711. trimEndingWhitespace(element);
  8712. // check pre state
  8713. if (element.pre) {
  8714. inVPre = false;
  8715. }
  8716. if (platformIsPreTag(element.tag)) {
  8717. inPre = false;
  8718. }
  8719. // apply post-transforms
  8720. for (var i = 0; i < postTransforms.length; i++) {
  8721. postTransforms[i](element, options);
  8722. }
  8723. }
  8724. function trimEndingWhitespace (el) {
  8725. // remove trailing whitespace node
  8726. if (!inPre) {
  8727. var lastNode;
  8728. while (
  8729. (lastNode = el.children[el.children.length - 1]) &&
  8730. lastNode.type === 3 &&
  8731. lastNode.text === ' '
  8732. ) {
  8733. el.children.pop();
  8734. }
  8735. }
  8736. }
  8737. function checkRootConstraints (el) {
  8738. if (el.tag === 'slot' || el.tag === 'template') {
  8739. warnOnce(
  8740. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  8741. 'contain multiple nodes.',
  8742. { start: el.start }
  8743. );
  8744. }
  8745. if (el.attrsMap.hasOwnProperty('v-for')) {
  8746. warnOnce(
  8747. 'Cannot use v-for on stateful component root element because ' +
  8748. 'it renders multiple elements.',
  8749. el.rawAttrsMap['v-for']
  8750. );
  8751. }
  8752. }
  8753. parseHTML(template, {
  8754. warn: warn$2,
  8755. expectHTML: options.expectHTML,
  8756. isUnaryTag: options.isUnaryTag,
  8757. canBeLeftOpenTag: options.canBeLeftOpenTag,
  8758. shouldDecodeNewlines: options.shouldDecodeNewlines,
  8759. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  8760. shouldKeepComment: options.comments,
  8761. outputSourceRange: options.outputSourceRange,
  8762. start: function start (tag, attrs, unary, start$1, end) {
  8763. // check namespace.
  8764. // inherit parent ns if there is one
  8765. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  8766. // handle IE svg bug
  8767. /* istanbul ignore if */
  8768. if (isIE && ns === 'svg') {
  8769. attrs = guardIESVGBug(attrs);
  8770. }
  8771. var element = createASTElement(tag, attrs, currentParent);
  8772. if (ns) {
  8773. element.ns = ns;
  8774. }
  8775. {
  8776. if (options.outputSourceRange) {
  8777. element.start = start$1;
  8778. element.end = end;
  8779. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  8780. cumulated[attr.name] = attr;
  8781. return cumulated
  8782. }, {});
  8783. }
  8784. attrs.forEach(function (attr) {
  8785. if (invalidAttributeRE.test(attr.name)) {
  8786. warn$2(
  8787. "Invalid dynamic argument expression: attribute names cannot contain " +
  8788. "spaces, quotes, <, >, / or =.",
  8789. {
  8790. start: attr.start + attr.name.indexOf("["),
  8791. end: attr.start + attr.name.length
  8792. }
  8793. );
  8794. }
  8795. });
  8796. }
  8797. if (isForbiddenTag(element) && !isServerRendering()) {
  8798. element.forbidden = true;
  8799. warn$2(
  8800. 'Templates should only be responsible for mapping the state to the ' +
  8801. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  8802. "<" + tag + ">" + ', as they will not be parsed.',
  8803. { start: element.start }
  8804. );
  8805. }
  8806. // apply pre-transforms
  8807. for (var i = 0; i < preTransforms.length; i++) {
  8808. element = preTransforms[i](element, options) || element;
  8809. }
  8810. if (!inVPre) {
  8811. processPre(element);
  8812. if (element.pre) {
  8813. inVPre = true;
  8814. }
  8815. }
  8816. if (platformIsPreTag(element.tag)) {
  8817. inPre = true;
  8818. }
  8819. if (inVPre) {
  8820. processRawAttrs(element);
  8821. } else if (!element.processed) {
  8822. // structural directives
  8823. processFor(element);
  8824. processIf(element);
  8825. processOnce(element);
  8826. }
  8827. if (!root) {
  8828. root = element;
  8829. {
  8830. checkRootConstraints(root);
  8831. }
  8832. }
  8833. if (!unary) {
  8834. currentParent = element;
  8835. stack.push(element);
  8836. } else {
  8837. closeElement(element);
  8838. }
  8839. },
  8840. end: function end (tag, start, end$1) {
  8841. var element = stack[stack.length - 1];
  8842. // pop stack
  8843. stack.length -= 1;
  8844. currentParent = stack[stack.length - 1];
  8845. if (options.outputSourceRange) {
  8846. element.end = end$1;
  8847. }
  8848. closeElement(element);
  8849. },
  8850. chars: function chars (text, start, end) {
  8851. if (!currentParent) {
  8852. {
  8853. if (text === template) {
  8854. warnOnce(
  8855. 'Component template requires a root element, rather than just text.',
  8856. { start: start }
  8857. );
  8858. } else if ((text = text.trim())) {
  8859. warnOnce(
  8860. ("text \"" + text + "\" outside root element will be ignored."),
  8861. { start: start }
  8862. );
  8863. }
  8864. }
  8865. return
  8866. }
  8867. // IE textarea placeholder bug
  8868. /* istanbul ignore if */
  8869. if (isIE &&
  8870. currentParent.tag === 'textarea' &&
  8871. currentParent.attrsMap.placeholder === text
  8872. ) {
  8873. return
  8874. }
  8875. var children = currentParent.children;
  8876. if (inPre || text.trim()) {
  8877. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  8878. } else if (!children.length) {
  8879. // remove the whitespace-only node right after an opening tag
  8880. text = '';
  8881. } else if (whitespaceOption) {
  8882. if (whitespaceOption === 'condense') {
  8883. // in condense mode, remove the whitespace node if it contains
  8884. // line break, otherwise condense to a single space
  8885. text = lineBreakRE.test(text) ? '' : ' ';
  8886. } else {
  8887. text = ' ';
  8888. }
  8889. } else {
  8890. text = preserveWhitespace ? ' ' : '';
  8891. }
  8892. if (text) {
  8893. if (!inPre && whitespaceOption === 'condense') {
  8894. // condense consecutive whitespaces into single space
  8895. text = text.replace(whitespaceRE$1, ' ');
  8896. }
  8897. var res;
  8898. var child;
  8899. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  8900. child = {
  8901. type: 2,
  8902. expression: res.expression,
  8903. tokens: res.tokens,
  8904. text: text
  8905. };
  8906. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  8907. child = {
  8908. type: 3,
  8909. text: text
  8910. };
  8911. }
  8912. if (child) {
  8913. if (options.outputSourceRange) {
  8914. child.start = start;
  8915. child.end = end;
  8916. }
  8917. children.push(child);
  8918. }
  8919. }
  8920. },
  8921. comment: function comment (text, start, end) {
  8922. // adding anything as a sibling to the root node is forbidden
  8923. // comments should still be allowed, but ignored
  8924. if (currentParent) {
  8925. var child = {
  8926. type: 3,
  8927. text: text,
  8928. isComment: true
  8929. };
  8930. if (options.outputSourceRange) {
  8931. child.start = start;
  8932. child.end = end;
  8933. }
  8934. currentParent.children.push(child);
  8935. }
  8936. }
  8937. });
  8938. return root
  8939. }
  8940. function processPre (el) {
  8941. if (getAndRemoveAttr(el, 'v-pre') != null) {
  8942. el.pre = true;
  8943. }
  8944. }
  8945. function processRawAttrs (el) {
  8946. var list = el.attrsList;
  8947. var len = list.length;
  8948. if (len) {
  8949. var attrs = el.attrs = new Array(len);
  8950. for (var i = 0; i < len; i++) {
  8951. attrs[i] = {
  8952. name: list[i].name,
  8953. value: JSON.stringify(list[i].value)
  8954. };
  8955. if (list[i].start != null) {
  8956. attrs[i].start = list[i].start;
  8957. attrs[i].end = list[i].end;
  8958. }
  8959. }
  8960. } else if (!el.pre) {
  8961. // non root node in pre blocks with no attributes
  8962. el.plain = true;
  8963. }
  8964. }
  8965. function processElement (
  8966. element,
  8967. options
  8968. ) {
  8969. processKey(element);
  8970. // determine whether this is a plain element after
  8971. // removing structural attributes
  8972. element.plain = (
  8973. !element.key &&
  8974. !element.scopedSlots &&
  8975. !element.attrsList.length
  8976. );
  8977. processRef(element);
  8978. processSlotContent(element);
  8979. processSlotOutlet(element);
  8980. processComponent(element);
  8981. for (var i = 0; i < transforms.length; i++) {
  8982. element = transforms[i](element, options) || element;
  8983. }
  8984. processAttrs(element);
  8985. return element
  8986. }
  8987. function processKey (el) {
  8988. var exp = getBindingAttr(el, 'key');
  8989. if (exp) {
  8990. {
  8991. if (el.tag === 'template') {
  8992. warn$2(
  8993. "<template> cannot be keyed. Place the key on real elements instead.",
  8994. getRawBindingAttr(el, 'key')
  8995. );
  8996. }
  8997. if (el.for) {
  8998. var iterator = el.iterator2 || el.iterator1;
  8999. var parent = el.parent;
  9000. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  9001. warn$2(
  9002. "Do not use v-for index as key on <transition-group> children, " +
  9003. "this is the same as not using keys.",
  9004. getRawBindingAttr(el, 'key'),
  9005. true /* tip */
  9006. );
  9007. }
  9008. }
  9009. }
  9010. el.key = exp;
  9011. }
  9012. }
  9013. function processRef (el) {
  9014. var ref = getBindingAttr(el, 'ref');
  9015. if (ref) {
  9016. el.ref = ref;
  9017. el.refInFor = checkInFor(el);
  9018. }
  9019. }
  9020. function processFor (el) {
  9021. var exp;
  9022. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  9023. var res = parseFor(exp);
  9024. if (res) {
  9025. extend(el, res);
  9026. } else {
  9027. warn$2(
  9028. ("Invalid v-for expression: " + exp),
  9029. el.rawAttrsMap['v-for']
  9030. );
  9031. }
  9032. }
  9033. }
  9034. function parseFor (exp) {
  9035. var inMatch = exp.match(forAliasRE);
  9036. if (!inMatch) { return }
  9037. var res = {};
  9038. res.for = inMatch[2].trim();
  9039. var alias = inMatch[1].trim().replace(stripParensRE, '');
  9040. var iteratorMatch = alias.match(forIteratorRE);
  9041. if (iteratorMatch) {
  9042. res.alias = alias.replace(forIteratorRE, '').trim();
  9043. res.iterator1 = iteratorMatch[1].trim();
  9044. if (iteratorMatch[2]) {
  9045. res.iterator2 = iteratorMatch[2].trim();
  9046. }
  9047. } else {
  9048. res.alias = alias;
  9049. }
  9050. return res
  9051. }
  9052. function processIf (el) {
  9053. var exp = getAndRemoveAttr(el, 'v-if');
  9054. if (exp) {
  9055. el.if = exp;
  9056. addIfCondition(el, {
  9057. exp: exp,
  9058. block: el
  9059. });
  9060. } else {
  9061. if (getAndRemoveAttr(el, 'v-else') != null) {
  9062. el.else = true;
  9063. }
  9064. var elseif = getAndRemoveAttr(el, 'v-else-if');
  9065. if (elseif) {
  9066. el.elseif = elseif;
  9067. }
  9068. }
  9069. }
  9070. function processIfConditions (el, parent) {
  9071. var prev = findPrevElement(parent.children);
  9072. if (prev && prev.if) {
  9073. addIfCondition(prev, {
  9074. exp: el.elseif,
  9075. block: el
  9076. });
  9077. } else {
  9078. warn$2(
  9079. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  9080. "used on element <" + (el.tag) + "> without corresponding v-if.",
  9081. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  9082. );
  9083. }
  9084. }
  9085. function findPrevElement (children) {
  9086. var i = children.length;
  9087. while (i--) {
  9088. if (children[i].type === 1) {
  9089. return children[i]
  9090. } else {
  9091. if (children[i].text !== ' ') {
  9092. warn$2(
  9093. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  9094. "will be ignored.",
  9095. children[i]
  9096. );
  9097. }
  9098. children.pop();
  9099. }
  9100. }
  9101. }
  9102. function addIfCondition (el, condition) {
  9103. if (!el.ifConditions) {
  9104. el.ifConditions = [];
  9105. }
  9106. el.ifConditions.push(condition);
  9107. }
  9108. function processOnce (el) {
  9109. var once$$1 = getAndRemoveAttr(el, 'v-once');
  9110. if (once$$1 != null) {
  9111. el.once = true;
  9112. }
  9113. }
  9114. // handle content being passed to a component as slot,
  9115. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  9116. function processSlotContent (el) {
  9117. var slotScope;
  9118. if (el.tag === 'template') {
  9119. slotScope = getAndRemoveAttr(el, 'scope');
  9120. /* istanbul ignore if */
  9121. if (slotScope) {
  9122. warn$2(
  9123. "the \"scope\" attribute for scoped slots have been deprecated and " +
  9124. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  9125. "can also be used on plain elements in addition to <template> to " +
  9126. "denote scoped slots.",
  9127. el.rawAttrsMap['scope'],
  9128. true
  9129. );
  9130. }
  9131. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  9132. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  9133. /* istanbul ignore if */
  9134. if (el.attrsMap['v-for']) {
  9135. warn$2(
  9136. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  9137. "(v-for takes higher priority). Use a wrapper <template> for the " +
  9138. "scoped slot to make it clearer.",
  9139. el.rawAttrsMap['slot-scope'],
  9140. true
  9141. );
  9142. }
  9143. el.slotScope = slotScope;
  9144. }
  9145. // slot="xxx"
  9146. var slotTarget = getBindingAttr(el, 'slot');
  9147. if (slotTarget) {
  9148. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  9149. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  9150. // preserve slot as an attribute for native shadow DOM compat
  9151. // only for non-scoped slots.
  9152. if (el.tag !== 'template' && !el.slotScope) {
  9153. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  9154. }
  9155. }
  9156. // 2.6 v-slot syntax
  9157. {
  9158. if (el.tag === 'template') {
  9159. // v-slot on <template>
  9160. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  9161. if (slotBinding) {
  9162. {
  9163. if (el.slotTarget || el.slotScope) {
  9164. warn$2(
  9165. "Unexpected mixed usage of different slot syntaxes.",
  9166. el
  9167. );
  9168. }
  9169. if (el.parent && !maybeComponent(el.parent)) {
  9170. warn$2(
  9171. "<template v-slot> can only appear at the root level inside " +
  9172. "the receiving component",
  9173. el
  9174. );
  9175. }
  9176. }
  9177. var ref = getSlotName(slotBinding);
  9178. var name = ref.name;
  9179. var dynamic = ref.dynamic;
  9180. el.slotTarget = name;
  9181. el.slotTargetDynamic = dynamic;
  9182. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  9183. }
  9184. } else {
  9185. // v-slot on component, denotes default slot
  9186. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  9187. if (slotBinding$1) {
  9188. {
  9189. if (!maybeComponent(el)) {
  9190. warn$2(
  9191. "v-slot can only be used on components or <template>.",
  9192. slotBinding$1
  9193. );
  9194. }
  9195. if (el.slotScope || el.slotTarget) {
  9196. warn$2(
  9197. "Unexpected mixed usage of different slot syntaxes.",
  9198. el
  9199. );
  9200. }
  9201. if (el.scopedSlots) {
  9202. warn$2(
  9203. "To avoid scope ambiguity, the default slot should also use " +
  9204. "<template> syntax when there are other named slots.",
  9205. slotBinding$1
  9206. );
  9207. }
  9208. }
  9209. // add the component's children to its default slot
  9210. var slots = el.scopedSlots || (el.scopedSlots = {});
  9211. var ref$1 = getSlotName(slotBinding$1);
  9212. var name$1 = ref$1.name;
  9213. var dynamic$1 = ref$1.dynamic;
  9214. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  9215. slotContainer.slotTarget = name$1;
  9216. slotContainer.slotTargetDynamic = dynamic$1;
  9217. slotContainer.children = el.children.filter(function (c) {
  9218. if (!c.slotScope) {
  9219. c.parent = slotContainer;
  9220. return true
  9221. }
  9222. });
  9223. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  9224. // remove children as they are returned from scopedSlots now
  9225. el.children = [];
  9226. // mark el non-plain so data gets generated
  9227. el.plain = false;
  9228. }
  9229. }
  9230. }
  9231. }
  9232. function getSlotName (binding) {
  9233. var name = binding.name.replace(slotRE, '');
  9234. if (!name) {
  9235. if (binding.name[0] !== '#') {
  9236. name = 'default';
  9237. } else {
  9238. warn$2(
  9239. "v-slot shorthand syntax requires a slot name.",
  9240. binding
  9241. );
  9242. }
  9243. }
  9244. return dynamicArgRE.test(name)
  9245. // dynamic [name]
  9246. ? { name: name.slice(1, -1), dynamic: true }
  9247. // static name
  9248. : { name: ("\"" + name + "\""), dynamic: false }
  9249. }
  9250. // handle <slot/> outlets
  9251. function processSlotOutlet (el) {
  9252. if (el.tag === 'slot') {
  9253. el.slotName = getBindingAttr(el, 'name');
  9254. if (el.key) {
  9255. warn$2(
  9256. "`key` does not work on <slot> because slots are abstract outlets " +
  9257. "and can possibly expand into multiple elements. " +
  9258. "Use the key on a wrapping element instead.",
  9259. getRawBindingAttr(el, 'key')
  9260. );
  9261. }
  9262. }
  9263. }
  9264. function processComponent (el) {
  9265. var binding;
  9266. if ((binding = getBindingAttr(el, 'is'))) {
  9267. el.component = binding;
  9268. }
  9269. if (getAndRemoveAttr(el, 'inline-template') != null) {
  9270. el.inlineTemplate = true;
  9271. }
  9272. }
  9273. function processAttrs (el) {
  9274. var list = el.attrsList;
  9275. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  9276. for (i = 0, l = list.length; i < l; i++) {
  9277. name = rawName = list[i].name;
  9278. value = list[i].value;
  9279. if (dirRE.test(name)) {
  9280. // mark element as dynamic
  9281. el.hasBindings = true;
  9282. // modifiers
  9283. modifiers = parseModifiers(name.replace(dirRE, ''));
  9284. // support .foo shorthand syntax for the .prop modifier
  9285. if (modifiers) {
  9286. name = name.replace(modifierRE, '');
  9287. }
  9288. if (bindRE.test(name)) { // v-bind
  9289. name = name.replace(bindRE, '');
  9290. value = parseFilters(value);
  9291. isDynamic = dynamicArgRE.test(name);
  9292. if (isDynamic) {
  9293. name = name.slice(1, -1);
  9294. }
  9295. if (
  9296. value.trim().length === 0
  9297. ) {
  9298. warn$2(
  9299. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  9300. );
  9301. }
  9302. if (modifiers) {
  9303. if (modifiers.prop && !isDynamic) {
  9304. name = camelize(name);
  9305. if (name === 'innerHtml') { name = 'innerHTML'; }
  9306. }
  9307. if (modifiers.camel && !isDynamic) {
  9308. name = camelize(name);
  9309. }
  9310. if (modifiers.sync) {
  9311. syncGen = genAssignmentCode(value, "$event");
  9312. if (!isDynamic) {
  9313. addHandler(
  9314. el,
  9315. ("update:" + (camelize(name))),
  9316. syncGen,
  9317. null,
  9318. false,
  9319. warn$2,
  9320. list[i]
  9321. );
  9322. if (hyphenate(name) !== camelize(name)) {
  9323. addHandler(
  9324. el,
  9325. ("update:" + (hyphenate(name))),
  9326. syncGen,
  9327. null,
  9328. false,
  9329. warn$2,
  9330. list[i]
  9331. );
  9332. }
  9333. } else {
  9334. // handler w/ dynamic event name
  9335. addHandler(
  9336. el,
  9337. ("\"update:\"+(" + name + ")"),
  9338. syncGen,
  9339. null,
  9340. false,
  9341. warn$2,
  9342. list[i],
  9343. true // dynamic
  9344. );
  9345. }
  9346. }
  9347. }
  9348. if ((modifiers && modifiers.prop) || (
  9349. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  9350. )) {
  9351. addProp(el, name, value, list[i], isDynamic);
  9352. } else {
  9353. addAttr(el, name, value, list[i], isDynamic);
  9354. }
  9355. } else if (onRE.test(name)) { // v-on
  9356. name = name.replace(onRE, '');
  9357. isDynamic = dynamicArgRE.test(name);
  9358. if (isDynamic) {
  9359. name = name.slice(1, -1);
  9360. }
  9361. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  9362. } else { // normal directives
  9363. name = name.replace(dirRE, '');
  9364. // parse arg
  9365. var argMatch = name.match(argRE);
  9366. var arg = argMatch && argMatch[1];
  9367. isDynamic = false;
  9368. if (arg) {
  9369. name = name.slice(0, -(arg.length + 1));
  9370. if (dynamicArgRE.test(arg)) {
  9371. arg = arg.slice(1, -1);
  9372. isDynamic = true;
  9373. }
  9374. }
  9375. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  9376. if (name === 'model') {
  9377. checkForAliasModel(el, value);
  9378. }
  9379. }
  9380. } else {
  9381. // literal attribute
  9382. {
  9383. var res = parseText(value, delimiters);
  9384. if (res) {
  9385. warn$2(
  9386. name + "=\"" + value + "\": " +
  9387. 'Interpolation inside attributes has been removed. ' +
  9388. 'Use v-bind or the colon shorthand instead. For example, ' +
  9389. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  9390. list[i]
  9391. );
  9392. }
  9393. }
  9394. addAttr(el, name, JSON.stringify(value), list[i]);
  9395. // #6887 firefox doesn't update muted state if set via attribute
  9396. // even immediately after element creation
  9397. if (!el.component &&
  9398. name === 'muted' &&
  9399. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  9400. addProp(el, name, 'true', list[i]);
  9401. }
  9402. }
  9403. }
  9404. }
  9405. function checkInFor (el) {
  9406. var parent = el;
  9407. while (parent) {
  9408. if (parent.for !== undefined) {
  9409. return true
  9410. }
  9411. parent = parent.parent;
  9412. }
  9413. return false
  9414. }
  9415. function parseModifiers (name) {
  9416. var match = name.match(modifierRE);
  9417. if (match) {
  9418. var ret = {};
  9419. match.forEach(function (m) { ret[m.slice(1)] = true; });
  9420. return ret
  9421. }
  9422. }
  9423. function makeAttrsMap (attrs) {
  9424. var map = {};
  9425. for (var i = 0, l = attrs.length; i < l; i++) {
  9426. if (
  9427. map[attrs[i].name] && !isIE && !isEdge
  9428. ) {
  9429. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  9430. }
  9431. map[attrs[i].name] = attrs[i].value;
  9432. }
  9433. return map
  9434. }
  9435. // for script (e.g. type="x/template") or style, do not decode content
  9436. function isTextTag (el) {
  9437. return el.tag === 'script' || el.tag === 'style'
  9438. }
  9439. function isForbiddenTag (el) {
  9440. return (
  9441. el.tag === 'style' ||
  9442. (el.tag === 'script' && (
  9443. !el.attrsMap.type ||
  9444. el.attrsMap.type === 'text/javascript'
  9445. ))
  9446. )
  9447. }
  9448. var ieNSBug = /^xmlns:NS\d+/;
  9449. var ieNSPrefix = /^NS\d+:/;
  9450. /* istanbul ignore next */
  9451. function guardIESVGBug (attrs) {
  9452. var res = [];
  9453. for (var i = 0; i < attrs.length; i++) {
  9454. var attr = attrs[i];
  9455. if (!ieNSBug.test(attr.name)) {
  9456. attr.name = attr.name.replace(ieNSPrefix, '');
  9457. res.push(attr);
  9458. }
  9459. }
  9460. return res
  9461. }
  9462. function checkForAliasModel (el, value) {
  9463. var _el = el;
  9464. while (_el) {
  9465. if (_el.for && _el.alias === value) {
  9466. warn$2(
  9467. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  9468. "You are binding v-model directly to a v-for iteration alias. " +
  9469. "This will not be able to modify the v-for source array because " +
  9470. "writing to the alias is like modifying a function local variable. " +
  9471. "Consider using an array of objects and use v-model on an object property instead.",
  9472. el.rawAttrsMap['v-model']
  9473. );
  9474. }
  9475. _el = _el.parent;
  9476. }
  9477. }
  9478. /* */
  9479. function preTransformNode (el, options) {
  9480. if (el.tag === 'input') {
  9481. var map = el.attrsMap;
  9482. if (!map['v-model']) {
  9483. return
  9484. }
  9485. var typeBinding;
  9486. if (map[':type'] || map['v-bind:type']) {
  9487. typeBinding = getBindingAttr(el, 'type');
  9488. }
  9489. if (!map.type && !typeBinding && map['v-bind']) {
  9490. typeBinding = "(" + (map['v-bind']) + ").type";
  9491. }
  9492. if (typeBinding) {
  9493. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  9494. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  9495. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  9496. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  9497. // 1. checkbox
  9498. var branch0 = cloneASTElement(el);
  9499. // process for on the main node
  9500. processFor(branch0);
  9501. addRawAttr(branch0, 'type', 'checkbox');
  9502. processElement(branch0, options);
  9503. branch0.processed = true; // prevent it from double-processed
  9504. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  9505. addIfCondition(branch0, {
  9506. exp: branch0.if,
  9507. block: branch0
  9508. });
  9509. // 2. add radio else-if condition
  9510. var branch1 = cloneASTElement(el);
  9511. getAndRemoveAttr(branch1, 'v-for', true);
  9512. addRawAttr(branch1, 'type', 'radio');
  9513. processElement(branch1, options);
  9514. addIfCondition(branch0, {
  9515. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  9516. block: branch1
  9517. });
  9518. // 3. other
  9519. var branch2 = cloneASTElement(el);
  9520. getAndRemoveAttr(branch2, 'v-for', true);
  9521. addRawAttr(branch2, ':type', typeBinding);
  9522. processElement(branch2, options);
  9523. addIfCondition(branch0, {
  9524. exp: ifCondition,
  9525. block: branch2
  9526. });
  9527. if (hasElse) {
  9528. branch0.else = true;
  9529. } else if (elseIfCondition) {
  9530. branch0.elseif = elseIfCondition;
  9531. }
  9532. return branch0
  9533. }
  9534. }
  9535. }
  9536. function cloneASTElement (el) {
  9537. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  9538. }
  9539. var model$1 = {
  9540. preTransformNode: preTransformNode
  9541. };
  9542. var modules$1 = [
  9543. klass$1,
  9544. style$1,
  9545. model$1
  9546. ];
  9547. /* */
  9548. function text (el, dir) {
  9549. if (dir.value) {
  9550. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  9551. }
  9552. }
  9553. /* */
  9554. function html (el, dir) {
  9555. if (dir.value) {
  9556. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  9557. }
  9558. }
  9559. var directives$1 = {
  9560. model: model,
  9561. text: text,
  9562. html: html
  9563. };
  9564. /* */
  9565. var baseOptions = {
  9566. expectHTML: true,
  9567. modules: modules$1,
  9568. directives: directives$1,
  9569. isPreTag: isPreTag,
  9570. isUnaryTag: isUnaryTag,
  9571. mustUseProp: mustUseProp,
  9572. canBeLeftOpenTag: canBeLeftOpenTag,
  9573. isReservedTag: isReservedTag,
  9574. getTagNamespace: getTagNamespace,
  9575. staticKeys: genStaticKeys(modules$1)
  9576. };
  9577. /* */
  9578. var isStaticKey;
  9579. var isPlatformReservedTag;
  9580. var genStaticKeysCached = cached(genStaticKeys$1);
  9581. /**
  9582. * Goal of the optimizer: walk the generated template AST tree
  9583. * and detect sub-trees that are purely static, i.e. parts of
  9584. * the DOM that never needs to change.
  9585. *
  9586. * Once we detect these sub-trees, we can:
  9587. *
  9588. * 1. Hoist them into constants, so that we no longer need to
  9589. * create fresh nodes for them on each re-render;
  9590. * 2. Completely skip them in the patching process.
  9591. */
  9592. function optimize (root, options) {
  9593. if (!root) { return }
  9594. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  9595. isPlatformReservedTag = options.isReservedTag || no;
  9596. // first pass: mark all non-static nodes.
  9597. markStatic$1(root);
  9598. // second pass: mark static roots.
  9599. markStaticRoots(root, false);
  9600. }
  9601. function genStaticKeys$1 (keys) {
  9602. return makeMap(
  9603. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  9604. (keys ? ',' + keys : '')
  9605. )
  9606. }
  9607. function markStatic$1 (node) {
  9608. node.static = isStatic(node);
  9609. if (node.type === 1) {
  9610. // do not make component slot content static. this avoids
  9611. // 1. components not able to mutate slot nodes
  9612. // 2. static slot content fails for hot-reloading
  9613. if (
  9614. !isPlatformReservedTag(node.tag) &&
  9615. node.tag !== 'slot' &&
  9616. node.attrsMap['inline-template'] == null
  9617. ) {
  9618. return
  9619. }
  9620. for (var i = 0, l = node.children.length; i < l; i++) {
  9621. var child = node.children[i];
  9622. markStatic$1(child);
  9623. if (!child.static) {
  9624. node.static = false;
  9625. }
  9626. }
  9627. if (node.ifConditions) {
  9628. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9629. var block = node.ifConditions[i$1].block;
  9630. markStatic$1(block);
  9631. if (!block.static) {
  9632. node.static = false;
  9633. }
  9634. }
  9635. }
  9636. }
  9637. }
  9638. function markStaticRoots (node, isInFor) {
  9639. if (node.type === 1) {
  9640. if (node.static || node.once) {
  9641. node.staticInFor = isInFor;
  9642. }
  9643. // For a node to qualify as a static root, it should have children that
  9644. // are not just static text. Otherwise the cost of hoisting out will
  9645. // outweigh the benefits and it's better off to just always render it fresh.
  9646. if (node.static && node.children.length && !(
  9647. node.children.length === 1 &&
  9648. node.children[0].type === 3
  9649. )) {
  9650. node.staticRoot = true;
  9651. return
  9652. } else {
  9653. node.staticRoot = false;
  9654. }
  9655. if (node.children) {
  9656. for (var i = 0, l = node.children.length; i < l; i++) {
  9657. markStaticRoots(node.children[i], isInFor || !!node.for);
  9658. }
  9659. }
  9660. if (node.ifConditions) {
  9661. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  9662. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  9663. }
  9664. }
  9665. }
  9666. }
  9667. function isStatic (node) {
  9668. if (node.type === 2) { // expression
  9669. return false
  9670. }
  9671. if (node.type === 3) { // text
  9672. return true
  9673. }
  9674. return !!(node.pre || (
  9675. !node.hasBindings && // no dynamic bindings
  9676. !node.if && !node.for && // not v-if or v-for or v-else
  9677. !isBuiltInTag(node.tag) && // not a built-in
  9678. isPlatformReservedTag(node.tag) && // not a component
  9679. !isDirectChildOfTemplateFor(node) &&
  9680. Object.keys(node).every(isStaticKey)
  9681. ))
  9682. }
  9683. function isDirectChildOfTemplateFor (node) {
  9684. while (node.parent) {
  9685. node = node.parent;
  9686. if (node.tag !== 'template') {
  9687. return false
  9688. }
  9689. if (node.for) {
  9690. return true
  9691. }
  9692. }
  9693. return false
  9694. }
  9695. /* */
  9696. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  9697. var fnInvokeRE = /\([^)]*?\);*$/;
  9698. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  9699. // KeyboardEvent.keyCode aliases
  9700. var keyCodes = {
  9701. esc: 27,
  9702. tab: 9,
  9703. enter: 13,
  9704. space: 32,
  9705. up: 38,
  9706. left: 37,
  9707. right: 39,
  9708. down: 40,
  9709. 'delete': [8, 46]
  9710. };
  9711. // KeyboardEvent.key aliases
  9712. var keyNames = {
  9713. // #7880: IE11 and Edge use `Esc` for Escape key name.
  9714. esc: ['Esc', 'Escape'],
  9715. tab: 'Tab',
  9716. enter: 'Enter',
  9717. // #9112: IE11 uses `Spacebar` for Space key name.
  9718. space: [' ', 'Spacebar'],
  9719. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  9720. up: ['Up', 'ArrowUp'],
  9721. left: ['Left', 'ArrowLeft'],
  9722. right: ['Right', 'ArrowRight'],
  9723. down: ['Down', 'ArrowDown'],
  9724. // #9112: IE11 uses `Del` for Delete key name.
  9725. 'delete': ['Backspace', 'Delete', 'Del']
  9726. };
  9727. // #4868: modifiers that prevent the execution of the listener
  9728. // need to explicitly return null so that we can determine whether to remove
  9729. // the listener for .once
  9730. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  9731. var modifierCode = {
  9732. stop: '$event.stopPropagation();',
  9733. prevent: '$event.preventDefault();',
  9734. self: genGuard("$event.target !== $event.currentTarget"),
  9735. ctrl: genGuard("!$event.ctrlKey"),
  9736. shift: genGuard("!$event.shiftKey"),
  9737. alt: genGuard("!$event.altKey"),
  9738. meta: genGuard("!$event.metaKey"),
  9739. left: genGuard("'button' in $event && $event.button !== 0"),
  9740. middle: genGuard("'button' in $event && $event.button !== 1"),
  9741. right: genGuard("'button' in $event && $event.button !== 2")
  9742. };
  9743. function genHandlers (
  9744. events,
  9745. isNative
  9746. ) {
  9747. var prefix = isNative ? 'nativeOn:' : 'on:';
  9748. var staticHandlers = "";
  9749. var dynamicHandlers = "";
  9750. for (var name in events) {
  9751. var handlerCode = genHandler(events[name]);
  9752. if (events[name] && events[name].dynamic) {
  9753. dynamicHandlers += name + "," + handlerCode + ",";
  9754. } else {
  9755. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  9756. }
  9757. }
  9758. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  9759. if (dynamicHandlers) {
  9760. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  9761. } else {
  9762. return prefix + staticHandlers
  9763. }
  9764. }
  9765. function genHandler (handler) {
  9766. if (!handler) {
  9767. return 'function(){}'
  9768. }
  9769. if (Array.isArray(handler)) {
  9770. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  9771. }
  9772. var isMethodPath = simplePathRE.test(handler.value);
  9773. var isFunctionExpression = fnExpRE.test(handler.value);
  9774. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  9775. if (!handler.modifiers) {
  9776. if (isMethodPath || isFunctionExpression) {
  9777. return handler.value
  9778. }
  9779. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  9780. } else {
  9781. var code = '';
  9782. var genModifierCode = '';
  9783. var keys = [];
  9784. for (var key in handler.modifiers) {
  9785. if (modifierCode[key]) {
  9786. genModifierCode += modifierCode[key];
  9787. // left/right
  9788. if (keyCodes[key]) {
  9789. keys.push(key);
  9790. }
  9791. } else if (key === 'exact') {
  9792. var modifiers = (handler.modifiers);
  9793. genModifierCode += genGuard(
  9794. ['ctrl', 'shift', 'alt', 'meta']
  9795. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  9796. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  9797. .join('||')
  9798. );
  9799. } else {
  9800. keys.push(key);
  9801. }
  9802. }
  9803. if (keys.length) {
  9804. code += genKeyFilter(keys);
  9805. }
  9806. // Make sure modifiers like prevent and stop get executed after key filtering
  9807. if (genModifierCode) {
  9808. code += genModifierCode;
  9809. }
  9810. var handlerCode = isMethodPath
  9811. ? ("return " + (handler.value) + "($event)")
  9812. : isFunctionExpression
  9813. ? ("return (" + (handler.value) + ")($event)")
  9814. : isFunctionInvocation
  9815. ? ("return " + (handler.value))
  9816. : handler.value;
  9817. return ("function($event){" + code + handlerCode + "}")
  9818. }
  9819. }
  9820. function genKeyFilter (keys) {
  9821. return (
  9822. // make sure the key filters only apply to KeyboardEvents
  9823. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  9824. // key events that do not have keyCode property...
  9825. "if(!$event.type.indexOf('key')&&" +
  9826. (keys.map(genFilterCode).join('&&')) + ")return null;"
  9827. )
  9828. }
  9829. function genFilterCode (key) {
  9830. var keyVal = parseInt(key, 10);
  9831. if (keyVal) {
  9832. return ("$event.keyCode!==" + keyVal)
  9833. }
  9834. var keyCode = keyCodes[key];
  9835. var keyName = keyNames[key];
  9836. return (
  9837. "_k($event.keyCode," +
  9838. (JSON.stringify(key)) + "," +
  9839. (JSON.stringify(keyCode)) + "," +
  9840. "$event.key," +
  9841. "" + (JSON.stringify(keyName)) +
  9842. ")"
  9843. )
  9844. }
  9845. /* */
  9846. function on (el, dir) {
  9847. if (dir.modifiers) {
  9848. warn("v-on without argument does not support modifiers.");
  9849. }
  9850. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  9851. }
  9852. /* */
  9853. function bind$1 (el, dir) {
  9854. el.wrapData = function (code) {
  9855. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  9856. };
  9857. }
  9858. /* */
  9859. var baseDirectives = {
  9860. on: on,
  9861. bind: bind$1,
  9862. cloak: noop
  9863. };
  9864. /* */
  9865. var CodegenState = function CodegenState (options) {
  9866. this.options = options;
  9867. this.warn = options.warn || baseWarn;
  9868. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  9869. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  9870. this.directives = extend(extend({}, baseDirectives), options.directives);
  9871. var isReservedTag = options.isReservedTag || no;
  9872. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  9873. this.onceId = 0;
  9874. this.staticRenderFns = [];
  9875. this.pre = false;
  9876. };
  9877. function generate (
  9878. ast,
  9879. options
  9880. ) {
  9881. var state = new CodegenState(options);
  9882. var code = ast ? genElement(ast, state) : '_c("div")';
  9883. return {
  9884. render: ("with(this){return " + code + "}"),
  9885. staticRenderFns: state.staticRenderFns
  9886. }
  9887. }
  9888. function genElement (el, state) {
  9889. if (el.parent) {
  9890. el.pre = el.pre || el.parent.pre;
  9891. }
  9892. if (el.staticRoot && !el.staticProcessed) {
  9893. return genStatic(el, state)
  9894. } else if (el.once && !el.onceProcessed) {
  9895. return genOnce(el, state)
  9896. } else if (el.for && !el.forProcessed) {
  9897. return genFor(el, state)
  9898. } else if (el.if && !el.ifProcessed) {
  9899. return genIf(el, state)
  9900. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  9901. return genChildren(el, state) || 'void 0'
  9902. } else if (el.tag === 'slot') {
  9903. return genSlot(el, state)
  9904. } else {
  9905. // component or element
  9906. var code;
  9907. if (el.component) {
  9908. code = genComponent(el.component, el, state);
  9909. } else {
  9910. var data;
  9911. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  9912. data = genData$2(el, state);
  9913. }
  9914. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  9915. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  9916. }
  9917. // module transforms
  9918. for (var i = 0; i < state.transforms.length; i++) {
  9919. code = state.transforms[i](el, code);
  9920. }
  9921. return code
  9922. }
  9923. }
  9924. // hoist static sub-trees out
  9925. function genStatic (el, state) {
  9926. el.staticProcessed = true;
  9927. // Some elements (templates) need to behave differently inside of a v-pre
  9928. // node. All pre nodes are static roots, so we can use this as a location to
  9929. // wrap a state change and reset it upon exiting the pre node.
  9930. var originalPreState = state.pre;
  9931. if (el.pre) {
  9932. state.pre = el.pre;
  9933. }
  9934. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  9935. state.pre = originalPreState;
  9936. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  9937. }
  9938. // v-once
  9939. function genOnce (el, state) {
  9940. el.onceProcessed = true;
  9941. if (el.if && !el.ifProcessed) {
  9942. return genIf(el, state)
  9943. } else if (el.staticInFor) {
  9944. var key = '';
  9945. var parent = el.parent;
  9946. while (parent) {
  9947. if (parent.for) {
  9948. key = parent.key;
  9949. break
  9950. }
  9951. parent = parent.parent;
  9952. }
  9953. if (!key) {
  9954. state.warn(
  9955. "v-once can only be used inside v-for that is keyed. ",
  9956. el.rawAttrsMap['v-once']
  9957. );
  9958. return genElement(el, state)
  9959. }
  9960. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  9961. } else {
  9962. return genStatic(el, state)
  9963. }
  9964. }
  9965. function genIf (
  9966. el,
  9967. state,
  9968. altGen,
  9969. altEmpty
  9970. ) {
  9971. el.ifProcessed = true; // avoid recursion
  9972. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  9973. }
  9974. function genIfConditions (
  9975. conditions,
  9976. state,
  9977. altGen,
  9978. altEmpty
  9979. ) {
  9980. if (!conditions.length) {
  9981. return altEmpty || '_e()'
  9982. }
  9983. var condition = conditions.shift();
  9984. if (condition.exp) {
  9985. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  9986. } else {
  9987. return ("" + (genTernaryExp(condition.block)))
  9988. }
  9989. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  9990. function genTernaryExp (el) {
  9991. return altGen
  9992. ? altGen(el, state)
  9993. : el.once
  9994. ? genOnce(el, state)
  9995. : genElement(el, state)
  9996. }
  9997. }
  9998. function genFor (
  9999. el,
  10000. state,
  10001. altGen,
  10002. altHelper
  10003. ) {
  10004. var exp = el.for;
  10005. var alias = el.alias;
  10006. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  10007. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  10008. if (state.maybeComponent(el) &&
  10009. el.tag !== 'slot' &&
  10010. el.tag !== 'template' &&
  10011. !el.key
  10012. ) {
  10013. state.warn(
  10014. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  10015. "v-for should have explicit keys. " +
  10016. "See https://vuejs.org/guide/list.html#key for more info.",
  10017. el.rawAttrsMap['v-for'],
  10018. true /* tip */
  10019. );
  10020. }
  10021. el.forProcessed = true; // avoid recursion
  10022. return (altHelper || '_l') + "((" + exp + ")," +
  10023. "function(" + alias + iterator1 + iterator2 + "){" +
  10024. "return " + ((altGen || genElement)(el, state)) +
  10025. '})'
  10026. }
  10027. function genData$2 (el, state) {
  10028. var data = '{';
  10029. // directives first.
  10030. // directives may mutate the el's other properties before they are generated.
  10031. var dirs = genDirectives(el, state);
  10032. if (dirs) { data += dirs + ','; }
  10033. // key
  10034. if (el.key) {
  10035. data += "key:" + (el.key) + ",";
  10036. }
  10037. // ref
  10038. if (el.ref) {
  10039. data += "ref:" + (el.ref) + ",";
  10040. }
  10041. if (el.refInFor) {
  10042. data += "refInFor:true,";
  10043. }
  10044. // pre
  10045. if (el.pre) {
  10046. data += "pre:true,";
  10047. }
  10048. // record original tag name for components using "is" attribute
  10049. if (el.component) {
  10050. data += "tag:\"" + (el.tag) + "\",";
  10051. }
  10052. // module data generation functions
  10053. for (var i = 0; i < state.dataGenFns.length; i++) {
  10054. data += state.dataGenFns[i](el);
  10055. }
  10056. // attributes
  10057. if (el.attrs) {
  10058. data += "attrs:" + (genProps(el.attrs)) + ",";
  10059. }
  10060. // DOM props
  10061. if (el.props) {
  10062. data += "domProps:" + (genProps(el.props)) + ",";
  10063. }
  10064. // event handlers
  10065. if (el.events) {
  10066. data += (genHandlers(el.events, false)) + ",";
  10067. }
  10068. if (el.nativeEvents) {
  10069. data += (genHandlers(el.nativeEvents, true)) + ",";
  10070. }
  10071. // slot target
  10072. // only for non-scoped slots
  10073. if (el.slotTarget && !el.slotScope) {
  10074. data += "slot:" + (el.slotTarget) + ",";
  10075. }
  10076. // scoped slots
  10077. if (el.scopedSlots) {
  10078. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  10079. }
  10080. // component v-model
  10081. if (el.model) {
  10082. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  10083. }
  10084. // inline-template
  10085. if (el.inlineTemplate) {
  10086. var inlineTemplate = genInlineTemplate(el, state);
  10087. if (inlineTemplate) {
  10088. data += inlineTemplate + ",";
  10089. }
  10090. }
  10091. data = data.replace(/,$/, '') + '}';
  10092. // v-bind dynamic argument wrap
  10093. // v-bind with dynamic arguments must be applied using the same v-bind object
  10094. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  10095. if (el.dynamicAttrs) {
  10096. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  10097. }
  10098. // v-bind data wrap
  10099. if (el.wrapData) {
  10100. data = el.wrapData(data);
  10101. }
  10102. // v-on data wrap
  10103. if (el.wrapListeners) {
  10104. data = el.wrapListeners(data);
  10105. }
  10106. return data
  10107. }
  10108. function genDirectives (el, state) {
  10109. var dirs = el.directives;
  10110. if (!dirs) { return }
  10111. var res = 'directives:[';
  10112. var hasRuntime = false;
  10113. var i, l, dir, needRuntime;
  10114. for (i = 0, l = dirs.length; i < l; i++) {
  10115. dir = dirs[i];
  10116. needRuntime = true;
  10117. var gen = state.directives[dir.name];
  10118. if (gen) {
  10119. // compile-time directive that manipulates AST.
  10120. // returns true if it also needs a runtime counterpart.
  10121. needRuntime = !!gen(el, dir, state.warn);
  10122. }
  10123. if (needRuntime) {
  10124. hasRuntime = true;
  10125. 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))) : '') + "},";
  10126. }
  10127. }
  10128. if (hasRuntime) {
  10129. return res.slice(0, -1) + ']'
  10130. }
  10131. }
  10132. function genInlineTemplate (el, state) {
  10133. var ast = el.children[0];
  10134. if (el.children.length !== 1 || ast.type !== 1) {
  10135. state.warn(
  10136. 'Inline-template components must have exactly one child element.',
  10137. { start: el.start }
  10138. );
  10139. }
  10140. if (ast && ast.type === 1) {
  10141. var inlineRenderFns = generate(ast, state.options);
  10142. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  10143. }
  10144. }
  10145. function genScopedSlots (
  10146. el,
  10147. slots,
  10148. state
  10149. ) {
  10150. // by default scoped slots are considered "stable", this allows child
  10151. // components with only scoped slots to skip forced updates from parent.
  10152. // but in some cases we have to bail-out of this optimization
  10153. // for example if the slot contains dynamic names, has v-if or v-for on them...
  10154. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  10155. var slot = slots[key];
  10156. return (
  10157. slot.slotTargetDynamic ||
  10158. slot.if ||
  10159. slot.for ||
  10160. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  10161. )
  10162. });
  10163. // #9534: if a component with scoped slots is inside a conditional branch,
  10164. // it's possible for the same component to be reused but with different
  10165. // compiled slot content. To avoid that, we generate a unique key based on
  10166. // the generated code of all the slot contents.
  10167. var needsKey = !!el.if;
  10168. // OR when it is inside another scoped slot or v-for (the reactivity may be
  10169. // disconnected due to the intermediate scope variable)
  10170. // #9438, #9506
  10171. // TODO: this can be further optimized by properly analyzing in-scope bindings
  10172. // and skip force updating ones that do not actually use scope variables.
  10173. if (!needsForceUpdate) {
  10174. var parent = el.parent;
  10175. while (parent) {
  10176. if (
  10177. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  10178. parent.for
  10179. ) {
  10180. needsForceUpdate = true;
  10181. break
  10182. }
  10183. if (parent.if) {
  10184. needsKey = true;
  10185. }
  10186. parent = parent.parent;
  10187. }
  10188. }
  10189. var generatedSlots = Object.keys(slots)
  10190. .map(function (key) { return genScopedSlot(slots[key], state); })
  10191. .join(',');
  10192. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  10193. }
  10194. function hash(str) {
  10195. var hash = 5381;
  10196. var i = str.length;
  10197. while(i) {
  10198. hash = (hash * 33) ^ str.charCodeAt(--i);
  10199. }
  10200. return hash >>> 0
  10201. }
  10202. function containsSlotChild (el) {
  10203. if (el.type === 1) {
  10204. if (el.tag === 'slot') {
  10205. return true
  10206. }
  10207. return el.children.some(containsSlotChild)
  10208. }
  10209. return false
  10210. }
  10211. function genScopedSlot (
  10212. el,
  10213. state
  10214. ) {
  10215. var isLegacySyntax = el.attrsMap['slot-scope'];
  10216. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  10217. return genIf(el, state, genScopedSlot, "null")
  10218. }
  10219. if (el.for && !el.forProcessed) {
  10220. return genFor(el, state, genScopedSlot)
  10221. }
  10222. var slotScope = el.slotScope === emptySlotScopeToken
  10223. ? ""
  10224. : String(el.slotScope);
  10225. var fn = "function(" + slotScope + "){" +
  10226. "return " + (el.tag === 'template'
  10227. ? el.if && isLegacySyntax
  10228. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  10229. : genChildren(el, state) || 'undefined'
  10230. : genElement(el, state)) + "}";
  10231. // reverse proxy v-slot without scope on this.$slots
  10232. var reverseProxy = slotScope ? "" : ",proxy:true";
  10233. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  10234. }
  10235. function genChildren (
  10236. el,
  10237. state,
  10238. checkSkip,
  10239. altGenElement,
  10240. altGenNode
  10241. ) {
  10242. var children = el.children;
  10243. if (children.length) {
  10244. var el$1 = children[0];
  10245. // optimize single v-for
  10246. if (children.length === 1 &&
  10247. el$1.for &&
  10248. el$1.tag !== 'template' &&
  10249. el$1.tag !== 'slot'
  10250. ) {
  10251. var normalizationType = checkSkip
  10252. ? state.maybeComponent(el$1) ? ",1" : ",0"
  10253. : "";
  10254. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  10255. }
  10256. var normalizationType$1 = checkSkip
  10257. ? getNormalizationType(children, state.maybeComponent)
  10258. : 0;
  10259. var gen = altGenNode || genNode;
  10260. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  10261. }
  10262. }
  10263. // determine the normalization needed for the children array.
  10264. // 0: no normalization needed
  10265. // 1: simple normalization needed (possible 1-level deep nested array)
  10266. // 2: full normalization needed
  10267. function getNormalizationType (
  10268. children,
  10269. maybeComponent
  10270. ) {
  10271. var res = 0;
  10272. for (var i = 0; i < children.length; i++) {
  10273. var el = children[i];
  10274. if (el.type !== 1) {
  10275. continue
  10276. }
  10277. if (needsNormalization(el) ||
  10278. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  10279. res = 2;
  10280. break
  10281. }
  10282. if (maybeComponent(el) ||
  10283. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  10284. res = 1;
  10285. }
  10286. }
  10287. return res
  10288. }
  10289. function needsNormalization (el) {
  10290. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  10291. }
  10292. function genNode (node, state) {
  10293. if (node.type === 1) {
  10294. return genElement(node, state)
  10295. } else if (node.type === 3 && node.isComment) {
  10296. return genComment(node)
  10297. } else {
  10298. return genText(node)
  10299. }
  10300. }
  10301. function genText (text) {
  10302. return ("_v(" + (text.type === 2
  10303. ? text.expression // no need for () because already wrapped in _s()
  10304. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  10305. }
  10306. function genComment (comment) {
  10307. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  10308. }
  10309. function genSlot (el, state) {
  10310. var slotName = el.slotName || '"default"';
  10311. var children = genChildren(el, state);
  10312. var res = "_t(" + slotName + (children ? ("," + children) : '');
  10313. var attrs = el.attrs || el.dynamicAttrs
  10314. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  10315. // slot props are camelized
  10316. name: camelize(attr.name),
  10317. value: attr.value,
  10318. dynamic: attr.dynamic
  10319. }); }))
  10320. : null;
  10321. var bind$$1 = el.attrsMap['v-bind'];
  10322. if ((attrs || bind$$1) && !children) {
  10323. res += ",null";
  10324. }
  10325. if (attrs) {
  10326. res += "," + attrs;
  10327. }
  10328. if (bind$$1) {
  10329. res += (attrs ? '' : ',null') + "," + bind$$1;
  10330. }
  10331. return res + ')'
  10332. }
  10333. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  10334. function genComponent (
  10335. componentName,
  10336. el,
  10337. state
  10338. ) {
  10339. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10340. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  10341. }
  10342. function genProps (props) {
  10343. var staticProps = "";
  10344. var dynamicProps = "";
  10345. for (var i = 0; i < props.length; i++) {
  10346. var prop = props[i];
  10347. var value = transformSpecialNewlines(prop.value);
  10348. if (prop.dynamic) {
  10349. dynamicProps += (prop.name) + "," + value + ",";
  10350. } else {
  10351. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  10352. }
  10353. }
  10354. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  10355. if (dynamicProps) {
  10356. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  10357. } else {
  10358. return staticProps
  10359. }
  10360. }
  10361. // #3895, #4268
  10362. function transformSpecialNewlines (text) {
  10363. return text
  10364. .replace(/\u2028/g, '\\u2028')
  10365. .replace(/\u2029/g, '\\u2029')
  10366. }
  10367. /* */
  10368. // these keywords should not appear inside expressions, but operators like
  10369. // typeof, instanceof and in are allowed
  10370. var prohibitedKeywordRE = new RegExp('\\b' + (
  10371. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  10372. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  10373. 'extends,finally,continue,debugger,function,arguments'
  10374. ).split(',').join('\\b|\\b') + '\\b');
  10375. // these unary operators should not be used as property/method names
  10376. var unaryOperatorsRE = new RegExp('\\b' + (
  10377. 'delete,typeof,void'
  10378. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  10379. // strip strings in expressions
  10380. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  10381. // detect problematic expressions in a template
  10382. function detectErrors (ast, warn) {
  10383. if (ast) {
  10384. checkNode(ast, warn);
  10385. }
  10386. }
  10387. function checkNode (node, warn) {
  10388. if (node.type === 1) {
  10389. for (var name in node.attrsMap) {
  10390. if (dirRE.test(name)) {
  10391. var value = node.attrsMap[name];
  10392. if (value) {
  10393. var range = node.rawAttrsMap[name];
  10394. if (name === 'v-for') {
  10395. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  10396. } else if (name === 'v-slot' || name[0] === '#') {
  10397. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  10398. } else if (onRE.test(name)) {
  10399. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  10400. } else {
  10401. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  10402. }
  10403. }
  10404. }
  10405. }
  10406. if (node.children) {
  10407. for (var i = 0; i < node.children.length; i++) {
  10408. checkNode(node.children[i], warn);
  10409. }
  10410. }
  10411. } else if (node.type === 2) {
  10412. checkExpression(node.expression, node.text, warn, node);
  10413. }
  10414. }
  10415. function checkEvent (exp, text, warn, range) {
  10416. var stripped = exp.replace(stripStringRE, '');
  10417. var keywordMatch = stripped.match(unaryOperatorsRE);
  10418. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  10419. warn(
  10420. "avoid using JavaScript unary operator as property name: " +
  10421. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  10422. range
  10423. );
  10424. }
  10425. checkExpression(exp, text, warn, range);
  10426. }
  10427. function checkFor (node, text, warn, range) {
  10428. checkExpression(node.for || '', text, warn, range);
  10429. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  10430. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  10431. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  10432. }
  10433. function checkIdentifier (
  10434. ident,
  10435. type,
  10436. text,
  10437. warn,
  10438. range
  10439. ) {
  10440. if (typeof ident === 'string') {
  10441. try {
  10442. new Function(("var " + ident + "=_"));
  10443. } catch (e) {
  10444. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  10445. }
  10446. }
  10447. }
  10448. function checkExpression (exp, text, warn, range) {
  10449. try {
  10450. new Function(("return " + exp));
  10451. } catch (e) {
  10452. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  10453. if (keywordMatch) {
  10454. warn(
  10455. "avoid using JavaScript keyword as property name: " +
  10456. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  10457. range
  10458. );
  10459. } else {
  10460. warn(
  10461. "invalid expression: " + (e.message) + " in\n\n" +
  10462. " " + exp + "\n\n" +
  10463. " Raw expression: " + (text.trim()) + "\n",
  10464. range
  10465. );
  10466. }
  10467. }
  10468. }
  10469. function checkFunctionParameterExpression (exp, text, warn, range) {
  10470. try {
  10471. new Function(exp, '');
  10472. } catch (e) {
  10473. warn(
  10474. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  10475. " " + exp + "\n\n" +
  10476. " Raw expression: " + (text.trim()) + "\n",
  10477. range
  10478. );
  10479. }
  10480. }
  10481. /* */
  10482. var range = 2;
  10483. function generateCodeFrame (
  10484. source,
  10485. start,
  10486. end
  10487. ) {
  10488. if ( start === void 0 ) start = 0;
  10489. if ( end === void 0 ) end = source.length;
  10490. var lines = source.split(/\r?\n/);
  10491. var count = 0;
  10492. var res = [];
  10493. for (var i = 0; i < lines.length; i++) {
  10494. count += lines[i].length + 1;
  10495. if (count >= start) {
  10496. for (var j = i - range; j <= i + range || end > count; j++) {
  10497. if (j < 0 || j >= lines.length) { continue }
  10498. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  10499. var lineLength = lines[j].length;
  10500. if (j === i) {
  10501. // push underline
  10502. var pad = start - (count - lineLength) + 1;
  10503. var length = end > count ? lineLength - pad : end - start;
  10504. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  10505. } else if (j > i) {
  10506. if (end > count) {
  10507. var length$1 = Math.min(end - count, lineLength);
  10508. res.push(" | " + repeat$1("^", length$1));
  10509. }
  10510. count += lineLength + 1;
  10511. }
  10512. }
  10513. break
  10514. }
  10515. }
  10516. return res.join('\n')
  10517. }
  10518. function repeat$1 (str, n) {
  10519. var result = '';
  10520. if (n > 0) {
  10521. while (true) { // eslint-disable-line
  10522. if (n & 1) { result += str; }
  10523. n >>>= 1;
  10524. if (n <= 0) { break }
  10525. str += str;
  10526. }
  10527. }
  10528. return result
  10529. }
  10530. /* */
  10531. function createFunction (code, errors) {
  10532. try {
  10533. return new Function(code)
  10534. } catch (err) {
  10535. errors.push({ err: err, code: code });
  10536. return noop
  10537. }
  10538. }
  10539. function createCompileToFunctionFn (compile) {
  10540. var cache = Object.create(null);
  10541. return function compileToFunctions (
  10542. template,
  10543. options,
  10544. vm
  10545. ) {
  10546. options = extend({}, options);
  10547. var warn$$1 = options.warn || warn;
  10548. delete options.warn;
  10549. /* istanbul ignore if */
  10550. {
  10551. // detect possible CSP restriction
  10552. try {
  10553. new Function('return 1');
  10554. } catch (e) {
  10555. if (e.toString().match(/unsafe-eval|CSP/)) {
  10556. warn$$1(
  10557. 'It seems you are using the standalone build of Vue.js in an ' +
  10558. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  10559. 'The template compiler cannot work in this environment. Consider ' +
  10560. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  10561. 'templates into render functions.'
  10562. );
  10563. }
  10564. }
  10565. }
  10566. // check cache
  10567. var key = options.delimiters
  10568. ? String(options.delimiters) + template
  10569. : template;
  10570. if (cache[key]) {
  10571. return cache[key]
  10572. }
  10573. // compile
  10574. var compiled = compile(template, options);
  10575. // check compilation errors/tips
  10576. {
  10577. if (compiled.errors && compiled.errors.length) {
  10578. if (options.outputSourceRange) {
  10579. compiled.errors.forEach(function (e) {
  10580. warn$$1(
  10581. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  10582. generateCodeFrame(template, e.start, e.end),
  10583. vm
  10584. );
  10585. });
  10586. } else {
  10587. warn$$1(
  10588. "Error compiling template:\n\n" + template + "\n\n" +
  10589. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  10590. vm
  10591. );
  10592. }
  10593. }
  10594. if (compiled.tips && compiled.tips.length) {
  10595. if (options.outputSourceRange) {
  10596. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  10597. } else {
  10598. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  10599. }
  10600. }
  10601. }
  10602. // turn code into functions
  10603. var res = {};
  10604. var fnGenErrors = [];
  10605. res.render = createFunction(compiled.render, fnGenErrors);
  10606. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  10607. return createFunction(code, fnGenErrors)
  10608. });
  10609. // check function generation errors.
  10610. // this should only happen if there is a bug in the compiler itself.
  10611. // mostly for codegen development use
  10612. /* istanbul ignore if */
  10613. {
  10614. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  10615. warn$$1(
  10616. "Failed to generate render function:\n\n" +
  10617. fnGenErrors.map(function (ref) {
  10618. var err = ref.err;
  10619. var code = ref.code;
  10620. return ((err.toString()) + " in\n\n" + code + "\n");
  10621. }).join('\n'),
  10622. vm
  10623. );
  10624. }
  10625. }
  10626. return (cache[key] = res)
  10627. }
  10628. }
  10629. /* */
  10630. function createCompilerCreator (baseCompile) {
  10631. return function createCompiler (baseOptions) {
  10632. function compile (
  10633. template,
  10634. options
  10635. ) {
  10636. var finalOptions = Object.create(baseOptions);
  10637. var errors = [];
  10638. var tips = [];
  10639. var warn = function (msg, range, tip) {
  10640. (tip ? tips : errors).push(msg);
  10641. };
  10642. if (options) {
  10643. if (options.outputSourceRange) {
  10644. // $flow-disable-line
  10645. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  10646. warn = function (msg, range, tip) {
  10647. var data = { msg: msg };
  10648. if (range) {
  10649. if (range.start != null) {
  10650. data.start = range.start + leadingSpaceLength;
  10651. }
  10652. if (range.end != null) {
  10653. data.end = range.end + leadingSpaceLength;
  10654. }
  10655. }
  10656. (tip ? tips : errors).push(data);
  10657. };
  10658. }
  10659. // merge custom modules
  10660. if (options.modules) {
  10661. finalOptions.modules =
  10662. (baseOptions.modules || []).concat(options.modules);
  10663. }
  10664. // merge custom directives
  10665. if (options.directives) {
  10666. finalOptions.directives = extend(
  10667. Object.create(baseOptions.directives || null),
  10668. options.directives
  10669. );
  10670. }
  10671. // copy other options
  10672. for (var key in options) {
  10673. if (key !== 'modules' && key !== 'directives') {
  10674. finalOptions[key] = options[key];
  10675. }
  10676. }
  10677. }
  10678. finalOptions.warn = warn;
  10679. var compiled = baseCompile(template.trim(), finalOptions);
  10680. {
  10681. detectErrors(compiled.ast, warn);
  10682. }
  10683. compiled.errors = errors;
  10684. compiled.tips = tips;
  10685. return compiled
  10686. }
  10687. return {
  10688. compile: compile,
  10689. compileToFunctions: createCompileToFunctionFn(compile)
  10690. }
  10691. }
  10692. }
  10693. /* */
  10694. // `createCompilerCreator` allows creating compilers that use alternative
  10695. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  10696. // Here we just export a default compiler using the default parts.
  10697. var createCompiler = createCompilerCreator(function baseCompile (
  10698. template,
  10699. options
  10700. ) {
  10701. var ast = parse(template.trim(), options);
  10702. if (options.optimize !== false) {
  10703. optimize(ast, options);
  10704. }
  10705. var code = generate(ast, options);
  10706. return {
  10707. ast: ast,
  10708. render: code.render,
  10709. staticRenderFns: code.staticRenderFns
  10710. }
  10711. });
  10712. /* */
  10713. var ref$1 = createCompiler(baseOptions);
  10714. var compile = ref$1.compile;
  10715. var compileToFunctions = ref$1.compileToFunctions;
  10716. /* */
  10717. // check whether current browser encodes a char inside attribute values
  10718. var div;
  10719. function getShouldDecode (href) {
  10720. div = div || document.createElement('div');
  10721. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  10722. return div.innerHTML.indexOf('&#10;') > 0
  10723. }
  10724. // #3663: IE encodes newlines inside attribute values while other browsers don't
  10725. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  10726. // #6828: chrome encodes content in a[href]
  10727. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  10728. /* */
  10729. var idToTemplate = cached(function (id) {
  10730. var el = query(id);
  10731. return el && el.innerHTML
  10732. });
  10733. var mount = Vue.prototype.$mount;
  10734. Vue.prototype.$mount = function (
  10735. el,
  10736. hydrating
  10737. ) {
  10738. el = el && query(el);
  10739. /* istanbul ignore if */
  10740. if (el === document.body || el === document.documentElement) {
  10741. warn(
  10742. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  10743. );
  10744. return this
  10745. }
  10746. var options = this.$options;
  10747. // resolve template/el and convert to render function
  10748. if (!options.render) {
  10749. var template = options.template;
  10750. if (template) {
  10751. if (typeof template === 'string') {
  10752. if (template.charAt(0) === '#') {
  10753. template = idToTemplate(template);
  10754. /* istanbul ignore if */
  10755. if (!template) {
  10756. warn(
  10757. ("Template element not found or is empty: " + (options.template)),
  10758. this
  10759. );
  10760. }
  10761. }
  10762. } else if (template.nodeType) {
  10763. template = template.innerHTML;
  10764. } else {
  10765. {
  10766. warn('invalid template option:' + template, this);
  10767. }
  10768. return this
  10769. }
  10770. } else if (el) {
  10771. template = getOuterHTML(el);
  10772. }
  10773. if (template) {
  10774. /* istanbul ignore if */
  10775. if (config.performance && mark) {
  10776. mark('compile');
  10777. }
  10778. var ref = compileToFunctions(template, {
  10779. outputSourceRange: "development" !== 'production',
  10780. shouldDecodeNewlines: shouldDecodeNewlines,
  10781. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  10782. delimiters: options.delimiters,
  10783. comments: options.comments
  10784. }, this);
  10785. var render = ref.render;
  10786. var staticRenderFns = ref.staticRenderFns;
  10787. options.render = render;
  10788. options.staticRenderFns = staticRenderFns;
  10789. /* istanbul ignore if */
  10790. if (config.performance && mark) {
  10791. mark('compile end');
  10792. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  10793. }
  10794. }
  10795. }
  10796. return mount.call(this, el, hydrating)
  10797. };
  10798. /**
  10799. * Get outerHTML of elements, taking care
  10800. * of SVG elements in IE as well.
  10801. */
  10802. function getOuterHTML (el) {
  10803. if (el.outerHTML) {
  10804. return el.outerHTML
  10805. } else {
  10806. var container = document.createElement('div');
  10807. container.appendChild(el.cloneNode(true));
  10808. return container.innerHTML
  10809. }
  10810. }
  10811. Vue.compile = compileToFunctions;
  10812. module.exports = Vue;