vue.runtime.esm.js 214 KB

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