vue.js 230 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962
  1. /*!
  2. * Vue.js v0.12.10
  3. * (c) 2015 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function webpackUniversalModuleDefinition(root, factory) {
  7. if(typeof exports === 'object' && typeof module === 'object')
  8. module.exports = factory();
  9. else if(typeof define === 'function' && define.amd)
  10. define(factory);
  11. else if(typeof exports === 'object')
  12. exports["Vue"] = factory();
  13. else
  14. root["Vue"] = factory();
  15. })(this, function() {
  16. return /******/ (function(modules) { // webpackBootstrap
  17. /******/ // The module cache
  18. /******/ var installedModules = {};
  19. /******/ // The require function
  20. /******/ function __webpack_require__(moduleId) {
  21. /******/ // Check if module is in cache
  22. /******/ if(installedModules[moduleId])
  23. /******/ return installedModules[moduleId].exports;
  24. /******/ // Create a new module (and put it into the cache)
  25. /******/ var module = installedModules[moduleId] = {
  26. /******/ exports: {},
  27. /******/ id: moduleId,
  28. /******/ loaded: false
  29. /******/ };
  30. /******/ // Execute the module function
  31. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  32. /******/ // Flag the module as loaded
  33. /******/ module.loaded = true;
  34. /******/ // Return the exports of the module
  35. /******/ return module.exports;
  36. /******/ }
  37. /******/ // expose the modules object (__webpack_modules__)
  38. /******/ __webpack_require__.m = modules;
  39. /******/ // expose the module cache
  40. /******/ __webpack_require__.c = installedModules;
  41. /******/ // __webpack_public_path__
  42. /******/ __webpack_require__.p = "";
  43. /******/ // Load entry module and return exports
  44. /******/ return __webpack_require__(0);
  45. /******/ })
  46. /************************************************************************/
  47. /******/ ([
  48. /* 0 */
  49. /***/ function(module, exports, __webpack_require__) {
  50. var _ = __webpack_require__(1)
  51. var extend = _.extend
  52. /**
  53. * The exposed Vue constructor.
  54. *
  55. * API conventions:
  56. * - public API methods/properties are prefiexed with `$`
  57. * - internal methods/properties are prefixed with `_`
  58. * - non-prefixed properties are assumed to be proxied user
  59. * data.
  60. *
  61. * @constructor
  62. * @param {Object} [options]
  63. * @public
  64. */
  65. function Vue (options) {
  66. this._init(options)
  67. }
  68. /**
  69. * Mixin global API
  70. */
  71. extend(Vue, __webpack_require__(9))
  72. /**
  73. * Vue and every constructor that extends Vue has an
  74. * associated options object, which can be accessed during
  75. * compilation steps as `this.constructor.options`.
  76. *
  77. * These can be seen as the default options of every
  78. * Vue instance.
  79. */
  80. Vue.options = {
  81. replace: true,
  82. directives: __webpack_require__(25),
  83. elementDirectives: __webpack_require__(47),
  84. filters: __webpack_require__(50),
  85. transitions: {},
  86. components: {},
  87. partials: {}
  88. }
  89. /**
  90. * Build up the prototype
  91. */
  92. var p = Vue.prototype
  93. /**
  94. * $data has a setter which does a bunch of
  95. * teardown/setup work
  96. */
  97. Object.defineProperty(p, '$data', {
  98. get: function () {
  99. return this._data
  100. },
  101. set: function (newData) {
  102. if (newData !== this._data) {
  103. this._setData(newData)
  104. }
  105. }
  106. })
  107. /**
  108. * Mixin internal instance methods
  109. */
  110. extend(p, __webpack_require__(52))
  111. extend(p, __webpack_require__(53))
  112. extend(p, __webpack_require__(54))
  113. extend(p, __webpack_require__(58))
  114. extend(p, __webpack_require__(60))
  115. /**
  116. * Mixin public API methods
  117. */
  118. extend(p, __webpack_require__(61))
  119. extend(p, __webpack_require__(62))
  120. extend(p, __webpack_require__(63))
  121. extend(p, __webpack_require__(64))
  122. extend(p, __webpack_require__(65))
  123. module.exports = _.Vue = Vue
  124. /***/ },
  125. /* 1 */
  126. /***/ function(module, exports, __webpack_require__) {
  127. var lang = __webpack_require__(2)
  128. var extend = lang.extend
  129. extend(exports, lang)
  130. extend(exports, __webpack_require__(3))
  131. extend(exports, __webpack_require__(4))
  132. extend(exports, __webpack_require__(6))
  133. extend(exports, __webpack_require__(7))
  134. extend(exports, __webpack_require__(8))
  135. /***/ },
  136. /* 2 */
  137. /***/ function(module, exports) {
  138. /**
  139. * Check is a string starts with $ or _
  140. *
  141. * @param {String} str
  142. * @return {Boolean}
  143. */
  144. exports.isReserved = function (str) {
  145. var c = (str + '').charCodeAt(0)
  146. return c === 0x24 || c === 0x5F
  147. }
  148. /**
  149. * Guard text output, make sure undefined outputs
  150. * empty string
  151. *
  152. * @param {*} value
  153. * @return {String}
  154. */
  155. exports.toString = function (value) {
  156. return value == null
  157. ? ''
  158. : value.toString()
  159. }
  160. /**
  161. * Check and convert possible numeric strings to numbers
  162. * before setting back to data
  163. *
  164. * @param {*} value
  165. * @return {*|Number}
  166. */
  167. exports.toNumber = function (value) {
  168. if (typeof value !== 'string') {
  169. return value
  170. } else {
  171. var parsed = Number(value)
  172. return isNaN(parsed)
  173. ? value
  174. : parsed
  175. }
  176. }
  177. /**
  178. * Convert string boolean literals into real booleans.
  179. *
  180. * @param {*} value
  181. * @return {*|Boolean}
  182. */
  183. exports.toBoolean = function (value) {
  184. return value === 'true'
  185. ? true
  186. : value === 'false'
  187. ? false
  188. : value
  189. }
  190. /**
  191. * Strip quotes from a string
  192. *
  193. * @param {String} str
  194. * @return {String | false}
  195. */
  196. exports.stripQuotes = function (str) {
  197. var a = str.charCodeAt(0)
  198. var b = str.charCodeAt(str.length - 1)
  199. return a === b && (a === 0x22 || a === 0x27)
  200. ? str.slice(1, -1)
  201. : false
  202. }
  203. /**
  204. * Camelize a hyphen-delmited string.
  205. *
  206. * @param {String} str
  207. * @return {String}
  208. */
  209. exports.camelize = function (str) {
  210. return str.replace(/-(\w)/g, toUpper)
  211. }
  212. function toUpper (_, c) {
  213. return c ? c.toUpperCase() : ''
  214. }
  215. /**
  216. * Hyphenate a camelCase string.
  217. *
  218. * @param {String} str
  219. * @return {String}
  220. */
  221. exports.hyphenate = function (str) {
  222. return str
  223. .replace(/([a-z\d])([A-Z])/g, '$1-$2')
  224. .toLowerCase()
  225. }
  226. /**
  227. * Converts hyphen/underscore/slash delimitered names into
  228. * camelized classNames.
  229. *
  230. * e.g. my-component => MyComponent
  231. * some_else => SomeElse
  232. * some/comp => SomeComp
  233. *
  234. * @param {String} str
  235. * @return {String}
  236. */
  237. var classifyRE = /(?:^|[-_\/])(\w)/g
  238. exports.classify = function (str) {
  239. return str.replace(classifyRE, toUpper)
  240. }
  241. /**
  242. * Simple bind, faster than native
  243. *
  244. * @param {Function} fn
  245. * @param {Object} ctx
  246. * @return {Function}
  247. */
  248. exports.bind = function (fn, ctx) {
  249. return function (a) {
  250. var l = arguments.length
  251. return l
  252. ? l > 1
  253. ? fn.apply(ctx, arguments)
  254. : fn.call(ctx, a)
  255. : fn.call(ctx)
  256. }
  257. }
  258. /**
  259. * Convert an Array-like object to a real Array.
  260. *
  261. * @param {Array-like} list
  262. * @param {Number} [start] - start index
  263. * @return {Array}
  264. */
  265. exports.toArray = function (list, start) {
  266. start = start || 0
  267. var i = list.length - start
  268. var ret = new Array(i)
  269. while (i--) {
  270. ret[i] = list[i + start]
  271. }
  272. return ret
  273. }
  274. /**
  275. * Mix properties into target object.
  276. *
  277. * @param {Object} to
  278. * @param {Object} from
  279. */
  280. exports.extend = function (to, from) {
  281. for (var key in from) {
  282. to[key] = from[key]
  283. }
  284. return to
  285. }
  286. /**
  287. * Quick object check - this is primarily used to tell
  288. * Objects from primitive values when we know the value
  289. * is a JSON-compliant type.
  290. *
  291. * @param {*} obj
  292. * @return {Boolean}
  293. */
  294. exports.isObject = function (obj) {
  295. return obj !== null && typeof obj === 'object'
  296. }
  297. /**
  298. * Strict object type check. Only returns true
  299. * for plain JavaScript objects.
  300. *
  301. * @param {*} obj
  302. * @return {Boolean}
  303. */
  304. var toString = Object.prototype.toString
  305. exports.isPlainObject = function (obj) {
  306. return toString.call(obj) === '[object Object]'
  307. }
  308. /**
  309. * Array type check.
  310. *
  311. * @param {*} obj
  312. * @return {Boolean}
  313. */
  314. exports.isArray = Array.isArray
  315. /**
  316. * Define a non-enumerable property
  317. *
  318. * @param {Object} obj
  319. * @param {String} key
  320. * @param {*} val
  321. * @param {Boolean} [enumerable]
  322. */
  323. exports.define = function (obj, key, val, enumerable) {
  324. Object.defineProperty(obj, key, {
  325. value: val,
  326. enumerable: !!enumerable,
  327. writable: true,
  328. configurable: true
  329. })
  330. }
  331. /**
  332. * Debounce a function so it only gets called after the
  333. * input stops arriving after the given wait period.
  334. *
  335. * @param {Function} func
  336. * @param {Number} wait
  337. * @return {Function} - the debounced function
  338. */
  339. exports.debounce = function (func, wait) {
  340. var timeout, args, context, timestamp, result
  341. var later = function () {
  342. var last = Date.now() - timestamp
  343. if (last < wait && last >= 0) {
  344. timeout = setTimeout(later, wait - last)
  345. } else {
  346. timeout = null
  347. result = func.apply(context, args)
  348. if (!timeout) context = args = null
  349. }
  350. }
  351. return function () {
  352. context = this
  353. args = arguments
  354. timestamp = Date.now()
  355. if (!timeout) {
  356. timeout = setTimeout(later, wait)
  357. }
  358. return result
  359. }
  360. }
  361. /**
  362. * Manual indexOf because it's slightly faster than
  363. * native.
  364. *
  365. * @param {Array} arr
  366. * @param {*} obj
  367. */
  368. exports.indexOf = function (arr, obj) {
  369. for (var i = 0, l = arr.length; i < l; i++) {
  370. if (arr[i] === obj) return i
  371. }
  372. return -1
  373. }
  374. /**
  375. * Make a cancellable version of an async callback.
  376. *
  377. * @param {Function} fn
  378. * @return {Function}
  379. */
  380. exports.cancellable = function (fn) {
  381. var cb = function () {
  382. if (!cb.cancelled) {
  383. return fn.apply(this, arguments)
  384. }
  385. }
  386. cb.cancel = function () {
  387. cb.cancelled = true
  388. }
  389. return cb
  390. }
  391. /***/ },
  392. /* 3 */
  393. /***/ function(module, exports) {
  394. // can we use __proto__?
  395. exports.hasProto = '__proto__' in {}
  396. // Browser environment sniffing
  397. var inBrowser = exports.inBrowser =
  398. typeof window !== 'undefined' &&
  399. Object.prototype.toString.call(window) !== '[object Object]'
  400. exports.isIE9 =
  401. inBrowser &&
  402. navigator.userAgent.toLowerCase().indexOf('msie 9.0') > 0
  403. exports.isAndroid =
  404. inBrowser &&
  405. navigator.userAgent.toLowerCase().indexOf('android') > 0
  406. // Transition property/event sniffing
  407. if (inBrowser && !exports.isIE9) {
  408. var isWebkitTrans =
  409. window.ontransitionend === undefined &&
  410. window.onwebkittransitionend !== undefined
  411. var isWebkitAnim =
  412. window.onanimationend === undefined &&
  413. window.onwebkitanimationend !== undefined
  414. exports.transitionProp = isWebkitTrans
  415. ? 'WebkitTransition'
  416. : 'transition'
  417. exports.transitionEndEvent = isWebkitTrans
  418. ? 'webkitTransitionEnd'
  419. : 'transitionend'
  420. exports.animationProp = isWebkitAnim
  421. ? 'WebkitAnimation'
  422. : 'animation'
  423. exports.animationEndEvent = isWebkitAnim
  424. ? 'webkitAnimationEnd'
  425. : 'animationend'
  426. }
  427. /**
  428. * Defer a task to execute it asynchronously. Ideally this
  429. * should be executed as a microtask, so we leverage
  430. * MutationObserver if it's available, and fallback to
  431. * setTimeout(0).
  432. *
  433. * @param {Function} cb
  434. * @param {Object} ctx
  435. */
  436. exports.nextTick = (function () {
  437. var callbacks = []
  438. var pending = false
  439. var timerFunc
  440. function handle () {
  441. pending = false
  442. var copies = callbacks.slice(0)
  443. callbacks = []
  444. for (var i = 0; i < copies.length; i++) {
  445. copies[i]()
  446. }
  447. }
  448. /* istanbul ignore if */
  449. if (typeof MutationObserver !== 'undefined') {
  450. var counter = 1
  451. var observer = new MutationObserver(handle)
  452. var textNode = document.createTextNode(counter)
  453. observer.observe(textNode, {
  454. characterData: true
  455. })
  456. timerFunc = function () {
  457. counter = (counter + 1) % 2
  458. textNode.data = counter
  459. }
  460. } else {
  461. timerFunc = setTimeout
  462. }
  463. return function (cb, ctx) {
  464. var func = ctx
  465. ? function () { cb.call(ctx) }
  466. : cb
  467. callbacks.push(func)
  468. if (pending) return
  469. pending = true
  470. timerFunc(handle, 0)
  471. }
  472. })()
  473. /***/ },
  474. /* 4 */
  475. /***/ function(module, exports, __webpack_require__) {
  476. var _ = __webpack_require__(1)
  477. var config = __webpack_require__(5)
  478. /**
  479. * Query an element selector if it's not an element already.
  480. *
  481. * @param {String|Element} el
  482. * @return {Element}
  483. */
  484. exports.query = function (el) {
  485. if (typeof el === 'string') {
  486. var selector = el
  487. el = document.querySelector(el)
  488. if (!el) {
  489. ("development") !== 'production' && _.warn(
  490. 'Cannot find element: ' + selector
  491. )
  492. }
  493. }
  494. return el
  495. }
  496. /**
  497. * Check if a node is in the document.
  498. * Note: document.documentElement.contains should work here
  499. * but always returns false for comment nodes in phantomjs,
  500. * making unit tests difficult. This is fixed byy doing the
  501. * contains() check on the node's parentNode instead of
  502. * the node itself.
  503. *
  504. * @param {Node} node
  505. * @return {Boolean}
  506. */
  507. exports.inDoc = function (node) {
  508. var doc = document.documentElement
  509. var parent = node && node.parentNode
  510. return doc === node ||
  511. doc === parent ||
  512. !!(parent && parent.nodeType === 1 && (doc.contains(parent)))
  513. }
  514. /**
  515. * Extract an attribute from a node.
  516. *
  517. * @param {Node} node
  518. * @param {String} attr
  519. */
  520. exports.attr = function (node, attr) {
  521. attr = config.prefix + attr
  522. var val = node.getAttribute(attr)
  523. if (val !== null) {
  524. node.removeAttribute(attr)
  525. }
  526. return val
  527. }
  528. /**
  529. * Insert el before target
  530. *
  531. * @param {Element} el
  532. * @param {Element} target
  533. */
  534. exports.before = function (el, target) {
  535. target.parentNode.insertBefore(el, target)
  536. }
  537. /**
  538. * Insert el after target
  539. *
  540. * @param {Element} el
  541. * @param {Element} target
  542. */
  543. exports.after = function (el, target) {
  544. if (target.nextSibling) {
  545. exports.before(el, target.nextSibling)
  546. } else {
  547. target.parentNode.appendChild(el)
  548. }
  549. }
  550. /**
  551. * Remove el from DOM
  552. *
  553. * @param {Element} el
  554. */
  555. exports.remove = function (el) {
  556. el.parentNode.removeChild(el)
  557. }
  558. /**
  559. * Prepend el to target
  560. *
  561. * @param {Element} el
  562. * @param {Element} target
  563. */
  564. exports.prepend = function (el, target) {
  565. if (target.firstChild) {
  566. exports.before(el, target.firstChild)
  567. } else {
  568. target.appendChild(el)
  569. }
  570. }
  571. /**
  572. * Replace target with el
  573. *
  574. * @param {Element} target
  575. * @param {Element} el
  576. */
  577. exports.replace = function (target, el) {
  578. var parent = target.parentNode
  579. if (parent) {
  580. parent.replaceChild(el, target)
  581. }
  582. }
  583. /**
  584. * Add event listener shorthand.
  585. *
  586. * @param {Element} el
  587. * @param {String} event
  588. * @param {Function} cb
  589. */
  590. exports.on = function (el, event, cb) {
  591. el.addEventListener(event, cb)
  592. }
  593. /**
  594. * Remove event listener shorthand.
  595. *
  596. * @param {Element} el
  597. * @param {String} event
  598. * @param {Function} cb
  599. */
  600. exports.off = function (el, event, cb) {
  601. el.removeEventListener(event, cb)
  602. }
  603. /**
  604. * Add class with compatibility for IE & SVG
  605. *
  606. * @param {Element} el
  607. * @param {Strong} cls
  608. */
  609. exports.addClass = function (el, cls) {
  610. if (el.classList) {
  611. el.classList.add(cls)
  612. } else {
  613. var cur = ' ' + (el.getAttribute('class') || '') + ' '
  614. if (cur.indexOf(' ' + cls + ' ') < 0) {
  615. el.setAttribute('class', (cur + cls).trim())
  616. }
  617. }
  618. }
  619. /**
  620. * Remove class with compatibility for IE & SVG
  621. *
  622. * @param {Element} el
  623. * @param {Strong} cls
  624. */
  625. exports.removeClass = function (el, cls) {
  626. if (el.classList) {
  627. el.classList.remove(cls)
  628. } else {
  629. var cur = ' ' + (el.getAttribute('class') || '') + ' '
  630. var tar = ' ' + cls + ' '
  631. while (cur.indexOf(tar) >= 0) {
  632. cur = cur.replace(tar, ' ')
  633. }
  634. el.setAttribute('class', cur.trim())
  635. }
  636. }
  637. /**
  638. * Extract raw content inside an element into a temporary
  639. * container div
  640. *
  641. * @param {Element} el
  642. * @param {Boolean} asFragment
  643. * @return {Element}
  644. */
  645. exports.extractContent = function (el, asFragment) {
  646. var child
  647. var rawContent
  648. /* istanbul ignore if */
  649. if (
  650. exports.isTemplate(el) &&
  651. el.content instanceof DocumentFragment
  652. ) {
  653. el = el.content
  654. }
  655. if (el.hasChildNodes()) {
  656. exports.trimNode(el)
  657. rawContent = asFragment
  658. ? document.createDocumentFragment()
  659. : document.createElement('div')
  660. /* eslint-disable no-cond-assign */
  661. while (child = el.firstChild) {
  662. /* eslint-enable no-cond-assign */
  663. rawContent.appendChild(child)
  664. }
  665. }
  666. return rawContent
  667. }
  668. /**
  669. * Trim possible empty head/tail textNodes inside a parent.
  670. *
  671. * @param {Node} node
  672. */
  673. exports.trimNode = function (node) {
  674. trim(node, node.firstChild)
  675. trim(node, node.lastChild)
  676. }
  677. function trim (parent, node) {
  678. if (node && node.nodeType === 3 && !node.data.trim()) {
  679. parent.removeChild(node)
  680. }
  681. }
  682. /**
  683. * Check if an element is a template tag.
  684. * Note if the template appears inside an SVG its tagName
  685. * will be in lowercase.
  686. *
  687. * @param {Element} el
  688. */
  689. exports.isTemplate = function (el) {
  690. return el.tagName &&
  691. el.tagName.toLowerCase() === 'template'
  692. }
  693. /**
  694. * Create an "anchor" for performing dom insertion/removals.
  695. * This is used in a number of scenarios:
  696. * - fragment instance
  697. * - v-html
  698. * - v-if
  699. * - component
  700. * - repeat
  701. *
  702. * @param {String} content
  703. * @param {Boolean} persist - IE trashes empty textNodes on
  704. * cloneNode(true), so in certain
  705. * cases the anchor needs to be
  706. * non-empty to be persisted in
  707. * templates.
  708. * @return {Comment|Text}
  709. */
  710. exports.createAnchor = function (content, persist) {
  711. return config.debug
  712. ? document.createComment(content)
  713. : document.createTextNode(persist ? ' ' : '')
  714. }
  715. /***/ },
  716. /* 5 */
  717. /***/ function(module, exports) {
  718. module.exports = {
  719. /**
  720. * The prefix to look for when parsing directives.
  721. *
  722. * @type {String}
  723. */
  724. prefix: 'v-',
  725. /**
  726. * Whether to print debug messages.
  727. * Also enables stack trace for warnings.
  728. *
  729. * @type {Boolean}
  730. */
  731. debug: false,
  732. /**
  733. * Strict mode.
  734. * Disables asset lookup in the view parent chain.
  735. */
  736. strict: false,
  737. /**
  738. * Whether to suppress warnings.
  739. *
  740. * @type {Boolean}
  741. */
  742. silent: false,
  743. /**
  744. * Whether allow observer to alter data objects'
  745. * __proto__.
  746. *
  747. * @type {Boolean}
  748. */
  749. proto: true,
  750. /**
  751. * Whether to parse mustache tags in templates.
  752. *
  753. * @type {Boolean}
  754. */
  755. interpolate: true,
  756. /**
  757. * Whether to use async rendering.
  758. */
  759. async: true,
  760. /**
  761. * Whether to warn against errors caught when evaluating
  762. * expressions.
  763. */
  764. warnExpressionErrors: true,
  765. /**
  766. * Internal flag to indicate the delimiters have been
  767. * changed.
  768. *
  769. * @type {Boolean}
  770. */
  771. _delimitersChanged: true,
  772. /**
  773. * List of asset types that a component can own.
  774. *
  775. * @type {Array}
  776. */
  777. _assetTypes: [
  778. 'component',
  779. 'directive',
  780. 'elementDirective',
  781. 'filter',
  782. 'transition',
  783. 'partial'
  784. ],
  785. /**
  786. * prop binding modes
  787. */
  788. _propBindingModes: {
  789. ONE_WAY: 0,
  790. TWO_WAY: 1,
  791. ONE_TIME: 2
  792. },
  793. /**
  794. * Max circular updates allowed in a batcher flush cycle.
  795. */
  796. _maxUpdateCount: 100
  797. }
  798. /**
  799. * Interpolation delimiters.
  800. * We need to mark the changed flag so that the text parser
  801. * knows it needs to recompile the regex.
  802. *
  803. * @type {Array<String>}
  804. */
  805. var delimiters = ['{{', '}}']
  806. Object.defineProperty(module.exports, 'delimiters', {
  807. get: function () {
  808. return delimiters
  809. },
  810. set: function (val) {
  811. delimiters = val
  812. this._delimitersChanged = true
  813. }
  814. })
  815. /***/ },
  816. /* 6 */
  817. /***/ function(module, exports, __webpack_require__) {
  818. var _ = __webpack_require__(1)
  819. var config = __webpack_require__(5)
  820. var extend = _.extend
  821. /**
  822. * Option overwriting strategies are functions that handle
  823. * how to merge a parent option value and a child option
  824. * value into the final value.
  825. *
  826. * All strategy functions follow the same signature:
  827. *
  828. * @param {*} parentVal
  829. * @param {*} childVal
  830. * @param {Vue} [vm]
  831. */
  832. var strats = Object.create(null)
  833. /**
  834. * Helper that recursively merges two data objects together.
  835. */
  836. function mergeData (to, from) {
  837. var key, toVal, fromVal
  838. for (key in from) {
  839. toVal = to[key]
  840. fromVal = from[key]
  841. if (!to.hasOwnProperty(key)) {
  842. to.$add(key, fromVal)
  843. } else if (_.isObject(toVal) && _.isObject(fromVal)) {
  844. mergeData(toVal, fromVal)
  845. }
  846. }
  847. return to
  848. }
  849. /**
  850. * Data
  851. */
  852. strats.data = function (parentVal, childVal, vm) {
  853. if (!vm) {
  854. // in a Vue.extend merge, both should be functions
  855. if (!childVal) {
  856. return parentVal
  857. }
  858. if (typeof childVal !== 'function') {
  859. ("development") !== 'production' && _.warn(
  860. 'The "data" option should be a function ' +
  861. 'that returns a per-instance value in component ' +
  862. 'definitions.'
  863. )
  864. return parentVal
  865. }
  866. if (!parentVal) {
  867. return childVal
  868. }
  869. // when parentVal & childVal are both present,
  870. // we need to return a function that returns the
  871. // merged result of both functions... no need to
  872. // check if parentVal is a function here because
  873. // it has to be a function to pass previous merges.
  874. return function mergedDataFn () {
  875. return mergeData(
  876. childVal.call(this),
  877. parentVal.call(this)
  878. )
  879. }
  880. } else if (parentVal || childVal) {
  881. return function mergedInstanceDataFn () {
  882. // instance merge
  883. var instanceData = typeof childVal === 'function'
  884. ? childVal.call(vm)
  885. : childVal
  886. var defaultData = typeof parentVal === 'function'
  887. ? parentVal.call(vm)
  888. : undefined
  889. if (instanceData) {
  890. return mergeData(instanceData, defaultData)
  891. } else {
  892. return defaultData
  893. }
  894. }
  895. }
  896. }
  897. /**
  898. * El
  899. */
  900. strats.el = function (parentVal, childVal, vm) {
  901. if (!vm && childVal && typeof childVal !== 'function') {
  902. ("development") !== 'production' && _.warn(
  903. 'The "el" option should be a function ' +
  904. 'that returns a per-instance value in component ' +
  905. 'definitions.'
  906. )
  907. return
  908. }
  909. var ret = childVal || parentVal
  910. // invoke the element factory if this is instance merge
  911. return vm && typeof ret === 'function'
  912. ? ret.call(vm)
  913. : ret
  914. }
  915. /**
  916. * Hooks and param attributes are merged as arrays.
  917. */
  918. strats.created =
  919. strats.ready =
  920. strats.attached =
  921. strats.detached =
  922. strats.beforeCompile =
  923. strats.compiled =
  924. strats.beforeDestroy =
  925. strats.destroyed =
  926. strats.props = function (parentVal, childVal) {
  927. return childVal
  928. ? parentVal
  929. ? parentVal.concat(childVal)
  930. : _.isArray(childVal)
  931. ? childVal
  932. : [childVal]
  933. : parentVal
  934. }
  935. /**
  936. * 0.11 deprecation warning
  937. */
  938. strats.paramAttributes = function () {
  939. /* istanbul ignore next */
  940. ("development") !== 'production' && _.warn(
  941. '"paramAttributes" option has been deprecated in 0.12. ' +
  942. 'Use "props" instead.'
  943. )
  944. }
  945. /**
  946. * Assets
  947. *
  948. * When a vm is present (instance creation), we need to do
  949. * a three-way merge between constructor options, instance
  950. * options and parent options.
  951. */
  952. function mergeAssets (parentVal, childVal) {
  953. var res = Object.create(parentVal)
  954. return childVal
  955. ? extend(res, guardArrayAssets(childVal))
  956. : res
  957. }
  958. config._assetTypes.forEach(function (type) {
  959. strats[type + 's'] = mergeAssets
  960. })
  961. /**
  962. * Events & Watchers.
  963. *
  964. * Events & watchers hashes should not overwrite one
  965. * another, so we merge them as arrays.
  966. */
  967. strats.watch =
  968. strats.events = function (parentVal, childVal) {
  969. if (!childVal) return parentVal
  970. if (!parentVal) return childVal
  971. var ret = {}
  972. extend(ret, parentVal)
  973. for (var key in childVal) {
  974. var parent = ret[key]
  975. var child = childVal[key]
  976. if (parent && !_.isArray(parent)) {
  977. parent = [parent]
  978. }
  979. ret[key] = parent
  980. ? parent.concat(child)
  981. : [child]
  982. }
  983. return ret
  984. }
  985. /**
  986. * Other object hashes.
  987. */
  988. strats.methods =
  989. strats.computed = function (parentVal, childVal) {
  990. if (!childVal) return parentVal
  991. if (!parentVal) return childVal
  992. var ret = Object.create(parentVal)
  993. extend(ret, childVal)
  994. return ret
  995. }
  996. /**
  997. * Default strategy.
  998. */
  999. var defaultStrat = function (parentVal, childVal) {
  1000. return childVal === undefined
  1001. ? parentVal
  1002. : childVal
  1003. }
  1004. /**
  1005. * Make sure component options get converted to actual
  1006. * constructors.
  1007. *
  1008. * @param {Object} options
  1009. */
  1010. function guardComponents (options) {
  1011. if (options.components) {
  1012. var components = options.components =
  1013. guardArrayAssets(options.components)
  1014. var def
  1015. var ids = Object.keys(components)
  1016. for (var i = 0, l = ids.length; i < l; i++) {
  1017. var key = ids[i]
  1018. if (_.commonTagRE.test(key)) {
  1019. ("development") !== 'production' && _.warn(
  1020. 'Do not use built-in HTML elements as component ' +
  1021. 'id: ' + key
  1022. )
  1023. continue
  1024. }
  1025. def = components[key]
  1026. if (_.isPlainObject(def)) {
  1027. def.id = def.id || key
  1028. components[key] = def._Ctor || (def._Ctor = _.Vue.extend(def))
  1029. }
  1030. }
  1031. }
  1032. }
  1033. /**
  1034. * Ensure all props option syntax are normalized into the
  1035. * Object-based format.
  1036. *
  1037. * @param {Object} options
  1038. */
  1039. function guardProps (options) {
  1040. var props = options.props
  1041. if (_.isPlainObject(props)) {
  1042. options.props = Object.keys(props).map(function (key) {
  1043. var val = props[key]
  1044. if (!_.isPlainObject(val)) {
  1045. val = { type: val }
  1046. }
  1047. val.name = key
  1048. return val
  1049. })
  1050. } else if (_.isArray(props)) {
  1051. options.props = props.map(function (prop) {
  1052. return typeof prop === 'string'
  1053. ? { name: prop }
  1054. : prop
  1055. })
  1056. }
  1057. }
  1058. /**
  1059. * Guard an Array-format assets option and converted it
  1060. * into the key-value Object format.
  1061. *
  1062. * @param {Object|Array} assets
  1063. * @return {Object}
  1064. */
  1065. function guardArrayAssets (assets) {
  1066. if (_.isArray(assets)) {
  1067. var res = {}
  1068. var i = assets.length
  1069. var asset
  1070. while (i--) {
  1071. asset = assets[i]
  1072. var id = asset.id || (asset.options && asset.options.id)
  1073. if (!id) {
  1074. ("development") !== 'production' && _.warn(
  1075. 'Array-syntax assets must provide an id field.'
  1076. )
  1077. } else {
  1078. res[id] = asset
  1079. }
  1080. }
  1081. return res
  1082. }
  1083. return assets
  1084. }
  1085. /**
  1086. * Merge two option objects into a new one.
  1087. * Core utility used in both instantiation and inheritance.
  1088. *
  1089. * @param {Object} parent
  1090. * @param {Object} child
  1091. * @param {Vue} [vm] - if vm is present, indicates this is
  1092. * an instantiation merge.
  1093. */
  1094. exports.mergeOptions = function merge (parent, child, vm) {
  1095. guardComponents(child)
  1096. guardProps(child)
  1097. var options = {}
  1098. var key
  1099. if (child.mixins) {
  1100. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1101. parent = merge(parent, child.mixins[i], vm)
  1102. }
  1103. }
  1104. for (key in parent) {
  1105. mergeField(key)
  1106. }
  1107. for (key in child) {
  1108. if (!(parent.hasOwnProperty(key))) {
  1109. mergeField(key)
  1110. }
  1111. }
  1112. function mergeField (key) {
  1113. var strat = strats[key] || defaultStrat
  1114. options[key] = strat(parent[key], child[key], vm, key)
  1115. }
  1116. return options
  1117. }
  1118. /**
  1119. * Resolve an asset.
  1120. * This function is used because child instances need access
  1121. * to assets defined in its ancestor chain.
  1122. *
  1123. * @param {Object} options
  1124. * @param {String} type
  1125. * @param {String} id
  1126. * @return {Object|Function}
  1127. */
  1128. exports.resolveAsset = function resolve (options, type, id) {
  1129. var camelizedId = _.camelize(id)
  1130. var asset = options[type][id] || options[type][camelizedId]
  1131. while (
  1132. !asset && options._parent &&
  1133. (!config.strict || options._repeat)
  1134. ) {
  1135. options = options._parent.$options
  1136. asset = options[type][id] || options[type][camelizedId]
  1137. }
  1138. return asset
  1139. }
  1140. /***/ },
  1141. /* 7 */
  1142. /***/ function(module, exports, __webpack_require__) {
  1143. var _ = __webpack_require__(1)
  1144. /**
  1145. * Check if an element is a component, if yes return its
  1146. * component id.
  1147. *
  1148. * @param {Element} el
  1149. * @param {Object} options
  1150. * @return {String|undefined}
  1151. */
  1152. exports.commonTagRE = /^(div|p|span|img|a|br|ul|ol|li|h1|h2|h3|h4|h5|code|pre)$/
  1153. exports.checkComponent = function (el, options) {
  1154. var tag = el.tagName.toLowerCase()
  1155. if (tag === 'component') {
  1156. // dynamic syntax
  1157. var exp = el.getAttribute('is')
  1158. el.removeAttribute('is')
  1159. return exp
  1160. } else if (
  1161. !exports.commonTagRE.test(tag) &&
  1162. _.resolveAsset(options, 'components', tag)
  1163. ) {
  1164. return tag
  1165. /* eslint-disable no-cond-assign */
  1166. } else if (tag = _.attr(el, 'component')) {
  1167. /* eslint-enable no-cond-assign */
  1168. return tag
  1169. }
  1170. }
  1171. /**
  1172. * Set a prop's initial value on a vm and its data object.
  1173. * The vm may have inherit:true so we need to make sure
  1174. * we don't accidentally overwrite parent value.
  1175. *
  1176. * @param {Vue} vm
  1177. * @param {Object} prop
  1178. * @param {*} value
  1179. */
  1180. exports.initProp = function (vm, prop, value) {
  1181. if (exports.assertProp(prop, value)) {
  1182. var key = prop.path
  1183. if (key in vm) {
  1184. _.define(vm, key, value, true)
  1185. } else {
  1186. vm[key] = value
  1187. }
  1188. vm._data[key] = value
  1189. }
  1190. }
  1191. /**
  1192. * Assert whether a prop is valid.
  1193. *
  1194. * @param {Object} prop
  1195. * @param {*} value
  1196. */
  1197. exports.assertProp = function (prop, value) {
  1198. // if a prop is not provided and is not required,
  1199. // skip the check.
  1200. if (prop.raw === null && !prop.required) {
  1201. return true
  1202. }
  1203. var options = prop.options
  1204. var type = options.type
  1205. var valid = true
  1206. var expectedType
  1207. if (type) {
  1208. if (type === String) {
  1209. expectedType = 'string'
  1210. valid = typeof value === expectedType
  1211. } else if (type === Number) {
  1212. expectedType = 'number'
  1213. valid = typeof value === 'number'
  1214. } else if (type === Boolean) {
  1215. expectedType = 'boolean'
  1216. valid = typeof value === 'boolean'
  1217. } else if (type === Function) {
  1218. expectedType = 'function'
  1219. valid = typeof value === 'function'
  1220. } else if (type === Object) {
  1221. expectedType = 'object'
  1222. valid = _.isPlainObject(value)
  1223. } else if (type === Array) {
  1224. expectedType = 'array'
  1225. valid = _.isArray(value)
  1226. } else {
  1227. valid = value instanceof type
  1228. }
  1229. }
  1230. if (!valid) {
  1231. ("development") !== 'production' && _.warn(
  1232. 'Invalid prop: type check failed for ' +
  1233. prop.path + '="' + prop.raw + '".' +
  1234. ' Expected ' + formatType(expectedType) +
  1235. ', got ' + formatValue(value) + '.'
  1236. )
  1237. return false
  1238. }
  1239. var validator = options.validator
  1240. if (validator) {
  1241. if (!validator.call(null, value)) {
  1242. ("development") !== 'production' && _.warn(
  1243. 'Invalid prop: custom validator check failed for ' +
  1244. prop.path + '="' + prop.raw + '"'
  1245. )
  1246. return false
  1247. }
  1248. }
  1249. return true
  1250. }
  1251. function formatType (val) {
  1252. return val
  1253. ? val.charAt(0).toUpperCase() + val.slice(1)
  1254. : 'custom type'
  1255. }
  1256. function formatValue (val) {
  1257. return Object.prototype.toString.call(val).slice(8, -1)
  1258. }
  1259. /***/ },
  1260. /* 8 */
  1261. /***/ function(module, exports, __webpack_require__) {
  1262. /**
  1263. * Enable debug utilities.
  1264. */
  1265. if (true) {
  1266. var config = __webpack_require__(5)
  1267. var hasConsole = typeof console !== 'undefined'
  1268. /**
  1269. * Log a message.
  1270. *
  1271. * @param {String} msg
  1272. */
  1273. exports.log = function (msg) {
  1274. if (hasConsole && config.debug) {
  1275. console.log('[Vue info]: ' + msg)
  1276. }
  1277. }
  1278. /**
  1279. * We've got a problem here.
  1280. *
  1281. * @param {String} msg
  1282. */
  1283. exports.warn = function (msg, e) {
  1284. if (hasConsole && (!config.silent || config.debug)) {
  1285. console.warn('[Vue warn]: ' + msg)
  1286. /* istanbul ignore if */
  1287. if (config.debug) {
  1288. console.warn((e || new Error('Warning Stack Trace')).stack)
  1289. }
  1290. }
  1291. }
  1292. /**
  1293. * Assert asset exists
  1294. */
  1295. exports.assertAsset = function (val, type, id) {
  1296. /* istanbul ignore if */
  1297. if (type === 'directive') {
  1298. if (id === 'with') {
  1299. exports.warn(
  1300. 'v-with has been deprecated in ^0.12.0. ' +
  1301. 'Use props instead.'
  1302. )
  1303. return
  1304. }
  1305. if (id === 'events') {
  1306. exports.warn(
  1307. 'v-events has been deprecated in ^0.12.0. ' +
  1308. 'Pass down methods as callback props instead.'
  1309. )
  1310. return
  1311. }
  1312. }
  1313. if (!val) {
  1314. exports.warn('Failed to resolve ' + type + ': ' + id)
  1315. }
  1316. }
  1317. }
  1318. /***/ },
  1319. /* 9 */
  1320. /***/ function(module, exports, __webpack_require__) {
  1321. var _ = __webpack_require__(1)
  1322. var config = __webpack_require__(5)
  1323. /**
  1324. * Expose useful internals
  1325. */
  1326. exports.util = _
  1327. exports.config = config
  1328. exports.nextTick = _.nextTick
  1329. exports.compiler = __webpack_require__(10)
  1330. exports.parsers = {
  1331. path: __webpack_require__(20),
  1332. text: __webpack_require__(13),
  1333. template: __webpack_require__(22),
  1334. directive: __webpack_require__(15),
  1335. expression: __webpack_require__(19)
  1336. }
  1337. /**
  1338. * Each instance constructor, including Vue, has a unique
  1339. * cid. This enables us to create wrapped "child
  1340. * constructors" for prototypal inheritance and cache them.
  1341. */
  1342. exports.cid = 0
  1343. var cid = 1
  1344. /**
  1345. * Class inheritance
  1346. *
  1347. * @param {Object} extendOptions
  1348. */
  1349. exports.extend = function (extendOptions) {
  1350. extendOptions = extendOptions || {}
  1351. var Super = this
  1352. var Sub = createClass(
  1353. extendOptions.name ||
  1354. Super.options.name ||
  1355. 'VueComponent'
  1356. )
  1357. Sub.prototype = Object.create(Super.prototype)
  1358. Sub.prototype.constructor = Sub
  1359. Sub.cid = cid++
  1360. Sub.options = _.mergeOptions(
  1361. Super.options,
  1362. extendOptions
  1363. )
  1364. Sub['super'] = Super
  1365. // allow further extension
  1366. Sub.extend = Super.extend
  1367. // create asset registers, so extended classes
  1368. // can have their private assets too.
  1369. config._assetTypes.forEach(function (type) {
  1370. Sub[type] = Super[type]
  1371. })
  1372. return Sub
  1373. }
  1374. /**
  1375. * A function that returns a sub-class constructor with the
  1376. * given name. This gives us much nicer output when
  1377. * logging instances in the console.
  1378. *
  1379. * @param {String} name
  1380. * @return {Function}
  1381. */
  1382. function createClass (name) {
  1383. return new Function(
  1384. 'return function ' + _.classify(name) +
  1385. ' (options) { this._init(options) }'
  1386. )()
  1387. }
  1388. /**
  1389. * Plugin system
  1390. *
  1391. * @param {Object} plugin
  1392. */
  1393. exports.use = function (plugin) {
  1394. // additional parameters
  1395. var args = _.toArray(arguments, 1)
  1396. args.unshift(this)
  1397. if (typeof plugin.install === 'function') {
  1398. plugin.install.apply(plugin, args)
  1399. } else {
  1400. plugin.apply(null, args)
  1401. }
  1402. return this
  1403. }
  1404. /**
  1405. * Create asset registration methods with the following
  1406. * signature:
  1407. *
  1408. * @param {String} id
  1409. * @param {*} definition
  1410. */
  1411. config._assetTypes.forEach(function (type) {
  1412. exports[type] = function (id, definition) {
  1413. if (!definition) {
  1414. return this.options[type + 's'][id]
  1415. } else {
  1416. if (
  1417. type === 'component' &&
  1418. _.isPlainObject(definition)
  1419. ) {
  1420. definition.name = id
  1421. definition = _.Vue.extend(definition)
  1422. }
  1423. this.options[type + 's'][id] = definition
  1424. }
  1425. }
  1426. })
  1427. /***/ },
  1428. /* 10 */
  1429. /***/ function(module, exports, __webpack_require__) {
  1430. var _ = __webpack_require__(1)
  1431. _.extend(exports, __webpack_require__(11))
  1432. _.extend(exports, __webpack_require__(24))
  1433. /***/ },
  1434. /* 11 */
  1435. /***/ function(module, exports, __webpack_require__) {
  1436. var _ = __webpack_require__(1)
  1437. var compileProps = __webpack_require__(12)
  1438. var config = __webpack_require__(5)
  1439. var textParser = __webpack_require__(13)
  1440. var dirParser = __webpack_require__(15)
  1441. var templateParser = __webpack_require__(22)
  1442. var resolveAsset = _.resolveAsset
  1443. var componentDef = __webpack_require__(23)
  1444. // terminal directives
  1445. var terminalDirectives = [
  1446. 'repeat',
  1447. 'if'
  1448. ]
  1449. /**
  1450. * Compile a template and return a reusable composite link
  1451. * function, which recursively contains more link functions
  1452. * inside. This top level compile function would normally
  1453. * be called on instance root nodes, but can also be used
  1454. * for partial compilation if the partial argument is true.
  1455. *
  1456. * The returned composite link function, when called, will
  1457. * return an unlink function that tearsdown all directives
  1458. * created during the linking phase.
  1459. *
  1460. * @param {Element|DocumentFragment} el
  1461. * @param {Object} options
  1462. * @param {Boolean} partial
  1463. * @param {Vue} [host] - host vm of transcluded content
  1464. * @return {Function}
  1465. */
  1466. exports.compile = function (el, options, partial, host) {
  1467. // link function for the node itself.
  1468. var nodeLinkFn = partial || !options._asComponent
  1469. ? compileNode(el, options)
  1470. : null
  1471. // link function for the childNodes
  1472. var childLinkFn =
  1473. !(nodeLinkFn && nodeLinkFn.terminal) &&
  1474. el.tagName !== 'SCRIPT' &&
  1475. el.hasChildNodes()
  1476. ? compileNodeList(el.childNodes, options)
  1477. : null
  1478. /**
  1479. * A composite linker function to be called on a already
  1480. * compiled piece of DOM, which instantiates all directive
  1481. * instances.
  1482. *
  1483. * @param {Vue} vm
  1484. * @param {Element|DocumentFragment} el
  1485. * @return {Function|undefined}
  1486. */
  1487. return function compositeLinkFn (vm, el) {
  1488. // cache childNodes before linking parent, fix #657
  1489. var childNodes = _.toArray(el.childNodes)
  1490. // link
  1491. var dirs = linkAndCapture(function () {
  1492. if (nodeLinkFn) nodeLinkFn(vm, el, host)
  1493. if (childLinkFn) childLinkFn(vm, childNodes, host)
  1494. }, vm)
  1495. return makeUnlinkFn(vm, dirs)
  1496. }
  1497. }
  1498. /**
  1499. * Apply a linker to a vm/element pair and capture the
  1500. * directives created during the process.
  1501. *
  1502. * @param {Function} linker
  1503. * @param {Vue} vm
  1504. */
  1505. function linkAndCapture (linker, vm) {
  1506. var originalDirCount = vm._directives.length
  1507. linker()
  1508. return vm._directives.slice(originalDirCount)
  1509. }
  1510. /**
  1511. * Linker functions return an unlink function that
  1512. * tearsdown all directives instances generated during
  1513. * the process.
  1514. *
  1515. * We create unlink functions with only the necessary
  1516. * information to avoid retaining additional closures.
  1517. *
  1518. * @param {Vue} vm
  1519. * @param {Array} dirs
  1520. * @param {Vue} [context]
  1521. * @param {Array} [contextDirs]
  1522. * @return {Function}
  1523. */
  1524. function makeUnlinkFn (vm, dirs, context, contextDirs) {
  1525. return function unlink (destroying) {
  1526. teardownDirs(vm, dirs, destroying)
  1527. if (context && contextDirs) {
  1528. teardownDirs(context, contextDirs)
  1529. }
  1530. }
  1531. }
  1532. /**
  1533. * Teardown partial linked directives.
  1534. *
  1535. * @param {Vue} vm
  1536. * @param {Array} dirs
  1537. * @param {Boolean} destroying
  1538. */
  1539. function teardownDirs (vm, dirs, destroying) {
  1540. var i = dirs.length
  1541. while (i--) {
  1542. dirs[i]._teardown()
  1543. if (!destroying) {
  1544. vm._directives.$remove(dirs[i])
  1545. }
  1546. }
  1547. }
  1548. /**
  1549. * Compile link props on an instance.
  1550. *
  1551. * @param {Vue} vm
  1552. * @param {Element} el
  1553. * @param {Object} options
  1554. * @return {Function}
  1555. */
  1556. exports.compileAndLinkProps = function (vm, el, props) {
  1557. var propsLinkFn = compileProps(el, props)
  1558. var propDirs = linkAndCapture(function () {
  1559. propsLinkFn(vm, null)
  1560. }, vm)
  1561. return makeUnlinkFn(vm, propDirs)
  1562. }
  1563. /**
  1564. * Compile the root element of an instance.
  1565. *
  1566. * 1. attrs on context container (context scope)
  1567. * 2. attrs on the component template root node, if
  1568. * replace:true (child scope)
  1569. *
  1570. * If this is a fragment instance, we only need to compile 1.
  1571. *
  1572. * @param {Vue} vm
  1573. * @param {Element} el
  1574. * @param {Object} options
  1575. * @return {Function}
  1576. */
  1577. exports.compileRoot = function (el, options) {
  1578. var containerAttrs = options._containerAttrs
  1579. var replacerAttrs = options._replacerAttrs
  1580. var contextLinkFn, replacerLinkFn
  1581. // only need to compile other attributes for
  1582. // non-fragment instances
  1583. if (el.nodeType !== 11) {
  1584. // for components, container and replacer need to be
  1585. // compiled separately and linked in different scopes.
  1586. if (options._asComponent) {
  1587. // 2. container attributes
  1588. if (containerAttrs) {
  1589. contextLinkFn = compileDirectives(containerAttrs, options)
  1590. }
  1591. if (replacerAttrs) {
  1592. // 3. replacer attributes
  1593. replacerLinkFn = compileDirectives(replacerAttrs, options)
  1594. }
  1595. } else {
  1596. // non-component, just compile as a normal element.
  1597. replacerLinkFn = compileDirectives(el.attributes, options)
  1598. }
  1599. }
  1600. return function rootLinkFn (vm, el) {
  1601. // link context scope dirs
  1602. var context = vm._context
  1603. var contextDirs
  1604. if (context && contextLinkFn) {
  1605. contextDirs = linkAndCapture(function () {
  1606. contextLinkFn(context, el)
  1607. }, context)
  1608. }
  1609. // link self
  1610. var selfDirs = linkAndCapture(function () {
  1611. if (replacerLinkFn) replacerLinkFn(vm, el)
  1612. }, vm)
  1613. // return the unlink function that tearsdown context
  1614. // container directives.
  1615. return makeUnlinkFn(vm, selfDirs, context, contextDirs)
  1616. }
  1617. }
  1618. /**
  1619. * Compile a node and return a nodeLinkFn based on the
  1620. * node type.
  1621. *
  1622. * @param {Node} node
  1623. * @param {Object} options
  1624. * @return {Function|null}
  1625. */
  1626. function compileNode (node, options) {
  1627. var type = node.nodeType
  1628. if (type === 1 && node.tagName !== 'SCRIPT') {
  1629. return compileElement(node, options)
  1630. } else if (type === 3 && config.interpolate && node.data.trim()) {
  1631. return compileTextNode(node, options)
  1632. } else {
  1633. return null
  1634. }
  1635. }
  1636. /**
  1637. * Compile an element and return a nodeLinkFn.
  1638. *
  1639. * @param {Element} el
  1640. * @param {Object} options
  1641. * @return {Function|null}
  1642. */
  1643. function compileElement (el, options) {
  1644. // preprocess textareas.
  1645. // textarea treats its text content as the initial value.
  1646. // just bind it as a v-attr directive for value.
  1647. if (el.tagName === 'TEXTAREA') {
  1648. if (textParser.parse(el.value)) {
  1649. el.setAttribute('value', el.value)
  1650. }
  1651. }
  1652. var linkFn
  1653. var hasAttrs = el.hasAttributes()
  1654. // check terminal directives (repeat & if)
  1655. if (hasAttrs) {
  1656. linkFn = checkTerminalDirectives(el, options)
  1657. }
  1658. // check element directives
  1659. if (!linkFn) {
  1660. linkFn = checkElementDirectives(el, options)
  1661. }
  1662. // check component
  1663. if (!linkFn) {
  1664. linkFn = checkComponent(el, options)
  1665. }
  1666. // normal directives
  1667. if (!linkFn && hasAttrs) {
  1668. linkFn = compileDirectives(el.attributes, options)
  1669. }
  1670. return linkFn
  1671. }
  1672. /**
  1673. * Compile a textNode and return a nodeLinkFn.
  1674. *
  1675. * @param {TextNode} node
  1676. * @param {Object} options
  1677. * @return {Function|null} textNodeLinkFn
  1678. */
  1679. function compileTextNode (node, options) {
  1680. var tokens = textParser.parse(node.data)
  1681. if (!tokens) {
  1682. return null
  1683. }
  1684. var frag = document.createDocumentFragment()
  1685. var el, token
  1686. for (var i = 0, l = tokens.length; i < l; i++) {
  1687. token = tokens[i]
  1688. el = token.tag
  1689. ? processTextToken(token, options)
  1690. : document.createTextNode(token.value)
  1691. frag.appendChild(el)
  1692. }
  1693. return makeTextNodeLinkFn(tokens, frag, options)
  1694. }
  1695. /**
  1696. * Process a single text token.
  1697. *
  1698. * @param {Object} token
  1699. * @param {Object} options
  1700. * @return {Node}
  1701. */
  1702. function processTextToken (token, options) {
  1703. var el
  1704. if (token.oneTime) {
  1705. el = document.createTextNode(token.value)
  1706. } else {
  1707. if (token.html) {
  1708. el = document.createComment('v-html')
  1709. setTokenType('html')
  1710. } else {
  1711. // IE will clean up empty textNodes during
  1712. // frag.cloneNode(true), so we have to give it
  1713. // something here...
  1714. el = document.createTextNode(' ')
  1715. setTokenType('text')
  1716. }
  1717. }
  1718. function setTokenType (type) {
  1719. token.type = type
  1720. token.def = resolveAsset(options, 'directives', type)
  1721. token.descriptor = dirParser.parse(token.value)[0]
  1722. }
  1723. return el
  1724. }
  1725. /**
  1726. * Build a function that processes a textNode.
  1727. *
  1728. * @param {Array<Object>} tokens
  1729. * @param {DocumentFragment} frag
  1730. */
  1731. function makeTextNodeLinkFn (tokens, frag) {
  1732. return function textNodeLinkFn (vm, el) {
  1733. var fragClone = frag.cloneNode(true)
  1734. var childNodes = _.toArray(fragClone.childNodes)
  1735. var token, value, node
  1736. for (var i = 0, l = tokens.length; i < l; i++) {
  1737. token = tokens[i]
  1738. value = token.value
  1739. if (token.tag) {
  1740. node = childNodes[i]
  1741. if (token.oneTime) {
  1742. value = vm.$eval(value)
  1743. if (token.html) {
  1744. _.replace(node, templateParser.parse(value, true))
  1745. } else {
  1746. node.data = value
  1747. }
  1748. } else {
  1749. vm._bindDir(token.type, node,
  1750. token.descriptor, token.def)
  1751. }
  1752. }
  1753. }
  1754. _.replace(el, fragClone)
  1755. }
  1756. }
  1757. /**
  1758. * Compile a node list and return a childLinkFn.
  1759. *
  1760. * @param {NodeList} nodeList
  1761. * @param {Object} options
  1762. * @return {Function|undefined}
  1763. */
  1764. function compileNodeList (nodeList, options) {
  1765. var linkFns = []
  1766. var nodeLinkFn, childLinkFn, node
  1767. for (var i = 0, l = nodeList.length; i < l; i++) {
  1768. node = nodeList[i]
  1769. nodeLinkFn = compileNode(node, options)
  1770. childLinkFn =
  1771. !(nodeLinkFn && nodeLinkFn.terminal) &&
  1772. node.tagName !== 'SCRIPT' &&
  1773. node.hasChildNodes()
  1774. ? compileNodeList(node.childNodes, options)
  1775. : null
  1776. linkFns.push(nodeLinkFn, childLinkFn)
  1777. }
  1778. return linkFns.length
  1779. ? makeChildLinkFn(linkFns)
  1780. : null
  1781. }
  1782. /**
  1783. * Make a child link function for a node's childNodes.
  1784. *
  1785. * @param {Array<Function>} linkFns
  1786. * @return {Function} childLinkFn
  1787. */
  1788. function makeChildLinkFn (linkFns) {
  1789. return function childLinkFn (vm, nodes, host) {
  1790. var node, nodeLinkFn, childrenLinkFn
  1791. for (var i = 0, n = 0, l = linkFns.length; i < l; n++) {
  1792. node = nodes[n]
  1793. nodeLinkFn = linkFns[i++]
  1794. childrenLinkFn = linkFns[i++]
  1795. // cache childNodes before linking parent, fix #657
  1796. var childNodes = _.toArray(node.childNodes)
  1797. if (nodeLinkFn) {
  1798. nodeLinkFn(vm, node, host)
  1799. }
  1800. if (childrenLinkFn) {
  1801. childrenLinkFn(vm, childNodes, host)
  1802. }
  1803. }
  1804. }
  1805. }
  1806. /**
  1807. * Check for element directives (custom elements that should
  1808. * be resovled as terminal directives).
  1809. *
  1810. * @param {Element} el
  1811. * @param {Object} options
  1812. */
  1813. function checkElementDirectives (el, options) {
  1814. var tag = el.tagName.toLowerCase()
  1815. if (_.commonTagRE.test(tag)) return
  1816. var def = resolveAsset(options, 'elementDirectives', tag)
  1817. if (def) {
  1818. return makeTerminalNodeLinkFn(el, tag, '', options, def)
  1819. }
  1820. }
  1821. /**
  1822. * Check if an element is a component. If yes, return
  1823. * a component link function.
  1824. *
  1825. * @param {Element} el
  1826. * @param {Object} options
  1827. * @param {Boolean} hasAttrs
  1828. * @return {Function|undefined}
  1829. */
  1830. function checkComponent (el, options, hasAttrs) {
  1831. var componentId = _.checkComponent(el, options, hasAttrs)
  1832. if (componentId) {
  1833. var componentLinkFn = function (vm, el, host) {
  1834. vm._bindDir('component', el, {
  1835. expression: componentId
  1836. }, componentDef, host)
  1837. }
  1838. componentLinkFn.terminal = true
  1839. return componentLinkFn
  1840. }
  1841. }
  1842. /**
  1843. * Check an element for terminal directives in fixed order.
  1844. * If it finds one, return a terminal link function.
  1845. *
  1846. * @param {Element} el
  1847. * @param {Object} options
  1848. * @return {Function} terminalLinkFn
  1849. */
  1850. function checkTerminalDirectives (el, options) {
  1851. if (_.attr(el, 'pre') !== null) {
  1852. return skip
  1853. }
  1854. var value, dirName
  1855. for (var i = 0, l = terminalDirectives.length; i < l; i++) {
  1856. dirName = terminalDirectives[i]
  1857. if ((value = _.attr(el, dirName)) !== null) {
  1858. return makeTerminalNodeLinkFn(el, dirName, value, options)
  1859. }
  1860. }
  1861. }
  1862. function skip () {}
  1863. skip.terminal = true
  1864. /**
  1865. * Build a node link function for a terminal directive.
  1866. * A terminal link function terminates the current
  1867. * compilation recursion and handles compilation of the
  1868. * subtree in the directive.
  1869. *
  1870. * @param {Element} el
  1871. * @param {String} dirName
  1872. * @param {String} value
  1873. * @param {Object} options
  1874. * @param {Object} [def]
  1875. * @return {Function} terminalLinkFn
  1876. */
  1877. function makeTerminalNodeLinkFn (el, dirName, value, options, def) {
  1878. var descriptor = dirParser.parse(value)[0]
  1879. // no need to call resolveAsset since terminal directives
  1880. // are always internal
  1881. def = def || options.directives[dirName]
  1882. var fn = function terminalNodeLinkFn (vm, el, host) {
  1883. vm._bindDir(dirName, el, descriptor, def, host)
  1884. }
  1885. fn.terminal = true
  1886. return fn
  1887. }
  1888. /**
  1889. * Compile the directives on an element and return a linker.
  1890. *
  1891. * @param {Array|NamedNodeMap} attrs
  1892. * @param {Object} options
  1893. * @return {Function}
  1894. */
  1895. function compileDirectives (attrs, options) {
  1896. var i = attrs.length
  1897. var dirs = []
  1898. var attr, name, value, dir, dirName, dirDef
  1899. while (i--) {
  1900. attr = attrs[i]
  1901. name = attr.name
  1902. value = attr.value
  1903. if (name.indexOf(config.prefix) === 0) {
  1904. dirName = name.slice(config.prefix.length)
  1905. dirDef = resolveAsset(options, 'directives', dirName)
  1906. if (true) {
  1907. _.assertAsset(dirDef, 'directive', dirName)
  1908. }
  1909. if (dirDef) {
  1910. dirs.push({
  1911. name: dirName,
  1912. descriptors: dirParser.parse(value),
  1913. def: dirDef
  1914. })
  1915. }
  1916. } else if (config.interpolate) {
  1917. dir = collectAttrDirective(name, value, options)
  1918. if (dir) {
  1919. dirs.push(dir)
  1920. }
  1921. }
  1922. }
  1923. // sort by priority, LOW to HIGH
  1924. if (dirs.length) {
  1925. dirs.sort(directiveComparator)
  1926. return makeNodeLinkFn(dirs)
  1927. }
  1928. }
  1929. /**
  1930. * Build a link function for all directives on a single node.
  1931. *
  1932. * @param {Array} directives
  1933. * @return {Function} directivesLinkFn
  1934. */
  1935. function makeNodeLinkFn (directives) {
  1936. return function nodeLinkFn (vm, el, host) {
  1937. // reverse apply because it's sorted low to high
  1938. var i = directives.length
  1939. var dir, j, k
  1940. while (i--) {
  1941. dir = directives[i]
  1942. if (dir._link) {
  1943. // custom link fn
  1944. dir._link(vm, el)
  1945. } else {
  1946. k = dir.descriptors.length
  1947. for (j = 0; j < k; j++) {
  1948. vm._bindDir(dir.name, el,
  1949. dir.descriptors[j], dir.def, host)
  1950. }
  1951. }
  1952. }
  1953. }
  1954. }
  1955. /**
  1956. * Check an attribute for potential dynamic bindings,
  1957. * and return a directive object.
  1958. *
  1959. * Special case: class interpolations are translated into
  1960. * v-class instead v-attr, so that it can work with user
  1961. * provided v-class bindings.
  1962. *
  1963. * @param {String} name
  1964. * @param {String} value
  1965. * @param {Object} options
  1966. * @return {Object}
  1967. */
  1968. function collectAttrDirective (name, value, options) {
  1969. var tokens = textParser.parse(value)
  1970. var isClass = name === 'class'
  1971. if (tokens) {
  1972. var dirName = isClass ? 'class' : 'attr'
  1973. var def = options.directives[dirName]
  1974. var i = tokens.length
  1975. var allOneTime = true
  1976. while (i--) {
  1977. var token = tokens[i]
  1978. if (token.tag && !token.oneTime) {
  1979. allOneTime = false
  1980. }
  1981. }
  1982. return {
  1983. def: def,
  1984. _link: allOneTime
  1985. ? function (vm, el) {
  1986. el.setAttribute(name, vm.$interpolate(value))
  1987. }
  1988. : function (vm, el) {
  1989. var exp = textParser.tokensToExp(tokens, vm)
  1990. var desc = isClass
  1991. ? dirParser.parse(exp)[0]
  1992. : dirParser.parse(name + ':' + exp)[0]
  1993. if (isClass) {
  1994. desc._rawClass = value
  1995. }
  1996. vm._bindDir(dirName, el, desc, def)
  1997. }
  1998. }
  1999. }
  2000. }
  2001. /**
  2002. * Directive priority sort comparator
  2003. *
  2004. * @param {Object} a
  2005. * @param {Object} b
  2006. */
  2007. function directiveComparator (a, b) {
  2008. a = a.def.priority || 0
  2009. b = b.def.priority || 0
  2010. return a > b ? 1 : -1
  2011. }
  2012. /***/ },
  2013. /* 12 */
  2014. /***/ function(module, exports, __webpack_require__) {
  2015. var _ = __webpack_require__(1)
  2016. var textParser = __webpack_require__(13)
  2017. var propDef = __webpack_require__(16)
  2018. var propBindingModes = __webpack_require__(5)._propBindingModes
  2019. // regexes
  2020. var identRE = __webpack_require__(20).identRE
  2021. var dataAttrRE = /^data-/
  2022. var settablePathRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\[[^\[\]]+\])*$/
  2023. var literalValueRE = /^(true|false)$|^\d.*/
  2024. /**
  2025. * Compile param attributes on a root element and return
  2026. * a props link function.
  2027. *
  2028. * @param {Element|DocumentFragment} el
  2029. * @param {Array} propOptions
  2030. * @return {Function} propsLinkFn
  2031. */
  2032. module.exports = function compileProps (el, propOptions) {
  2033. var props = []
  2034. var i = propOptions.length
  2035. var options, name, attr, value, path, prop, literal, single
  2036. while (i--) {
  2037. options = propOptions[i]
  2038. name = options.name
  2039. // props could contain dashes, which will be
  2040. // interpreted as minus calculations by the parser
  2041. // so we need to camelize the path here
  2042. path = _.camelize(name.replace(dataAttrRE, ''))
  2043. if (!identRE.test(path)) {
  2044. ("development") !== 'production' && _.warn(
  2045. 'Invalid prop key: "' + name + '". Prop keys ' +
  2046. 'must be valid identifiers.'
  2047. )
  2048. continue
  2049. }
  2050. attr = _.hyphenate(name)
  2051. value = el.getAttribute(attr)
  2052. if (value === null) {
  2053. attr = 'data-' + attr
  2054. value = el.getAttribute(attr)
  2055. }
  2056. // create a prop descriptor
  2057. prop = {
  2058. name: name,
  2059. raw: value,
  2060. path: path,
  2061. options: options,
  2062. mode: propBindingModes.ONE_WAY
  2063. }
  2064. if (value !== null) {
  2065. // important so that this doesn't get compiled
  2066. // again as a normal attribute binding
  2067. el.removeAttribute(attr)
  2068. var tokens = textParser.parse(value)
  2069. if (tokens) {
  2070. prop.dynamic = true
  2071. prop.parentPath = textParser.tokensToExp(tokens)
  2072. // check prop binding type.
  2073. single = tokens.length === 1
  2074. literal = literalValueRE.test(prop.parentPath)
  2075. // one time: {{* prop}}
  2076. if (literal || (single && tokens[0].oneTime)) {
  2077. prop.mode = propBindingModes.ONE_TIME
  2078. } else if (
  2079. !literal &&
  2080. (single && tokens[0].twoWay)
  2081. ) {
  2082. if (settablePathRE.test(prop.parentPath)) {
  2083. prop.mode = propBindingModes.TWO_WAY
  2084. } else {
  2085. ("development") !== 'production' && _.warn(
  2086. 'Cannot bind two-way prop with non-settable ' +
  2087. 'parent path: ' + prop.parentPath
  2088. )
  2089. }
  2090. }
  2091. if (
  2092. ("development") !== 'production' &&
  2093. options.twoWay &&
  2094. prop.mode !== propBindingModes.TWO_WAY
  2095. ) {
  2096. _.warn(
  2097. 'Prop "' + name + '" expects a two-way binding type.'
  2098. )
  2099. }
  2100. }
  2101. } else if (options && options.required) {
  2102. ("development") !== 'production' && _.warn(
  2103. 'Missing required prop: ' + name
  2104. )
  2105. }
  2106. props.push(prop)
  2107. }
  2108. return makePropsLinkFn(props)
  2109. }
  2110. /**
  2111. * Build a function that applies props to a vm.
  2112. *
  2113. * @param {Array} props
  2114. * @return {Function} propsLinkFn
  2115. */
  2116. function makePropsLinkFn (props) {
  2117. return function propsLinkFn (vm, el) {
  2118. // store resolved props info
  2119. vm._props = {}
  2120. var i = props.length
  2121. var prop, path, options, value
  2122. while (i--) {
  2123. prop = props[i]
  2124. path = prop.path
  2125. vm._props[path] = prop
  2126. options = prop.options
  2127. if (prop.raw === null) {
  2128. // initialize absent prop
  2129. _.initProp(vm, prop, getDefault(options))
  2130. } else if (prop.dynamic) {
  2131. // dynamic prop
  2132. if (vm._context) {
  2133. if (prop.mode === propBindingModes.ONE_TIME) {
  2134. // one time binding
  2135. value = vm._context.$get(prop.parentPath)
  2136. _.initProp(vm, prop, value)
  2137. } else {
  2138. // dynamic binding
  2139. vm._bindDir('prop', el, prop, propDef)
  2140. }
  2141. } else {
  2142. ("development") !== 'production' && _.warn(
  2143. 'Cannot bind dynamic prop on a root instance' +
  2144. ' with no parent: ' + prop.name + '="' +
  2145. prop.raw + '"'
  2146. )
  2147. }
  2148. } else {
  2149. // literal, cast it and just set once
  2150. var raw = prop.raw
  2151. value = options.type === Boolean && raw === ''
  2152. ? true
  2153. // do not cast emptry string.
  2154. // _.toNumber casts empty string to 0.
  2155. : raw.trim()
  2156. ? _.toBoolean(_.toNumber(raw))
  2157. : raw
  2158. _.initProp(vm, prop, value)
  2159. }
  2160. }
  2161. }
  2162. }
  2163. /**
  2164. * Get the default value of a prop.
  2165. *
  2166. * @param {Object} options
  2167. * @return {*}
  2168. */
  2169. function getDefault (options) {
  2170. // no default, return undefined
  2171. if (!options.hasOwnProperty('default')) {
  2172. // absent boolean value defaults to false
  2173. return options.type === Boolean
  2174. ? false
  2175. : undefined
  2176. }
  2177. var def = options.default
  2178. // warn against non-factory defaults for Object & Array
  2179. if (_.isObject(def)) {
  2180. ("development") !== 'production' && _.warn(
  2181. 'Object/Array as default prop values will be shared ' +
  2182. 'across multiple instances. Use a factory function ' +
  2183. 'to return the default value instead.'
  2184. )
  2185. }
  2186. // call factory function for non-Function types
  2187. return typeof def === 'function' && options.type !== Function
  2188. ? def()
  2189. : def
  2190. }
  2191. /***/ },
  2192. /* 13 */
  2193. /***/ function(module, exports, __webpack_require__) {
  2194. var Cache = __webpack_require__(14)
  2195. var config = __webpack_require__(5)
  2196. var dirParser = __webpack_require__(15)
  2197. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g
  2198. var cache, tagRE, htmlRE, firstChar, lastChar
  2199. /**
  2200. * Escape a string so it can be used in a RegExp
  2201. * constructor.
  2202. *
  2203. * @param {String} str
  2204. */
  2205. function escapeRegex (str) {
  2206. return str.replace(regexEscapeRE, '\\$&')
  2207. }
  2208. /**
  2209. * Compile the interpolation tag regex.
  2210. *
  2211. * @return {RegExp}
  2212. */
  2213. function compileRegex () {
  2214. config._delimitersChanged = false
  2215. var open = config.delimiters[0]
  2216. var close = config.delimiters[1]
  2217. firstChar = open.charAt(0)
  2218. lastChar = close.charAt(close.length - 1)
  2219. var firstCharRE = escapeRegex(firstChar)
  2220. var lastCharRE = escapeRegex(lastChar)
  2221. var openRE = escapeRegex(open)
  2222. var closeRE = escapeRegex(close)
  2223. tagRE = new RegExp(
  2224. firstCharRE + '?' + openRE +
  2225. '(.+?)' +
  2226. closeRE + lastCharRE + '?',
  2227. 'g'
  2228. )
  2229. htmlRE = new RegExp(
  2230. '^' + firstCharRE + openRE +
  2231. '.*' +
  2232. closeRE + lastCharRE + '$'
  2233. )
  2234. // reset cache
  2235. cache = new Cache(1000)
  2236. }
  2237. /**
  2238. * Parse a template text string into an array of tokens.
  2239. *
  2240. * @param {String} text
  2241. * @return {Array<Object> | null}
  2242. * - {String} type
  2243. * - {String} value
  2244. * - {Boolean} [html]
  2245. * - {Boolean} [oneTime]
  2246. */
  2247. exports.parse = function (text) {
  2248. if (config._delimitersChanged) {
  2249. compileRegex()
  2250. }
  2251. var hit = cache.get(text)
  2252. if (hit) {
  2253. return hit
  2254. }
  2255. text = text.replace(/\n/g, '')
  2256. if (!tagRE.test(text)) {
  2257. return null
  2258. }
  2259. var tokens = []
  2260. var lastIndex = tagRE.lastIndex = 0
  2261. var match, index, value, first, oneTime, twoWay
  2262. /* eslint-disable no-cond-assign */
  2263. while (match = tagRE.exec(text)) {
  2264. /* eslint-enable no-cond-assign */
  2265. index = match.index
  2266. // push text token
  2267. if (index > lastIndex) {
  2268. tokens.push({
  2269. value: text.slice(lastIndex, index)
  2270. })
  2271. }
  2272. // tag token
  2273. first = match[1].charCodeAt(0)
  2274. oneTime = first === 42 // *
  2275. twoWay = first === 64 // @
  2276. value = oneTime || twoWay
  2277. ? match[1].slice(1)
  2278. : match[1]
  2279. tokens.push({
  2280. tag: true,
  2281. value: value.trim(),
  2282. html: htmlRE.test(match[0]),
  2283. oneTime: oneTime,
  2284. twoWay: twoWay
  2285. })
  2286. lastIndex = index + match[0].length
  2287. }
  2288. if (lastIndex < text.length) {
  2289. tokens.push({
  2290. value: text.slice(lastIndex)
  2291. })
  2292. }
  2293. cache.put(text, tokens)
  2294. return tokens
  2295. }
  2296. /**
  2297. * Format a list of tokens into an expression.
  2298. * e.g. tokens parsed from 'a {{b}} c' can be serialized
  2299. * into one single expression as '"a " + b + " c"'.
  2300. *
  2301. * @param {Array} tokens
  2302. * @param {Vue} [vm]
  2303. * @return {String}
  2304. */
  2305. exports.tokensToExp = function (tokens, vm) {
  2306. return tokens.length > 1
  2307. ? tokens.map(function (token) {
  2308. return formatToken(token, vm)
  2309. }).join('+')
  2310. : formatToken(tokens[0], vm, true)
  2311. }
  2312. /**
  2313. * Format a single token.
  2314. *
  2315. * @param {Object} token
  2316. * @param {Vue} [vm]
  2317. * @param {Boolean} single
  2318. * @return {String}
  2319. */
  2320. function formatToken (token, vm, single) {
  2321. return token.tag
  2322. ? vm && token.oneTime
  2323. ? '"' + vm.$eval(token.value) + '"'
  2324. : inlineFilters(token.value, single)
  2325. : '"' + token.value + '"'
  2326. }
  2327. /**
  2328. * For an attribute with multiple interpolation tags,
  2329. * e.g. attr="some-{{thing | filter}}", in order to combine
  2330. * the whole thing into a single watchable expression, we
  2331. * have to inline those filters. This function does exactly
  2332. * that. This is a bit hacky but it avoids heavy changes
  2333. * to directive parser and watcher mechanism.
  2334. *
  2335. * @param {String} exp
  2336. * @param {Boolean} single
  2337. * @return {String}
  2338. */
  2339. var filterRE = /[^|]\|[^|]/
  2340. function inlineFilters (exp, single) {
  2341. if (!filterRE.test(exp)) {
  2342. return single
  2343. ? exp
  2344. : '(' + exp + ')'
  2345. } else {
  2346. var dir = dirParser.parse(exp)[0]
  2347. if (!dir.filters) {
  2348. return '(' + exp + ')'
  2349. } else {
  2350. return 'this._applyFilters(' +
  2351. dir.expression + // value
  2352. ',null,' + // oldValue (null for read)
  2353. JSON.stringify(dir.filters) + // filter descriptors
  2354. ',false)' // write?
  2355. }
  2356. }
  2357. }
  2358. /***/ },
  2359. /* 14 */
  2360. /***/ function(module, exports) {
  2361. /**
  2362. * A doubly linked list-based Least Recently Used (LRU)
  2363. * cache. Will keep most recently used items while
  2364. * discarding least recently used items when its limit is
  2365. * reached. This is a bare-bone version of
  2366. * Rasmus Andersson's js-lru:
  2367. *
  2368. * https://github.com/rsms/js-lru
  2369. *
  2370. * @param {Number} limit
  2371. * @constructor
  2372. */
  2373. function Cache (limit) {
  2374. this.size = 0
  2375. this.limit = limit
  2376. this.head = this.tail = undefined
  2377. this._keymap = Object.create(null)
  2378. }
  2379. var p = Cache.prototype
  2380. /**
  2381. * Put <value> into the cache associated with <key>.
  2382. * Returns the entry which was removed to make room for
  2383. * the new entry. Otherwise undefined is returned.
  2384. * (i.e. if there was enough room already).
  2385. *
  2386. * @param {String} key
  2387. * @param {*} value
  2388. * @return {Entry|undefined}
  2389. */
  2390. p.put = function (key, value) {
  2391. var entry = {
  2392. key: key,
  2393. value: value
  2394. }
  2395. this._keymap[key] = entry
  2396. if (this.tail) {
  2397. this.tail.newer = entry
  2398. entry.older = this.tail
  2399. } else {
  2400. this.head = entry
  2401. }
  2402. this.tail = entry
  2403. if (this.size === this.limit) {
  2404. return this.shift()
  2405. } else {
  2406. this.size++
  2407. }
  2408. }
  2409. /**
  2410. * Purge the least recently used (oldest) entry from the
  2411. * cache. Returns the removed entry or undefined if the
  2412. * cache was empty.
  2413. */
  2414. p.shift = function () {
  2415. var entry = this.head
  2416. if (entry) {
  2417. this.head = this.head.newer
  2418. this.head.older = undefined
  2419. entry.newer = entry.older = undefined
  2420. this._keymap[entry.key] = undefined
  2421. }
  2422. return entry
  2423. }
  2424. /**
  2425. * Get and register recent use of <key>. Returns the value
  2426. * associated with <key> or undefined if not in cache.
  2427. *
  2428. * @param {String} key
  2429. * @param {Boolean} returnEntry
  2430. * @return {Entry|*}
  2431. */
  2432. p.get = function (key, returnEntry) {
  2433. var entry = this._keymap[key]
  2434. if (entry === undefined) return
  2435. if (entry === this.tail) {
  2436. return returnEntry
  2437. ? entry
  2438. : entry.value
  2439. }
  2440. // HEAD--------------TAIL
  2441. // <.older .newer>
  2442. // <--- add direction --
  2443. // A B C <D> E
  2444. if (entry.newer) {
  2445. if (entry === this.head) {
  2446. this.head = entry.newer
  2447. }
  2448. entry.newer.older = entry.older // C <-- E.
  2449. }
  2450. if (entry.older) {
  2451. entry.older.newer = entry.newer // C. --> E
  2452. }
  2453. entry.newer = undefined // D --x
  2454. entry.older = this.tail // D. --> E
  2455. if (this.tail) {
  2456. this.tail.newer = entry // E. <-- D
  2457. }
  2458. this.tail = entry
  2459. return returnEntry
  2460. ? entry
  2461. : entry.value
  2462. }
  2463. module.exports = Cache
  2464. /***/ },
  2465. /* 15 */
  2466. /***/ function(module, exports, __webpack_require__) {
  2467. var _ = __webpack_require__(1)
  2468. var Cache = __webpack_require__(14)
  2469. var cache = new Cache(1000)
  2470. var argRE = /^[^\{\?]+$|^'[^']*'$|^"[^"]*"$/
  2471. var filterTokenRE = /[^\s'"]+|'[^']+'|"[^"]+"/g
  2472. var reservedArgRE = /^in$|^-?\d+/
  2473. /**
  2474. * Parser state
  2475. */
  2476. var str
  2477. var c, i, l
  2478. var inSingle
  2479. var inDouble
  2480. var curly
  2481. var square
  2482. var paren
  2483. var begin
  2484. var argIndex
  2485. var dirs
  2486. var dir
  2487. var lastFilterIndex
  2488. var arg
  2489. /**
  2490. * Push a directive object into the result Array
  2491. */
  2492. function pushDir () {
  2493. dir.raw = str.slice(begin, i).trim()
  2494. if (dir.expression === undefined) {
  2495. dir.expression = str.slice(argIndex, i).trim()
  2496. } else if (lastFilterIndex !== begin) {
  2497. pushFilter()
  2498. }
  2499. if (i === 0 || dir.expression) {
  2500. dirs.push(dir)
  2501. }
  2502. }
  2503. /**
  2504. * Push a filter to the current directive object
  2505. */
  2506. function pushFilter () {
  2507. var exp = str.slice(lastFilterIndex, i).trim()
  2508. var filter
  2509. if (exp) {
  2510. filter = {}
  2511. var tokens = exp.match(filterTokenRE)
  2512. filter.name = tokens[0]
  2513. if (tokens.length > 1) {
  2514. filter.args = tokens.slice(1).map(processFilterArg)
  2515. }
  2516. }
  2517. if (filter) {
  2518. (dir.filters = dir.filters || []).push(filter)
  2519. }
  2520. lastFilterIndex = i + 1
  2521. }
  2522. /**
  2523. * Check if an argument is dynamic and strip quotes.
  2524. *
  2525. * @param {String} arg
  2526. * @return {Object}
  2527. */
  2528. function processFilterArg (arg) {
  2529. var stripped = reservedArgRE.test(arg)
  2530. ? arg
  2531. : _.stripQuotes(arg)
  2532. return {
  2533. value: stripped || arg,
  2534. dynamic: !stripped
  2535. }
  2536. }
  2537. /**
  2538. * Parse a directive string into an Array of AST-like
  2539. * objects representing directives.
  2540. *
  2541. * Example:
  2542. *
  2543. * "click: a = a + 1 | uppercase" will yield:
  2544. * {
  2545. * arg: 'click',
  2546. * expression: 'a = a + 1',
  2547. * filters: [
  2548. * { name: 'uppercase', args: null }
  2549. * ]
  2550. * }
  2551. *
  2552. * @param {String} str
  2553. * @return {Array<Object>}
  2554. */
  2555. exports.parse = function (s) {
  2556. var hit = cache.get(s)
  2557. if (hit) {
  2558. return hit
  2559. }
  2560. // reset parser state
  2561. str = s
  2562. inSingle = inDouble = false
  2563. curly = square = paren = begin = argIndex = 0
  2564. lastFilterIndex = 0
  2565. dirs = []
  2566. dir = {}
  2567. arg = null
  2568. for (i = 0, l = str.length; i < l; i++) {
  2569. c = str.charCodeAt(i)
  2570. if (inSingle) {
  2571. // check single quote
  2572. if (c === 0x27) inSingle = !inSingle
  2573. } else if (inDouble) {
  2574. // check double quote
  2575. if (c === 0x22) inDouble = !inDouble
  2576. } else if (
  2577. c === 0x2C && // comma
  2578. !paren && !curly && !square
  2579. ) {
  2580. // reached the end of a directive
  2581. pushDir()
  2582. // reset & skip the comma
  2583. dir = {}
  2584. begin = argIndex = lastFilterIndex = i + 1
  2585. } else if (
  2586. c === 0x3A && // colon
  2587. !dir.expression &&
  2588. !dir.arg
  2589. ) {
  2590. // argument
  2591. arg = str.slice(begin, i).trim()
  2592. // test for valid argument here
  2593. // since we may have caught stuff like first half of
  2594. // an object literal or a ternary expression.
  2595. if (argRE.test(arg)) {
  2596. argIndex = i + 1
  2597. dir.arg = _.stripQuotes(arg) || arg
  2598. }
  2599. } else if (
  2600. c === 0x7C && // pipe
  2601. str.charCodeAt(i + 1) !== 0x7C &&
  2602. str.charCodeAt(i - 1) !== 0x7C
  2603. ) {
  2604. if (dir.expression === undefined) {
  2605. // first filter, end of expression
  2606. lastFilterIndex = i + 1
  2607. dir.expression = str.slice(argIndex, i).trim()
  2608. } else {
  2609. // already has filter
  2610. pushFilter()
  2611. }
  2612. } else {
  2613. switch (c) {
  2614. case 0x22: inDouble = true; break // "
  2615. case 0x27: inSingle = true; break // '
  2616. case 0x28: paren++; break // (
  2617. case 0x29: paren--; break // )
  2618. case 0x5B: square++; break // [
  2619. case 0x5D: square--; break // ]
  2620. case 0x7B: curly++; break // {
  2621. case 0x7D: curly--; break // }
  2622. }
  2623. }
  2624. }
  2625. if (i === 0 || begin !== i) {
  2626. pushDir()
  2627. }
  2628. cache.put(s, dirs)
  2629. return dirs
  2630. }
  2631. /***/ },
  2632. /* 16 */
  2633. /***/ function(module, exports, __webpack_require__) {
  2634. // NOTE: the prop internal directive is compiled and linked
  2635. // during _initScope(), before the created hook is called.
  2636. // The purpose is to make the initial prop values available
  2637. // inside `created` hooks and `data` functions.
  2638. var _ = __webpack_require__(1)
  2639. var Watcher = __webpack_require__(17)
  2640. var bindingModes = __webpack_require__(5)._propBindingModes
  2641. module.exports = {
  2642. bind: function () {
  2643. var child = this.vm
  2644. var parent = child._context
  2645. // passed in from compiler directly
  2646. var prop = this._descriptor
  2647. var childKey = prop.path
  2648. var parentKey = prop.parentPath
  2649. this.parentWatcher = new Watcher(
  2650. parent,
  2651. parentKey,
  2652. function (val) {
  2653. if (_.assertProp(prop, val)) {
  2654. child[childKey] = val
  2655. }
  2656. }
  2657. )
  2658. // set the child initial value.
  2659. var value = this.parentWatcher.value
  2660. if (childKey === '$data') {
  2661. child._data = value
  2662. } else {
  2663. _.initProp(child, prop, value)
  2664. }
  2665. // setup two-way binding
  2666. if (prop.mode === bindingModes.TWO_WAY) {
  2667. // important: defer the child watcher creation until
  2668. // the created hook (after data observation)
  2669. var self = this
  2670. child.$once('hook:created', function () {
  2671. self.childWatcher = new Watcher(
  2672. child,
  2673. childKey,
  2674. function (val) {
  2675. parent.$set(parentKey, val)
  2676. }
  2677. )
  2678. })
  2679. }
  2680. },
  2681. unbind: function () {
  2682. this.parentWatcher.teardown()
  2683. if (this.childWatcher) {
  2684. this.childWatcher.teardown()
  2685. }
  2686. }
  2687. }
  2688. /***/ },
  2689. /* 17 */
  2690. /***/ function(module, exports, __webpack_require__) {
  2691. var _ = __webpack_require__(1)
  2692. var config = __webpack_require__(5)
  2693. var Dep = __webpack_require__(18)
  2694. var expParser = __webpack_require__(19)
  2695. var batcher = __webpack_require__(21)
  2696. var uid = 0
  2697. /**
  2698. * A watcher parses an expression, collects dependencies,
  2699. * and fires callback when the expression value changes.
  2700. * This is used for both the $watch() api and directives.
  2701. *
  2702. * @param {Vue} vm
  2703. * @param {String} expression
  2704. * @param {Function} cb
  2705. * @param {Object} options
  2706. * - {Array} filters
  2707. * - {Boolean} twoWay
  2708. * - {Boolean} deep
  2709. * - {Boolean} user
  2710. * - {Boolean} lazy
  2711. * - {Function} [preProcess]
  2712. * @constructor
  2713. */
  2714. function Watcher (vm, expOrFn, cb, options) {
  2715. var isFn = typeof expOrFn === 'function'
  2716. this.vm = vm
  2717. vm._watchers.push(this)
  2718. this.expression = isFn ? expOrFn.toString() : expOrFn
  2719. this.cb = cb
  2720. this.id = ++uid // uid for batching
  2721. this.active = true
  2722. options = options || {}
  2723. this.deep = !!options.deep
  2724. this.user = !!options.user
  2725. this.twoWay = !!options.twoWay
  2726. this.lazy = !!options.lazy
  2727. this.dirty = this.lazy
  2728. this.filters = options.filters
  2729. this.preProcess = options.preProcess
  2730. this.deps = []
  2731. this.newDeps = null
  2732. // parse expression for getter/setter
  2733. if (isFn) {
  2734. this.getter = expOrFn
  2735. this.setter = undefined
  2736. } else {
  2737. var res = expParser.parse(expOrFn, options.twoWay)
  2738. this.getter = res.get
  2739. this.setter = res.set
  2740. }
  2741. this.value = this.lazy
  2742. ? undefined
  2743. : this.get()
  2744. // state for avoiding false triggers for deep and Array
  2745. // watchers during vm._digest()
  2746. this.queued = this.shallow = false
  2747. }
  2748. var p = Watcher.prototype
  2749. /**
  2750. * Add a dependency to this directive.
  2751. *
  2752. * @param {Dep} dep
  2753. */
  2754. p.addDep = function (dep) {
  2755. var newDeps = this.newDeps
  2756. var old = this.deps
  2757. if (_.indexOf(newDeps, dep) < 0) {
  2758. newDeps.push(dep)
  2759. var i = _.indexOf(old, dep)
  2760. if (i < 0) {
  2761. dep.addSub(this)
  2762. } else {
  2763. old[i] = null
  2764. }
  2765. }
  2766. }
  2767. /**
  2768. * Evaluate the getter, and re-collect dependencies.
  2769. */
  2770. p.get = function () {
  2771. this.beforeGet()
  2772. var vm = this.vm
  2773. var value
  2774. try {
  2775. value = this.getter.call(vm, vm)
  2776. } catch (e) {
  2777. if (
  2778. ("development") !== 'production' &&
  2779. config.warnExpressionErrors
  2780. ) {
  2781. _.warn(
  2782. 'Error when evaluating expression "' +
  2783. this.expression + '". ' +
  2784. (config.debug
  2785. ? '' :
  2786. 'Turn on debug mode to see stack trace.'
  2787. ), e
  2788. )
  2789. }
  2790. }
  2791. // "touch" every property so they are all tracked as
  2792. // dependencies for deep watching
  2793. if (this.deep) {
  2794. traverse(value)
  2795. }
  2796. if (this.preProcess) {
  2797. value = this.preProcess(value)
  2798. }
  2799. if (this.filters) {
  2800. value = vm._applyFilters(value, null, this.filters, false)
  2801. }
  2802. this.afterGet()
  2803. return value
  2804. }
  2805. /**
  2806. * Set the corresponding value with the setter.
  2807. *
  2808. * @param {*} value
  2809. */
  2810. p.set = function (value) {
  2811. var vm = this.vm
  2812. if (this.filters) {
  2813. value = vm._applyFilters(
  2814. value, this.value, this.filters, true)
  2815. }
  2816. try {
  2817. this.setter.call(vm, vm, value)
  2818. } catch (e) {
  2819. if (
  2820. ("development") !== 'production' &&
  2821. config.warnExpressionErrors
  2822. ) {
  2823. _.warn(
  2824. 'Error when evaluating setter "' +
  2825. this.expression + '"', e
  2826. )
  2827. }
  2828. }
  2829. }
  2830. /**
  2831. * Prepare for dependency collection.
  2832. */
  2833. p.beforeGet = function () {
  2834. Dep.target = this
  2835. this.newDeps = []
  2836. }
  2837. /**
  2838. * Clean up for dependency collection.
  2839. */
  2840. p.afterGet = function () {
  2841. Dep.target = null
  2842. var i = this.deps.length
  2843. while (i--) {
  2844. var dep = this.deps[i]
  2845. if (dep) {
  2846. dep.removeSub(this)
  2847. }
  2848. }
  2849. this.deps = this.newDeps
  2850. this.newDeps = null
  2851. }
  2852. /**
  2853. * Subscriber interface.
  2854. * Will be called when a dependency changes.
  2855. *
  2856. * @param {Boolean} shallow
  2857. */
  2858. p.update = function (shallow) {
  2859. if (this.lazy) {
  2860. this.dirty = true
  2861. } else if (!config.async) {
  2862. this.run()
  2863. } else {
  2864. // if queued, only overwrite shallow with non-shallow,
  2865. // but not the other way around.
  2866. this.shallow = this.queued
  2867. ? shallow
  2868. ? this.shallow
  2869. : false
  2870. : !!shallow
  2871. this.queued = true
  2872. batcher.push(this)
  2873. }
  2874. }
  2875. /**
  2876. * Batcher job interface.
  2877. * Will be called by the batcher.
  2878. */
  2879. p.run = function () {
  2880. if (this.active) {
  2881. var value = this.get()
  2882. if (
  2883. value !== this.value ||
  2884. // Deep watchers and Array watchers should fire even
  2885. // when the value is the same, because the value may
  2886. // have mutated; but only do so if this is a
  2887. // non-shallow update (caused by a vm digest).
  2888. ((_.isArray(value) || this.deep) && !this.shallow)
  2889. ) {
  2890. var oldValue = this.value
  2891. this.value = value
  2892. this.cb(value, oldValue)
  2893. }
  2894. this.queued = this.shallow = false
  2895. }
  2896. }
  2897. /**
  2898. * Evaluate the value of the watcher.
  2899. * This only gets called for lazy watchers.
  2900. */
  2901. p.evaluate = function () {
  2902. // avoid overwriting another watcher that is being
  2903. // collected.
  2904. var current = Dep.target
  2905. this.value = this.get()
  2906. this.dirty = false
  2907. Dep.target = current
  2908. }
  2909. /**
  2910. * Depend on all deps collected by this watcher.
  2911. */
  2912. p.depend = function () {
  2913. var i = this.deps.length
  2914. while (i--) {
  2915. this.deps[i].depend()
  2916. }
  2917. }
  2918. /**
  2919. * Remove self from all dependencies' subcriber list.
  2920. */
  2921. p.teardown = function () {
  2922. if (this.active) {
  2923. // remove self from vm's watcher list
  2924. // we can skip this if the vm if being destroyed
  2925. // which can improve teardown performance.
  2926. if (!this.vm._isBeingDestroyed) {
  2927. this.vm._watchers.$remove(this)
  2928. }
  2929. var i = this.deps.length
  2930. while (i--) {
  2931. this.deps[i].removeSub(this)
  2932. }
  2933. this.active = false
  2934. this.vm = this.cb = this.value = null
  2935. }
  2936. }
  2937. /**
  2938. * Recrusively traverse an object to evoke all converted
  2939. * getters, so that every nested property inside the object
  2940. * is collected as a "deep" dependency.
  2941. *
  2942. * @param {Object} obj
  2943. */
  2944. function traverse (obj) {
  2945. var key, val, i
  2946. for (key in obj) {
  2947. val = obj[key]
  2948. if (_.isArray(val)) {
  2949. i = val.length
  2950. while (i--) traverse(val[i])
  2951. } else if (_.isObject(val)) {
  2952. traverse(val)
  2953. }
  2954. }
  2955. }
  2956. module.exports = Watcher
  2957. /***/ },
  2958. /* 18 */
  2959. /***/ function(module, exports, __webpack_require__) {
  2960. var _ = __webpack_require__(1)
  2961. /**
  2962. * A dep is an observable that can have multiple
  2963. * directives subscribing to it.
  2964. *
  2965. * @constructor
  2966. */
  2967. function Dep () {
  2968. this.subs = []
  2969. }
  2970. // the current target watcher being evaluated.
  2971. // this is globally unique because there could be only one
  2972. // watcher being evaluated at any time.
  2973. Dep.target = null
  2974. var p = Dep.prototype
  2975. /**
  2976. * Add a directive subscriber.
  2977. *
  2978. * @param {Directive} sub
  2979. */
  2980. p.addSub = function (sub) {
  2981. this.subs.push(sub)
  2982. }
  2983. /**
  2984. * Remove a directive subscriber.
  2985. *
  2986. * @param {Directive} sub
  2987. */
  2988. p.removeSub = function (sub) {
  2989. this.subs.$remove(sub)
  2990. }
  2991. /**
  2992. * Add self as a dependency to the target watcher.
  2993. */
  2994. p.depend = function () {
  2995. Dep.target.addDep(this)
  2996. }
  2997. /**
  2998. * Notify all subscribers of a new value.
  2999. */
  3000. p.notify = function () {
  3001. // stablize the subscriber list first
  3002. var subs = _.toArray(this.subs)
  3003. for (var i = 0, l = subs.length; i < l; i++) {
  3004. subs[i].update()
  3005. }
  3006. }
  3007. module.exports = Dep
  3008. /***/ },
  3009. /* 19 */
  3010. /***/ function(module, exports, __webpack_require__) {
  3011. var _ = __webpack_require__(1)
  3012. var Path = __webpack_require__(20)
  3013. var Cache = __webpack_require__(14)
  3014. var expressionCache = new Cache(1000)
  3015. var allowedKeywords =
  3016. 'Math,Date,this,true,false,null,undefined,Infinity,NaN,' +
  3017. 'isNaN,isFinite,decodeURI,decodeURIComponent,encodeURI,' +
  3018. 'encodeURIComponent,parseInt,parseFloat'
  3019. var allowedKeywordsRE =
  3020. new RegExp('^(' + allowedKeywords.replace(/,/g, '\\b|') + '\\b)')
  3021. // keywords that don't make sense inside expressions
  3022. var improperKeywords =
  3023. 'break,case,class,catch,const,continue,debugger,default,' +
  3024. 'delete,do,else,export,extends,finally,for,function,if,' +
  3025. 'import,in,instanceof,let,return,super,switch,throw,try,' +
  3026. 'var,while,with,yield,enum,await,implements,package,' +
  3027. 'proctected,static,interface,private,public'
  3028. var improperKeywordsRE =
  3029. new RegExp('^(' + improperKeywords.replace(/,/g, '\\b|') + '\\b)')
  3030. var wsRE = /\s/g
  3031. var newlineRE = /\n/g
  3032. var saveRE = /[\{,]\s*[\w\$_]+\s*:|('[^']*'|"[^"]*")|new |typeof |void /g
  3033. var restoreRE = /"(\d+)"/g
  3034. var pathTestRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/
  3035. var pathReplaceRE = /[^\w$\.]([A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\])*)/g
  3036. var booleanLiteralRE = /^(true|false)$/
  3037. /**
  3038. * Save / Rewrite / Restore
  3039. *
  3040. * When rewriting paths found in an expression, it is
  3041. * possible for the same letter sequences to be found in
  3042. * strings and Object literal property keys. Therefore we
  3043. * remove and store these parts in a temporary array, and
  3044. * restore them after the path rewrite.
  3045. */
  3046. var saved = []
  3047. /**
  3048. * Save replacer
  3049. *
  3050. * The save regex can match two possible cases:
  3051. * 1. An opening object literal
  3052. * 2. A string
  3053. * If matched as a plain string, we need to escape its
  3054. * newlines, since the string needs to be preserved when
  3055. * generating the function body.
  3056. *
  3057. * @param {String} str
  3058. * @param {String} isString - str if matched as a string
  3059. * @return {String} - placeholder with index
  3060. */
  3061. function save (str, isString) {
  3062. var i = saved.length
  3063. saved[i] = isString
  3064. ? str.replace(newlineRE, '\\n')
  3065. : str
  3066. return '"' + i + '"'
  3067. }
  3068. /**
  3069. * Path rewrite replacer
  3070. *
  3071. * @param {String} raw
  3072. * @return {String}
  3073. */
  3074. function rewrite (raw) {
  3075. var c = raw.charAt(0)
  3076. var path = raw.slice(1)
  3077. if (allowedKeywordsRE.test(path)) {
  3078. return raw
  3079. } else {
  3080. path = path.indexOf('"') > -1
  3081. ? path.replace(restoreRE, restore)
  3082. : path
  3083. return c + 'scope.' + path
  3084. }
  3085. }
  3086. /**
  3087. * Restore replacer
  3088. *
  3089. * @param {String} str
  3090. * @param {String} i - matched save index
  3091. * @return {String}
  3092. */
  3093. function restore (str, i) {
  3094. return saved[i]
  3095. }
  3096. /**
  3097. * Rewrite an expression, prefixing all path accessors with
  3098. * `scope.` and generate getter/setter functions.
  3099. *
  3100. * @param {String} exp
  3101. * @param {Boolean} needSet
  3102. * @return {Function}
  3103. */
  3104. function compileExpFns (exp, needSet) {
  3105. if (improperKeywordsRE.test(exp)) {
  3106. ("development") !== 'production' && _.warn(
  3107. 'Avoid using reserved keywords in expression: ' + exp
  3108. )
  3109. }
  3110. // reset state
  3111. saved.length = 0
  3112. // save strings and object literal keys
  3113. var body = exp
  3114. .replace(saveRE, save)
  3115. .replace(wsRE, '')
  3116. // rewrite all paths
  3117. // pad 1 space here becaue the regex matches 1 extra char
  3118. body = (' ' + body)
  3119. .replace(pathReplaceRE, rewrite)
  3120. .replace(restoreRE, restore)
  3121. var getter = makeGetter(body)
  3122. if (getter) {
  3123. return {
  3124. get: getter,
  3125. body: body,
  3126. set: needSet
  3127. ? makeSetter(body)
  3128. : null
  3129. }
  3130. }
  3131. }
  3132. /**
  3133. * Compile getter setters for a simple path.
  3134. *
  3135. * @param {String} exp
  3136. * @return {Function}
  3137. */
  3138. function compilePathFns (exp) {
  3139. var getter, path
  3140. if (exp.indexOf('[') < 0) {
  3141. // really simple path
  3142. path = exp.split('.')
  3143. path.raw = exp
  3144. getter = Path.compileGetter(path)
  3145. } else {
  3146. // do the real parsing
  3147. path = Path.parse(exp)
  3148. getter = path.get
  3149. }
  3150. return {
  3151. get: getter,
  3152. // always generate setter for simple paths
  3153. set: function (obj, val) {
  3154. Path.set(obj, path, val)
  3155. }
  3156. }
  3157. }
  3158. /**
  3159. * Build a getter function. Requires eval.
  3160. *
  3161. * We isolate the try/catch so it doesn't affect the
  3162. * optimization of the parse function when it is not called.
  3163. *
  3164. * @param {String} body
  3165. * @return {Function|undefined}
  3166. */
  3167. function makeGetter (body) {
  3168. try {
  3169. return new Function('scope', 'return ' + body + ';')
  3170. } catch (e) {
  3171. ("development") !== 'production' && _.warn(
  3172. 'Invalid expression. ' +
  3173. 'Generated function body: ' + body
  3174. )
  3175. }
  3176. }
  3177. /**
  3178. * Build a setter function.
  3179. *
  3180. * This is only needed in rare situations like "a[b]" where
  3181. * a settable path requires dynamic evaluation.
  3182. *
  3183. * This setter function may throw error when called if the
  3184. * expression body is not a valid left-hand expression in
  3185. * assignment.
  3186. *
  3187. * @param {String} body
  3188. * @return {Function|undefined}
  3189. */
  3190. function makeSetter (body) {
  3191. try {
  3192. return new Function('scope', 'value', body + '=value;')
  3193. } catch (e) {
  3194. ("development") !== 'production' && _.warn(
  3195. 'Invalid setter function body: ' + body
  3196. )
  3197. }
  3198. }
  3199. /**
  3200. * Check for setter existence on a cache hit.
  3201. *
  3202. * @param {Function} hit
  3203. */
  3204. function checkSetter (hit) {
  3205. if (!hit.set) {
  3206. hit.set = makeSetter(hit.body)
  3207. }
  3208. }
  3209. /**
  3210. * Parse an expression into re-written getter/setters.
  3211. *
  3212. * @param {String} exp
  3213. * @param {Boolean} needSet
  3214. * @return {Function}
  3215. */
  3216. exports.parse = function (exp, needSet) {
  3217. exp = exp.trim()
  3218. // try cache
  3219. var hit = expressionCache.get(exp)
  3220. if (hit) {
  3221. if (needSet) {
  3222. checkSetter(hit)
  3223. }
  3224. return hit
  3225. }
  3226. // we do a simple path check to optimize for them.
  3227. // the check fails valid paths with unusal whitespaces,
  3228. // but that's too rare and we don't care.
  3229. // also skip boolean literals and paths that start with
  3230. // global "Math"
  3231. var res = exports.isSimplePath(exp)
  3232. ? compilePathFns(exp)
  3233. : compileExpFns(exp, needSet)
  3234. expressionCache.put(exp, res)
  3235. return res
  3236. }
  3237. /**
  3238. * Check if an expression is a simple path.
  3239. *
  3240. * @param {String} exp
  3241. * @return {Boolean}
  3242. */
  3243. exports.isSimplePath = function (exp) {
  3244. return pathTestRE.test(exp) &&
  3245. // don't treat true/false as paths
  3246. !booleanLiteralRE.test(exp) &&
  3247. // Math constants e.g. Math.PI, Math.E etc.
  3248. exp.slice(0, 5) !== 'Math.'
  3249. }
  3250. /***/ },
  3251. /* 20 */
  3252. /***/ function(module, exports, __webpack_require__) {
  3253. var _ = __webpack_require__(1)
  3254. var Cache = __webpack_require__(14)
  3255. var pathCache = new Cache(1000)
  3256. var identRE = exports.identRE = /^[$_a-zA-Z]+[\w$]*$/
  3257. // actions
  3258. var APPEND = 0
  3259. var PUSH = 1
  3260. // states
  3261. var BEFORE_PATH = 0
  3262. var IN_PATH = 1
  3263. var BEFORE_IDENT = 2
  3264. var IN_IDENT = 3
  3265. var BEFORE_ELEMENT = 4
  3266. var AFTER_ZERO = 5
  3267. var IN_INDEX = 6
  3268. var IN_SINGLE_QUOTE = 7
  3269. var IN_DOUBLE_QUOTE = 8
  3270. var IN_SUB_PATH = 9
  3271. var AFTER_ELEMENT = 10
  3272. var AFTER_PATH = 11
  3273. var ERROR = 12
  3274. var pathStateMachine = []
  3275. pathStateMachine[BEFORE_PATH] = {
  3276. 'ws': [BEFORE_PATH],
  3277. 'ident': [IN_IDENT, APPEND],
  3278. '[': [BEFORE_ELEMENT],
  3279. 'eof': [AFTER_PATH]
  3280. }
  3281. pathStateMachine[IN_PATH] = {
  3282. 'ws': [IN_PATH],
  3283. '.': [BEFORE_IDENT],
  3284. '[': [BEFORE_ELEMENT],
  3285. 'eof': [AFTER_PATH]
  3286. }
  3287. pathStateMachine[BEFORE_IDENT] = {
  3288. 'ws': [BEFORE_IDENT],
  3289. 'ident': [IN_IDENT, APPEND]
  3290. }
  3291. pathStateMachine[IN_IDENT] = {
  3292. 'ident': [IN_IDENT, APPEND],
  3293. '0': [IN_IDENT, APPEND],
  3294. 'number': [IN_IDENT, APPEND],
  3295. 'ws': [IN_PATH, PUSH],
  3296. '.': [BEFORE_IDENT, PUSH],
  3297. '[': [BEFORE_ELEMENT, PUSH],
  3298. 'eof': [AFTER_PATH, PUSH]
  3299. }
  3300. pathStateMachine[BEFORE_ELEMENT] = {
  3301. 'ws': [BEFORE_ELEMENT],
  3302. '0': [AFTER_ZERO, APPEND],
  3303. 'number': [IN_INDEX, APPEND],
  3304. "'": [IN_SINGLE_QUOTE, APPEND, ''],
  3305. '"': [IN_DOUBLE_QUOTE, APPEND, ''],
  3306. 'ident': [IN_SUB_PATH, APPEND, '*']
  3307. }
  3308. pathStateMachine[AFTER_ZERO] = {
  3309. 'ws': [AFTER_ELEMENT, PUSH],
  3310. ']': [IN_PATH, PUSH]
  3311. }
  3312. pathStateMachine[IN_INDEX] = {
  3313. '0': [IN_INDEX, APPEND],
  3314. 'number': [IN_INDEX, APPEND],
  3315. 'ws': [AFTER_ELEMENT],
  3316. ']': [IN_PATH, PUSH]
  3317. }
  3318. pathStateMachine[IN_SINGLE_QUOTE] = {
  3319. "'": [AFTER_ELEMENT],
  3320. 'eof': ERROR,
  3321. 'else': [IN_SINGLE_QUOTE, APPEND]
  3322. }
  3323. pathStateMachine[IN_DOUBLE_QUOTE] = {
  3324. '"': [AFTER_ELEMENT],
  3325. 'eof': ERROR,
  3326. 'else': [IN_DOUBLE_QUOTE, APPEND]
  3327. }
  3328. pathStateMachine[IN_SUB_PATH] = {
  3329. 'ident': [IN_SUB_PATH, APPEND],
  3330. '0': [IN_SUB_PATH, APPEND],
  3331. 'number': [IN_SUB_PATH, APPEND],
  3332. 'ws': [AFTER_ELEMENT],
  3333. ']': [IN_PATH, PUSH]
  3334. }
  3335. pathStateMachine[AFTER_ELEMENT] = {
  3336. 'ws': [AFTER_ELEMENT],
  3337. ']': [IN_PATH, PUSH]
  3338. }
  3339. /**
  3340. * Determine the type of a character in a keypath.
  3341. *
  3342. * @param {Char} ch
  3343. * @return {String} type
  3344. */
  3345. function getPathCharType (ch) {
  3346. if (ch === undefined) {
  3347. return 'eof'
  3348. }
  3349. var code = ch.charCodeAt(0)
  3350. switch (code) {
  3351. case 0x5B: // [
  3352. case 0x5D: // ]
  3353. case 0x2E: // .
  3354. case 0x22: // "
  3355. case 0x27: // '
  3356. case 0x30: // 0
  3357. return ch
  3358. case 0x5F: // _
  3359. case 0x24: // $
  3360. return 'ident'
  3361. case 0x20: // Space
  3362. case 0x09: // Tab
  3363. case 0x0A: // Newline
  3364. case 0x0D: // Return
  3365. case 0xA0: // No-break space
  3366. case 0xFEFF: // Byte Order Mark
  3367. case 0x2028: // Line Separator
  3368. case 0x2029: // Paragraph Separator
  3369. return 'ws'
  3370. }
  3371. // a-z, A-Z
  3372. if (
  3373. (code >= 0x61 && code <= 0x7A) ||
  3374. (code >= 0x41 && code <= 0x5A)
  3375. ) {
  3376. return 'ident'
  3377. }
  3378. // 1-9
  3379. if (code >= 0x31 && code <= 0x39) {
  3380. return 'number'
  3381. }
  3382. return 'else'
  3383. }
  3384. /**
  3385. * Parse a string path into an array of segments
  3386. * Todo implement cache
  3387. *
  3388. * @param {String} path
  3389. * @return {Array|undefined}
  3390. */
  3391. function parsePath (path) {
  3392. var keys = []
  3393. var index = -1
  3394. var mode = BEFORE_PATH
  3395. var c, newChar, key, type, transition, action, typeMap
  3396. var actions = []
  3397. actions[PUSH] = function () {
  3398. if (key === undefined) {
  3399. return
  3400. }
  3401. keys.push(key)
  3402. key = undefined
  3403. }
  3404. actions[APPEND] = function () {
  3405. if (key === undefined) {
  3406. key = newChar
  3407. } else {
  3408. key += newChar
  3409. }
  3410. }
  3411. function maybeUnescapeQuote () {
  3412. var nextChar = path[index + 1]
  3413. if ((mode === IN_SINGLE_QUOTE && nextChar === "'") ||
  3414. (mode === IN_DOUBLE_QUOTE && nextChar === '"')) {
  3415. index++
  3416. newChar = nextChar
  3417. actions[APPEND]()
  3418. return true
  3419. }
  3420. }
  3421. while (mode != null) {
  3422. index++
  3423. c = path[index]
  3424. if (c === '\\' && maybeUnescapeQuote()) {
  3425. continue
  3426. }
  3427. type = getPathCharType(c)
  3428. typeMap = pathStateMachine[mode]
  3429. transition = typeMap[type] || typeMap['else'] || ERROR
  3430. if (transition === ERROR) {
  3431. return // parse error
  3432. }
  3433. mode = transition[0]
  3434. action = actions[transition[1]]
  3435. if (action) {
  3436. newChar = transition[2]
  3437. newChar = newChar === undefined
  3438. ? c
  3439. : newChar === '*'
  3440. ? newChar + c
  3441. : newChar
  3442. action()
  3443. }
  3444. if (mode === AFTER_PATH) {
  3445. keys.raw = path
  3446. return keys
  3447. }
  3448. }
  3449. }
  3450. /**
  3451. * Format a accessor segment based on its type.
  3452. *
  3453. * @param {String} key
  3454. * @return {Boolean}
  3455. */
  3456. function formatAccessor (key) {
  3457. if (identRE.test(key)) { // identifier
  3458. return '.' + key
  3459. } else if (+key === key >>> 0) { // bracket index
  3460. return '[' + key + ']'
  3461. } else if (key.charAt(0) === '*') {
  3462. return '[o' + formatAccessor(key.slice(1)) + ']'
  3463. } else { // bracket string
  3464. return '["' + key.replace(/"/g, '\\"') + '"]'
  3465. }
  3466. }
  3467. /**
  3468. * Compiles a getter function with a fixed path.
  3469. * The fixed path getter supresses errors.
  3470. *
  3471. * @param {Array} path
  3472. * @return {Function}
  3473. */
  3474. exports.compileGetter = function (path) {
  3475. var body = 'return o' + path.map(formatAccessor).join('')
  3476. return new Function('o', body)
  3477. }
  3478. /**
  3479. * External parse that check for a cache hit first
  3480. *
  3481. * @param {String} path
  3482. * @return {Array|undefined}
  3483. */
  3484. exports.parse = function (path) {
  3485. var hit = pathCache.get(path)
  3486. if (!hit) {
  3487. hit = parsePath(path)
  3488. if (hit) {
  3489. hit.get = exports.compileGetter(hit)
  3490. pathCache.put(path, hit)
  3491. }
  3492. }
  3493. return hit
  3494. }
  3495. /**
  3496. * Get from an object from a path string
  3497. *
  3498. * @param {Object} obj
  3499. * @param {String} path
  3500. */
  3501. exports.get = function (obj, path) {
  3502. path = exports.parse(path)
  3503. if (path) {
  3504. return path.get(obj)
  3505. }
  3506. }
  3507. /**
  3508. * Set on an object from a path
  3509. *
  3510. * @param {Object} obj
  3511. * @param {String | Array} path
  3512. * @param {*} val
  3513. */
  3514. exports.set = function (obj, path, val) {
  3515. var original = obj
  3516. if (typeof path === 'string') {
  3517. path = exports.parse(path)
  3518. }
  3519. if (!path || !_.isObject(obj)) {
  3520. return false
  3521. }
  3522. var last, key
  3523. for (var i = 0, l = path.length; i < l; i++) {
  3524. last = obj
  3525. key = path[i]
  3526. if (key.charAt(0) === '*') {
  3527. key = original[key.slice(1)]
  3528. }
  3529. if (i < l - 1) {
  3530. obj = obj[key]
  3531. if (!_.isObject(obj)) {
  3532. warnNonExistent(path)
  3533. obj = {}
  3534. last.$add(key, obj)
  3535. }
  3536. } else {
  3537. if (_.isArray(obj)) {
  3538. obj.$set(key, val)
  3539. } else if (key in obj) {
  3540. obj[key] = val
  3541. } else {
  3542. warnNonExistent(path)
  3543. obj.$add(key, val)
  3544. }
  3545. }
  3546. }
  3547. return true
  3548. }
  3549. function warnNonExistent (path) {
  3550. ("development") !== 'production' && _.warn(
  3551. 'You are setting a non-existent path "' + path.raw + '" ' +
  3552. 'on a vm instance. Consider pre-initializing the property ' +
  3553. 'with the "data" option for more reliable reactivity ' +
  3554. 'and better performance.'
  3555. )
  3556. }
  3557. /***/ },
  3558. /* 21 */
  3559. /***/ function(module, exports, __webpack_require__) {
  3560. var _ = __webpack_require__(1)
  3561. var config = __webpack_require__(5)
  3562. // we have two separate queues: one for directive updates
  3563. // and one for user watcher registered via $watch().
  3564. // we want to guarantee directive updates to be called
  3565. // before user watchers so that when user watchers are
  3566. // triggered, the DOM would have already been in updated
  3567. // state.
  3568. var queue = []
  3569. var userQueue = []
  3570. var has = {}
  3571. var circular = {}
  3572. var waiting = false
  3573. var internalQueueDepleted = false
  3574. /**
  3575. * Reset the batcher's state.
  3576. */
  3577. function reset () {
  3578. queue = []
  3579. userQueue = []
  3580. has = {}
  3581. circular = {}
  3582. waiting = internalQueueDepleted = false
  3583. }
  3584. /**
  3585. * Flush both queues and run the watchers.
  3586. */
  3587. function flush () {
  3588. run(queue)
  3589. internalQueueDepleted = true
  3590. run(userQueue)
  3591. reset()
  3592. }
  3593. /**
  3594. * Run the watchers in a single queue.
  3595. *
  3596. * @param {Array} queue
  3597. */
  3598. function run (queue) {
  3599. // do not cache length because more watchers might be pushed
  3600. // as we run existing watchers
  3601. for (var i = 0; i < queue.length; i++) {
  3602. var watcher = queue[i]
  3603. var id = watcher.id
  3604. has[id] = null
  3605. watcher.run()
  3606. // in dev build, check and stop circular updates.
  3607. if (("development") !== 'production' && has[id] != null) {
  3608. circular[id] = (circular[id] || 0) + 1
  3609. if (circular[id] > config._maxUpdateCount) {
  3610. queue.splice(has[id], 1)
  3611. _.warn(
  3612. 'You may have an infinite update loop for watcher ' +
  3613. 'with expression: ' + watcher.expression
  3614. )
  3615. }
  3616. }
  3617. }
  3618. }
  3619. /**
  3620. * Push a watcher into the watcher queue.
  3621. * Jobs with duplicate IDs will be skipped unless it's
  3622. * pushed when the queue is being flushed.
  3623. *
  3624. * @param {Watcher} watcher
  3625. * properties:
  3626. * - {Number} id
  3627. * - {Function} run
  3628. */
  3629. exports.push = function (watcher) {
  3630. var id = watcher.id
  3631. if (has[id] == null) {
  3632. // if an internal watcher is pushed, but the internal
  3633. // queue is already depleted, we run it immediately.
  3634. if (internalQueueDepleted && !watcher.user) {
  3635. watcher.run()
  3636. return
  3637. }
  3638. // push watcher into appropriate queue
  3639. var q = watcher.user ? userQueue : queue
  3640. has[id] = q.length
  3641. q.push(watcher)
  3642. // queue the flush
  3643. if (!waiting) {
  3644. waiting = true
  3645. _.nextTick(flush)
  3646. }
  3647. }
  3648. }
  3649. /***/ },
  3650. /* 22 */
  3651. /***/ function(module, exports, __webpack_require__) {
  3652. var _ = __webpack_require__(1)
  3653. var Cache = __webpack_require__(14)
  3654. var templateCache = new Cache(1000)
  3655. var idSelectorCache = new Cache(1000)
  3656. var map = {
  3657. _default: [0, '', ''],
  3658. legend: [1, '<fieldset>', '</fieldset>'],
  3659. tr: [2, '<table><tbody>', '</tbody></table>'],
  3660. col: [
  3661. 2,
  3662. '<table><tbody></tbody><colgroup>',
  3663. '</colgroup></table>'
  3664. ]
  3665. }
  3666. map.td =
  3667. map.th = [
  3668. 3,
  3669. '<table><tbody><tr>',
  3670. '</tr></tbody></table>'
  3671. ]
  3672. map.option =
  3673. map.optgroup = [
  3674. 1,
  3675. '<select multiple="multiple">',
  3676. '</select>'
  3677. ]
  3678. map.thead =
  3679. map.tbody =
  3680. map.colgroup =
  3681. map.caption =
  3682. map.tfoot = [1, '<table>', '</table>']
  3683. map.g =
  3684. map.defs =
  3685. map.symbol =
  3686. map.use =
  3687. map.image =
  3688. map.text =
  3689. map.circle =
  3690. map.ellipse =
  3691. map.line =
  3692. map.path =
  3693. map.polygon =
  3694. map.polyline =
  3695. map.rect = [
  3696. 1,
  3697. '<svg ' +
  3698. 'xmlns="http://www.w3.org/2000/svg" ' +
  3699. 'xmlns:xlink="http://www.w3.org/1999/xlink" ' +
  3700. 'xmlns:ev="http://www.w3.org/2001/xml-events"' +
  3701. 'version="1.1">',
  3702. '</svg>'
  3703. ]
  3704. /**
  3705. * Check if a node is a supported template node with a
  3706. * DocumentFragment content.
  3707. *
  3708. * @param {Node} node
  3709. * @return {Boolean}
  3710. */
  3711. function isRealTemplate (node) {
  3712. return _.isTemplate(node) &&
  3713. node.content instanceof DocumentFragment
  3714. }
  3715. var tagRE = /<([\w:]+)/
  3716. var entityRE = /&\w+;/
  3717. /**
  3718. * Convert a string template to a DocumentFragment.
  3719. * Determines correct wrapping by tag types. Wrapping
  3720. * strategy found in jQuery & component/domify.
  3721. *
  3722. * @param {String} templateString
  3723. * @return {DocumentFragment}
  3724. */
  3725. function stringToFragment (templateString) {
  3726. // try a cache hit first
  3727. var hit = templateCache.get(templateString)
  3728. if (hit) {
  3729. return hit
  3730. }
  3731. var frag = document.createDocumentFragment()
  3732. var tagMatch = templateString.match(tagRE)
  3733. var entityMatch = entityRE.test(templateString)
  3734. if (!tagMatch && !entityMatch) {
  3735. // text only, return a single text node.
  3736. frag.appendChild(
  3737. document.createTextNode(templateString)
  3738. )
  3739. } else {
  3740. var tag = tagMatch && tagMatch[1]
  3741. var wrap = map[tag] || map._default
  3742. var depth = wrap[0]
  3743. var prefix = wrap[1]
  3744. var suffix = wrap[2]
  3745. var node = document.createElement('div')
  3746. node.innerHTML = prefix + templateString.trim() + suffix
  3747. while (depth--) {
  3748. node = node.lastChild
  3749. }
  3750. var child
  3751. /* eslint-disable no-cond-assign */
  3752. while (child = node.firstChild) {
  3753. /* eslint-enable no-cond-assign */
  3754. frag.appendChild(child)
  3755. }
  3756. }
  3757. templateCache.put(templateString, frag)
  3758. return frag
  3759. }
  3760. /**
  3761. * Convert a template node to a DocumentFragment.
  3762. *
  3763. * @param {Node} node
  3764. * @return {DocumentFragment}
  3765. */
  3766. function nodeToFragment (node) {
  3767. // if its a template tag and the browser supports it,
  3768. // its content is already a document fragment.
  3769. if (isRealTemplate(node)) {
  3770. _.trimNode(node.content)
  3771. return node.content
  3772. }
  3773. // script template
  3774. if (node.tagName === 'SCRIPT') {
  3775. return stringToFragment(node.textContent)
  3776. }
  3777. // normal node, clone it to avoid mutating the original
  3778. var clone = exports.clone(node)
  3779. var frag = document.createDocumentFragment()
  3780. var child
  3781. /* eslint-disable no-cond-assign */
  3782. while (child = clone.firstChild) {
  3783. /* eslint-enable no-cond-assign */
  3784. frag.appendChild(child)
  3785. }
  3786. _.trimNode(frag)
  3787. return frag
  3788. }
  3789. // Test for the presence of the Safari template cloning bug
  3790. // https://bugs.webkit.org/show_bug.cgi?id=137755
  3791. var hasBrokenTemplate = _.inBrowser
  3792. ? (function () {
  3793. var a = document.createElement('div')
  3794. a.innerHTML = '<template>1</template>'
  3795. return !a.cloneNode(true).firstChild.innerHTML
  3796. })()
  3797. : false
  3798. // Test for IE10/11 textarea placeholder clone bug
  3799. var hasTextareaCloneBug = _.inBrowser
  3800. ? (function () {
  3801. var t = document.createElement('textarea')
  3802. t.placeholder = 't'
  3803. return t.cloneNode(true).value === 't'
  3804. })()
  3805. : false
  3806. /**
  3807. * 1. Deal with Safari cloning nested <template> bug by
  3808. * manually cloning all template instances.
  3809. * 2. Deal with IE10/11 textarea placeholder bug by setting
  3810. * the correct value after cloning.
  3811. *
  3812. * @param {Element|DocumentFragment} node
  3813. * @return {Element|DocumentFragment}
  3814. */
  3815. exports.clone = function (node) {
  3816. if (!node.querySelectorAll) {
  3817. return node.cloneNode()
  3818. }
  3819. var res = node.cloneNode(true)
  3820. var i, original, cloned
  3821. /* istanbul ignore if */
  3822. if (hasBrokenTemplate) {
  3823. var clone = res
  3824. if (isRealTemplate(node)) {
  3825. node = node.content
  3826. clone = res.content
  3827. }
  3828. original = node.querySelectorAll('template')
  3829. if (original.length) {
  3830. cloned = clone.querySelectorAll('template')
  3831. i = cloned.length
  3832. while (i--) {
  3833. cloned[i].parentNode.replaceChild(
  3834. exports.clone(original[i]),
  3835. cloned[i]
  3836. )
  3837. }
  3838. }
  3839. }
  3840. /* istanbul ignore if */
  3841. if (hasTextareaCloneBug) {
  3842. if (node.tagName === 'TEXTAREA') {
  3843. res.value = node.value
  3844. } else {
  3845. original = node.querySelectorAll('textarea')
  3846. if (original.length) {
  3847. cloned = res.querySelectorAll('textarea')
  3848. i = cloned.length
  3849. while (i--) {
  3850. cloned[i].value = original[i].value
  3851. }
  3852. }
  3853. }
  3854. }
  3855. return res
  3856. }
  3857. /**
  3858. * Process the template option and normalizes it into a
  3859. * a DocumentFragment that can be used as a partial or a
  3860. * instance template.
  3861. *
  3862. * @param {*} template
  3863. * Possible values include:
  3864. * - DocumentFragment object
  3865. * - Node object of type Template
  3866. * - id selector: '#some-template-id'
  3867. * - template string: '<div><span>{{msg}}</span></div>'
  3868. * @param {Boolean} clone
  3869. * @param {Boolean} noSelector
  3870. * @return {DocumentFragment|undefined}
  3871. */
  3872. exports.parse = function (template, clone, noSelector) {
  3873. var node, frag
  3874. // if the template is already a document fragment,
  3875. // do nothing
  3876. if (template instanceof DocumentFragment) {
  3877. _.trimNode(template)
  3878. return clone
  3879. ? exports.clone(template)
  3880. : template
  3881. }
  3882. if (typeof template === 'string') {
  3883. // id selector
  3884. if (!noSelector && template.charAt(0) === '#') {
  3885. // id selector can be cached too
  3886. frag = idSelectorCache.get(template)
  3887. if (!frag) {
  3888. node = document.getElementById(template.slice(1))
  3889. if (node) {
  3890. frag = nodeToFragment(node)
  3891. // save selector to cache
  3892. idSelectorCache.put(template, frag)
  3893. }
  3894. }
  3895. } else {
  3896. // normal string template
  3897. frag = stringToFragment(template)
  3898. }
  3899. } else if (template.nodeType) {
  3900. // a direct node
  3901. frag = nodeToFragment(template)
  3902. }
  3903. return frag && clone
  3904. ? exports.clone(frag)
  3905. : frag
  3906. }
  3907. /***/ },
  3908. /* 23 */
  3909. /***/ function(module, exports, __webpack_require__) {
  3910. var _ = __webpack_require__(1)
  3911. var config = __webpack_require__(5)
  3912. var templateParser = __webpack_require__(22)
  3913. module.exports = {
  3914. isLiteral: true,
  3915. /**
  3916. * Setup. Two possible usages:
  3917. *
  3918. * - static:
  3919. * v-component="comp"
  3920. *
  3921. * - dynamic:
  3922. * v-component="{{currentView}}"
  3923. */
  3924. bind: function () {
  3925. if (!this.el.__vue__) {
  3926. // create a ref anchor
  3927. this.anchor = _.createAnchor('v-component')
  3928. _.replace(this.el, this.anchor)
  3929. // check keep-alive options.
  3930. // If yes, instead of destroying the active vm when
  3931. // hiding (v-if) or switching (dynamic literal) it,
  3932. // we simply remove it from the DOM and save it in a
  3933. // cache object, with its constructor id as the key.
  3934. this.keepAlive = this._checkParam('keep-alive') != null
  3935. // wait for event before insertion
  3936. this.waitForEvent = this._checkParam('wait-for')
  3937. // check ref
  3938. this.refID = this._checkParam(config.prefix + 'ref')
  3939. if (this.keepAlive) {
  3940. this.cache = {}
  3941. }
  3942. // check inline-template
  3943. if (this._checkParam('inline-template') !== null) {
  3944. // extract inline template as a DocumentFragment
  3945. this.template = _.extractContent(this.el, true)
  3946. }
  3947. // component resolution related state
  3948. this.pendingComponentCb =
  3949. this.Component = null
  3950. // transition related state
  3951. this.pendingRemovals = 0
  3952. this.pendingRemovalCb = null
  3953. // if static, build right now.
  3954. if (!this._isDynamicLiteral) {
  3955. this.resolveComponent(this.expression, _.bind(this.initStatic, this))
  3956. } else {
  3957. // check dynamic component params
  3958. this.transMode = this._checkParam('transition-mode')
  3959. }
  3960. } else {
  3961. ("development") !== 'production' && _.warn(
  3962. 'cannot mount component "' + this.expression + '" ' +
  3963. 'on already mounted element: ' + this.el
  3964. )
  3965. }
  3966. },
  3967. /**
  3968. * Initialize a static component.
  3969. */
  3970. initStatic: function () {
  3971. // wait-for
  3972. var anchor = this.anchor
  3973. var options
  3974. var waitFor = this.waitForEvent
  3975. if (waitFor) {
  3976. options = {
  3977. created: function () {
  3978. this.$once(waitFor, function () {
  3979. this.$before(anchor)
  3980. })
  3981. }
  3982. }
  3983. }
  3984. var child = this.build(options)
  3985. this.setCurrent(child)
  3986. if (!this.waitForEvent) {
  3987. child.$before(anchor)
  3988. }
  3989. },
  3990. /**
  3991. * Public update, called by the watcher in the dynamic
  3992. * literal scenario, e.g. v-component="{{view}}"
  3993. */
  3994. update: function (value) {
  3995. this.setComponent(value)
  3996. },
  3997. /**
  3998. * Switch dynamic components. May resolve the component
  3999. * asynchronously, and perform transition based on
  4000. * specified transition mode. Accepts a few additional
  4001. * arguments specifically for vue-router.
  4002. *
  4003. * The callback is called when the full transition is
  4004. * finished.
  4005. *
  4006. * @param {String} value
  4007. * @param {Function} [cb]
  4008. */
  4009. setComponent: function (value, cb) {
  4010. this.invalidatePending()
  4011. if (!value) {
  4012. // just remove current
  4013. this.unbuild(true)
  4014. this.remove(this.childVM, cb)
  4015. this.unsetCurrent()
  4016. } else {
  4017. this.resolveComponent(value, _.bind(function () {
  4018. this.unbuild(true)
  4019. var options
  4020. var self = this
  4021. var waitFor = this.waitForEvent
  4022. if (waitFor) {
  4023. options = {
  4024. created: function () {
  4025. this.$once(waitFor, function () {
  4026. self.transition(this, cb)
  4027. })
  4028. }
  4029. }
  4030. }
  4031. var newComponent = this.build(options)
  4032. if (!waitFor) {
  4033. this.transition(newComponent, cb)
  4034. }
  4035. }, this))
  4036. }
  4037. },
  4038. /**
  4039. * Resolve the component constructor to use when creating
  4040. * the child vm.
  4041. */
  4042. resolveComponent: function (id, cb) {
  4043. var self = this
  4044. this.pendingComponentCb = _.cancellable(function (Component) {
  4045. self.Component = Component
  4046. cb()
  4047. })
  4048. this.vm._resolveComponent(id, this.pendingComponentCb)
  4049. },
  4050. /**
  4051. * When the component changes or unbinds before an async
  4052. * constructor is resolved, we need to invalidate its
  4053. * pending callback.
  4054. */
  4055. invalidatePending: function () {
  4056. if (this.pendingComponentCb) {
  4057. this.pendingComponentCb.cancel()
  4058. this.pendingComponentCb = null
  4059. }
  4060. },
  4061. /**
  4062. * Instantiate/insert a new child vm.
  4063. * If keep alive and has cached instance, insert that
  4064. * instance; otherwise build a new one and cache it.
  4065. *
  4066. * @param {Object} [extraOptions]
  4067. * @return {Vue} - the created instance
  4068. */
  4069. build: function (extraOptions) {
  4070. if (this.keepAlive) {
  4071. var cached = this.cache[this.Component.cid]
  4072. if (cached) {
  4073. return cached
  4074. }
  4075. }
  4076. if (this.Component) {
  4077. // default options
  4078. var options = {
  4079. el: templateParser.clone(this.el),
  4080. template: this.template,
  4081. // if no inline-template, then the compiled
  4082. // linker can be cached for better performance.
  4083. _linkerCachable: !this.template,
  4084. _asComponent: true,
  4085. _isRouterView: this._isRouterView,
  4086. _context: this.vm
  4087. }
  4088. // extra options
  4089. if (extraOptions) {
  4090. _.extend(options, extraOptions)
  4091. }
  4092. var parent = this._host || this.vm
  4093. var child = parent.$addChild(options, this.Component)
  4094. if (this.keepAlive) {
  4095. this.cache[this.Component.cid] = child
  4096. }
  4097. return child
  4098. }
  4099. },
  4100. /**
  4101. * Teardown the current child, but defers cleanup so
  4102. * that we can separate the destroy and removal steps.
  4103. *
  4104. * @param {Boolean} defer
  4105. */
  4106. unbuild: function (defer) {
  4107. var child = this.childVM
  4108. if (!child || this.keepAlive) {
  4109. return
  4110. }
  4111. // the sole purpose of `deferCleanup` is so that we can
  4112. // "deactivate" the vm right now and perform DOM removal
  4113. // later.
  4114. child.$destroy(false, defer)
  4115. },
  4116. /**
  4117. * Remove current destroyed child and manually do
  4118. * the cleanup after removal.
  4119. *
  4120. * @param {Function} cb
  4121. */
  4122. remove: function (child, cb) {
  4123. var keepAlive = this.keepAlive
  4124. if (child) {
  4125. // we may have a component switch when a previous
  4126. // component is still being transitioned out.
  4127. // we want to trigger only one lastest insertion cb
  4128. // when the existing transition finishes. (#1119)
  4129. this.pendingRemovals++
  4130. this.pendingRemovalCb = cb
  4131. var self = this
  4132. child.$remove(function () {
  4133. self.pendingRemovals--
  4134. if (!keepAlive) child._cleanup()
  4135. if (!self.pendingRemovals && self.pendingRemovalCb) {
  4136. self.pendingRemovalCb()
  4137. self.pendingRemovalCb = null
  4138. }
  4139. })
  4140. } else if (cb) {
  4141. cb()
  4142. }
  4143. },
  4144. /**
  4145. * Actually swap the components, depending on the
  4146. * transition mode. Defaults to simultaneous.
  4147. *
  4148. * @param {Vue} target
  4149. * @param {Function} [cb]
  4150. */
  4151. transition: function (target, cb) {
  4152. var self = this
  4153. var current = this.childVM
  4154. this.unsetCurrent()
  4155. this.setCurrent(target)
  4156. switch (self.transMode) {
  4157. case 'in-out':
  4158. target.$before(self.anchor, function () {
  4159. self.remove(current, cb)
  4160. })
  4161. break
  4162. case 'out-in':
  4163. self.remove(current, function () {
  4164. target.$before(self.anchor, cb)
  4165. })
  4166. break
  4167. default:
  4168. self.remove(current)
  4169. target.$before(self.anchor, cb)
  4170. }
  4171. },
  4172. /**
  4173. * Set childVM and parent ref
  4174. */
  4175. setCurrent: function (child) {
  4176. this.childVM = child
  4177. var refID = child._refID || this.refID
  4178. if (refID) {
  4179. this.vm.$[refID] = child
  4180. }
  4181. },
  4182. /**
  4183. * Unset childVM and parent ref
  4184. */
  4185. unsetCurrent: function () {
  4186. var child = this.childVM
  4187. this.childVM = null
  4188. var refID = (child && child._refID) || this.refID
  4189. if (refID) {
  4190. this.vm.$[refID] = null
  4191. }
  4192. },
  4193. /**
  4194. * Unbind.
  4195. */
  4196. unbind: function () {
  4197. this.invalidatePending()
  4198. // Do not defer cleanup when unbinding
  4199. this.unbuild()
  4200. this.unsetCurrent()
  4201. // destroy all keep-alive cached instances
  4202. if (this.cache) {
  4203. for (var key in this.cache) {
  4204. this.cache[key].$destroy()
  4205. }
  4206. this.cache = null
  4207. }
  4208. }
  4209. }
  4210. /***/ },
  4211. /* 24 */
  4212. /***/ function(module, exports, __webpack_require__) {
  4213. var _ = __webpack_require__(1)
  4214. var config = __webpack_require__(5)
  4215. var templateParser = __webpack_require__(22)
  4216. /**
  4217. * Process an element or a DocumentFragment based on a
  4218. * instance option object. This allows us to transclude
  4219. * a template node/fragment before the instance is created,
  4220. * so the processed fragment can then be cloned and reused
  4221. * in v-repeat.
  4222. *
  4223. * @param {Element} el
  4224. * @param {Object} options
  4225. * @return {Element|DocumentFragment}
  4226. */
  4227. exports.transclude = function (el, options) {
  4228. // extract container attributes to pass them down
  4229. // to compiler, because they need to be compiled in
  4230. // parent scope. we are mutating the options object here
  4231. // assuming the same object will be used for compile
  4232. // right after this.
  4233. if (options) {
  4234. options._containerAttrs = extractAttrs(el)
  4235. }
  4236. // for template tags, what we want is its content as
  4237. // a documentFragment (for fragment instances)
  4238. if (_.isTemplate(el)) {
  4239. el = templateParser.parse(el)
  4240. }
  4241. if (options) {
  4242. if (options._asComponent && !options.template) {
  4243. options.template = '<content></content>'
  4244. }
  4245. if (options.template) {
  4246. options._content = _.extractContent(el)
  4247. el = transcludeTemplate(el, options)
  4248. }
  4249. }
  4250. if (el instanceof DocumentFragment) {
  4251. // anchors for fragment instance
  4252. // passing in `persist: true` to avoid them being
  4253. // discarded by IE during template cloning
  4254. _.prepend(_.createAnchor('v-start', true), el)
  4255. el.appendChild(_.createAnchor('v-end', true))
  4256. }
  4257. return el
  4258. }
  4259. /**
  4260. * Process the template option.
  4261. * If the replace option is true this will swap the $el.
  4262. *
  4263. * @param {Element} el
  4264. * @param {Object} options
  4265. * @return {Element|DocumentFragment}
  4266. */
  4267. function transcludeTemplate (el, options) {
  4268. var template = options.template
  4269. var frag = templateParser.parse(template, true)
  4270. if (frag) {
  4271. var replacer = frag.firstChild
  4272. var tag = replacer.tagName && replacer.tagName.toLowerCase()
  4273. if (options.replace) {
  4274. /* istanbul ignore if */
  4275. if (el === document.body) {
  4276. ("development") !== 'production' && _.warn(
  4277. 'You are mounting an instance with a template to ' +
  4278. '<body>. This will replace <body> entirely. You ' +
  4279. 'should probably use `replace: false` here.'
  4280. )
  4281. }
  4282. // there are many cases where the instance must
  4283. // become a fragment instance: basically anything that
  4284. // can create more than 1 root nodes.
  4285. if (
  4286. // multi-children template
  4287. frag.childNodes.length > 1 ||
  4288. // non-element template
  4289. replacer.nodeType !== 1 ||
  4290. // single nested component
  4291. tag === 'component' ||
  4292. _.resolveAsset(options, 'components', tag) ||
  4293. replacer.hasAttribute(config.prefix + 'component') ||
  4294. // element directive
  4295. _.resolveAsset(options, 'elementDirectives', tag) ||
  4296. // repeat block
  4297. replacer.hasAttribute(config.prefix + 'repeat')
  4298. ) {
  4299. return frag
  4300. } else {
  4301. options._replacerAttrs = extractAttrs(replacer)
  4302. mergeAttrs(el, replacer)
  4303. return replacer
  4304. }
  4305. } else {
  4306. el.appendChild(frag)
  4307. return el
  4308. }
  4309. } else {
  4310. ("development") !== 'production' && _.warn(
  4311. 'Invalid template option: ' + template
  4312. )
  4313. }
  4314. }
  4315. /**
  4316. * Helper to extract a component container's attributes
  4317. * into a plain object array.
  4318. *
  4319. * @param {Element} el
  4320. * @return {Array}
  4321. */
  4322. function extractAttrs (el) {
  4323. if (el.nodeType === 1 && el.hasAttributes()) {
  4324. return _.toArray(el.attributes)
  4325. }
  4326. }
  4327. /**
  4328. * Merge the attributes of two elements, and make sure
  4329. * the class names are merged properly.
  4330. *
  4331. * @param {Element} from
  4332. * @param {Element} to
  4333. */
  4334. function mergeAttrs (from, to) {
  4335. var attrs = from.attributes
  4336. var i = attrs.length
  4337. var name, value
  4338. while (i--) {
  4339. name = attrs[i].name
  4340. value = attrs[i].value
  4341. if (!to.hasAttribute(name)) {
  4342. to.setAttribute(name, value)
  4343. } else if (name === 'class') {
  4344. value = to.getAttribute(name) + ' ' + value
  4345. to.setAttribute(name, value)
  4346. }
  4347. }
  4348. }
  4349. /***/ },
  4350. /* 25 */
  4351. /***/ function(module, exports, __webpack_require__) {
  4352. // manipulation directives
  4353. exports.text = __webpack_require__(26)
  4354. exports.html = __webpack_require__(27)
  4355. exports.attr = __webpack_require__(28)
  4356. exports.show = __webpack_require__(29)
  4357. exports['class'] = __webpack_require__(31)
  4358. exports.el = __webpack_require__(32)
  4359. exports.ref = __webpack_require__(33)
  4360. exports.cloak = __webpack_require__(34)
  4361. exports.style = __webpack_require__(35)
  4362. exports.transition = __webpack_require__(36)
  4363. // event listener directives
  4364. exports.on = __webpack_require__(39)
  4365. exports.model = __webpack_require__(40)
  4366. // logic control directives
  4367. exports.repeat = __webpack_require__(45)
  4368. exports['if'] = __webpack_require__(46)
  4369. // internal directives that should not be used directly
  4370. // but we still want to expose them for advanced usage.
  4371. exports._component = __webpack_require__(23)
  4372. exports._prop = __webpack_require__(16)
  4373. /***/ },
  4374. /* 26 */
  4375. /***/ function(module, exports, __webpack_require__) {
  4376. var _ = __webpack_require__(1)
  4377. module.exports = {
  4378. bind: function () {
  4379. this.attr = this.el.nodeType === 3
  4380. ? 'data'
  4381. : 'textContent'
  4382. },
  4383. update: function (value) {
  4384. this.el[this.attr] = _.toString(value)
  4385. }
  4386. }
  4387. /***/ },
  4388. /* 27 */
  4389. /***/ function(module, exports, __webpack_require__) {
  4390. var _ = __webpack_require__(1)
  4391. var templateParser = __webpack_require__(22)
  4392. module.exports = {
  4393. bind: function () {
  4394. // a comment node means this is a binding for
  4395. // {{{ inline unescaped html }}}
  4396. if (this.el.nodeType === 8) {
  4397. // hold nodes
  4398. this.nodes = []
  4399. // replace the placeholder with proper anchor
  4400. this.anchor = _.createAnchor('v-html')
  4401. _.replace(this.el, this.anchor)
  4402. }
  4403. },
  4404. update: function (value) {
  4405. value = _.toString(value)
  4406. if (this.nodes) {
  4407. this.swap(value)
  4408. } else {
  4409. this.el.innerHTML = value
  4410. }
  4411. },
  4412. swap: function (value) {
  4413. // remove old nodes
  4414. var i = this.nodes.length
  4415. while (i--) {
  4416. _.remove(this.nodes[i])
  4417. }
  4418. // convert new value to a fragment
  4419. // do not attempt to retrieve from id selector
  4420. var frag = templateParser.parse(value, true, true)
  4421. // save a reference to these nodes so we can remove later
  4422. this.nodes = _.toArray(frag.childNodes)
  4423. _.before(frag, this.anchor)
  4424. }
  4425. }
  4426. /***/ },
  4427. /* 28 */
  4428. /***/ function(module, exports) {
  4429. // xlink
  4430. var xlinkNS = 'http://www.w3.org/1999/xlink'
  4431. var xlinkRE = /^xlink:/
  4432. module.exports = {
  4433. priority: 850,
  4434. update: function (value) {
  4435. if (this.arg) {
  4436. this.setAttr(this.arg, value)
  4437. } else if (typeof value === 'object') {
  4438. this.objectHandler(value)
  4439. }
  4440. },
  4441. objectHandler: function (value) {
  4442. // cache object attrs so that only changed attrs
  4443. // are actually updated.
  4444. var cache = this.cache || (this.cache = {})
  4445. var attr, val
  4446. for (attr in cache) {
  4447. if (!(attr in value)) {
  4448. this.setAttr(attr, null)
  4449. delete cache[attr]
  4450. }
  4451. }
  4452. for (attr in value) {
  4453. val = value[attr]
  4454. if (val !== cache[attr]) {
  4455. cache[attr] = val
  4456. this.setAttr(attr, val)
  4457. }
  4458. }
  4459. },
  4460. setAttr: function (attr, value) {
  4461. if (attr === 'value' && attr in this.el) {
  4462. if (!this.valueRemoved) {
  4463. this.el.removeAttribute(attr)
  4464. this.valueRemoved = true
  4465. }
  4466. this.el.value = value
  4467. } else if (value != null && value !== false) {
  4468. if (xlinkRE.test(attr)) {
  4469. this.el.setAttributeNS(xlinkNS, attr, value)
  4470. } else {
  4471. this.el.setAttribute(attr, value)
  4472. }
  4473. } else {
  4474. this.el.removeAttribute(attr)
  4475. }
  4476. }
  4477. }
  4478. /***/ },
  4479. /* 29 */
  4480. /***/ function(module, exports, __webpack_require__) {
  4481. var transition = __webpack_require__(30)
  4482. module.exports = function (value) {
  4483. var el = this.el
  4484. transition.apply(el, value ? 1 : -1, function () {
  4485. el.style.display = value ? '' : 'none'
  4486. }, this.vm)
  4487. }
  4488. /***/ },
  4489. /* 30 */
  4490. /***/ function(module, exports, __webpack_require__) {
  4491. var _ = __webpack_require__(1)
  4492. /**
  4493. * Append with transition.
  4494. *
  4495. * @param {Element} el
  4496. * @param {Element} target
  4497. * @param {Vue} vm
  4498. * @param {Function} [cb]
  4499. */
  4500. exports.append = function (el, target, vm, cb) {
  4501. apply(el, 1, function () {
  4502. target.appendChild(el)
  4503. }, vm, cb)
  4504. }
  4505. /**
  4506. * InsertBefore with transition.
  4507. *
  4508. * @param {Element} el
  4509. * @param {Element} target
  4510. * @param {Vue} vm
  4511. * @param {Function} [cb]
  4512. */
  4513. exports.before = function (el, target, vm, cb) {
  4514. apply(el, 1, function () {
  4515. _.before(el, target)
  4516. }, vm, cb)
  4517. }
  4518. /**
  4519. * Remove with transition.
  4520. *
  4521. * @param {Element} el
  4522. * @param {Vue} vm
  4523. * @param {Function} [cb]
  4524. */
  4525. exports.remove = function (el, vm, cb) {
  4526. apply(el, -1, function () {
  4527. _.remove(el)
  4528. }, vm, cb)
  4529. }
  4530. /**
  4531. * Remove by appending to another parent with transition.
  4532. * This is only used in block operations.
  4533. *
  4534. * @param {Element} el
  4535. * @param {Element} target
  4536. * @param {Vue} vm
  4537. * @param {Function} [cb]
  4538. */
  4539. exports.removeThenAppend = function (el, target, vm, cb) {
  4540. apply(el, -1, function () {
  4541. target.appendChild(el)
  4542. }, vm, cb)
  4543. }
  4544. /**
  4545. * Append the childNodes of a fragment to target.
  4546. *
  4547. * @param {DocumentFragment} block
  4548. * @param {Node} target
  4549. * @param {Vue} vm
  4550. */
  4551. exports.blockAppend = function (block, target, vm) {
  4552. var nodes = _.toArray(block.childNodes)
  4553. for (var i = 0, l = nodes.length; i < l; i++) {
  4554. exports.before(nodes[i], target, vm)
  4555. }
  4556. }
  4557. /**
  4558. * Remove a block of nodes between two edge nodes.
  4559. *
  4560. * @param {Node} start
  4561. * @param {Node} end
  4562. * @param {Vue} vm
  4563. */
  4564. exports.blockRemove = function (start, end, vm) {
  4565. var node = start.nextSibling
  4566. var next
  4567. while (node !== end) {
  4568. next = node.nextSibling
  4569. exports.remove(node, vm)
  4570. node = next
  4571. }
  4572. }
  4573. /**
  4574. * Apply transitions with an operation callback.
  4575. *
  4576. * @param {Element} el
  4577. * @param {Number} direction
  4578. * 1: enter
  4579. * -1: leave
  4580. * @param {Function} op - the actual DOM operation
  4581. * @param {Vue} vm
  4582. * @param {Function} [cb]
  4583. */
  4584. var apply = exports.apply = function (el, direction, op, vm, cb) {
  4585. var transition = el.__v_trans
  4586. if (
  4587. !transition ||
  4588. // skip if there are no js hooks and CSS transition is
  4589. // not supported
  4590. (!transition.hooks && !_.transitionEndEvent) ||
  4591. // skip transitions for initial compile
  4592. !vm._isCompiled ||
  4593. // if the vm is being manipulated by a parent directive
  4594. // during the parent's compilation phase, skip the
  4595. // animation.
  4596. (vm.$parent && !vm.$parent._isCompiled)
  4597. ) {
  4598. op()
  4599. if (cb) cb()
  4600. return
  4601. }
  4602. var action = direction > 0 ? 'enter' : 'leave'
  4603. transition[action](op, cb)
  4604. }
  4605. /***/ },
  4606. /* 31 */
  4607. /***/ function(module, exports, __webpack_require__) {
  4608. var _ = __webpack_require__(1)
  4609. var addClass = _.addClass
  4610. var removeClass = _.removeClass
  4611. module.exports = {
  4612. bind: function () {
  4613. // interpolations like class="{{abc}}" are converted
  4614. // to v-class, and we need to remove the raw,
  4615. // uninterpolated className at binding time.
  4616. var raw = this._descriptor._rawClass
  4617. if (raw) {
  4618. this.prevKeys = raw.trim().split(/\s+/)
  4619. }
  4620. },
  4621. update: function (value) {
  4622. if (this.arg) {
  4623. // single toggle
  4624. if (value) {
  4625. addClass(this.el, this.arg)
  4626. } else {
  4627. removeClass(this.el, this.arg)
  4628. }
  4629. } else {
  4630. if (value && typeof value === 'string') {
  4631. this.handleObject(stringToObject(value))
  4632. } else if (_.isPlainObject(value)) {
  4633. this.handleObject(value)
  4634. } else {
  4635. this.cleanup()
  4636. }
  4637. }
  4638. },
  4639. handleObject: function (value) {
  4640. this.cleanup(value)
  4641. var keys = this.prevKeys = Object.keys(value)
  4642. for (var i = 0, l = keys.length; i < l; i++) {
  4643. var key = keys[i]
  4644. if (value[key]) {
  4645. addClass(this.el, key)
  4646. } else {
  4647. removeClass(this.el, key)
  4648. }
  4649. }
  4650. },
  4651. cleanup: function (value) {
  4652. if (this.prevKeys) {
  4653. var i = this.prevKeys.length
  4654. while (i--) {
  4655. var key = this.prevKeys[i]
  4656. if (!value || !value.hasOwnProperty(key)) {
  4657. removeClass(this.el, key)
  4658. }
  4659. }
  4660. }
  4661. }
  4662. }
  4663. function stringToObject (value) {
  4664. var res = {}
  4665. var keys = value.trim().split(/\s+/)
  4666. var i = keys.length
  4667. while (i--) {
  4668. res[keys[i]] = true
  4669. }
  4670. return res
  4671. }
  4672. /***/ },
  4673. /* 32 */
  4674. /***/ function(module, exports) {
  4675. module.exports = {
  4676. isLiteral: true,
  4677. bind: function () {
  4678. this.vm.$$[this.expression] = this.el
  4679. },
  4680. unbind: function () {
  4681. delete this.vm.$$[this.expression]
  4682. }
  4683. }
  4684. /***/ },
  4685. /* 33 */
  4686. /***/ function(module, exports, __webpack_require__) {
  4687. var _ = __webpack_require__(1)
  4688. module.exports = {
  4689. isLiteral: true,
  4690. bind: function () {
  4691. var vm = this.el.__vue__
  4692. if (!vm) {
  4693. ("development") !== 'production' && _.warn(
  4694. 'v-ref should only be used on a component root element.'
  4695. )
  4696. return
  4697. }
  4698. // If we get here, it means this is a `v-ref` on a
  4699. // child, because parent scope `v-ref` is stripped in
  4700. // `v-component` already. So we just record our own ref
  4701. // here - it will overwrite parent ref in `v-component`,
  4702. // if any.
  4703. vm._refID = this.expression
  4704. }
  4705. }
  4706. /***/ },
  4707. /* 34 */
  4708. /***/ function(module, exports, __webpack_require__) {
  4709. var config = __webpack_require__(5)
  4710. module.exports = {
  4711. bind: function () {
  4712. var el = this.el
  4713. this.vm.$once('hook:compiled', function () {
  4714. el.removeAttribute(config.prefix + 'cloak')
  4715. })
  4716. }
  4717. }
  4718. /***/ },
  4719. /* 35 */
  4720. /***/ function(module, exports, __webpack_require__) {
  4721. var _ = __webpack_require__(1)
  4722. var prefixes = ['-webkit-', '-moz-', '-ms-']
  4723. var camelPrefixes = ['Webkit', 'Moz', 'ms']
  4724. var importantRE = /!important;?$/
  4725. var camelRE = /([a-z])([A-Z])/g
  4726. var testEl = null
  4727. var propCache = {}
  4728. module.exports = {
  4729. deep: true,
  4730. update: function (value) {
  4731. if (this.arg) {
  4732. this.setProp(this.arg, value)
  4733. } else {
  4734. if (typeof value === 'object') {
  4735. this.objectHandler(value)
  4736. } else {
  4737. this.el.style.cssText = value
  4738. }
  4739. }
  4740. },
  4741. objectHandler: function (value) {
  4742. // cache object styles so that only changed props
  4743. // are actually updated.
  4744. var cache = this.cache || (this.cache = {})
  4745. var prop, val
  4746. for (prop in cache) {
  4747. if (!(prop in value)) {
  4748. this.setProp(prop, null)
  4749. delete cache[prop]
  4750. }
  4751. }
  4752. for (prop in value) {
  4753. val = value[prop]
  4754. if (val !== cache[prop]) {
  4755. cache[prop] = val
  4756. this.setProp(prop, val)
  4757. }
  4758. }
  4759. },
  4760. setProp: function (prop, value) {
  4761. prop = normalize(prop)
  4762. if (!prop) return // unsupported prop
  4763. // cast possible numbers/booleans into strings
  4764. if (value != null) value += ''
  4765. if (value) {
  4766. var isImportant = importantRE.test(value)
  4767. ? 'important'
  4768. : ''
  4769. if (isImportant) {
  4770. value = value.replace(importantRE, '').trim()
  4771. }
  4772. this.el.style.setProperty(prop, value, isImportant)
  4773. } else {
  4774. this.el.style.removeProperty(prop)
  4775. }
  4776. }
  4777. }
  4778. /**
  4779. * Normalize a CSS property name.
  4780. * - cache result
  4781. * - auto prefix
  4782. * - camelCase -> dash-case
  4783. *
  4784. * @param {String} prop
  4785. * @return {String}
  4786. */
  4787. function normalize (prop) {
  4788. if (propCache[prop]) {
  4789. return propCache[prop]
  4790. }
  4791. var res = prefix(prop)
  4792. propCache[prop] = propCache[res] = res
  4793. return res
  4794. }
  4795. /**
  4796. * Auto detect the appropriate prefix for a CSS property.
  4797. * https://gist.github.com/paulirish/523692
  4798. *
  4799. * @param {String} prop
  4800. * @return {String}
  4801. */
  4802. function prefix (prop) {
  4803. prop = prop.replace(camelRE, '$1-$2').toLowerCase()
  4804. var camel = _.camelize(prop)
  4805. var upper = camel.charAt(0).toUpperCase() + camel.slice(1)
  4806. if (!testEl) {
  4807. testEl = document.createElement('div')
  4808. }
  4809. if (camel in testEl.style) {
  4810. return prop
  4811. }
  4812. var i = prefixes.length
  4813. var prefixed
  4814. while (i--) {
  4815. prefixed = camelPrefixes[i] + upper
  4816. if (prefixed in testEl.style) {
  4817. return prefixes[i] + prop
  4818. }
  4819. }
  4820. }
  4821. /***/ },
  4822. /* 36 */
  4823. /***/ function(module, exports, __webpack_require__) {
  4824. var _ = __webpack_require__(1)
  4825. var Transition = __webpack_require__(37)
  4826. module.exports = {
  4827. priority: 1000,
  4828. isLiteral: true,
  4829. bind: function () {
  4830. if (!this._isDynamicLiteral) {
  4831. this.update(this.expression)
  4832. }
  4833. },
  4834. update: function (id, oldId) {
  4835. var el = this.el
  4836. var vm = this.el.__vue__ || this.vm
  4837. var hooks = _.resolveAsset(vm.$options, 'transitions', id)
  4838. id = id || 'v'
  4839. el.__v_trans = new Transition(el, id, hooks, vm)
  4840. if (oldId) {
  4841. _.removeClass(el, oldId + '-transition')
  4842. }
  4843. _.addClass(el, id + '-transition')
  4844. }
  4845. }
  4846. /***/ },
  4847. /* 37 */
  4848. /***/ function(module, exports, __webpack_require__) {
  4849. var _ = __webpack_require__(1)
  4850. var queue = __webpack_require__(38)
  4851. var addClass = _.addClass
  4852. var removeClass = _.removeClass
  4853. var transitionEndEvent = _.transitionEndEvent
  4854. var animationEndEvent = _.animationEndEvent
  4855. var transDurationProp = _.transitionProp + 'Duration'
  4856. var animDurationProp = _.animationProp + 'Duration'
  4857. var TYPE_TRANSITION = 1
  4858. var TYPE_ANIMATION = 2
  4859. var uid = 0
  4860. /**
  4861. * A Transition object that encapsulates the state and logic
  4862. * of the transition.
  4863. *
  4864. * @param {Element} el
  4865. * @param {String} id
  4866. * @param {Object} hooks
  4867. * @param {Vue} vm
  4868. */
  4869. function Transition (el, id, hooks, vm) {
  4870. this.id = uid++
  4871. this.el = el
  4872. this.enterClass = id + '-enter'
  4873. this.leaveClass = id + '-leave'
  4874. this.hooks = hooks
  4875. this.vm = vm
  4876. // async state
  4877. this.pendingCssEvent =
  4878. this.pendingCssCb =
  4879. this.cancel =
  4880. this.pendingJsCb =
  4881. this.op =
  4882. this.cb = null
  4883. this.justEntered = false
  4884. this.typeCache = {}
  4885. // bind
  4886. var self = this
  4887. ;['enterNextTick', 'enterDone', 'leaveNextTick', 'leaveDone']
  4888. .forEach(function (m) {
  4889. self[m] = _.bind(self[m], self)
  4890. })
  4891. }
  4892. var p = Transition.prototype
  4893. /**
  4894. * Start an entering transition.
  4895. *
  4896. * 1. enter transition triggered
  4897. * 2. call beforeEnter hook
  4898. * 3. add enter class
  4899. * 4. insert/show element
  4900. * 5. call enter hook (with possible explicit js callback)
  4901. * 6. reflow
  4902. * 7. based on transition type:
  4903. * - transition:
  4904. * remove class now, wait for transitionend,
  4905. * then done if there's no explicit js callback.
  4906. * - animation:
  4907. * wait for animationend, remove class,
  4908. * then done if there's no explicit js callback.
  4909. * - no css transition:
  4910. * done now if there's no explicit js callback.
  4911. * 8. wait for either done or js callback, then call
  4912. * afterEnter hook.
  4913. *
  4914. * @param {Function} op - insert/show the element
  4915. * @param {Function} [cb]
  4916. */
  4917. p.enter = function (op, cb) {
  4918. this.cancelPending()
  4919. this.callHook('beforeEnter')
  4920. this.cb = cb
  4921. addClass(this.el, this.enterClass)
  4922. op()
  4923. this.callHookWithCb('enter')
  4924. this.cancel = this.hooks && this.hooks.enterCancelled
  4925. queue.push(this.enterNextTick)
  4926. }
  4927. /**
  4928. * The "nextTick" phase of an entering transition, which is
  4929. * to be pushed into a queue and executed after a reflow so
  4930. * that removing the class can trigger a CSS transition.
  4931. */
  4932. p.enterNextTick = function () {
  4933. this.justEntered = true
  4934. _.nextTick(function () {
  4935. this.justEntered = false
  4936. }, this)
  4937. var type = this.getCssTransitionType(this.enterClass)
  4938. var enterDone = this.enterDone
  4939. if (type === TYPE_TRANSITION) {
  4940. // trigger transition by removing enter class now
  4941. removeClass(this.el, this.enterClass)
  4942. this.setupCssCb(transitionEndEvent, enterDone)
  4943. } else if (type === TYPE_ANIMATION) {
  4944. this.setupCssCb(animationEndEvent, enterDone)
  4945. } else if (!this.pendingJsCb) {
  4946. enterDone()
  4947. }
  4948. }
  4949. /**
  4950. * The "cleanup" phase of an entering transition.
  4951. */
  4952. p.enterDone = function () {
  4953. this.cancel = this.pendingJsCb = null
  4954. removeClass(this.el, this.enterClass)
  4955. this.callHook('afterEnter')
  4956. if (this.cb) this.cb()
  4957. }
  4958. /**
  4959. * Start a leaving transition.
  4960. *
  4961. * 1. leave transition triggered.
  4962. * 2. call beforeLeave hook
  4963. * 3. add leave class (trigger css transition)
  4964. * 4. call leave hook (with possible explicit js callback)
  4965. * 5. reflow if no explicit js callback is provided
  4966. * 6. based on transition type:
  4967. * - transition or animation:
  4968. * wait for end event, remove class, then done if
  4969. * there's no explicit js callback.
  4970. * - no css transition:
  4971. * done if there's no explicit js callback.
  4972. * 7. wait for either done or js callback, then call
  4973. * afterLeave hook.
  4974. *
  4975. * @param {Function} op - remove/hide the element
  4976. * @param {Function} [cb]
  4977. */
  4978. p.leave = function (op, cb) {
  4979. this.cancelPending()
  4980. this.callHook('beforeLeave')
  4981. this.op = op
  4982. this.cb = cb
  4983. addClass(this.el, this.leaveClass)
  4984. this.callHookWithCb('leave')
  4985. this.cancel = this.hooks && this.hooks.leaveCancelled
  4986. // only need to handle leaveDone if
  4987. // 1. the transition is already done (synchronously called
  4988. // by the user, which causes this.op set to null)
  4989. // 2. there's no explicit js callback
  4990. if (this.op && !this.pendingJsCb) {
  4991. // if a CSS transition leaves immediately after enter,
  4992. // the transitionend event never fires. therefore we
  4993. // detect such cases and end the leave immediately.
  4994. if (this.justEntered) {
  4995. this.leaveDone()
  4996. } else {
  4997. queue.push(this.leaveNextTick)
  4998. }
  4999. }
  5000. }
  5001. /**
  5002. * The "nextTick" phase of a leaving transition.
  5003. */
  5004. p.leaveNextTick = function () {
  5005. var type = this.getCssTransitionType(this.leaveClass)
  5006. if (type) {
  5007. var event = type === TYPE_TRANSITION
  5008. ? transitionEndEvent
  5009. : animationEndEvent
  5010. this.setupCssCb(event, this.leaveDone)
  5011. } else {
  5012. this.leaveDone()
  5013. }
  5014. }
  5015. /**
  5016. * The "cleanup" phase of a leaving transition.
  5017. */
  5018. p.leaveDone = function () {
  5019. this.cancel = this.pendingJsCb = null
  5020. this.op()
  5021. removeClass(this.el, this.leaveClass)
  5022. this.callHook('afterLeave')
  5023. if (this.cb) this.cb()
  5024. this.op = null
  5025. }
  5026. /**
  5027. * Cancel any pending callbacks from a previously running
  5028. * but not finished transition.
  5029. */
  5030. p.cancelPending = function () {
  5031. this.op = this.cb = null
  5032. var hasPending = false
  5033. if (this.pendingCssCb) {
  5034. hasPending = true
  5035. _.off(this.el, this.pendingCssEvent, this.pendingCssCb)
  5036. this.pendingCssEvent = this.pendingCssCb = null
  5037. }
  5038. if (this.pendingJsCb) {
  5039. hasPending = true
  5040. this.pendingJsCb.cancel()
  5041. this.pendingJsCb = null
  5042. }
  5043. if (hasPending) {
  5044. removeClass(this.el, this.enterClass)
  5045. removeClass(this.el, this.leaveClass)
  5046. }
  5047. if (this.cancel) {
  5048. this.cancel.call(this.vm, this.el)
  5049. this.cancel = null
  5050. }
  5051. }
  5052. /**
  5053. * Call a user-provided synchronous hook function.
  5054. *
  5055. * @param {String} type
  5056. */
  5057. p.callHook = function (type) {
  5058. if (this.hooks && this.hooks[type]) {
  5059. this.hooks[type].call(this.vm, this.el)
  5060. }
  5061. }
  5062. /**
  5063. * Call a user-provided, potentially-async hook function.
  5064. * We check for the length of arguments to see if the hook
  5065. * expects a `done` callback. If true, the transition's end
  5066. * will be determined by when the user calls that callback;
  5067. * otherwise, the end is determined by the CSS transition or
  5068. * animation.
  5069. *
  5070. * @param {String} type
  5071. */
  5072. p.callHookWithCb = function (type) {
  5073. var hook = this.hooks && this.hooks[type]
  5074. if (hook) {
  5075. if (hook.length > 1) {
  5076. this.pendingJsCb = _.cancellable(this[type + 'Done'])
  5077. }
  5078. hook.call(this.vm, this.el, this.pendingJsCb)
  5079. }
  5080. }
  5081. /**
  5082. * Get an element's transition type based on the
  5083. * calculated styles.
  5084. *
  5085. * @param {String} className
  5086. * @return {Number}
  5087. */
  5088. p.getCssTransitionType = function (className) {
  5089. /* istanbul ignore if */
  5090. if (
  5091. !transitionEndEvent ||
  5092. // skip CSS transitions if page is not visible -
  5093. // this solves the issue of transitionend events not
  5094. // firing until the page is visible again.
  5095. // pageVisibility API is supported in IE10+, same as
  5096. // CSS transitions.
  5097. document.hidden ||
  5098. // explicit js-only transition
  5099. (this.hooks && this.hooks.css === false)
  5100. ) {
  5101. return
  5102. }
  5103. var type = this.typeCache[className]
  5104. if (type) return type
  5105. var inlineStyles = this.el.style
  5106. var computedStyles = window.getComputedStyle(this.el)
  5107. var transDuration =
  5108. inlineStyles[transDurationProp] ||
  5109. computedStyles[transDurationProp]
  5110. if (transDuration && transDuration !== '0s') {
  5111. type = TYPE_TRANSITION
  5112. } else {
  5113. var animDuration =
  5114. inlineStyles[animDurationProp] ||
  5115. computedStyles[animDurationProp]
  5116. if (animDuration && animDuration !== '0s') {
  5117. type = TYPE_ANIMATION
  5118. }
  5119. }
  5120. if (type) {
  5121. this.typeCache[className] = type
  5122. }
  5123. return type
  5124. }
  5125. /**
  5126. * Setup a CSS transitionend/animationend callback.
  5127. *
  5128. * @param {String} event
  5129. * @param {Function} cb
  5130. */
  5131. p.setupCssCb = function (event, cb) {
  5132. this.pendingCssEvent = event
  5133. var self = this
  5134. var el = this.el
  5135. var onEnd = this.pendingCssCb = function (e) {
  5136. if (e.target === el) {
  5137. _.off(el, event, onEnd)
  5138. self.pendingCssEvent = self.pendingCssCb = null
  5139. if (!self.pendingJsCb && cb) {
  5140. cb()
  5141. }
  5142. }
  5143. }
  5144. _.on(el, event, onEnd)
  5145. }
  5146. module.exports = Transition
  5147. /***/ },
  5148. /* 38 */
  5149. /***/ function(module, exports, __webpack_require__) {
  5150. var _ = __webpack_require__(1)
  5151. var queue = []
  5152. var queued = false
  5153. /**
  5154. * Push a job into the queue.
  5155. *
  5156. * @param {Function} job
  5157. */
  5158. exports.push = function (job) {
  5159. queue.push(job)
  5160. if (!queued) {
  5161. queued = true
  5162. _.nextTick(flush)
  5163. }
  5164. }
  5165. /**
  5166. * Flush the queue, and do one forced reflow before
  5167. * triggering transitions.
  5168. */
  5169. function flush () {
  5170. // Force layout
  5171. var f = document.documentElement.offsetHeight
  5172. for (var i = 0; i < queue.length; i++) {
  5173. queue[i]()
  5174. }
  5175. queue = []
  5176. queued = false
  5177. // dummy return, so js linters don't complain about
  5178. // unused variable f
  5179. return f
  5180. }
  5181. /***/ },
  5182. /* 39 */
  5183. /***/ function(module, exports, __webpack_require__) {
  5184. var _ = __webpack_require__(1)
  5185. module.exports = {
  5186. acceptStatement: true,
  5187. priority: 700,
  5188. bind: function () {
  5189. // deal with iframes
  5190. if (
  5191. this.el.tagName === 'IFRAME' &&
  5192. this.arg !== 'load'
  5193. ) {
  5194. var self = this
  5195. this.iframeBind = function () {
  5196. _.on(self.el.contentWindow, self.arg, self.handler)
  5197. }
  5198. _.on(this.el, 'load', this.iframeBind)
  5199. }
  5200. },
  5201. update: function (handler) {
  5202. if (typeof handler !== 'function') {
  5203. ("development") !== 'production' && _.warn(
  5204. 'Directive v-on="' + this.arg + ': ' +
  5205. this.expression + '" expects a function value, ' +
  5206. 'got ' + handler
  5207. )
  5208. return
  5209. }
  5210. this.reset()
  5211. var vm = this.vm
  5212. this.handler = function (e) {
  5213. e.targetVM = vm
  5214. vm.$event = e
  5215. var res = handler(e)
  5216. vm.$event = null
  5217. return res
  5218. }
  5219. if (this.iframeBind) {
  5220. this.iframeBind()
  5221. } else {
  5222. _.on(this.el, this.arg, this.handler)
  5223. }
  5224. },
  5225. reset: function () {
  5226. var el = this.iframeBind
  5227. ? this.el.contentWindow
  5228. : this.el
  5229. if (this.handler) {
  5230. _.off(el, this.arg, this.handler)
  5231. }
  5232. },
  5233. unbind: function () {
  5234. this.reset()
  5235. _.off(this.el, 'load', this.iframeBind)
  5236. }
  5237. }
  5238. /***/ },
  5239. /* 40 */
  5240. /***/ function(module, exports, __webpack_require__) {
  5241. var _ = __webpack_require__(1)
  5242. var handlers = {
  5243. text: __webpack_require__(41),
  5244. radio: __webpack_require__(42),
  5245. select: __webpack_require__(43),
  5246. checkbox: __webpack_require__(44)
  5247. }
  5248. module.exports = {
  5249. priority: 800,
  5250. twoWay: true,
  5251. handlers: handlers,
  5252. /**
  5253. * Possible elements:
  5254. * <select>
  5255. * <textarea>
  5256. * <input type="*">
  5257. * - text
  5258. * - checkbox
  5259. * - radio
  5260. * - number
  5261. * - TODO: more types may be supplied as a plugin
  5262. */
  5263. bind: function () {
  5264. // friendly warning...
  5265. this.checkFilters()
  5266. if (this.hasRead && !this.hasWrite) {
  5267. ("development") !== 'production' && _.warn(
  5268. 'It seems you are using a read-only filter with ' +
  5269. 'v-model. You might want to use a two-way filter ' +
  5270. 'to ensure correct behavior.'
  5271. )
  5272. }
  5273. var el = this.el
  5274. var tag = el.tagName
  5275. var handler
  5276. if (tag === 'INPUT') {
  5277. handler = handlers[el.type] || handlers.text
  5278. } else if (tag === 'SELECT') {
  5279. handler = handlers.select
  5280. } else if (tag === 'TEXTAREA') {
  5281. handler = handlers.text
  5282. } else {
  5283. ("development") !== 'production' && _.warn(
  5284. 'v-model does not support element type: ' + tag
  5285. )
  5286. return
  5287. }
  5288. handler.bind.call(this)
  5289. this.update = handler.update
  5290. this.unbind = handler.unbind
  5291. },
  5292. /**
  5293. * Check read/write filter stats.
  5294. */
  5295. checkFilters: function () {
  5296. var filters = this.filters
  5297. if (!filters) return
  5298. var i = filters.length
  5299. while (i--) {
  5300. var filter = _.resolveAsset(this.vm.$options, 'filters', filters[i].name)
  5301. if (typeof filter === 'function' || filter.read) {
  5302. this.hasRead = true
  5303. }
  5304. if (filter.write) {
  5305. this.hasWrite = true
  5306. }
  5307. }
  5308. }
  5309. }
  5310. /***/ },
  5311. /* 41 */
  5312. /***/ function(module, exports, __webpack_require__) {
  5313. var _ = __webpack_require__(1)
  5314. module.exports = {
  5315. bind: function () {
  5316. var self = this
  5317. var el = this.el
  5318. // check params
  5319. // - lazy: update model on "change" instead of "input"
  5320. var lazy = this._checkParam('lazy') != null
  5321. // - number: cast value into number when updating model.
  5322. var number = this._checkParam('number') != null
  5323. // - debounce: debounce the input listener
  5324. var debounce = parseInt(this._checkParam('debounce'), 10)
  5325. // handle composition events.
  5326. // http://blog.evanyou.me/2014/01/03/composition-event/
  5327. // skip this for Android because it handles composition
  5328. // events quite differently. Android doesn't trigger
  5329. // composition events for language input methods e.g.
  5330. // Chinese, but instead triggers them for spelling
  5331. // suggestions... (see Discussion/#162)
  5332. var composing = false
  5333. if (!_.isAndroid) {
  5334. this.onComposeStart = function () {
  5335. composing = true
  5336. }
  5337. this.onComposeEnd = function () {
  5338. composing = false
  5339. // in IE11 the "compositionend" event fires AFTER
  5340. // the "input" event, so the input handler is blocked
  5341. // at the end... have to call it here.
  5342. self.listener()
  5343. }
  5344. _.on(el, 'compositionstart', this.onComposeStart)
  5345. _.on(el, 'compositionend', this.onComposeEnd)
  5346. }
  5347. function syncToModel () {
  5348. var val = number
  5349. ? _.toNumber(el.value)
  5350. : el.value
  5351. self.set(val)
  5352. }
  5353. // if the directive has filters, we need to
  5354. // record cursor position and restore it after updating
  5355. // the input with the filtered value.
  5356. // also force update for type="range" inputs to enable
  5357. // "lock in range" (see #506)
  5358. if (this.hasRead || el.type === 'range') {
  5359. this.listener = function () {
  5360. if (composing) return
  5361. var charsOffset
  5362. // some HTML5 input types throw error here
  5363. try {
  5364. // record how many chars from the end of input
  5365. // the cursor was at
  5366. charsOffset = el.value.length - el.selectionStart
  5367. } catch (e) {}
  5368. // Fix IE10/11 infinite update cycle
  5369. // https://github.com/yyx990803/vue/issues/592
  5370. /* istanbul ignore if */
  5371. if (charsOffset < 0) {
  5372. return
  5373. }
  5374. syncToModel()
  5375. _.nextTick(function () {
  5376. // force a value update, because in
  5377. // certain cases the write filters output the
  5378. // same result for different input values, and
  5379. // the Observer set events won't be triggered.
  5380. var newVal = self._watcher.value
  5381. self.update(newVal)
  5382. if (charsOffset != null) {
  5383. var cursorPos =
  5384. _.toString(newVal).length - charsOffset
  5385. el.setSelectionRange(cursorPos, cursorPos)
  5386. }
  5387. })
  5388. }
  5389. } else {
  5390. this.listener = function () {
  5391. if (composing) return
  5392. syncToModel()
  5393. }
  5394. }
  5395. if (debounce) {
  5396. this.listener = _.debounce(this.listener, debounce)
  5397. }
  5398. // Now attach the main listener
  5399. this.event = lazy ? 'change' : 'input'
  5400. // Support jQuery events, since jQuery.trigger() doesn't
  5401. // trigger native events in some cases and some plugins
  5402. // rely on $.trigger()
  5403. //
  5404. // We want to make sure if a listener is attached using
  5405. // jQuery, it is also removed with jQuery, that's why
  5406. // we do the check for each directive instance and
  5407. // store that check result on itself. This also allows
  5408. // easier test coverage control by unsetting the global
  5409. // jQuery variable in tests.
  5410. this.hasjQuery = typeof jQuery === 'function'
  5411. if (this.hasjQuery) {
  5412. jQuery(el).on(this.event, this.listener)
  5413. } else {
  5414. _.on(el, this.event, this.listener)
  5415. }
  5416. // IE9 doesn't fire input event on backspace/del/cut
  5417. if (!lazy && _.isIE9) {
  5418. this.onCut = function () {
  5419. _.nextTick(self.listener)
  5420. }
  5421. this.onDel = function (e) {
  5422. if (e.keyCode === 46 || e.keyCode === 8) {
  5423. self.listener()
  5424. }
  5425. }
  5426. _.on(el, 'cut', this.onCut)
  5427. _.on(el, 'keyup', this.onDel)
  5428. }
  5429. // set initial value if present
  5430. if (
  5431. el.hasAttribute('value') ||
  5432. (el.tagName === 'TEXTAREA' && el.value.trim())
  5433. ) {
  5434. this._initValue = number
  5435. ? _.toNumber(el.value)
  5436. : el.value
  5437. }
  5438. },
  5439. update: function (value) {
  5440. this.el.value = _.toString(value)
  5441. },
  5442. unbind: function () {
  5443. var el = this.el
  5444. if (this.hasjQuery) {
  5445. jQuery(el).off(this.event, this.listener)
  5446. } else {
  5447. _.off(el, this.event, this.listener)
  5448. }
  5449. if (this.onComposeStart) {
  5450. _.off(el, 'compositionstart', this.onComposeStart)
  5451. _.off(el, 'compositionend', this.onComposeEnd)
  5452. }
  5453. if (this.onCut) {
  5454. _.off(el, 'cut', this.onCut)
  5455. _.off(el, 'keyup', this.onDel)
  5456. }
  5457. }
  5458. }
  5459. /***/ },
  5460. /* 42 */
  5461. /***/ function(module, exports, __webpack_require__) {
  5462. var _ = __webpack_require__(1)
  5463. module.exports = {
  5464. bind: function () {
  5465. var self = this
  5466. var el = this.el
  5467. var number = this._checkParam('number') != null
  5468. function getValue () {
  5469. return number
  5470. ? _.toNumber(el.value)
  5471. : el.value
  5472. }
  5473. this.listener = function () {
  5474. self.set(getValue())
  5475. }
  5476. _.on(el, 'change', this.listener)
  5477. if (el.checked) {
  5478. this._initValue = getValue()
  5479. }
  5480. },
  5481. update: function (value) {
  5482. /* eslint-disable eqeqeq */
  5483. this.el.checked = value == this.el.value
  5484. /* eslint-enable eqeqeq */
  5485. },
  5486. unbind: function () {
  5487. _.off(this.el, 'change', this.listener)
  5488. }
  5489. }
  5490. /***/ },
  5491. /* 43 */
  5492. /***/ function(module, exports, __webpack_require__) {
  5493. var _ = __webpack_require__(1)
  5494. var Watcher = __webpack_require__(17)
  5495. var dirParser = __webpack_require__(15)
  5496. module.exports = {
  5497. bind: function () {
  5498. var self = this
  5499. var el = this.el
  5500. // update DOM using latest value.
  5501. this.forceUpdate = function () {
  5502. if (self._watcher) {
  5503. self.update(self._watcher.get())
  5504. }
  5505. }
  5506. // check options param
  5507. var optionsParam = this._checkParam('options')
  5508. if (optionsParam) {
  5509. initOptions.call(this, optionsParam)
  5510. }
  5511. this.number = this._checkParam('number') != null
  5512. this.multiple = el.hasAttribute('multiple')
  5513. this.listener = function () {
  5514. var value = self.multiple
  5515. ? getMultiValue(el)
  5516. : el.value
  5517. value = self.number
  5518. ? _.isArray(value)
  5519. ? value.map(_.toNumber)
  5520. : _.toNumber(value)
  5521. : value
  5522. self.set(value)
  5523. }
  5524. _.on(el, 'change', this.listener)
  5525. checkInitialValue.call(this)
  5526. // All major browsers except Firefox resets
  5527. // selectedIndex with value -1 to 0 when the element
  5528. // is appended to a new parent, therefore we have to
  5529. // force a DOM update whenever that happens...
  5530. this.vm.$on('hook:attached', this.forceUpdate)
  5531. },
  5532. update: function (value) {
  5533. var el = this.el
  5534. el.selectedIndex = -1
  5535. if (!value && value !== 0) {
  5536. if (this.defaultOption) {
  5537. this.defaultOption.selected = true
  5538. }
  5539. return
  5540. }
  5541. var multi = this.multiple && _.isArray(value)
  5542. var options = el.options
  5543. var i = options.length
  5544. var option
  5545. while (i--) {
  5546. option = options[i]
  5547. /* eslint-disable eqeqeq */
  5548. option.selected = multi
  5549. ? indexOf(value, option.value) > -1
  5550. : value == option.value
  5551. /* eslint-enable eqeqeq */
  5552. }
  5553. },
  5554. unbind: function () {
  5555. _.off(this.el, 'change', this.listener)
  5556. this.vm.$off('hook:attached', this.forceUpdate)
  5557. if (this.optionWatcher) {
  5558. this.optionWatcher.teardown()
  5559. }
  5560. }
  5561. }
  5562. /**
  5563. * Initialize the option list from the param.
  5564. *
  5565. * @param {String} expression
  5566. */
  5567. function initOptions (expression) {
  5568. var self = this
  5569. var el = self.el
  5570. var defaultOption = self.defaultOption = self.el.options[0]
  5571. var descriptor = dirParser.parse(expression)[0]
  5572. function optionUpdateWatcher (value) {
  5573. if (_.isArray(value)) {
  5574. // clear old options.
  5575. // cannot reset innerHTML here because IE family get
  5576. // confused during compilation.
  5577. var i = el.options.length
  5578. while (i--) {
  5579. var option = el.options[i]
  5580. if (option !== defaultOption) {
  5581. el.removeChild(option)
  5582. }
  5583. }
  5584. buildOptions(el, value)
  5585. self.forceUpdate()
  5586. } else {
  5587. ("development") !== 'production' && _.warn(
  5588. 'Invalid options value for v-model: ' + value
  5589. )
  5590. }
  5591. }
  5592. this.optionWatcher = new Watcher(
  5593. this.vm,
  5594. descriptor.expression,
  5595. optionUpdateWatcher,
  5596. {
  5597. deep: true,
  5598. filters: descriptor.filters
  5599. }
  5600. )
  5601. // update with initial value
  5602. optionUpdateWatcher(this.optionWatcher.value)
  5603. }
  5604. /**
  5605. * Build up option elements. IE9 doesn't create options
  5606. * when setting innerHTML on <select> elements, so we have
  5607. * to use DOM API here.
  5608. *
  5609. * @param {Element} parent - a <select> or an <optgroup>
  5610. * @param {Array} options
  5611. */
  5612. function buildOptions (parent, options) {
  5613. var op, el
  5614. for (var i = 0, l = options.length; i < l; i++) {
  5615. op = options[i]
  5616. if (!op.options) {
  5617. el = document.createElement('option')
  5618. if (typeof op === 'string') {
  5619. el.text = el.value = op
  5620. } else {
  5621. if (op.value != null) {
  5622. el.value = op.value
  5623. }
  5624. el.text = op.text || op.value || ''
  5625. if (op.disabled) {
  5626. el.disabled = true
  5627. }
  5628. }
  5629. } else {
  5630. el = document.createElement('optgroup')
  5631. el.label = op.label
  5632. buildOptions(el, op.options)
  5633. }
  5634. parent.appendChild(el)
  5635. }
  5636. }
  5637. /**
  5638. * Check the initial value for selected options.
  5639. */
  5640. function checkInitialValue () {
  5641. var initValue
  5642. var options = this.el.options
  5643. for (var i = 0, l = options.length; i < l; i++) {
  5644. if (options[i].hasAttribute('selected')) {
  5645. if (this.multiple) {
  5646. (initValue || (initValue = []))
  5647. .push(options[i].value)
  5648. } else {
  5649. initValue = options[i].value
  5650. }
  5651. }
  5652. }
  5653. if (typeof initValue !== 'undefined') {
  5654. this._initValue = this.number
  5655. ? _.toNumber(initValue)
  5656. : initValue
  5657. }
  5658. }
  5659. /**
  5660. * Helper to extract a value array for select[multiple]
  5661. *
  5662. * @param {SelectElement} el
  5663. * @return {Array}
  5664. */
  5665. function getMultiValue (el) {
  5666. return Array.prototype.filter
  5667. .call(el.options, filterSelected)
  5668. .map(getOptionValue)
  5669. }
  5670. function filterSelected (op) {
  5671. return op.selected
  5672. }
  5673. function getOptionValue (op) {
  5674. return op.value || op.text
  5675. }
  5676. /**
  5677. * Native Array.indexOf uses strict equal, but in this
  5678. * case we need to match string/numbers with soft equal.
  5679. *
  5680. * @param {Array} arr
  5681. * @param {*} val
  5682. */
  5683. function indexOf (arr, val) {
  5684. var i = arr.length
  5685. while (i--) {
  5686. /* eslint-disable eqeqeq */
  5687. if (arr[i] == val) return i
  5688. /* eslint-enable eqeqeq */
  5689. }
  5690. return -1
  5691. }
  5692. /***/ },
  5693. /* 44 */
  5694. /***/ function(module, exports, __webpack_require__) {
  5695. var _ = __webpack_require__(1)
  5696. module.exports = {
  5697. bind: function () {
  5698. var self = this
  5699. var el = this.el
  5700. this.listener = function () {
  5701. self.set(el.checked)
  5702. }
  5703. _.on(el, 'change', this.listener)
  5704. if (el.checked) {
  5705. this._initValue = el.checked
  5706. }
  5707. },
  5708. update: function (value) {
  5709. this.el.checked = !!value
  5710. },
  5711. unbind: function () {
  5712. _.off(this.el, 'change', this.listener)
  5713. }
  5714. }
  5715. /***/ },
  5716. /* 45 */
  5717. /***/ function(module, exports, __webpack_require__) {
  5718. var _ = __webpack_require__(1)
  5719. var config = __webpack_require__(5)
  5720. var isObject = _.isObject
  5721. var isPlainObject = _.isPlainObject
  5722. var textParser = __webpack_require__(13)
  5723. var expParser = __webpack_require__(19)
  5724. var templateParser = __webpack_require__(22)
  5725. var compiler = __webpack_require__(10)
  5726. var uid = 0
  5727. // async component resolution states
  5728. var UNRESOLVED = 0
  5729. var PENDING = 1
  5730. var RESOLVED = 2
  5731. var ABORTED = 3
  5732. module.exports = {
  5733. /**
  5734. * Setup.
  5735. */
  5736. bind: function () {
  5737. // support for item in array syntax
  5738. var inMatch = this.expression.match(/(.*) in (.*)/)
  5739. if (inMatch) {
  5740. this.arg = inMatch[1]
  5741. this._watcherExp = inMatch[2]
  5742. }
  5743. // uid as a cache identifier
  5744. this.id = '__v_repeat_' + (++uid)
  5745. // setup anchor nodes
  5746. this.start = _.createAnchor('v-repeat-start')
  5747. this.end = _.createAnchor('v-repeat-end')
  5748. _.replace(this.el, this.end)
  5749. _.before(this.start, this.end)
  5750. // check if this is a block repeat
  5751. this.template = _.isTemplate(this.el)
  5752. ? templateParser.parse(this.el, true)
  5753. : this.el
  5754. // check for trackby param
  5755. this.idKey = this._checkParam('track-by')
  5756. // check for transition stagger
  5757. var stagger = +this._checkParam('stagger')
  5758. this.enterStagger = +this._checkParam('enter-stagger') || stagger
  5759. this.leaveStagger = +this._checkParam('leave-stagger') || stagger
  5760. // check for v-ref/v-el
  5761. this.refID = this._checkParam(config.prefix + 'ref')
  5762. this.elID = this._checkParam(config.prefix + 'el')
  5763. // check other directives that need to be handled
  5764. // at v-repeat level
  5765. this.checkIf()
  5766. this.checkComponent()
  5767. // create cache object
  5768. this.cache = Object.create(null)
  5769. // some helpful tips...
  5770. /* istanbul ignore if */
  5771. if (
  5772. ("development") !== 'production' &&
  5773. this.el.tagName === 'OPTION'
  5774. ) {
  5775. _.warn(
  5776. 'Don\'t use v-repeat for v-model options; ' +
  5777. 'use the `options` param instead: ' +
  5778. 'http://vuejs.org/guide/forms.html#Dynamic_Select_Options'
  5779. )
  5780. }
  5781. },
  5782. /**
  5783. * Warn against v-if usage.
  5784. */
  5785. checkIf: function () {
  5786. if (_.attr(this.el, 'if') !== null) {
  5787. ("development") !== 'production' && _.warn(
  5788. 'Don\'t use v-if with v-repeat. ' +
  5789. 'Use v-show or the "filterBy" filter instead.'
  5790. )
  5791. }
  5792. },
  5793. /**
  5794. * Check the component constructor to use for repeated
  5795. * instances. If static we resolve it now, otherwise it
  5796. * needs to be resolved at build time with actual data.
  5797. */
  5798. checkComponent: function () {
  5799. this.componentState = UNRESOLVED
  5800. var options = this.vm.$options
  5801. var id = _.checkComponent(this.el, options)
  5802. if (!id) {
  5803. // default constructor
  5804. this.Component = _.Vue
  5805. // inline repeats should inherit
  5806. this.inline = true
  5807. // important: transclude with no options, just
  5808. // to ensure block start and block end
  5809. this.template = compiler.transclude(this.template)
  5810. var copy = _.extend({}, options)
  5811. copy._asComponent = false
  5812. this._linkFn = compiler.compile(this.template, copy)
  5813. } else {
  5814. this.Component = null
  5815. this.asComponent = true
  5816. // check inline-template
  5817. if (this._checkParam('inline-template') !== null) {
  5818. // extract inline template as a DocumentFragment
  5819. this.inlineTemplate = _.extractContent(this.el, true)
  5820. }
  5821. var tokens = textParser.parse(id)
  5822. if (tokens) {
  5823. // dynamic component to be resolved later
  5824. var componentExp = textParser.tokensToExp(tokens)
  5825. this.componentGetter = expParser.parse(componentExp).get
  5826. } else {
  5827. // static
  5828. this.componentId = id
  5829. this.pendingData = null
  5830. }
  5831. }
  5832. },
  5833. resolveComponent: function () {
  5834. this.componentState = PENDING
  5835. this.vm._resolveComponent(this.componentId, _.bind(function (Component) {
  5836. if (this.componentState === ABORTED) {
  5837. return
  5838. }
  5839. this.Component = Component
  5840. this.componentState = RESOLVED
  5841. this.realUpdate(this.pendingData)
  5842. this.pendingData = null
  5843. }, this))
  5844. },
  5845. /**
  5846. * Resolve a dynamic component to use for an instance.
  5847. * The tricky part here is that there could be dynamic
  5848. * components depending on instance data.
  5849. *
  5850. * @param {Object} data
  5851. * @param {Object} meta
  5852. * @return {Function}
  5853. */
  5854. resolveDynamicComponent: function (data, meta) {
  5855. // create a temporary context object and copy data
  5856. // and meta properties onto it.
  5857. // use _.define to avoid accidentally overwriting scope
  5858. // properties.
  5859. var context = Object.create(this.vm)
  5860. var key
  5861. for (key in data) {
  5862. _.define(context, key, data[key])
  5863. }
  5864. for (key in meta) {
  5865. _.define(context, key, meta[key])
  5866. }
  5867. var id = this.componentGetter.call(context, context)
  5868. var Component = _.resolveAsset(this.vm.$options, 'components', id)
  5869. if (true) {
  5870. _.assertAsset(Component, 'component', id)
  5871. }
  5872. if (!Component.options) {
  5873. ("development") !== 'production' && _.warn(
  5874. 'Async resolution is not supported for v-repeat ' +
  5875. '+ dynamic component. (component: ' + id + ')'
  5876. )
  5877. return _.Vue
  5878. }
  5879. return Component
  5880. },
  5881. /**
  5882. * Update.
  5883. * This is called whenever the Array mutates. If we have
  5884. * a component, we might need to wait for it to resolve
  5885. * asynchronously.
  5886. *
  5887. * @param {Array|Number|String} data
  5888. */
  5889. update: function (data) {
  5890. if (this.componentId) {
  5891. var state = this.componentState
  5892. if (state === UNRESOLVED) {
  5893. this.pendingData = data
  5894. // once resolved, it will call realUpdate
  5895. this.resolveComponent()
  5896. } else if (state === PENDING) {
  5897. this.pendingData = data
  5898. } else if (state === RESOLVED) {
  5899. this.realUpdate(data)
  5900. }
  5901. } else {
  5902. this.realUpdate(data)
  5903. }
  5904. },
  5905. /**
  5906. * The real update that actually modifies the DOM.
  5907. *
  5908. * @param {Array|Number|String} data
  5909. */
  5910. realUpdate: function (data) {
  5911. this.vms = this.diff(data, this.vms)
  5912. // update v-ref
  5913. if (this.refID) {
  5914. this.vm.$[this.refID] = this.converted
  5915. ? toRefObject(this.vms)
  5916. : this.vms
  5917. }
  5918. if (this.elID) {
  5919. this.vm.$$[this.elID] = this.vms.map(function (vm) {
  5920. return vm.$el
  5921. })
  5922. }
  5923. },
  5924. /**
  5925. * Diff, based on new data and old data, determine the
  5926. * minimum amount of DOM manipulations needed to make the
  5927. * DOM reflect the new data Array.
  5928. *
  5929. * The algorithm diffs the new data Array by storing a
  5930. * hidden reference to an owner vm instance on previously
  5931. * seen data. This allows us to achieve O(n) which is
  5932. * better than a levenshtein distance based algorithm,
  5933. * which is O(m * n).
  5934. *
  5935. * @param {Array} data
  5936. * @param {Array} oldVms
  5937. * @return {Array}
  5938. */
  5939. diff: function (data, oldVms) {
  5940. var idKey = this.idKey
  5941. var converted = this.converted
  5942. var start = this.start
  5943. var end = this.end
  5944. var inDoc = _.inDoc(start)
  5945. var alias = this.arg
  5946. var init = !oldVms
  5947. var vms = new Array(data.length)
  5948. var obj, raw, vm, i, l, primitive
  5949. // First pass, go through the new Array and fill up
  5950. // the new vms array. If a piece of data has a cached
  5951. // instance for it, we reuse it. Otherwise build a new
  5952. // instance.
  5953. for (i = 0, l = data.length; i < l; i++) {
  5954. obj = data[i]
  5955. raw = converted ? obj.$value : obj
  5956. primitive = !isObject(raw)
  5957. vm = !init && this.getVm(raw, i, converted ? obj.$key : null)
  5958. if (vm) { // reusable instance
  5959. vm._reused = true
  5960. vm.$index = i // update $index
  5961. // update data for track-by or object repeat,
  5962. // since in these two cases the data is replaced
  5963. // rather than mutated.
  5964. if (idKey || converted || primitive) {
  5965. if (alias) {
  5966. vm[alias] = raw
  5967. } else if (_.isPlainObject(raw)) {
  5968. vm.$data = raw
  5969. } else {
  5970. vm.$value = raw
  5971. }
  5972. }
  5973. } else { // new instance
  5974. vm = this.build(obj, i, true)
  5975. vm._reused = false
  5976. }
  5977. vms[i] = vm
  5978. // insert if this is first run
  5979. if (init) {
  5980. vm.$before(end)
  5981. }
  5982. }
  5983. // if this is the first run, we're done.
  5984. if (init) {
  5985. return vms
  5986. }
  5987. // Second pass, go through the old vm instances and
  5988. // destroy those who are not reused (and remove them
  5989. // from cache)
  5990. var removalIndex = 0
  5991. var totalRemoved = oldVms.length - vms.length
  5992. for (i = 0, l = oldVms.length; i < l; i++) {
  5993. vm = oldVms[i]
  5994. if (!vm._reused) {
  5995. this.uncacheVm(vm)
  5996. vm.$destroy(false, true) // defer cleanup until removal
  5997. this.remove(vm, removalIndex++, totalRemoved, inDoc)
  5998. }
  5999. }
  6000. // final pass, move/insert new instances into the
  6001. // right place.
  6002. var targetPrev, prevEl, currentPrev
  6003. var insertionIndex = 0
  6004. for (i = 0, l = vms.length; i < l; i++) {
  6005. vm = vms[i]
  6006. // this is the vm that we should be after
  6007. targetPrev = vms[i - 1]
  6008. prevEl = targetPrev
  6009. ? targetPrev._staggerCb
  6010. ? targetPrev._staggerAnchor
  6011. : targetPrev._fragmentEnd || targetPrev.$el
  6012. : start
  6013. if (vm._reused && !vm._staggerCb) {
  6014. currentPrev = findPrevVm(vm, start, this.id)
  6015. if (currentPrev !== targetPrev) {
  6016. this.move(vm, prevEl)
  6017. }
  6018. } else {
  6019. // new instance, or still in stagger.
  6020. // insert with updated stagger index.
  6021. this.insert(vm, insertionIndex++, prevEl, inDoc)
  6022. }
  6023. vm._reused = false
  6024. }
  6025. return vms
  6026. },
  6027. /**
  6028. * Build a new instance and cache it.
  6029. *
  6030. * @param {Object} data
  6031. * @param {Number} index
  6032. * @param {Boolean} needCache
  6033. */
  6034. build: function (data, index, needCache) {
  6035. var meta = { $index: index }
  6036. if (this.converted) {
  6037. meta.$key = data.$key
  6038. }
  6039. var raw = this.converted ? data.$value : data
  6040. var alias = this.arg
  6041. if (alias) {
  6042. data = {}
  6043. data[alias] = raw
  6044. } else if (!isPlainObject(raw)) {
  6045. // non-object values
  6046. data = {}
  6047. meta.$value = raw
  6048. } else {
  6049. // default
  6050. data = raw
  6051. }
  6052. // resolve constructor
  6053. var Component = this.Component || this.resolveDynamicComponent(data, meta)
  6054. var parent = this._host || this.vm
  6055. var vm = parent.$addChild({
  6056. el: templateParser.clone(this.template),
  6057. data: data,
  6058. inherit: this.inline,
  6059. template: this.inlineTemplate,
  6060. // repeater meta, e.g. $index, $key
  6061. _meta: meta,
  6062. // mark this as an inline-repeat instance
  6063. _repeat: this.inline,
  6064. // is this a component?
  6065. _asComponent: this.asComponent,
  6066. // linker cachable if no inline-template
  6067. _linkerCachable: !this.inlineTemplate && Component !== _.Vue,
  6068. // pre-compiled linker for simple repeats
  6069. _linkFn: this._linkFn,
  6070. // identifier, shows that this vm belongs to this collection
  6071. _repeatId: this.id,
  6072. // transclusion content owner
  6073. _context: this.vm
  6074. }, Component)
  6075. // cache instance
  6076. if (needCache) {
  6077. this.cacheVm(raw, vm, index, this.converted ? meta.$key : null)
  6078. }
  6079. // sync back changes for two-way bindings of primitive values
  6080. var dir = this
  6081. if (this.rawType === 'object' && isPrimitive(raw)) {
  6082. vm.$watch(alias || '$value', function (val) {
  6083. if (dir.filters) {
  6084. ("development") !== 'production' && _.warn(
  6085. 'You seem to be mutating the $value reference of ' +
  6086. 'a v-repeat instance (likely through v-model) ' +
  6087. 'and filtering the v-repeat at the same time. ' +
  6088. 'This will not work properly with an Array of ' +
  6089. 'primitive values. Please use an Array of ' +
  6090. 'Objects instead.'
  6091. )
  6092. }
  6093. dir._withLock(function () {
  6094. if (dir.converted) {
  6095. dir.rawValue[vm.$key] = val
  6096. } else {
  6097. dir.rawValue.$set(vm.$index, val)
  6098. }
  6099. })
  6100. })
  6101. }
  6102. return vm
  6103. },
  6104. /**
  6105. * Unbind, teardown everything
  6106. */
  6107. unbind: function () {
  6108. this.componentState = ABORTED
  6109. if (this.refID) {
  6110. this.vm.$[this.refID] = null
  6111. }
  6112. if (this.vms) {
  6113. var i = this.vms.length
  6114. var vm
  6115. while (i--) {
  6116. vm = this.vms[i]
  6117. this.uncacheVm(vm)
  6118. vm.$destroy()
  6119. }
  6120. }
  6121. },
  6122. /**
  6123. * Cache a vm instance based on its data.
  6124. *
  6125. * If the data is an object, we save the vm's reference on
  6126. * the data object as a hidden property. Otherwise we
  6127. * cache them in an object and for each primitive value
  6128. * there is an array in case there are duplicates.
  6129. *
  6130. * @param {Object} data
  6131. * @param {Vue} vm
  6132. * @param {Number} index
  6133. * @param {String} [key]
  6134. */
  6135. cacheVm: function (data, vm, index, key) {
  6136. var idKey = this.idKey
  6137. var cache = this.cache
  6138. var primitive = !isObject(data)
  6139. var id
  6140. if (key || idKey || primitive) {
  6141. id = idKey
  6142. ? idKey === '$index'
  6143. ? index
  6144. : data[idKey]
  6145. : (key || index)
  6146. if (!cache[id]) {
  6147. cache[id] = vm
  6148. } else if (!primitive && idKey !== '$index') {
  6149. ("development") !== 'production' && _.warn(
  6150. 'Duplicate track-by key in v-repeat: ' + id
  6151. )
  6152. }
  6153. } else {
  6154. id = this.id
  6155. if (data.hasOwnProperty(id)) {
  6156. if (data[id] === null) {
  6157. data[id] = vm
  6158. } else {
  6159. ("development") !== 'production' && _.warn(
  6160. 'Duplicate objects are not supported in v-repeat ' +
  6161. 'when using components or transitions.'
  6162. )
  6163. }
  6164. } else {
  6165. _.define(data, id, vm)
  6166. }
  6167. }
  6168. vm._raw = data
  6169. },
  6170. /**
  6171. * Try to get a cached instance from a piece of data.
  6172. *
  6173. * @param {Object} data
  6174. * @param {Number} index
  6175. * @param {String} [key]
  6176. * @return {Vue|undefined}
  6177. */
  6178. getVm: function (data, index, key) {
  6179. var idKey = this.idKey
  6180. var primitive = !isObject(data)
  6181. if (key || idKey || primitive) {
  6182. var id = idKey
  6183. ? idKey === '$index'
  6184. ? index
  6185. : data[idKey]
  6186. : (key || index)
  6187. return this.cache[id]
  6188. } else {
  6189. return data[this.id]
  6190. }
  6191. },
  6192. /**
  6193. * Delete a cached vm instance.
  6194. *
  6195. * @param {Vue} vm
  6196. */
  6197. uncacheVm: function (vm) {
  6198. var data = vm._raw
  6199. var idKey = this.idKey
  6200. var index = vm.$index
  6201. // fix #948: avoid accidentally fall through to
  6202. // a parent repeater which happens to have $key.
  6203. var key = vm.hasOwnProperty('$key') && vm.$key
  6204. var primitive = !isObject(data)
  6205. if (idKey || key || primitive) {
  6206. var id = idKey
  6207. ? idKey === '$index'
  6208. ? index
  6209. : data[idKey]
  6210. : (key || index)
  6211. this.cache[id] = null
  6212. } else {
  6213. data[this.id] = null
  6214. vm._raw = null
  6215. }
  6216. },
  6217. /**
  6218. * Insert an instance.
  6219. *
  6220. * @param {Vue} vm
  6221. * @param {Number} index
  6222. * @param {Node} prevEl
  6223. * @param {Boolean} inDoc
  6224. */
  6225. insert: function (vm, index, prevEl, inDoc) {
  6226. if (vm._staggerCb) {
  6227. vm._staggerCb.cancel()
  6228. vm._staggerCb = null
  6229. }
  6230. var staggerAmount = this.getStagger(vm, index, null, 'enter')
  6231. if (inDoc && staggerAmount) {
  6232. // create an anchor and insert it synchronously,
  6233. // so that we can resolve the correct order without
  6234. // worrying about some elements not inserted yet
  6235. var anchor = vm._staggerAnchor
  6236. if (!anchor) {
  6237. anchor = vm._staggerAnchor = _.createAnchor('stagger-anchor')
  6238. anchor.__vue__ = vm
  6239. }
  6240. _.after(anchor, prevEl)
  6241. var op = vm._staggerCb = _.cancellable(function () {
  6242. vm._staggerCb = null
  6243. vm.$before(anchor)
  6244. _.remove(anchor)
  6245. })
  6246. setTimeout(op, staggerAmount)
  6247. } else {
  6248. vm.$after(prevEl)
  6249. }
  6250. },
  6251. /**
  6252. * Move an already inserted instance.
  6253. *
  6254. * @param {Vue} vm
  6255. * @param {Node} prevEl
  6256. */
  6257. move: function (vm, prevEl) {
  6258. vm.$after(prevEl, null, false)
  6259. },
  6260. /**
  6261. * Remove an instance.
  6262. *
  6263. * @param {Vue} vm
  6264. * @param {Number} index
  6265. * @param {Boolean} inDoc
  6266. */
  6267. remove: function (vm, index, total, inDoc) {
  6268. if (vm._staggerCb) {
  6269. vm._staggerCb.cancel()
  6270. vm._staggerCb = null
  6271. // it's not possible for the same vm to be removed
  6272. // twice, so if we have a pending stagger callback,
  6273. // it means this vm is queued for enter but removed
  6274. // before its transition started. Since it is already
  6275. // destroyed, we can just leave it in detached state.
  6276. return
  6277. }
  6278. var staggerAmount = this.getStagger(vm, index, total, 'leave')
  6279. if (inDoc && staggerAmount) {
  6280. var op = vm._staggerCb = _.cancellable(function () {
  6281. vm._staggerCb = null
  6282. remove()
  6283. })
  6284. setTimeout(op, staggerAmount)
  6285. } else {
  6286. remove()
  6287. }
  6288. function remove () {
  6289. vm.$remove(function () {
  6290. vm._cleanup()
  6291. })
  6292. }
  6293. },
  6294. /**
  6295. * Get the stagger amount for an insertion/removal.
  6296. *
  6297. * @param {Vue} vm
  6298. * @param {Number} index
  6299. * @param {String} type
  6300. * @param {Number} total
  6301. */
  6302. getStagger: function (vm, index, total, type) {
  6303. type = type + 'Stagger'
  6304. var transition = vm.$el.__v_trans
  6305. var hooks = transition && transition.hooks
  6306. var hook = hooks && (hooks[type] || hooks.stagger)
  6307. return hook
  6308. ? hook.call(vm, index, total)
  6309. : index * this[type]
  6310. },
  6311. /**
  6312. * Pre-process the value before piping it through the
  6313. * filters, and convert non-Array objects to arrays.
  6314. *
  6315. * This function will be bound to this directive instance
  6316. * and passed into the watcher.
  6317. *
  6318. * @param {*} value
  6319. * @return {Array}
  6320. * @private
  6321. */
  6322. _preProcess: function (value) {
  6323. // regardless of type, store the un-filtered raw value.
  6324. this.rawValue = value
  6325. var type = this.rawType = typeof value
  6326. if (!isPlainObject(value)) {
  6327. this.converted = false
  6328. if (type === 'number') {
  6329. value = range(value)
  6330. } else if (type === 'string') {
  6331. value = _.toArray(value)
  6332. }
  6333. return value || []
  6334. } else {
  6335. // convert plain object to array.
  6336. var keys = Object.keys(value)
  6337. var i = keys.length
  6338. var res = new Array(i)
  6339. var key
  6340. while (i--) {
  6341. key = keys[i]
  6342. res[i] = {
  6343. $key: key,
  6344. $value: value[key]
  6345. }
  6346. }
  6347. this.converted = true
  6348. return res
  6349. }
  6350. }
  6351. }
  6352. /**
  6353. * Helper to find the previous element that is an instance
  6354. * root node. This is necessary because a destroyed vm's
  6355. * element could still be lingering in the DOM before its
  6356. * leaving transition finishes, but its __vue__ reference
  6357. * should have been removed so we can skip them.
  6358. *
  6359. * If this is a block repeat, we want to make sure we only
  6360. * return vm that is bound to this v-repeat. (see #929)
  6361. *
  6362. * @param {Vue} vm
  6363. * @param {Comment|Text} anchor
  6364. * @return {Vue}
  6365. */
  6366. function findPrevVm (vm, anchor, id) {
  6367. var el = vm.$el.previousSibling
  6368. /* istanbul ignore if */
  6369. if (!el) return
  6370. while (
  6371. (!el.__vue__ || el.__vue__.$options._repeatId !== id) &&
  6372. el !== anchor
  6373. ) {
  6374. el = el.previousSibling
  6375. }
  6376. return el.__vue__
  6377. }
  6378. /**
  6379. * Create a range array from given number.
  6380. *
  6381. * @param {Number} n
  6382. * @return {Array}
  6383. */
  6384. function range (n) {
  6385. var i = -1
  6386. var ret = new Array(n)
  6387. while (++i < n) {
  6388. ret[i] = i
  6389. }
  6390. return ret
  6391. }
  6392. /**
  6393. * Convert a vms array to an object ref for v-ref on an
  6394. * Object value.
  6395. *
  6396. * @param {Array} vms
  6397. * @return {Object}
  6398. */
  6399. function toRefObject (vms) {
  6400. var ref = {}
  6401. for (var i = 0, l = vms.length; i < l; i++) {
  6402. ref[vms[i].$key] = vms[i]
  6403. }
  6404. return ref
  6405. }
  6406. /**
  6407. * Check if a value is a primitive one:
  6408. * String, Number, Boolean, null or undefined.
  6409. *
  6410. * @param {*} value
  6411. * @return {Boolean}
  6412. */
  6413. function isPrimitive (value) {
  6414. var type = typeof value
  6415. return value == null ||
  6416. type === 'string' ||
  6417. type === 'number' ||
  6418. type === 'boolean'
  6419. }
  6420. /***/ },
  6421. /* 46 */
  6422. /***/ function(module, exports, __webpack_require__) {
  6423. var _ = __webpack_require__(1)
  6424. var compiler = __webpack_require__(10)
  6425. var templateParser = __webpack_require__(22)
  6426. var transition = __webpack_require__(30)
  6427. var Cache = __webpack_require__(14)
  6428. var cache = new Cache(1000)
  6429. module.exports = {
  6430. bind: function () {
  6431. var el = this.el
  6432. if (!el.__vue__) {
  6433. this.start = _.createAnchor('v-if-start')
  6434. this.end = _.createAnchor('v-if-end')
  6435. _.replace(el, this.end)
  6436. _.before(this.start, this.end)
  6437. if (_.isTemplate(el)) {
  6438. this.template = templateParser.parse(el, true)
  6439. } else {
  6440. this.template = document.createDocumentFragment()
  6441. this.template.appendChild(templateParser.clone(el))
  6442. }
  6443. // compile the nested partial
  6444. var cacheId = (this.vm.constructor.cid || '') + el.outerHTML
  6445. this.linker = cache.get(cacheId)
  6446. if (!this.linker) {
  6447. this.linker = compiler.compile(
  6448. this.template,
  6449. this.vm.$options,
  6450. true, // partial
  6451. this._host // important
  6452. )
  6453. cache.put(cacheId, this.linker)
  6454. }
  6455. } else {
  6456. ("development") !== 'production' && _.warn(
  6457. 'v-if="' + this.expression + '" cannot be ' +
  6458. 'used on an instance root element.'
  6459. )
  6460. this.invalid = true
  6461. }
  6462. },
  6463. update: function (value) {
  6464. if (this.invalid) return
  6465. if (value) {
  6466. // avoid duplicate compiles, since update() can be
  6467. // called with different truthy values
  6468. if (!this.unlink) {
  6469. this.link(
  6470. templateParser.clone(this.template),
  6471. this.linker
  6472. )
  6473. }
  6474. } else {
  6475. this.teardown()
  6476. }
  6477. },
  6478. link: function (frag, linker) {
  6479. var vm = this.vm
  6480. this.unlink = linker(vm, frag)
  6481. transition.blockAppend(frag, this.end, vm)
  6482. // call attached for all the child components created
  6483. // during the compilation
  6484. if (_.inDoc(vm.$el)) {
  6485. var children = this.getContainedComponents()
  6486. if (children) children.forEach(callAttach)
  6487. }
  6488. },
  6489. teardown: function () {
  6490. if (!this.unlink) return
  6491. // collect children beforehand
  6492. var children
  6493. if (_.inDoc(this.vm.$el)) {
  6494. children = this.getContainedComponents()
  6495. }
  6496. transition.blockRemove(this.start, this.end, this.vm)
  6497. if (children) children.forEach(callDetach)
  6498. this.unlink()
  6499. this.unlink = null
  6500. },
  6501. getContainedComponents: function () {
  6502. var vm = this.vm
  6503. var start = this.start.nextSibling
  6504. var end = this.end
  6505. function contains (c) {
  6506. var cur = start
  6507. var next
  6508. while (next !== end) {
  6509. next = cur.nextSibling
  6510. if (
  6511. cur === c.$el ||
  6512. cur.contains && cur.contains(c.$el)
  6513. ) {
  6514. return true
  6515. }
  6516. cur = next
  6517. }
  6518. return false
  6519. }
  6520. return vm.$children.length &&
  6521. vm.$children.filter(contains)
  6522. },
  6523. unbind: function () {
  6524. if (this.unlink) this.unlink()
  6525. }
  6526. }
  6527. function callAttach (child) {
  6528. if (!child._isAttached) {
  6529. child._callHook('attached')
  6530. }
  6531. }
  6532. function callDetach (child) {
  6533. if (child._isAttached) {
  6534. child._callHook('detached')
  6535. }
  6536. }
  6537. /***/ },
  6538. /* 47 */
  6539. /***/ function(module, exports, __webpack_require__) {
  6540. exports.content = __webpack_require__(48)
  6541. exports.partial = __webpack_require__(49)
  6542. /***/ },
  6543. /* 48 */
  6544. /***/ function(module, exports, __webpack_require__) {
  6545. var _ = __webpack_require__(1)
  6546. var clone = __webpack_require__(22).clone
  6547. // This is the elementDirective that handles <content>
  6548. // transclusions. It relies on the raw content of an
  6549. // instance being stored as `$options._content` during
  6550. // the transclude phase.
  6551. module.exports = {
  6552. bind: function () {
  6553. var vm = this.vm
  6554. var host = vm
  6555. // we need find the content context, which is the
  6556. // closest non-inline-repeater instance.
  6557. while (host.$options._repeat) {
  6558. host = host.$parent
  6559. }
  6560. var raw = host.$options._content
  6561. var content
  6562. if (!raw) {
  6563. this.fallback()
  6564. return
  6565. }
  6566. var context = host._context
  6567. var selector = this._checkParam('select')
  6568. if (!selector) {
  6569. // Default content
  6570. var self = this
  6571. var compileDefaultContent = function () {
  6572. self.compile(
  6573. extractFragment(raw.childNodes, raw, true),
  6574. context,
  6575. vm
  6576. )
  6577. }
  6578. if (!host._isCompiled) {
  6579. // defer until the end of instance compilation,
  6580. // because the default outlet must wait until all
  6581. // other possible outlets with selectors have picked
  6582. // out their contents.
  6583. host.$once('hook:compiled', compileDefaultContent)
  6584. } else {
  6585. compileDefaultContent()
  6586. }
  6587. } else {
  6588. // select content
  6589. var nodes = raw.querySelectorAll(selector)
  6590. if (nodes.length) {
  6591. content = extractFragment(nodes, raw)
  6592. if (content.hasChildNodes()) {
  6593. this.compile(content, context, vm)
  6594. } else {
  6595. this.fallback()
  6596. }
  6597. } else {
  6598. this.fallback()
  6599. }
  6600. }
  6601. },
  6602. fallback: function () {
  6603. this.compile(_.extractContent(this.el, true), this.vm)
  6604. },
  6605. compile: function (content, context, host) {
  6606. if (content && context) {
  6607. this.unlink = context.$compile(content, host)
  6608. }
  6609. if (content) {
  6610. _.replace(this.el, content)
  6611. } else {
  6612. _.remove(this.el)
  6613. }
  6614. },
  6615. unbind: function () {
  6616. if (this.unlink) {
  6617. this.unlink()
  6618. }
  6619. }
  6620. }
  6621. /**
  6622. * Extract qualified content nodes from a node list.
  6623. *
  6624. * @param {NodeList} nodes
  6625. * @param {Element} parent
  6626. * @param {Boolean} main
  6627. * @return {DocumentFragment}
  6628. */
  6629. function extractFragment (nodes, parent, main) {
  6630. var frag = document.createDocumentFragment()
  6631. for (var i = 0, l = nodes.length; i < l; i++) {
  6632. var node = nodes[i]
  6633. // if this is the main outlet, we want to skip all
  6634. // previously selected nodes;
  6635. // otherwise, we want to mark the node as selected.
  6636. // clone the node so the original raw content remains
  6637. // intact. this ensures proper re-compilation in cases
  6638. // where the outlet is inside a conditional block
  6639. if (main && !node.__v_selected) {
  6640. frag.appendChild(clone(node))
  6641. } else if (!main && node.parentNode === parent) {
  6642. node.__v_selected = true
  6643. frag.appendChild(clone(node))
  6644. }
  6645. }
  6646. return frag
  6647. }
  6648. /***/ },
  6649. /* 49 */
  6650. /***/ function(module, exports, __webpack_require__) {
  6651. var _ = __webpack_require__(1)
  6652. var templateParser = __webpack_require__(22)
  6653. var textParser = __webpack_require__(13)
  6654. var compiler = __webpack_require__(10)
  6655. var Cache = __webpack_require__(14)
  6656. var cache = new Cache(1000)
  6657. // v-partial reuses logic from v-if
  6658. var vIf = __webpack_require__(46)
  6659. module.exports = {
  6660. link: vIf.link,
  6661. teardown: vIf.teardown,
  6662. getContainedComponents: vIf.getContainedComponents,
  6663. bind: function () {
  6664. var el = this.el
  6665. this.start = _.createAnchor('v-partial-start')
  6666. this.end = _.createAnchor('v-partial-end')
  6667. _.replace(el, this.end)
  6668. _.before(this.start, this.end)
  6669. var id = el.getAttribute('name')
  6670. var tokens = textParser.parse(id)
  6671. if (tokens) {
  6672. // dynamic partial
  6673. this.setupDynamic(tokens)
  6674. } else {
  6675. // static partial
  6676. this.insert(id)
  6677. }
  6678. },
  6679. setupDynamic: function (tokens) {
  6680. var self = this
  6681. var exp = textParser.tokensToExp(tokens)
  6682. this.unwatch = this.vm.$watch(exp, function (value) {
  6683. self.teardown()
  6684. self.insert(value)
  6685. }, {
  6686. immediate: true,
  6687. user: false
  6688. })
  6689. },
  6690. insert: function (id) {
  6691. var partial = _.resolveAsset(this.vm.$options, 'partials', id)
  6692. if (true) {
  6693. _.assertAsset(partial, 'partial', id)
  6694. }
  6695. if (partial) {
  6696. var frag = templateParser.parse(partial, true)
  6697. // cache partials based on constructor id.
  6698. var cacheId = (this.vm.constructor.cid || '') + partial
  6699. var linker = this.compile(frag, cacheId)
  6700. // this is provided by v-if
  6701. this.link(frag, linker)
  6702. }
  6703. },
  6704. compile: function (frag, cacheId) {
  6705. var hit = cache.get(cacheId)
  6706. if (hit) return hit
  6707. var linker = compiler.compile(frag, this.vm.$options, true)
  6708. cache.put(cacheId, linker)
  6709. return linker
  6710. },
  6711. unbind: function () {
  6712. if (this.unlink) this.unlink()
  6713. if (this.unwatch) this.unwatch()
  6714. }
  6715. }
  6716. /***/ },
  6717. /* 50 */
  6718. /***/ function(module, exports, __webpack_require__) {
  6719. var _ = __webpack_require__(1)
  6720. /**
  6721. * Stringify value.
  6722. *
  6723. * @param {Number} indent
  6724. */
  6725. exports.json = {
  6726. read: function (value, indent) {
  6727. return typeof value === 'string'
  6728. ? value
  6729. : JSON.stringify(value, null, Number(indent) || 2)
  6730. },
  6731. write: function (value) {
  6732. try {
  6733. return JSON.parse(value)
  6734. } catch (e) {
  6735. return value
  6736. }
  6737. }
  6738. }
  6739. /**
  6740. * 'abc' => 'Abc'
  6741. */
  6742. exports.capitalize = function (value) {
  6743. if (!value && value !== 0) return ''
  6744. value = value.toString()
  6745. return value.charAt(0).toUpperCase() + value.slice(1)
  6746. }
  6747. /**
  6748. * 'abc' => 'ABC'
  6749. */
  6750. exports.uppercase = function (value) {
  6751. return (value || value === 0)
  6752. ? value.toString().toUpperCase()
  6753. : ''
  6754. }
  6755. /**
  6756. * 'AbC' => 'abc'
  6757. */
  6758. exports.lowercase = function (value) {
  6759. return (value || value === 0)
  6760. ? value.toString().toLowerCase()
  6761. : ''
  6762. }
  6763. /**
  6764. * 12345 => $12,345.00
  6765. *
  6766. * @param {String} sign
  6767. */
  6768. var digitsRE = /(\d{3})(?=\d)/g
  6769. exports.currency = function (value, currency) {
  6770. value = parseFloat(value)
  6771. if (!isFinite(value) || (!value && value !== 0)) return ''
  6772. currency = currency || '$'
  6773. var stringified = Math.abs(value).toFixed(2)
  6774. var _int = stringified.slice(0, -3)
  6775. var i = _int.length % 3
  6776. var head = i > 0
  6777. ? (_int.slice(0, i) + (_int.length > 3 ? ',' : ''))
  6778. : ''
  6779. var _float = stringified.slice(-3)
  6780. var sign = value < 0 ? '-' : ''
  6781. return currency + sign + head +
  6782. _int.slice(i).replace(digitsRE, '$1,') +
  6783. _float
  6784. }
  6785. /**
  6786. * 'item' => 'items'
  6787. *
  6788. * @params
  6789. * an array of strings corresponding to
  6790. * the single, double, triple ... forms of the word to
  6791. * be pluralized. When the number to be pluralized
  6792. * exceeds the length of the args, it will use the last
  6793. * entry in the array.
  6794. *
  6795. * e.g. ['single', 'double', 'triple', 'multiple']
  6796. */
  6797. exports.pluralize = function (value) {
  6798. var args = _.toArray(arguments, 1)
  6799. return args.length > 1
  6800. ? (args[value % 10 - 1] || args[args.length - 1])
  6801. : (args[0] + (value === 1 ? '' : 's'))
  6802. }
  6803. /**
  6804. * A special filter that takes a handler function,
  6805. * wraps it so it only gets triggered on specific
  6806. * keypresses. v-on only.
  6807. *
  6808. * @param {String} key
  6809. */
  6810. var keyCodes = {
  6811. esc: 27,
  6812. tab: 9,
  6813. enter: 13,
  6814. 'delete': 46,
  6815. up: 38,
  6816. left: 37,
  6817. right: 39,
  6818. down: 40
  6819. }
  6820. exports.key = function (handler, key) {
  6821. if (!handler) return
  6822. var code = keyCodes[key]
  6823. if (!code) {
  6824. code = parseInt(key, 10)
  6825. }
  6826. return function (e) {
  6827. if (e.keyCode === code) {
  6828. return handler.call(this, e)
  6829. }
  6830. }
  6831. }
  6832. // expose keycode hash
  6833. exports.key.keyCodes = keyCodes
  6834. /**
  6835. * Install special array filters
  6836. */
  6837. _.extend(exports, __webpack_require__(51))
  6838. /***/ },
  6839. /* 51 */
  6840. /***/ function(module, exports, __webpack_require__) {
  6841. var _ = __webpack_require__(1)
  6842. var Path = __webpack_require__(20)
  6843. /**
  6844. * Filter filter for v-repeat
  6845. *
  6846. * @param {String} searchKey
  6847. * @param {String} [delimiter]
  6848. * @param {String} dataKey
  6849. */
  6850. exports.filterBy = function (arr, search, delimiter, dataKey) {
  6851. // allow optional `in` delimiter
  6852. // because why not
  6853. if (delimiter && delimiter !== 'in') {
  6854. dataKey = delimiter
  6855. }
  6856. if (search == null) {
  6857. return arr
  6858. }
  6859. // cast to lowercase string
  6860. search = ('' + search).toLowerCase()
  6861. return arr.filter(function (item) {
  6862. return dataKey
  6863. ? contains(Path.get(item, dataKey), search)
  6864. : contains(item, search)
  6865. })
  6866. }
  6867. /**
  6868. * Filter filter for v-repeat
  6869. *
  6870. * @param {String} sortKey
  6871. * @param {String} reverse
  6872. */
  6873. exports.orderBy = function (arr, sortKey, reverse) {
  6874. if (!sortKey) {
  6875. return arr
  6876. }
  6877. var order = 1
  6878. if (arguments.length > 2) {
  6879. if (reverse === '-1') {
  6880. order = -1
  6881. } else {
  6882. order = reverse ? -1 : 1
  6883. }
  6884. }
  6885. // sort on a copy to avoid mutating original array
  6886. return arr.slice().sort(function (a, b) {
  6887. if (sortKey !== '$key' && sortKey !== '$value') {
  6888. if (a && '$value' in a) a = a.$value
  6889. if (b && '$value' in b) b = b.$value
  6890. }
  6891. a = _.isObject(a) ? Path.get(a, sortKey) : a
  6892. b = _.isObject(b) ? Path.get(b, sortKey) : b
  6893. return a === b ? 0 : a > b ? order : -order
  6894. })
  6895. }
  6896. /**
  6897. * String contain helper
  6898. *
  6899. * @param {*} val
  6900. * @param {String} search
  6901. */
  6902. function contains (val, search) {
  6903. if (_.isPlainObject(val)) {
  6904. for (var key in val) {
  6905. if (contains(val[key], search)) {
  6906. return true
  6907. }
  6908. }
  6909. } else if (_.isArray(val)) {
  6910. var i = val.length
  6911. while (i--) {
  6912. if (contains(val[i], search)) {
  6913. return true
  6914. }
  6915. }
  6916. } else if (val != null) {
  6917. return val.toString().toLowerCase().indexOf(search) > -1
  6918. }
  6919. }
  6920. /***/ },
  6921. /* 52 */
  6922. /***/ function(module, exports, __webpack_require__) {
  6923. var mergeOptions = __webpack_require__(1).mergeOptions
  6924. /**
  6925. * The main init sequence. This is called for every
  6926. * instance, including ones that are created from extended
  6927. * constructors.
  6928. *
  6929. * @param {Object} options - this options object should be
  6930. * the result of merging class
  6931. * options and the options passed
  6932. * in to the constructor.
  6933. */
  6934. exports._init = function (options) {
  6935. options = options || {}
  6936. this.$el = null
  6937. this.$parent = options._parent
  6938. this.$root = options._root || this
  6939. this.$children = []
  6940. this.$ = {} // child vm references
  6941. this.$$ = {} // element references
  6942. this._watchers = [] // all watchers as an array
  6943. this._directives = [] // all directives
  6944. this._childCtors = {} // inherit:true constructors
  6945. // a flag to avoid this being observed
  6946. this._isVue = true
  6947. // events bookkeeping
  6948. this._events = {} // registered callbacks
  6949. this._eventsCount = {} // for $broadcast optimization
  6950. this._eventCancelled = false // for event cancellation
  6951. // fragment instance properties
  6952. this._isFragment = false
  6953. this._fragmentStart = // @type {CommentNode}
  6954. this._fragmentEnd = null // @type {CommentNode}
  6955. // lifecycle state
  6956. this._isCompiled =
  6957. this._isDestroyed =
  6958. this._isReady =
  6959. this._isAttached =
  6960. this._isBeingDestroyed = false
  6961. this._unlinkFn = null
  6962. // context: the scope in which the component was used,
  6963. // and the scope in which props and contents of this
  6964. // instance should be compiled in.
  6965. this._context =
  6966. options._context ||
  6967. options._parent
  6968. // push self into parent / transclusion host
  6969. if (this.$parent) {
  6970. this.$parent.$children.push(this)
  6971. }
  6972. // props used in v-repeat diffing
  6973. this._reused = false
  6974. this._staggerOp = null
  6975. // merge options.
  6976. options = this.$options = mergeOptions(
  6977. this.constructor.options,
  6978. options,
  6979. this
  6980. )
  6981. // initialize data as empty object.
  6982. // it will be filled up in _initScope().
  6983. this._data = {}
  6984. // initialize data observation and scope inheritance.
  6985. this._initScope()
  6986. // setup event system and option events.
  6987. this._initEvents()
  6988. // call created hook
  6989. this._callHook('created')
  6990. // if `el` option is passed, start compilation.
  6991. if (options.el) {
  6992. this.$mount(options.el)
  6993. }
  6994. }
  6995. /***/ },
  6996. /* 53 */
  6997. /***/ function(module, exports, __webpack_require__) {
  6998. var _ = __webpack_require__(1)
  6999. var inDoc = _.inDoc
  7000. /**
  7001. * Setup the instance's option events & watchers.
  7002. * If the value is a string, we pull it from the
  7003. * instance's methods by name.
  7004. */
  7005. exports._initEvents = function () {
  7006. var options = this.$options
  7007. registerCallbacks(this, '$on', options.events)
  7008. registerCallbacks(this, '$watch', options.watch)
  7009. }
  7010. /**
  7011. * Register callbacks for option events and watchers.
  7012. *
  7013. * @param {Vue} vm
  7014. * @param {String} action
  7015. * @param {Object} hash
  7016. */
  7017. function registerCallbacks (vm, action, hash) {
  7018. if (!hash) return
  7019. var handlers, key, i, j
  7020. for (key in hash) {
  7021. handlers = hash[key]
  7022. if (_.isArray(handlers)) {
  7023. for (i = 0, j = handlers.length; i < j; i++) {
  7024. register(vm, action, key, handlers[i])
  7025. }
  7026. } else {
  7027. register(vm, action, key, handlers)
  7028. }
  7029. }
  7030. }
  7031. /**
  7032. * Helper to register an event/watch callback.
  7033. *
  7034. * @param {Vue} vm
  7035. * @param {String} action
  7036. * @param {String} key
  7037. * @param {Function|String|Object} handler
  7038. * @param {Object} [options]
  7039. */
  7040. function register (vm, action, key, handler, options) {
  7041. var type = typeof handler
  7042. if (type === 'function') {
  7043. vm[action](key, handler, options)
  7044. } else if (type === 'string') {
  7045. var methods = vm.$options.methods
  7046. var method = methods && methods[handler]
  7047. if (method) {
  7048. vm[action](key, method, options)
  7049. } else {
  7050. ("development") !== 'production' && _.warn(
  7051. 'Unknown method: "' + handler + '" when ' +
  7052. 'registering callback for ' + action +
  7053. ': "' + key + '".'
  7054. )
  7055. }
  7056. } else if (handler && type === 'object') {
  7057. register(vm, action, key, handler.handler, handler)
  7058. }
  7059. }
  7060. /**
  7061. * Setup recursive attached/detached calls
  7062. */
  7063. exports._initDOMHooks = function () {
  7064. this.$on('hook:attached', onAttached)
  7065. this.$on('hook:detached', onDetached)
  7066. }
  7067. /**
  7068. * Callback to recursively call attached hook on children
  7069. */
  7070. function onAttached () {
  7071. if (!this._isAttached) {
  7072. this._isAttached = true
  7073. this.$children.forEach(callAttach)
  7074. }
  7075. }
  7076. /**
  7077. * Iterator to call attached hook
  7078. *
  7079. * @param {Vue} child
  7080. */
  7081. function callAttach (child) {
  7082. if (!child._isAttached && inDoc(child.$el)) {
  7083. child._callHook('attached')
  7084. }
  7085. }
  7086. /**
  7087. * Callback to recursively call detached hook on children
  7088. */
  7089. function onDetached () {
  7090. if (this._isAttached) {
  7091. this._isAttached = false
  7092. this.$children.forEach(callDetach)
  7093. }
  7094. }
  7095. /**
  7096. * Iterator to call detached hook
  7097. *
  7098. * @param {Vue} child
  7099. */
  7100. function callDetach (child) {
  7101. if (child._isAttached && !inDoc(child.$el)) {
  7102. child._callHook('detached')
  7103. }
  7104. }
  7105. /**
  7106. * Trigger all handlers for a hook
  7107. *
  7108. * @param {String} hook
  7109. */
  7110. exports._callHook = function (hook) {
  7111. var handlers = this.$options[hook]
  7112. if (handlers) {
  7113. for (var i = 0, j = handlers.length; i < j; i++) {
  7114. handlers[i].call(this)
  7115. }
  7116. }
  7117. this.$emit('hook:' + hook)
  7118. }
  7119. /***/ },
  7120. /* 54 */
  7121. /***/ function(module, exports, __webpack_require__) {
  7122. var _ = __webpack_require__(1)
  7123. var compiler = __webpack_require__(10)
  7124. var Observer = __webpack_require__(55)
  7125. var Dep = __webpack_require__(18)
  7126. var Watcher = __webpack_require__(17)
  7127. /**
  7128. * Setup the scope of an instance, which contains:
  7129. * - observed data
  7130. * - computed properties
  7131. * - user methods
  7132. * - meta properties
  7133. */
  7134. exports._initScope = function () {
  7135. this._initProps()
  7136. this._initMeta()
  7137. this._initMethods()
  7138. this._initData()
  7139. this._initComputed()
  7140. }
  7141. /**
  7142. * Initialize props.
  7143. */
  7144. exports._initProps = function () {
  7145. var options = this.$options
  7146. var el = options.el
  7147. var props = options.props
  7148. if (props && !el) {
  7149. ("development") !== 'production' && _.warn(
  7150. 'Props will not be compiled if no `el` option is ' +
  7151. 'provided at instantiation.'
  7152. )
  7153. }
  7154. // make sure to convert string selectors into element now
  7155. el = options.el = _.query(el)
  7156. this._propsUnlinkFn = el && props
  7157. ? compiler.compileAndLinkProps(
  7158. this, el, props
  7159. )
  7160. : null
  7161. }
  7162. /**
  7163. * Initialize the data.
  7164. */
  7165. exports._initData = function () {
  7166. var propsData = this._data
  7167. var optionsDataFn = this.$options.data
  7168. var optionsData = optionsDataFn && optionsDataFn()
  7169. if (optionsData) {
  7170. this._data = optionsData
  7171. for (var prop in propsData) {
  7172. if (
  7173. this._props[prop].raw !== null ||
  7174. !optionsData.hasOwnProperty(prop)
  7175. ) {
  7176. optionsData.$set(prop, propsData[prop])
  7177. }
  7178. }
  7179. }
  7180. var data = this._data
  7181. // proxy data on instance
  7182. var keys = Object.keys(data)
  7183. var i, key
  7184. i = keys.length
  7185. while (i--) {
  7186. key = keys[i]
  7187. if (!_.isReserved(key)) {
  7188. this._proxy(key)
  7189. }
  7190. }
  7191. // observe data
  7192. Observer.create(data, this)
  7193. }
  7194. /**
  7195. * Swap the isntance's $data. Called in $data's setter.
  7196. *
  7197. * @param {Object} newData
  7198. */
  7199. exports._setData = function (newData) {
  7200. newData = newData || {}
  7201. var oldData = this._data
  7202. this._data = newData
  7203. var keys, key, i
  7204. // copy props.
  7205. // this should only happen during a v-repeat of component
  7206. // that also happens to have compiled props.
  7207. var props = this.$options.props
  7208. if (props) {
  7209. i = props.length
  7210. while (i--) {
  7211. key = props[i].name
  7212. if (key !== '$data' && !newData.hasOwnProperty(key)) {
  7213. newData.$set(key, oldData[key])
  7214. }
  7215. }
  7216. }
  7217. // unproxy keys not present in new data
  7218. keys = Object.keys(oldData)
  7219. i = keys.length
  7220. while (i--) {
  7221. key = keys[i]
  7222. if (!_.isReserved(key) && !(key in newData)) {
  7223. this._unproxy(key)
  7224. }
  7225. }
  7226. // proxy keys not already proxied,
  7227. // and trigger change for changed values
  7228. keys = Object.keys(newData)
  7229. i = keys.length
  7230. while (i--) {
  7231. key = keys[i]
  7232. if (!this.hasOwnProperty(key) && !_.isReserved(key)) {
  7233. // new property
  7234. this._proxy(key)
  7235. }
  7236. }
  7237. oldData.__ob__.removeVm(this)
  7238. Observer.create(newData, this)
  7239. this._digest()
  7240. }
  7241. /**
  7242. * Proxy a property, so that
  7243. * vm.prop === vm._data.prop
  7244. *
  7245. * @param {String} key
  7246. */
  7247. exports._proxy = function (key) {
  7248. // need to store ref to self here
  7249. // because these getter/setters might
  7250. // be called by child instances!
  7251. var self = this
  7252. Object.defineProperty(self, key, {
  7253. configurable: true,
  7254. enumerable: true,
  7255. get: function proxyGetter () {
  7256. return self._data[key]
  7257. },
  7258. set: function proxySetter (val) {
  7259. self._data[key] = val
  7260. }
  7261. })
  7262. }
  7263. /**
  7264. * Unproxy a property.
  7265. *
  7266. * @param {String} key
  7267. */
  7268. exports._unproxy = function (key) {
  7269. delete this[key]
  7270. }
  7271. /**
  7272. * Force update on every watcher in scope.
  7273. */
  7274. exports._digest = function () {
  7275. var i = this._watchers.length
  7276. while (i--) {
  7277. this._watchers[i].update(true) // shallow updates
  7278. }
  7279. var children = this.$children
  7280. i = children.length
  7281. while (i--) {
  7282. var child = children[i]
  7283. if (child.$options.inherit) {
  7284. child._digest()
  7285. }
  7286. }
  7287. }
  7288. /**
  7289. * Setup computed properties. They are essentially
  7290. * special getter/setters
  7291. */
  7292. function noop () {}
  7293. exports._initComputed = function () {
  7294. var computed = this.$options.computed
  7295. if (computed) {
  7296. for (var key in computed) {
  7297. var userDef = computed[key]
  7298. var def = {
  7299. enumerable: true,
  7300. configurable: true
  7301. }
  7302. if (typeof userDef === 'function') {
  7303. def.get = makeComputedGetter(userDef, this)
  7304. def.set = noop
  7305. } else {
  7306. def.get = userDef.get
  7307. ? makeComputedGetter(userDef.get, this)
  7308. : noop
  7309. def.set = userDef.set
  7310. ? _.bind(userDef.set, this)
  7311. : noop
  7312. }
  7313. Object.defineProperty(this, key, def)
  7314. }
  7315. }
  7316. }
  7317. function makeComputedGetter (getter, owner) {
  7318. var watcher = new Watcher(owner, getter, null, {
  7319. lazy: true
  7320. })
  7321. return function computedGetter () {
  7322. if (watcher.dirty) {
  7323. watcher.evaluate()
  7324. }
  7325. if (Dep.target) {
  7326. watcher.depend()
  7327. }
  7328. return watcher.value
  7329. }
  7330. }
  7331. /**
  7332. * Setup instance methods. Methods must be bound to the
  7333. * instance since they might be called by children
  7334. * inheriting them.
  7335. */
  7336. exports._initMethods = function () {
  7337. var methods = this.$options.methods
  7338. if (methods) {
  7339. for (var key in methods) {
  7340. this[key] = _.bind(methods[key], this)
  7341. }
  7342. }
  7343. }
  7344. /**
  7345. * Initialize meta information like $index, $key & $value.
  7346. */
  7347. exports._initMeta = function () {
  7348. var metas = this.$options._meta
  7349. if (metas) {
  7350. for (var key in metas) {
  7351. this._defineMeta(key, metas[key])
  7352. }
  7353. }
  7354. }
  7355. /**
  7356. * Define a meta property, e.g $index, $key, $value
  7357. * which only exists on the vm instance but not in $data.
  7358. *
  7359. * @param {String} key
  7360. * @param {*} value
  7361. */
  7362. exports._defineMeta = function (key, value) {
  7363. var dep = new Dep()
  7364. Object.defineProperty(this, key, {
  7365. enumerable: true,
  7366. configurable: true,
  7367. get: function metaGetter () {
  7368. if (Dep.target) {
  7369. dep.depend()
  7370. }
  7371. return value
  7372. },
  7373. set: function metaSetter (val) {
  7374. if (val !== value) {
  7375. value = val
  7376. dep.notify()
  7377. }
  7378. }
  7379. })
  7380. }
  7381. /***/ },
  7382. /* 55 */
  7383. /***/ function(module, exports, __webpack_require__) {
  7384. var _ = __webpack_require__(1)
  7385. var config = __webpack_require__(5)
  7386. var Dep = __webpack_require__(18)
  7387. var arrayMethods = __webpack_require__(56)
  7388. var arrayKeys = Object.getOwnPropertyNames(arrayMethods)
  7389. __webpack_require__(57)
  7390. /**
  7391. * Observer class that are attached to each observed
  7392. * object. Once attached, the observer converts target
  7393. * object's property keys into getter/setters that
  7394. * collect dependencies and dispatches updates.
  7395. *
  7396. * @param {Array|Object} value
  7397. * @constructor
  7398. */
  7399. function Observer (value) {
  7400. this.value = value
  7401. this.dep = new Dep()
  7402. _.define(value, '__ob__', this)
  7403. if (_.isArray(value)) {
  7404. var augment = config.proto && _.hasProto
  7405. ? protoAugment
  7406. : copyAugment
  7407. augment(value, arrayMethods, arrayKeys)
  7408. this.observeArray(value)
  7409. } else {
  7410. this.walk(value)
  7411. }
  7412. }
  7413. // Static methods
  7414. /**
  7415. * Attempt to create an observer instance for a value,
  7416. * returns the new observer if successfully observed,
  7417. * or the existing observer if the value already has one.
  7418. *
  7419. * @param {*} value
  7420. * @param {Vue} [vm]
  7421. * @return {Observer|undefined}
  7422. * @static
  7423. */
  7424. Observer.create = function (value, vm) {
  7425. var ob
  7426. if (
  7427. value &&
  7428. value.hasOwnProperty('__ob__') &&
  7429. value.__ob__ instanceof Observer
  7430. ) {
  7431. ob = value.__ob__
  7432. } else if (
  7433. _.isObject(value) &&
  7434. !Object.isFrozen(value) &&
  7435. !value._isVue
  7436. ) {
  7437. ob = new Observer(value)
  7438. }
  7439. if (ob && vm) {
  7440. ob.addVm(vm)
  7441. }
  7442. return ob
  7443. }
  7444. // Instance methods
  7445. var p = Observer.prototype
  7446. /**
  7447. * Walk through each property and convert them into
  7448. * getter/setters. This method should only be called when
  7449. * value type is Object. Properties prefixed with `$` or `_`
  7450. * and accessor properties are ignored.
  7451. *
  7452. * @param {Object} obj
  7453. */
  7454. p.walk = function (obj) {
  7455. var keys = Object.keys(obj)
  7456. var i = keys.length
  7457. var key, prefix
  7458. while (i--) {
  7459. key = keys[i]
  7460. prefix = key.charCodeAt(0)
  7461. if (prefix !== 0x24 && prefix !== 0x5F) { // skip $ or _
  7462. this.convert(key, obj[key])
  7463. }
  7464. }
  7465. }
  7466. /**
  7467. * Try to carete an observer for a child value,
  7468. * and if value is array, link dep to the array.
  7469. *
  7470. * @param {*} val
  7471. * @return {Dep|undefined}
  7472. */
  7473. p.observe = function (val) {
  7474. return Observer.create(val)
  7475. }
  7476. /**
  7477. * Observe a list of Array items.
  7478. *
  7479. * @param {Array} items
  7480. */
  7481. p.observeArray = function (items) {
  7482. var i = items.length
  7483. while (i--) {
  7484. this.observe(items[i])
  7485. }
  7486. }
  7487. /**
  7488. * Convert a property into getter/setter so we can emit
  7489. * the events when the property is accessed/changed.
  7490. *
  7491. * @param {String} key
  7492. * @param {*} val
  7493. */
  7494. p.convert = function (key, val) {
  7495. var ob = this
  7496. var childOb = ob.observe(val)
  7497. var dep = new Dep()
  7498. Object.defineProperty(ob.value, key, {
  7499. enumerable: true,
  7500. configurable: true,
  7501. get: function () {
  7502. if (Dep.target) {
  7503. dep.depend()
  7504. if (childOb) {
  7505. childOb.dep.depend()
  7506. }
  7507. if (_.isArray(val)) {
  7508. for (var e, i = 0, l = val.length; i < l; i++) {
  7509. e = val[i]
  7510. e && e.__ob__ && e.__ob__.dep.depend()
  7511. }
  7512. }
  7513. }
  7514. return val
  7515. },
  7516. set: function (newVal) {
  7517. if (newVal === val) return
  7518. val = newVal
  7519. childOb = ob.observe(newVal)
  7520. dep.notify()
  7521. }
  7522. })
  7523. }
  7524. /**
  7525. * Add an owner vm, so that when $add/$delete mutations
  7526. * happen we can notify owner vms to proxy the keys and
  7527. * digest the watchers. This is only called when the object
  7528. * is observed as an instance's root $data.
  7529. *
  7530. * @param {Vue} vm
  7531. */
  7532. p.addVm = function (vm) {
  7533. (this.vms || (this.vms = [])).push(vm)
  7534. }
  7535. /**
  7536. * Remove an owner vm. This is called when the object is
  7537. * swapped out as an instance's $data object.
  7538. *
  7539. * @param {Vue} vm
  7540. */
  7541. p.removeVm = function (vm) {
  7542. this.vms.$remove(vm)
  7543. }
  7544. // helpers
  7545. /**
  7546. * Augment an target Object or Array by intercepting
  7547. * the prototype chain using __proto__
  7548. *
  7549. * @param {Object|Array} target
  7550. * @param {Object} proto
  7551. */
  7552. function protoAugment (target, src) {
  7553. target.__proto__ = src
  7554. }
  7555. /**
  7556. * Augment an target Object or Array by defining
  7557. * hidden properties.
  7558. *
  7559. * @param {Object|Array} target
  7560. * @param {Object} proto
  7561. */
  7562. function copyAugment (target, src, keys) {
  7563. var i = keys.length
  7564. var key
  7565. while (i--) {
  7566. key = keys[i]
  7567. _.define(target, key, src[key])
  7568. }
  7569. }
  7570. module.exports = Observer
  7571. /***/ },
  7572. /* 56 */
  7573. /***/ function(module, exports, __webpack_require__) {
  7574. var _ = __webpack_require__(1)
  7575. var arrayProto = Array.prototype
  7576. var arrayMethods = Object.create(arrayProto)
  7577. /**
  7578. * Intercept mutating methods and emit events
  7579. */
  7580. ;[
  7581. 'push',
  7582. 'pop',
  7583. 'shift',
  7584. 'unshift',
  7585. 'splice',
  7586. 'sort',
  7587. 'reverse'
  7588. ]
  7589. .forEach(function (method) {
  7590. // cache original method
  7591. var original = arrayProto[method]
  7592. _.define(arrayMethods, method, function mutator () {
  7593. // avoid leaking arguments:
  7594. // http://jsperf.com/closure-with-arguments
  7595. var i = arguments.length
  7596. var args = new Array(i)
  7597. while (i--) {
  7598. args[i] = arguments[i]
  7599. }
  7600. var result = original.apply(this, args)
  7601. var ob = this.__ob__
  7602. var inserted
  7603. switch (method) {
  7604. case 'push':
  7605. inserted = args
  7606. break
  7607. case 'unshift':
  7608. inserted = args
  7609. break
  7610. case 'splice':
  7611. inserted = args.slice(2)
  7612. break
  7613. }
  7614. if (inserted) ob.observeArray(inserted)
  7615. // notify change
  7616. ob.dep.notify()
  7617. return result
  7618. })
  7619. })
  7620. /**
  7621. * Swap the element at the given index with a new value
  7622. * and emits corresponding event.
  7623. *
  7624. * @param {Number} index
  7625. * @param {*} val
  7626. * @return {*} - replaced element
  7627. */
  7628. _.define(
  7629. arrayProto,
  7630. '$set',
  7631. function $set (index, val) {
  7632. if (index >= this.length) {
  7633. this.length = index + 1
  7634. }
  7635. return this.splice(index, 1, val)[0]
  7636. }
  7637. )
  7638. /**
  7639. * Convenience method to remove the element at given index.
  7640. *
  7641. * @param {Number} index
  7642. * @param {*} val
  7643. */
  7644. _.define(
  7645. arrayProto,
  7646. '$remove',
  7647. function $remove (index) {
  7648. /* istanbul ignore if */
  7649. if (!this.length) return
  7650. if (typeof index !== 'number') {
  7651. index = _.indexOf(this, index)
  7652. }
  7653. if (index > -1) {
  7654. return this.splice(index, 1)
  7655. }
  7656. }
  7657. )
  7658. module.exports = arrayMethods
  7659. /***/ },
  7660. /* 57 */
  7661. /***/ function(module, exports, __webpack_require__) {
  7662. var _ = __webpack_require__(1)
  7663. var objProto = Object.prototype
  7664. /**
  7665. * Add a new property to an observed object
  7666. * and emits corresponding event
  7667. *
  7668. * @param {String} key
  7669. * @param {*} val
  7670. * @public
  7671. */
  7672. _.define(
  7673. objProto,
  7674. '$add',
  7675. function $add (key, val) {
  7676. if (this.hasOwnProperty(key)) return
  7677. var ob = this.__ob__
  7678. if (!ob || _.isReserved(key)) {
  7679. this[key] = val
  7680. return
  7681. }
  7682. ob.convert(key, val)
  7683. ob.dep.notify()
  7684. if (ob.vms) {
  7685. var i = ob.vms.length
  7686. while (i--) {
  7687. var vm = ob.vms[i]
  7688. vm._proxy(key)
  7689. vm._digest()
  7690. }
  7691. }
  7692. }
  7693. )
  7694. /**
  7695. * Set a property on an observed object, calling add to
  7696. * ensure the property is observed.
  7697. *
  7698. * @param {String} key
  7699. * @param {*} val
  7700. * @public
  7701. */
  7702. _.define(
  7703. objProto,
  7704. '$set',
  7705. function $set (key, val) {
  7706. this.$add(key, val)
  7707. this[key] = val
  7708. }
  7709. )
  7710. /**
  7711. * Deletes a property from an observed object
  7712. * and emits corresponding event
  7713. *
  7714. * @param {String} key
  7715. * @public
  7716. */
  7717. _.define(
  7718. objProto,
  7719. '$delete',
  7720. function $delete (key) {
  7721. if (!this.hasOwnProperty(key)) return
  7722. delete this[key]
  7723. var ob = this.__ob__
  7724. if (!ob || _.isReserved(key)) {
  7725. return
  7726. }
  7727. ob.dep.notify()
  7728. if (ob.vms) {
  7729. var i = ob.vms.length
  7730. while (i--) {
  7731. var vm = ob.vms[i]
  7732. vm._unproxy(key)
  7733. vm._digest()
  7734. }
  7735. }
  7736. }
  7737. )
  7738. /***/ },
  7739. /* 58 */
  7740. /***/ function(module, exports, __webpack_require__) {
  7741. var _ = __webpack_require__(1)
  7742. var Directive = __webpack_require__(59)
  7743. var compiler = __webpack_require__(10)
  7744. /**
  7745. * Transclude, compile and link element.
  7746. *
  7747. * If a pre-compiled linker is available, that means the
  7748. * passed in element will be pre-transcluded and compiled
  7749. * as well - all we need to do is to call the linker.
  7750. *
  7751. * Otherwise we need to call transclude/compile/link here.
  7752. *
  7753. * @param {Element} el
  7754. * @return {Element}
  7755. */
  7756. exports._compile = function (el) {
  7757. var options = this.$options
  7758. var host = this._host
  7759. if (options._linkFn) {
  7760. // pre-transcluded with linker, just use it
  7761. this._initElement(el)
  7762. this._unlinkFn = options._linkFn(this, el, host)
  7763. } else {
  7764. // transclude and init element
  7765. // transclude can potentially replace original
  7766. // so we need to keep reference; this step also injects
  7767. // the template and caches the original attributes
  7768. // on the container node and replacer node.
  7769. var original = el
  7770. el = compiler.transclude(el, options)
  7771. this._initElement(el)
  7772. // root is always compiled per-instance, because
  7773. // container attrs and props can be different every time.
  7774. var rootLinker = compiler.compileRoot(el, options)
  7775. // compile and link the rest
  7776. var contentLinkFn
  7777. var ctor = this.constructor
  7778. // component compilation can be cached
  7779. // as long as it's not using inline-template
  7780. if (options._linkerCachable) {
  7781. contentLinkFn = ctor.linker
  7782. if (!contentLinkFn) {
  7783. contentLinkFn = ctor.linker = compiler.compile(el, options)
  7784. }
  7785. }
  7786. // link phase
  7787. var rootUnlinkFn = rootLinker(this, el)
  7788. var contentUnlinkFn = contentLinkFn
  7789. ? contentLinkFn(this, el)
  7790. : compiler.compile(el, options)(this, el, host)
  7791. // register composite unlink function
  7792. // to be called during instance destruction
  7793. this._unlinkFn = function () {
  7794. rootUnlinkFn()
  7795. // passing destroying: true to avoid searching and
  7796. // splicing the directives
  7797. contentUnlinkFn(true)
  7798. }
  7799. // finally replace original
  7800. if (options.replace) {
  7801. _.replace(original, el)
  7802. }
  7803. }
  7804. return el
  7805. }
  7806. /**
  7807. * Initialize instance element. Called in the public
  7808. * $mount() method.
  7809. *
  7810. * @param {Element} el
  7811. */
  7812. exports._initElement = function (el) {
  7813. if (el instanceof DocumentFragment) {
  7814. this._isFragment = true
  7815. this.$el = this._fragmentStart = el.firstChild
  7816. this._fragmentEnd = el.lastChild
  7817. // set persisted text anchors to empty
  7818. if (this._fragmentStart.nodeType === 3) {
  7819. this._fragmentStart.data = this._fragmentEnd.data = ''
  7820. }
  7821. this._blockFragment = el
  7822. } else {
  7823. this.$el = el
  7824. }
  7825. this.$el.__vue__ = this
  7826. this._callHook('beforeCompile')
  7827. }
  7828. /**
  7829. * Create and bind a directive to an element.
  7830. *
  7831. * @param {String} name - directive name
  7832. * @param {Node} node - target node
  7833. * @param {Object} desc - parsed directive descriptor
  7834. * @param {Object} def - directive definition object
  7835. * @param {Vue|undefined} host - transclusion host component
  7836. */
  7837. exports._bindDir = function (name, node, desc, def, host) {
  7838. this._directives.push(
  7839. new Directive(name, node, this, desc, def, host)
  7840. )
  7841. }
  7842. /**
  7843. * Teardown an instance, unobserves the data, unbind all the
  7844. * directives, turn off all the event listeners, etc.
  7845. *
  7846. * @param {Boolean} remove - whether to remove the DOM node.
  7847. * @param {Boolean} deferCleanup - if true, defer cleanup to
  7848. * be called later
  7849. */
  7850. exports._destroy = function (remove, deferCleanup) {
  7851. if (this._isBeingDestroyed) {
  7852. return
  7853. }
  7854. this._callHook('beforeDestroy')
  7855. this._isBeingDestroyed = true
  7856. var i
  7857. // remove self from parent. only necessary
  7858. // if parent is not being destroyed as well.
  7859. var parent = this.$parent
  7860. if (parent && !parent._isBeingDestroyed) {
  7861. parent.$children.$remove(this)
  7862. }
  7863. // destroy all children.
  7864. i = this.$children.length
  7865. while (i--) {
  7866. this.$children[i].$destroy()
  7867. }
  7868. // teardown props
  7869. if (this._propsUnlinkFn) {
  7870. this._propsUnlinkFn()
  7871. }
  7872. // teardown all directives. this also tearsdown all
  7873. // directive-owned watchers.
  7874. if (this._unlinkFn) {
  7875. this._unlinkFn()
  7876. }
  7877. i = this._watchers.length
  7878. while (i--) {
  7879. this._watchers[i].teardown()
  7880. }
  7881. // remove reference to self on $el
  7882. if (this.$el) {
  7883. this.$el.__vue__ = null
  7884. }
  7885. // remove DOM element
  7886. var self = this
  7887. if (remove && this.$el) {
  7888. this.$remove(function () {
  7889. self._cleanup()
  7890. })
  7891. } else if (!deferCleanup) {
  7892. this._cleanup()
  7893. }
  7894. }
  7895. /**
  7896. * Clean up to ensure garbage collection.
  7897. * This is called after the leave transition if there
  7898. * is any.
  7899. */
  7900. exports._cleanup = function () {
  7901. // remove reference from data ob
  7902. // frozen object may not have observer.
  7903. if (this._data.__ob__) {
  7904. this._data.__ob__.removeVm(this)
  7905. }
  7906. // Clean up references to private properties and other
  7907. // instances. preserve reference to _data so that proxy
  7908. // accessors still work. The only potential side effect
  7909. // here is that mutating the instance after it's destroyed
  7910. // may affect the state of other components that are still
  7911. // observing the same object, but that seems to be a
  7912. // reasonable responsibility for the user rather than
  7913. // always throwing an error on them.
  7914. this.$el =
  7915. this.$parent =
  7916. this.$root =
  7917. this.$children =
  7918. this._watchers =
  7919. this._directives = null
  7920. // call the last hook...
  7921. this._isDestroyed = true
  7922. this._callHook('destroyed')
  7923. // turn off all instance listeners.
  7924. this.$off()
  7925. }
  7926. /***/ },
  7927. /* 59 */
  7928. /***/ function(module, exports, __webpack_require__) {
  7929. var _ = __webpack_require__(1)
  7930. var config = __webpack_require__(5)
  7931. var Watcher = __webpack_require__(17)
  7932. var textParser = __webpack_require__(13)
  7933. var expParser = __webpack_require__(19)
  7934. /**
  7935. * A directive links a DOM element with a piece of data,
  7936. * which is the result of evaluating an expression.
  7937. * It registers a watcher with the expression and calls
  7938. * the DOM update function when a change is triggered.
  7939. *
  7940. * @param {String} name
  7941. * @param {Node} el
  7942. * @param {Vue} vm
  7943. * @param {Object} descriptor
  7944. * - {String} expression
  7945. * - {String} [arg]
  7946. * - {Array<Object>} [filters]
  7947. * @param {Object} def - directive definition object
  7948. * @param {Vue|undefined} host - transclusion host target
  7949. * @constructor
  7950. */
  7951. function Directive (name, el, vm, descriptor, def, host) {
  7952. // public
  7953. this.name = name
  7954. this.el = el
  7955. this.vm = vm
  7956. // copy descriptor props
  7957. this.raw = descriptor.raw
  7958. this.expression = descriptor.expression
  7959. this.arg = descriptor.arg
  7960. this.filters = descriptor.filters
  7961. // private
  7962. this._descriptor = descriptor
  7963. this._host = host
  7964. this._locked = false
  7965. this._bound = false
  7966. // init
  7967. this._bind(def)
  7968. }
  7969. var p = Directive.prototype
  7970. /**
  7971. * Initialize the directive, mixin definition properties,
  7972. * setup the watcher, call definition bind() and update()
  7973. * if present.
  7974. *
  7975. * @param {Object} def
  7976. */
  7977. p._bind = function (def) {
  7978. if (
  7979. (this.name !== 'cloak' || this.vm._isCompiled) &&
  7980. this.el && this.el.removeAttribute
  7981. ) {
  7982. this.el.removeAttribute(config.prefix + this.name)
  7983. }
  7984. if (typeof def === 'function') {
  7985. this.update = def
  7986. } else {
  7987. _.extend(this, def)
  7988. }
  7989. this._watcherExp = this.expression
  7990. this._checkDynamicLiteral()
  7991. if (this.bind) {
  7992. this.bind()
  7993. }
  7994. if (this._watcherExp &&
  7995. (this.update || this.twoWay) &&
  7996. (!this.isLiteral || this._isDynamicLiteral) &&
  7997. !this._checkStatement()) {
  7998. // wrapped updater for context
  7999. var dir = this
  8000. var update = this._update = this.update
  8001. ? function (val, oldVal) {
  8002. if (!dir._locked) {
  8003. dir.update(val, oldVal)
  8004. }
  8005. }
  8006. : function () {} // noop if no update is provided
  8007. // pre-process hook called before the value is piped
  8008. // through the filters. used in v-repeat.
  8009. var preProcess = this._preProcess
  8010. ? _.bind(this._preProcess, this)
  8011. : null
  8012. var watcher = this._watcher = new Watcher(
  8013. this.vm,
  8014. this._watcherExp,
  8015. update, // callback
  8016. {
  8017. filters: this.filters,
  8018. twoWay: this.twoWay,
  8019. deep: this.deep,
  8020. preProcess: preProcess
  8021. }
  8022. )
  8023. if (this._initValue != null) {
  8024. watcher.set(this._initValue)
  8025. } else if (this.update) {
  8026. this.update(watcher.value)
  8027. }
  8028. }
  8029. this._bound = true
  8030. }
  8031. /**
  8032. * check if this is a dynamic literal binding.
  8033. *
  8034. * e.g. v-component="{{currentView}}"
  8035. */
  8036. p._checkDynamicLiteral = function () {
  8037. var expression = this.expression
  8038. if (expression && this.isLiteral) {
  8039. var tokens = textParser.parse(expression)
  8040. if (tokens) {
  8041. var exp = textParser.tokensToExp(tokens)
  8042. this.expression = this.vm.$get(exp)
  8043. this._watcherExp = exp
  8044. this._isDynamicLiteral = true
  8045. }
  8046. }
  8047. }
  8048. /**
  8049. * Check if the directive is a function caller
  8050. * and if the expression is a callable one. If both true,
  8051. * we wrap up the expression and use it as the event
  8052. * handler.
  8053. *
  8054. * e.g. v-on="click: a++"
  8055. *
  8056. * @return {Boolean}
  8057. */
  8058. p._checkStatement = function () {
  8059. var expression = this.expression
  8060. if (
  8061. expression && this.acceptStatement &&
  8062. !expParser.isSimplePath(expression)
  8063. ) {
  8064. var fn = expParser.parse(expression).get
  8065. var vm = this.vm
  8066. var handler = function () {
  8067. fn.call(vm, vm)
  8068. }
  8069. if (this.filters) {
  8070. handler = vm._applyFilters(handler, null, this.filters)
  8071. }
  8072. this.update(handler)
  8073. return true
  8074. }
  8075. }
  8076. /**
  8077. * Check for an attribute directive param, e.g. lazy
  8078. *
  8079. * @param {String} name
  8080. * @return {String}
  8081. */
  8082. p._checkParam = function (name) {
  8083. var param = this.el.getAttribute(name)
  8084. if (param !== null) {
  8085. this.el.removeAttribute(name)
  8086. param = this.vm.$interpolate(param)
  8087. }
  8088. return param
  8089. }
  8090. /**
  8091. * Teardown the watcher and call unbind.
  8092. */
  8093. p._teardown = function () {
  8094. if (this._bound) {
  8095. this._bound = false
  8096. if (this.unbind) {
  8097. this.unbind()
  8098. }
  8099. if (this._watcher) {
  8100. this._watcher.teardown()
  8101. }
  8102. this.vm = this.el = this._watcher = null
  8103. }
  8104. }
  8105. /**
  8106. * Set the corresponding value with the setter.
  8107. * This should only be used in two-way directives
  8108. * e.g. v-model.
  8109. *
  8110. * @param {*} value
  8111. * @public
  8112. */
  8113. p.set = function (value) {
  8114. if (this.twoWay) {
  8115. this._withLock(function () {
  8116. this._watcher.set(value)
  8117. })
  8118. }
  8119. }
  8120. /**
  8121. * Execute a function while preventing that function from
  8122. * triggering updates on this directive instance.
  8123. *
  8124. * @param {Function} fn
  8125. */
  8126. p._withLock = function (fn) {
  8127. var self = this
  8128. self._locked = true
  8129. fn.call(self)
  8130. _.nextTick(function () {
  8131. self._locked = false
  8132. })
  8133. }
  8134. module.exports = Directive
  8135. /***/ },
  8136. /* 60 */
  8137. /***/ function(module, exports, __webpack_require__) {
  8138. var _ = __webpack_require__(1)
  8139. /**
  8140. * Apply a list of filter (descriptors) to a value.
  8141. * Using plain for loops here because this will be called in
  8142. * the getter of any watcher with filters so it is very
  8143. * performance sensitive.
  8144. *
  8145. * @param {*} value
  8146. * @param {*} [oldValue]
  8147. * @param {Array} filters
  8148. * @param {Boolean} write
  8149. * @return {*}
  8150. */
  8151. exports._applyFilters = function (value, oldValue, filters, write) {
  8152. var filter, fn, args, arg, offset, i, l, j, k
  8153. for (i = 0, l = filters.length; i < l; i++) {
  8154. filter = filters[i]
  8155. fn = _.resolveAsset(this.$options, 'filters', filter.name)
  8156. if (true) {
  8157. _.assertAsset(fn, 'filter', filter.name)
  8158. }
  8159. if (!fn) continue
  8160. fn = write ? fn.write : (fn.read || fn)
  8161. if (typeof fn !== 'function') continue
  8162. args = write ? [value, oldValue] : [value]
  8163. offset = write ? 2 : 1
  8164. if (filter.args) {
  8165. for (j = 0, k = filter.args.length; j < k; j++) {
  8166. arg = filter.args[j]
  8167. args[j + offset] = arg.dynamic
  8168. ? this.$get(arg.value)
  8169. : arg.value
  8170. }
  8171. }
  8172. value = fn.apply(this, args)
  8173. }
  8174. return value
  8175. }
  8176. /**
  8177. * Resolve a component, depending on whether the component
  8178. * is defined normally or using an async factory function.
  8179. * Resolves synchronously if already resolved, otherwise
  8180. * resolves asynchronously and caches the resolved
  8181. * constructor on the factory.
  8182. *
  8183. * @param {String} id
  8184. * @param {Function} cb
  8185. */
  8186. exports._resolveComponent = function (id, cb) {
  8187. var factory = _.resolveAsset(this.$options, 'components', id)
  8188. if (true) {
  8189. _.assertAsset(factory, 'component', id)
  8190. }
  8191. if (!factory) {
  8192. return
  8193. }
  8194. // async component factory
  8195. if (!factory.options) {
  8196. if (factory.resolved) {
  8197. // cached
  8198. cb(factory.resolved)
  8199. } else if (factory.requested) {
  8200. // pool callbacks
  8201. factory.pendingCallbacks.push(cb)
  8202. } else {
  8203. factory.requested = true
  8204. var cbs = factory.pendingCallbacks = [cb]
  8205. factory(function resolve (res) {
  8206. if (_.isPlainObject(res)) {
  8207. res = _.Vue.extend(res)
  8208. }
  8209. // cache resolved
  8210. factory.resolved = res
  8211. // invoke callbacks
  8212. for (var i = 0, l = cbs.length; i < l; i++) {
  8213. cbs[i](res)
  8214. }
  8215. }, function reject (reason) {
  8216. ("development") !== 'production' && _.warn(
  8217. 'Failed to resolve async component: ' + id + '. ' +
  8218. (reason ? '\nReason: ' + reason : '')
  8219. )
  8220. })
  8221. }
  8222. } else {
  8223. // normal component
  8224. cb(factory)
  8225. }
  8226. }
  8227. /***/ },
  8228. /* 61 */
  8229. /***/ function(module, exports, __webpack_require__) {
  8230. var Watcher = __webpack_require__(17)
  8231. var Path = __webpack_require__(20)
  8232. var textParser = __webpack_require__(13)
  8233. var dirParser = __webpack_require__(15)
  8234. var expParser = __webpack_require__(19)
  8235. var filterRE = /[^|]\|[^|]/
  8236. /**
  8237. * Get the value from an expression on this vm.
  8238. *
  8239. * @param {String} exp
  8240. * @return {*}
  8241. */
  8242. exports.$get = function (exp) {
  8243. var res = expParser.parse(exp)
  8244. if (res) {
  8245. try {
  8246. return res.get.call(this, this)
  8247. } catch (e) {}
  8248. }
  8249. }
  8250. /**
  8251. * Set the value from an expression on this vm.
  8252. * The expression must be a valid left-hand
  8253. * expression in an assignment.
  8254. *
  8255. * @param {String} exp
  8256. * @param {*} val
  8257. */
  8258. exports.$set = function (exp, val) {
  8259. var res = expParser.parse(exp, true)
  8260. if (res && res.set) {
  8261. res.set.call(this, this, val)
  8262. }
  8263. }
  8264. /**
  8265. * Add a property on the VM
  8266. *
  8267. * @param {String} key
  8268. * @param {*} val
  8269. */
  8270. exports.$add = function (key, val) {
  8271. this._data.$add(key, val)
  8272. }
  8273. /**
  8274. * Delete a property on the VM
  8275. *
  8276. * @param {String} key
  8277. */
  8278. exports.$delete = function (key) {
  8279. this._data.$delete(key)
  8280. }
  8281. /**
  8282. * Watch an expression, trigger callback when its
  8283. * value changes.
  8284. *
  8285. * @param {String} exp
  8286. * @param {Function} cb
  8287. * @param {Object} [options]
  8288. * - {Boolean} deep
  8289. * - {Boolean} immediate
  8290. * - {Boolean} user
  8291. * @return {Function} - unwatchFn
  8292. */
  8293. exports.$watch = function (exp, cb, options) {
  8294. var vm = this
  8295. var wrappedCb = function (val, oldVal) {
  8296. cb.call(vm, val, oldVal)
  8297. }
  8298. var watcher = new Watcher(vm, exp, wrappedCb, {
  8299. deep: options && options.deep,
  8300. user: !options || options.user !== false
  8301. })
  8302. if (options && options.immediate) {
  8303. wrappedCb(watcher.value)
  8304. }
  8305. return function unwatchFn () {
  8306. watcher.teardown()
  8307. }
  8308. }
  8309. /**
  8310. * Evaluate a text directive, including filters.
  8311. *
  8312. * @param {String} text
  8313. * @return {String}
  8314. */
  8315. exports.$eval = function (text) {
  8316. // check for filters.
  8317. if (filterRE.test(text)) {
  8318. var dir = dirParser.parse(text)[0]
  8319. // the filter regex check might give false positive
  8320. // for pipes inside strings, so it's possible that
  8321. // we don't get any filters here
  8322. var val = this.$get(dir.expression)
  8323. return dir.filters
  8324. ? this._applyFilters(val, null, dir.filters)
  8325. : val
  8326. } else {
  8327. // no filter
  8328. return this.$get(text)
  8329. }
  8330. }
  8331. /**
  8332. * Interpolate a piece of template text.
  8333. *
  8334. * @param {String} text
  8335. * @return {String}
  8336. */
  8337. exports.$interpolate = function (text) {
  8338. var tokens = textParser.parse(text)
  8339. var vm = this
  8340. if (tokens) {
  8341. return tokens.length === 1
  8342. ? vm.$eval(tokens[0].value)
  8343. : tokens.map(function (token) {
  8344. return token.tag
  8345. ? vm.$eval(token.value)
  8346. : token.value
  8347. }).join('')
  8348. } else {
  8349. return text
  8350. }
  8351. }
  8352. /**
  8353. * Log instance data as a plain JS object
  8354. * so that it is easier to inspect in console.
  8355. * This method assumes console is available.
  8356. *
  8357. * @param {String} [path]
  8358. */
  8359. exports.$log = function (path) {
  8360. var data = path
  8361. ? Path.get(this._data, path)
  8362. : this._data
  8363. if (data) {
  8364. data = JSON.parse(JSON.stringify(data))
  8365. }
  8366. console.log(data)
  8367. }
  8368. /***/ },
  8369. /* 62 */
  8370. /***/ function(module, exports, __webpack_require__) {
  8371. var _ = __webpack_require__(1)
  8372. var transition = __webpack_require__(30)
  8373. /**
  8374. * Convenience on-instance nextTick. The callback is
  8375. * auto-bound to the instance, and this avoids component
  8376. * modules having to rely on the global Vue.
  8377. *
  8378. * @param {Function} fn
  8379. */
  8380. exports.$nextTick = function (fn) {
  8381. _.nextTick(fn, this)
  8382. }
  8383. /**
  8384. * Append instance to target
  8385. *
  8386. * @param {Node} target
  8387. * @param {Function} [cb]
  8388. * @param {Boolean} [withTransition] - defaults to true
  8389. */
  8390. exports.$appendTo = function (target, cb, withTransition) {
  8391. return insert(
  8392. this, target, cb, withTransition,
  8393. append, transition.append
  8394. )
  8395. }
  8396. /**
  8397. * Prepend instance to target
  8398. *
  8399. * @param {Node} target
  8400. * @param {Function} [cb]
  8401. * @param {Boolean} [withTransition] - defaults to true
  8402. */
  8403. exports.$prependTo = function (target, cb, withTransition) {
  8404. target = query(target)
  8405. if (target.hasChildNodes()) {
  8406. this.$before(target.firstChild, cb, withTransition)
  8407. } else {
  8408. this.$appendTo(target, cb, withTransition)
  8409. }
  8410. return this
  8411. }
  8412. /**
  8413. * Insert instance before target
  8414. *
  8415. * @param {Node} target
  8416. * @param {Function} [cb]
  8417. * @param {Boolean} [withTransition] - defaults to true
  8418. */
  8419. exports.$before = function (target, cb, withTransition) {
  8420. return insert(
  8421. this, target, cb, withTransition,
  8422. before, transition.before
  8423. )
  8424. }
  8425. /**
  8426. * Insert instance after target
  8427. *
  8428. * @param {Node} target
  8429. * @param {Function} [cb]
  8430. * @param {Boolean} [withTransition] - defaults to true
  8431. */
  8432. exports.$after = function (target, cb, withTransition) {
  8433. target = query(target)
  8434. if (target.nextSibling) {
  8435. this.$before(target.nextSibling, cb, withTransition)
  8436. } else {
  8437. this.$appendTo(target.parentNode, cb, withTransition)
  8438. }
  8439. return this
  8440. }
  8441. /**
  8442. * Remove instance from DOM
  8443. *
  8444. * @param {Function} [cb]
  8445. * @param {Boolean} [withTransition] - defaults to true
  8446. */
  8447. exports.$remove = function (cb, withTransition) {
  8448. if (!this.$el.parentNode) {
  8449. return cb && cb()
  8450. }
  8451. var inDoc = this._isAttached && _.inDoc(this.$el)
  8452. // if we are not in document, no need to check
  8453. // for transitions
  8454. if (!inDoc) withTransition = false
  8455. var op
  8456. var self = this
  8457. var realCb = function () {
  8458. if (inDoc) self._callHook('detached')
  8459. if (cb) cb()
  8460. }
  8461. if (
  8462. this._isFragment &&
  8463. !this._blockFragment.hasChildNodes()
  8464. ) {
  8465. op = withTransition === false
  8466. ? append
  8467. : transition.removeThenAppend
  8468. blockOp(this, this._blockFragment, op, realCb)
  8469. } else {
  8470. op = withTransition === false
  8471. ? remove
  8472. : transition.remove
  8473. op(this.$el, this, realCb)
  8474. }
  8475. return this
  8476. }
  8477. /**
  8478. * Shared DOM insertion function.
  8479. *
  8480. * @param {Vue} vm
  8481. * @param {Element} target
  8482. * @param {Function} [cb]
  8483. * @param {Boolean} [withTransition]
  8484. * @param {Function} op1 - op for non-transition insert
  8485. * @param {Function} op2 - op for transition insert
  8486. * @return vm
  8487. */
  8488. function insert (vm, target, cb, withTransition, op1, op2) {
  8489. target = query(target)
  8490. var targetIsDetached = !_.inDoc(target)
  8491. var op = withTransition === false || targetIsDetached
  8492. ? op1
  8493. : op2
  8494. var shouldCallHook =
  8495. !targetIsDetached &&
  8496. !vm._isAttached &&
  8497. !_.inDoc(vm.$el)
  8498. if (vm._isFragment) {
  8499. blockOp(vm, target, op, cb)
  8500. } else {
  8501. op(vm.$el, target, vm, cb)
  8502. }
  8503. if (shouldCallHook) {
  8504. vm._callHook('attached')
  8505. }
  8506. return vm
  8507. }
  8508. /**
  8509. * Execute a transition operation on a fragment instance,
  8510. * iterating through all its block nodes.
  8511. *
  8512. * @param {Vue} vm
  8513. * @param {Node} target
  8514. * @param {Function} op
  8515. * @param {Function} cb
  8516. */
  8517. function blockOp (vm, target, op, cb) {
  8518. var current = vm._fragmentStart
  8519. var end = vm._fragmentEnd
  8520. var next
  8521. while (next !== end) {
  8522. next = current.nextSibling
  8523. op(current, target, vm)
  8524. current = next
  8525. }
  8526. op(end, target, vm, cb)
  8527. }
  8528. /**
  8529. * Check for selectors
  8530. *
  8531. * @param {String|Element} el
  8532. */
  8533. function query (el) {
  8534. return typeof el === 'string'
  8535. ? document.querySelector(el)
  8536. : el
  8537. }
  8538. /**
  8539. * Append operation that takes a callback.
  8540. *
  8541. * @param {Node} el
  8542. * @param {Node} target
  8543. * @param {Vue} vm - unused
  8544. * @param {Function} [cb]
  8545. */
  8546. function append (el, target, vm, cb) {
  8547. target.appendChild(el)
  8548. if (cb) cb()
  8549. }
  8550. /**
  8551. * InsertBefore operation that takes a callback.
  8552. *
  8553. * @param {Node} el
  8554. * @param {Node} target
  8555. * @param {Vue} vm - unused
  8556. * @param {Function} [cb]
  8557. */
  8558. function before (el, target, vm, cb) {
  8559. _.before(el, target)
  8560. if (cb) cb()
  8561. }
  8562. /**
  8563. * Remove operation that takes a callback.
  8564. *
  8565. * @param {Node} el
  8566. * @param {Vue} vm - unused
  8567. * @param {Function} [cb]
  8568. */
  8569. function remove (el, vm, cb) {
  8570. _.remove(el)
  8571. if (cb) cb()
  8572. }
  8573. /***/ },
  8574. /* 63 */
  8575. /***/ function(module, exports, __webpack_require__) {
  8576. var _ = __webpack_require__(1)
  8577. /**
  8578. * Listen on the given `event` with `fn`.
  8579. *
  8580. * @param {String} event
  8581. * @param {Function} fn
  8582. */
  8583. exports.$on = function (event, fn) {
  8584. (this._events[event] || (this._events[event] = []))
  8585. .push(fn)
  8586. modifyListenerCount(this, event, 1)
  8587. return this
  8588. }
  8589. /**
  8590. * Adds an `event` listener that will be invoked a single
  8591. * time then automatically removed.
  8592. *
  8593. * @param {String} event
  8594. * @param {Function} fn
  8595. */
  8596. exports.$once = function (event, fn) {
  8597. var self = this
  8598. function on () {
  8599. self.$off(event, on)
  8600. fn.apply(this, arguments)
  8601. }
  8602. on.fn = fn
  8603. this.$on(event, on)
  8604. return this
  8605. }
  8606. /**
  8607. * Remove the given callback for `event` or all
  8608. * registered callbacks.
  8609. *
  8610. * @param {String} event
  8611. * @param {Function} fn
  8612. */
  8613. exports.$off = function (event, fn) {
  8614. var cbs
  8615. // all
  8616. if (!arguments.length) {
  8617. if (this.$parent) {
  8618. for (event in this._events) {
  8619. cbs = this._events[event]
  8620. if (cbs) {
  8621. modifyListenerCount(this, event, -cbs.length)
  8622. }
  8623. }
  8624. }
  8625. this._events = {}
  8626. return this
  8627. }
  8628. // specific event
  8629. cbs = this._events[event]
  8630. if (!cbs) {
  8631. return this
  8632. }
  8633. if (arguments.length === 1) {
  8634. modifyListenerCount(this, event, -cbs.length)
  8635. this._events[event] = null
  8636. return this
  8637. }
  8638. // specific handler
  8639. var cb
  8640. var i = cbs.length
  8641. while (i--) {
  8642. cb = cbs[i]
  8643. if (cb === fn || cb.fn === fn) {
  8644. modifyListenerCount(this, event, -1)
  8645. cbs.splice(i, 1)
  8646. break
  8647. }
  8648. }
  8649. return this
  8650. }
  8651. /**
  8652. * Trigger an event on self.
  8653. *
  8654. * @param {String} event
  8655. */
  8656. exports.$emit = function (event) {
  8657. this._eventCancelled = false
  8658. var cbs = this._events[event]
  8659. if (cbs) {
  8660. // avoid leaking arguments:
  8661. // http://jsperf.com/closure-with-arguments
  8662. var i = arguments.length - 1
  8663. var args = new Array(i)
  8664. while (i--) {
  8665. args[i] = arguments[i + 1]
  8666. }
  8667. i = 0
  8668. cbs = cbs.length > 1
  8669. ? _.toArray(cbs)
  8670. : cbs
  8671. for (var l = cbs.length; i < l; i++) {
  8672. if (cbs[i].apply(this, args) === false) {
  8673. this._eventCancelled = true
  8674. }
  8675. }
  8676. }
  8677. return this
  8678. }
  8679. /**
  8680. * Recursively broadcast an event to all children instances.
  8681. *
  8682. * @param {String} event
  8683. * @param {...*} additional arguments
  8684. */
  8685. exports.$broadcast = function (event) {
  8686. // if no child has registered for this event,
  8687. // then there's no need to broadcast.
  8688. if (!this._eventsCount[event]) return
  8689. var children = this.$children
  8690. for (var i = 0, l = children.length; i < l; i++) {
  8691. var child = children[i]
  8692. child.$emit.apply(child, arguments)
  8693. if (!child._eventCancelled) {
  8694. child.$broadcast.apply(child, arguments)
  8695. }
  8696. }
  8697. return this
  8698. }
  8699. /**
  8700. * Recursively propagate an event up the parent chain.
  8701. *
  8702. * @param {String} event
  8703. * @param {...*} additional arguments
  8704. */
  8705. exports.$dispatch = function () {
  8706. var parent = this.$parent
  8707. while (parent) {
  8708. parent.$emit.apply(parent, arguments)
  8709. parent = parent._eventCancelled
  8710. ? null
  8711. : parent.$parent
  8712. }
  8713. return this
  8714. }
  8715. /**
  8716. * Modify the listener counts on all parents.
  8717. * This bookkeeping allows $broadcast to return early when
  8718. * no child has listened to a certain event.
  8719. *
  8720. * @param {Vue} vm
  8721. * @param {String} event
  8722. * @param {Number} count
  8723. */
  8724. var hookRE = /^hook:/
  8725. function modifyListenerCount (vm, event, count) {
  8726. var parent = vm.$parent
  8727. // hooks do not get broadcasted so no need
  8728. // to do bookkeeping for them
  8729. if (!parent || !count || hookRE.test(event)) return
  8730. while (parent) {
  8731. parent._eventsCount[event] =
  8732. (parent._eventsCount[event] || 0) + count
  8733. parent = parent.$parent
  8734. }
  8735. }
  8736. /***/ },
  8737. /* 64 */
  8738. /***/ function(module, exports, __webpack_require__) {
  8739. var _ = __webpack_require__(1)
  8740. /**
  8741. * Create a child instance that prototypally inherits
  8742. * data on parent. To achieve that we create an intermediate
  8743. * constructor with its prototype pointing to parent.
  8744. *
  8745. * @param {Object} opts
  8746. * @param {Function} [BaseCtor]
  8747. * @return {Vue}
  8748. * @public
  8749. */
  8750. exports.$addChild = function (opts, BaseCtor) {
  8751. BaseCtor = BaseCtor || _.Vue
  8752. opts = opts || {}
  8753. var parent = this
  8754. var ChildVue
  8755. var inherit = opts.inherit !== undefined
  8756. ? opts.inherit
  8757. : BaseCtor.options.inherit
  8758. if (inherit) {
  8759. var ctors = parent._childCtors
  8760. ChildVue = ctors[BaseCtor.cid]
  8761. if (!ChildVue) {
  8762. var optionName = BaseCtor.options.name
  8763. var className = optionName
  8764. ? _.classify(optionName)
  8765. : 'VueComponent'
  8766. ChildVue = new Function(
  8767. 'return function ' + className + ' (options) {' +
  8768. 'this.constructor = ' + className + ';' +
  8769. 'this._init(options) }'
  8770. )()
  8771. ChildVue.options = BaseCtor.options
  8772. ChildVue.linker = BaseCtor.linker
  8773. // important: transcluded inline repeaters should
  8774. // inherit from outer scope rather than host
  8775. ChildVue.prototype = opts._context || this
  8776. ctors[BaseCtor.cid] = ChildVue
  8777. }
  8778. } else {
  8779. ChildVue = BaseCtor
  8780. }
  8781. opts._parent = parent
  8782. opts._root = parent.$root
  8783. var child = new ChildVue(opts)
  8784. return child
  8785. }
  8786. /***/ },
  8787. /* 65 */
  8788. /***/ function(module, exports, __webpack_require__) {
  8789. var _ = __webpack_require__(1)
  8790. var compiler = __webpack_require__(10)
  8791. /**
  8792. * Set instance target element and kick off the compilation
  8793. * process. The passed in `el` can be a selector string, an
  8794. * existing Element, or a DocumentFragment (for block
  8795. * instances).
  8796. *
  8797. * @param {Element|DocumentFragment|string} el
  8798. * @public
  8799. */
  8800. exports.$mount = function (el) {
  8801. if (this._isCompiled) {
  8802. ("development") !== 'production' && _.warn(
  8803. '$mount() should be called only once.'
  8804. )
  8805. return
  8806. }
  8807. el = _.query(el)
  8808. if (!el) {
  8809. el = document.createElement('div')
  8810. }
  8811. this._compile(el)
  8812. this._isCompiled = true
  8813. this._callHook('compiled')
  8814. this._initDOMHooks()
  8815. if (_.inDoc(this.$el)) {
  8816. this._callHook('attached')
  8817. ready.call(this)
  8818. } else {
  8819. this.$once('hook:attached', ready)
  8820. }
  8821. return this
  8822. }
  8823. /**
  8824. * Mark an instance as ready.
  8825. */
  8826. function ready () {
  8827. this._isAttached = true
  8828. this._isReady = true
  8829. this._callHook('ready')
  8830. }
  8831. /**
  8832. * Teardown the instance, simply delegate to the internal
  8833. * _destroy.
  8834. */
  8835. exports.$destroy = function (remove, deferCleanup) {
  8836. this._destroy(remove, deferCleanup)
  8837. }
  8838. /**
  8839. * Partially compile a piece of DOM and return a
  8840. * decompile function.
  8841. *
  8842. * @param {Element|DocumentFragment} el
  8843. * @param {Vue} [host]
  8844. * @return {Function}
  8845. */
  8846. exports.$compile = function (el, host) {
  8847. return compiler.compile(el, this.$options, true, host)(this, el)
  8848. }
  8849. /***/ }
  8850. /******/ ])
  8851. });
  8852. ;