Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

vue.common.js 286KB

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