vue.runtime.common.dev.js 206 KB

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