vue.runtime.js 221 KB

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