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

react-with-addons.js 646KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642
  1. /**
  2. * React (with addons) v0.13.3
  3. */
  4. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
  5. /**
  6. * Copyright 2013-2015, Facebook, Inc.
  7. * All rights reserved.
  8. *
  9. * This source code is licensed under the BSD-style license found in the
  10. * LICENSE file in the root directory of this source tree. An additional grant
  11. * of patent rights can be found in the PATENTS file in the same directory.
  12. *
  13. * @providesModule ReactWithAddons
  14. */
  15. /**
  16. * This module exists purely in the open source project, and is meant as a way
  17. * to create a separate standalone build of React. This build has "addons", or
  18. * functionality we've built and think might be useful but doesn't have a good
  19. * place to live inside React core.
  20. */
  21. 'use strict';
  22. var LinkedStateMixin = _dereq_(25);
  23. var React = _dereq_(31);
  24. var ReactComponentWithPureRenderMixin =
  25. _dereq_(42);
  26. var ReactCSSTransitionGroup = _dereq_(34);
  27. var ReactFragment = _dereq_(69);
  28. var ReactTransitionGroup = _dereq_(98);
  29. var ReactUpdates = _dereq_(100);
  30. var cx = _dereq_(127);
  31. var cloneWithProps = _dereq_(122);
  32. var update = _dereq_(170);
  33. React.addons = {
  34. CSSTransitionGroup: ReactCSSTransitionGroup,
  35. LinkedStateMixin: LinkedStateMixin,
  36. PureRenderMixin: ReactComponentWithPureRenderMixin,
  37. TransitionGroup: ReactTransitionGroup,
  38. batchedUpdates: ReactUpdates.batchedUpdates,
  39. classSet: cx,
  40. cloneWithProps: cloneWithProps,
  41. createFragment: ReactFragment.create,
  42. update: update
  43. };
  44. if ("production" !== "development") {
  45. React.addons.Perf = _dereq_(61);
  46. React.addons.TestUtils = _dereq_(95);
  47. }
  48. module.exports = React;
  49. },{"100":100,"122":122,"127":127,"170":170,"25":25,"31":31,"34":34,"42":42,"61":61,"69":69,"95":95,"98":98}],2:[function(_dereq_,module,exports){
  50. /**
  51. * Copyright 2013-2015, Facebook, Inc.
  52. * All rights reserved.
  53. *
  54. * This source code is licensed under the BSD-style license found in the
  55. * LICENSE file in the root directory of this source tree. An additional grant
  56. * of patent rights can be found in the PATENTS file in the same directory.
  57. *
  58. * @providesModule AutoFocusMixin
  59. * @typechecks static-only
  60. */
  61. 'use strict';
  62. var focusNode = _dereq_(134);
  63. var AutoFocusMixin = {
  64. componentDidMount: function() {
  65. if (this.props.autoFocus) {
  66. focusNode(this.getDOMNode());
  67. }
  68. }
  69. };
  70. module.exports = AutoFocusMixin;
  71. },{"134":134}],3:[function(_dereq_,module,exports){
  72. /**
  73. * Copyright 2013-2015 Facebook, Inc.
  74. * All rights reserved.
  75. *
  76. * This source code is licensed under the BSD-style license found in the
  77. * LICENSE file in the root directory of this source tree. An additional grant
  78. * of patent rights can be found in the PATENTS file in the same directory.
  79. *
  80. * @providesModule BeforeInputEventPlugin
  81. * @typechecks static-only
  82. */
  83. 'use strict';
  84. var EventConstants = _dereq_(16);
  85. var EventPropagators = _dereq_(21);
  86. var ExecutionEnvironment = _dereq_(22);
  87. var FallbackCompositionState = _dereq_(23);
  88. var SyntheticCompositionEvent = _dereq_(106);
  89. var SyntheticInputEvent = _dereq_(110);
  90. var keyOf = _dereq_(157);
  91. var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
  92. var START_KEYCODE = 229;
  93. var canUseCompositionEvent = (
  94. ExecutionEnvironment.canUseDOM &&
  95. 'CompositionEvent' in window
  96. );
  97. var documentMode = null;
  98. if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
  99. documentMode = document.documentMode;
  100. }
  101. // Webkit offers a very useful `textInput` event that can be used to
  102. // directly represent `beforeInput`. The IE `textinput` event is not as
  103. // useful, so we don't use it.
  104. var canUseTextInputEvent = (
  105. ExecutionEnvironment.canUseDOM &&
  106. 'TextEvent' in window &&
  107. !documentMode &&
  108. !isPresto()
  109. );
  110. // In IE9+, we have access to composition events, but the data supplied
  111. // by the native compositionend event may be incorrect. Japanese ideographic
  112. // spaces, for instance (\u3000) are not recorded correctly.
  113. var useFallbackCompositionData = (
  114. ExecutionEnvironment.canUseDOM &&
  115. (
  116. (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
  117. )
  118. );
  119. /**
  120. * Opera <= 12 includes TextEvent in window, but does not fire
  121. * text input events. Rely on keypress instead.
  122. */
  123. function isPresto() {
  124. var opera = window.opera;
  125. return (
  126. typeof opera === 'object' &&
  127. typeof opera.version === 'function' &&
  128. parseInt(opera.version(), 10) <= 12
  129. );
  130. }
  131. var SPACEBAR_CODE = 32;
  132. var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
  133. var topLevelTypes = EventConstants.topLevelTypes;
  134. // Events and their corresponding property names.
  135. var eventTypes = {
  136. beforeInput: {
  137. phasedRegistrationNames: {
  138. bubbled: keyOf({onBeforeInput: null}),
  139. captured: keyOf({onBeforeInputCapture: null})
  140. },
  141. dependencies: [
  142. topLevelTypes.topCompositionEnd,
  143. topLevelTypes.topKeyPress,
  144. topLevelTypes.topTextInput,
  145. topLevelTypes.topPaste
  146. ]
  147. },
  148. compositionEnd: {
  149. phasedRegistrationNames: {
  150. bubbled: keyOf({onCompositionEnd: null}),
  151. captured: keyOf({onCompositionEndCapture: null})
  152. },
  153. dependencies: [
  154. topLevelTypes.topBlur,
  155. topLevelTypes.topCompositionEnd,
  156. topLevelTypes.topKeyDown,
  157. topLevelTypes.topKeyPress,
  158. topLevelTypes.topKeyUp,
  159. topLevelTypes.topMouseDown
  160. ]
  161. },
  162. compositionStart: {
  163. phasedRegistrationNames: {
  164. bubbled: keyOf({onCompositionStart: null}),
  165. captured: keyOf({onCompositionStartCapture: null})
  166. },
  167. dependencies: [
  168. topLevelTypes.topBlur,
  169. topLevelTypes.topCompositionStart,
  170. topLevelTypes.topKeyDown,
  171. topLevelTypes.topKeyPress,
  172. topLevelTypes.topKeyUp,
  173. topLevelTypes.topMouseDown
  174. ]
  175. },
  176. compositionUpdate: {
  177. phasedRegistrationNames: {
  178. bubbled: keyOf({onCompositionUpdate: null}),
  179. captured: keyOf({onCompositionUpdateCapture: null})
  180. },
  181. dependencies: [
  182. topLevelTypes.topBlur,
  183. topLevelTypes.topCompositionUpdate,
  184. topLevelTypes.topKeyDown,
  185. topLevelTypes.topKeyPress,
  186. topLevelTypes.topKeyUp,
  187. topLevelTypes.topMouseDown
  188. ]
  189. }
  190. };
  191. // Track whether we've ever handled a keypress on the space key.
  192. var hasSpaceKeypress = false;
  193. /**
  194. * Return whether a native keypress event is assumed to be a command.
  195. * This is required because Firefox fires `keypress` events for key commands
  196. * (cut, copy, select-all, etc.) even though no character is inserted.
  197. */
  198. function isKeypressCommand(nativeEvent) {
  199. return (
  200. (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
  201. // ctrlKey && altKey is equivalent to AltGr, and is not a command.
  202. !(nativeEvent.ctrlKey && nativeEvent.altKey)
  203. );
  204. }
  205. /**
  206. * Translate native top level events into event types.
  207. *
  208. * @param {string} topLevelType
  209. * @return {object}
  210. */
  211. function getCompositionEventType(topLevelType) {
  212. switch (topLevelType) {
  213. case topLevelTypes.topCompositionStart:
  214. return eventTypes.compositionStart;
  215. case topLevelTypes.topCompositionEnd:
  216. return eventTypes.compositionEnd;
  217. case topLevelTypes.topCompositionUpdate:
  218. return eventTypes.compositionUpdate;
  219. }
  220. }
  221. /**
  222. * Does our fallback best-guess model think this event signifies that
  223. * composition has begun?
  224. *
  225. * @param {string} topLevelType
  226. * @param {object} nativeEvent
  227. * @return {boolean}
  228. */
  229. function isFallbackCompositionStart(topLevelType, nativeEvent) {
  230. return (
  231. topLevelType === topLevelTypes.topKeyDown &&
  232. nativeEvent.keyCode === START_KEYCODE
  233. );
  234. }
  235. /**
  236. * Does our fallback mode think that this event is the end of composition?
  237. *
  238. * @param {string} topLevelType
  239. * @param {object} nativeEvent
  240. * @return {boolean}
  241. */
  242. function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  243. switch (topLevelType) {
  244. case topLevelTypes.topKeyUp:
  245. // Command keys insert or clear IME input.
  246. return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
  247. case topLevelTypes.topKeyDown:
  248. // Expect IME keyCode on each keydown. If we get any other
  249. // code we must have exited earlier.
  250. return (nativeEvent.keyCode !== START_KEYCODE);
  251. case topLevelTypes.topKeyPress:
  252. case topLevelTypes.topMouseDown:
  253. case topLevelTypes.topBlur:
  254. // Events are not possible without cancelling IME.
  255. return true;
  256. default:
  257. return false;
  258. }
  259. }
  260. /**
  261. * Google Input Tools provides composition data via a CustomEvent,
  262. * with the `data` property populated in the `detail` object. If this
  263. * is available on the event object, use it. If not, this is a plain
  264. * composition event and we have nothing special to extract.
  265. *
  266. * @param {object} nativeEvent
  267. * @return {?string}
  268. */
  269. function getDataFromCustomEvent(nativeEvent) {
  270. var detail = nativeEvent.detail;
  271. if (typeof detail === 'object' && 'data' in detail) {
  272. return detail.data;
  273. }
  274. return null;
  275. }
  276. // Track the current IME composition fallback object, if any.
  277. var currentComposition = null;
  278. /**
  279. * @param {string} topLevelType Record from `EventConstants`.
  280. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  281. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  282. * @param {object} nativeEvent Native browser event.
  283. * @return {?object} A SyntheticCompositionEvent.
  284. */
  285. function extractCompositionEvent(
  286. topLevelType,
  287. topLevelTarget,
  288. topLevelTargetID,
  289. nativeEvent
  290. ) {
  291. var eventType;
  292. var fallbackData;
  293. if (canUseCompositionEvent) {
  294. eventType = getCompositionEventType(topLevelType);
  295. } else if (!currentComposition) {
  296. if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
  297. eventType = eventTypes.compositionStart;
  298. }
  299. } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  300. eventType = eventTypes.compositionEnd;
  301. }
  302. if (!eventType) {
  303. return null;
  304. }
  305. if (useFallbackCompositionData) {
  306. // The current composition is stored statically and must not be
  307. // overwritten while composition continues.
  308. if (!currentComposition && eventType === eventTypes.compositionStart) {
  309. currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
  310. } else if (eventType === eventTypes.compositionEnd) {
  311. if (currentComposition) {
  312. fallbackData = currentComposition.getData();
  313. }
  314. }
  315. }
  316. var event = SyntheticCompositionEvent.getPooled(
  317. eventType,
  318. topLevelTargetID,
  319. nativeEvent
  320. );
  321. if (fallbackData) {
  322. // Inject data generated from fallback path into the synthetic event.
  323. // This matches the property of native CompositionEventInterface.
  324. event.data = fallbackData;
  325. } else {
  326. var customData = getDataFromCustomEvent(nativeEvent);
  327. if (customData !== null) {
  328. event.data = customData;
  329. }
  330. }
  331. EventPropagators.accumulateTwoPhaseDispatches(event);
  332. return event;
  333. }
  334. /**
  335. * @param {string} topLevelType Record from `EventConstants`.
  336. * @param {object} nativeEvent Native browser event.
  337. * @return {?string} The string corresponding to this `beforeInput` event.
  338. */
  339. function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  340. switch (topLevelType) {
  341. case topLevelTypes.topCompositionEnd:
  342. return getDataFromCustomEvent(nativeEvent);
  343. case topLevelTypes.topKeyPress:
  344. /**
  345. * If native `textInput` events are available, our goal is to make
  346. * use of them. However, there is a special case: the spacebar key.
  347. * In Webkit, preventing default on a spacebar `textInput` event
  348. * cancels character insertion, but it *also* causes the browser
  349. * to fall back to its default spacebar behavior of scrolling the
  350. * page.
  351. *
  352. * Tracking at:
  353. * https://code.google.com/p/chromium/issues/detail?id=355103
  354. *
  355. * To avoid this issue, use the keypress event as if no `textInput`
  356. * event is available.
  357. */
  358. var which = nativeEvent.which;
  359. if (which !== SPACEBAR_CODE) {
  360. return null;
  361. }
  362. hasSpaceKeypress = true;
  363. return SPACEBAR_CHAR;
  364. case topLevelTypes.topTextInput:
  365. // Record the characters to be added to the DOM.
  366. var chars = nativeEvent.data;
  367. // If it's a spacebar character, assume that we have already handled
  368. // it at the keypress level and bail immediately. Android Chrome
  369. // doesn't give us keycodes, so we need to blacklist it.
  370. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
  371. return null;
  372. }
  373. return chars;
  374. default:
  375. // For other native event types, do nothing.
  376. return null;
  377. }
  378. }
  379. /**
  380. * For browsers that do not provide the `textInput` event, extract the
  381. * appropriate string to use for SyntheticInputEvent.
  382. *
  383. * @param {string} topLevelType Record from `EventConstants`.
  384. * @param {object} nativeEvent Native browser event.
  385. * @return {?string} The fallback string for this `beforeInput` event.
  386. */
  387. function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  388. // If we are currently composing (IME) and using a fallback to do so,
  389. // try to extract the composed characters from the fallback object.
  390. if (currentComposition) {
  391. if (
  392. topLevelType === topLevelTypes.topCompositionEnd ||
  393. isFallbackCompositionEnd(topLevelType, nativeEvent)
  394. ) {
  395. var chars = currentComposition.getData();
  396. FallbackCompositionState.release(currentComposition);
  397. currentComposition = null;
  398. return chars;
  399. }
  400. return null;
  401. }
  402. switch (topLevelType) {
  403. case topLevelTypes.topPaste:
  404. // If a paste event occurs after a keypress, throw out the input
  405. // chars. Paste events should not lead to BeforeInput events.
  406. return null;
  407. case topLevelTypes.topKeyPress:
  408. /**
  409. * As of v27, Firefox may fire keypress events even when no character
  410. * will be inserted. A few possibilities:
  411. *
  412. * - `which` is `0`. Arrow keys, Esc key, etc.
  413. *
  414. * - `which` is the pressed key code, but no char is available.
  415. * Ex: 'AltGr + d` in Polish. There is no modified character for
  416. * this key combination and no character is inserted into the
  417. * document, but FF fires the keypress for char code `100` anyway.
  418. * No `input` event will occur.
  419. *
  420. * - `which` is the pressed key code, but a command combination is
  421. * being used. Ex: `Cmd+C`. No character is inserted, and no
  422. * `input` event will occur.
  423. */
  424. if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
  425. return String.fromCharCode(nativeEvent.which);
  426. }
  427. return null;
  428. case topLevelTypes.topCompositionEnd:
  429. return useFallbackCompositionData ? null : nativeEvent.data;
  430. default:
  431. return null;
  432. }
  433. }
  434. /**
  435. * Extract a SyntheticInputEvent for `beforeInput`, based on either native
  436. * `textInput` or fallback behavior.
  437. *
  438. * @param {string} topLevelType Record from `EventConstants`.
  439. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  440. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  441. * @param {object} nativeEvent Native browser event.
  442. * @return {?object} A SyntheticInputEvent.
  443. */
  444. function extractBeforeInputEvent(
  445. topLevelType,
  446. topLevelTarget,
  447. topLevelTargetID,
  448. nativeEvent
  449. ) {
  450. var chars;
  451. if (canUseTextInputEvent) {
  452. chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
  453. } else {
  454. chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
  455. }
  456. // If no characters are being inserted, no BeforeInput event should
  457. // be fired.
  458. if (!chars) {
  459. return null;
  460. }
  461. var event = SyntheticInputEvent.getPooled(
  462. eventTypes.beforeInput,
  463. topLevelTargetID,
  464. nativeEvent
  465. );
  466. event.data = chars;
  467. EventPropagators.accumulateTwoPhaseDispatches(event);
  468. return event;
  469. }
  470. /**
  471. * Create an `onBeforeInput` event to match
  472. * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
  473. *
  474. * This event plugin is based on the native `textInput` event
  475. * available in Chrome, Safari, Opera, and IE. This event fires after
  476. * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
  477. *
  478. * `beforeInput` is spec'd but not implemented in any browsers, and
  479. * the `input` event does not provide any useful information about what has
  480. * actually been added, contrary to the spec. Thus, `textInput` is the best
  481. * available event to identify the characters that have actually been inserted
  482. * into the target node.
  483. *
  484. * This plugin is also responsible for emitting `composition` events, thus
  485. * allowing us to share composition fallback code for both `beforeInput` and
  486. * `composition` event types.
  487. */
  488. var BeforeInputEventPlugin = {
  489. eventTypes: eventTypes,
  490. /**
  491. * @param {string} topLevelType Record from `EventConstants`.
  492. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  493. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  494. * @param {object} nativeEvent Native browser event.
  495. * @return {*} An accumulation of synthetic events.
  496. * @see {EventPluginHub.extractEvents}
  497. */
  498. extractEvents: function(
  499. topLevelType,
  500. topLevelTarget,
  501. topLevelTargetID,
  502. nativeEvent
  503. ) {
  504. return [
  505. extractCompositionEvent(
  506. topLevelType,
  507. topLevelTarget,
  508. topLevelTargetID,
  509. nativeEvent
  510. ),
  511. extractBeforeInputEvent(
  512. topLevelType,
  513. topLevelTarget,
  514. topLevelTargetID,
  515. nativeEvent
  516. )
  517. ];
  518. }
  519. };
  520. module.exports = BeforeInputEventPlugin;
  521. },{"106":106,"110":110,"157":157,"16":16,"21":21,"22":22,"23":23}],4:[function(_dereq_,module,exports){
  522. /**
  523. * Copyright 2013-2015, Facebook, Inc.
  524. * All rights reserved.
  525. *
  526. * This source code is licensed under the BSD-style license found in the
  527. * LICENSE file in the root directory of this source tree. An additional grant
  528. * of patent rights can be found in the PATENTS file in the same directory.
  529. *
  530. * @providesModule CSSCore
  531. * @typechecks
  532. */
  533. var invariant = _dereq_(150);
  534. /**
  535. * The CSSCore module specifies the API (and implements most of the methods)
  536. * that should be used when dealing with the display of elements (via their
  537. * CSS classes and visibility on screen. It is an API focused on mutating the
  538. * display and not reading it as no logical state should be encoded in the
  539. * display of elements.
  540. */
  541. var CSSCore = {
  542. /**
  543. * Adds the class passed in to the element if it doesn't already have it.
  544. *
  545. * @param {DOMElement} element the element to set the class on
  546. * @param {string} className the CSS className
  547. * @return {DOMElement} the element passed in
  548. */
  549. addClass: function(element, className) {
  550. ("production" !== "development" ? invariant(
  551. !/\s/.test(className),
  552. 'CSSCore.addClass takes only a single class name. "%s" contains ' +
  553. 'multiple classes.', className
  554. ) : invariant(!/\s/.test(className)));
  555. if (className) {
  556. if (element.classList) {
  557. element.classList.add(className);
  558. } else if (!CSSCore.hasClass(element, className)) {
  559. element.className = element.className + ' ' + className;
  560. }
  561. }
  562. return element;
  563. },
  564. /**
  565. * Removes the class passed in from the element
  566. *
  567. * @param {DOMElement} element the element to set the class on
  568. * @param {string} className the CSS className
  569. * @return {DOMElement} the element passed in
  570. */
  571. removeClass: function(element, className) {
  572. ("production" !== "development" ? invariant(
  573. !/\s/.test(className),
  574. 'CSSCore.removeClass takes only a single class name. "%s" contains ' +
  575. 'multiple classes.', className
  576. ) : invariant(!/\s/.test(className)));
  577. if (className) {
  578. if (element.classList) {
  579. element.classList.remove(className);
  580. } else if (CSSCore.hasClass(element, className)) {
  581. element.className = element.className
  582. .replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1')
  583. .replace(/\s+/g, ' ') // multiple spaces to one
  584. .replace(/^\s*|\s*$/g, ''); // trim the ends
  585. }
  586. }
  587. return element;
  588. },
  589. /**
  590. * Helper to add or remove a class from an element based on a condition.
  591. *
  592. * @param {DOMElement} element the element to set the class on
  593. * @param {string} className the CSS className
  594. * @param {*} bool condition to whether to add or remove the class
  595. * @return {DOMElement} the element passed in
  596. */
  597. conditionClass: function(element, className, bool) {
  598. return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
  599. },
  600. /**
  601. * Tests whether the element has the class specified.
  602. *
  603. * @param {DOMNode|DOMWindow} element the element to set the class on
  604. * @param {string} className the CSS className
  605. * @return {boolean} true if the element has the class, false if not
  606. */
  607. hasClass: function(element, className) {
  608. ("production" !== "development" ? invariant(
  609. !/\s/.test(className),
  610. 'CSS.hasClass takes only a single class name.'
  611. ) : invariant(!/\s/.test(className)));
  612. if (element.classList) {
  613. return !!className && element.classList.contains(className);
  614. }
  615. return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
  616. }
  617. };
  618. module.exports = CSSCore;
  619. },{"150":150}],5:[function(_dereq_,module,exports){
  620. /**
  621. * Copyright 2013-2015, Facebook, Inc.
  622. * All rights reserved.
  623. *
  624. * This source code is licensed under the BSD-style license found in the
  625. * LICENSE file in the root directory of this source tree. An additional grant
  626. * of patent rights can be found in the PATENTS file in the same directory.
  627. *
  628. * @providesModule CSSProperty
  629. */
  630. 'use strict';
  631. /**
  632. * CSS properties which accept numbers but are not in units of "px".
  633. */
  634. var isUnitlessNumber = {
  635. boxFlex: true,
  636. boxFlexGroup: true,
  637. columnCount: true,
  638. flex: true,
  639. flexGrow: true,
  640. flexPositive: true,
  641. flexShrink: true,
  642. flexNegative: true,
  643. fontWeight: true,
  644. lineClamp: true,
  645. lineHeight: true,
  646. opacity: true,
  647. order: true,
  648. orphans: true,
  649. widows: true,
  650. zIndex: true,
  651. zoom: true,
  652. // SVG-related properties
  653. fillOpacity: true,
  654. strokeDashoffset: true,
  655. strokeOpacity: true,
  656. strokeWidth: true
  657. };
  658. /**
  659. * @param {string} prefix vendor-specific prefix, eg: Webkit
  660. * @param {string} key style name, eg: transitionDuration
  661. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  662. * WebkitTransitionDuration
  663. */
  664. function prefixKey(prefix, key) {
  665. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  666. }
  667. /**
  668. * Support style names that may come passed in prefixed by adding permutations
  669. * of vendor prefixes.
  670. */
  671. var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
  672. // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  673. // infinite loop, because it iterates over the newly added props too.
  674. Object.keys(isUnitlessNumber).forEach(function(prop) {
  675. prefixes.forEach(function(prefix) {
  676. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  677. });
  678. });
  679. /**
  680. * Most style properties can be unset by doing .style[prop] = '' but IE8
  681. * doesn't like doing that with shorthand properties so for the properties that
  682. * IE8 breaks on, which are listed here, we instead unset each of the
  683. * individual properties. See http://bugs.jquery.com/ticket/12385.
  684. * The 4-value 'clock' properties like margin, padding, border-width seem to
  685. * behave without any problems. Curiously, list-style works too without any
  686. * special prodding.
  687. */
  688. var shorthandPropertyExpansions = {
  689. background: {
  690. backgroundImage: true,
  691. backgroundPosition: true,
  692. backgroundRepeat: true,
  693. backgroundColor: true
  694. },
  695. border: {
  696. borderWidth: true,
  697. borderStyle: true,
  698. borderColor: true
  699. },
  700. borderBottom: {
  701. borderBottomWidth: true,
  702. borderBottomStyle: true,
  703. borderBottomColor: true
  704. },
  705. borderLeft: {
  706. borderLeftWidth: true,
  707. borderLeftStyle: true,
  708. borderLeftColor: true
  709. },
  710. borderRight: {
  711. borderRightWidth: true,
  712. borderRightStyle: true,
  713. borderRightColor: true
  714. },
  715. borderTop: {
  716. borderTopWidth: true,
  717. borderTopStyle: true,
  718. borderTopColor: true
  719. },
  720. font: {
  721. fontStyle: true,
  722. fontVariant: true,
  723. fontWeight: true,
  724. fontSize: true,
  725. lineHeight: true,
  726. fontFamily: true
  727. }
  728. };
  729. var CSSProperty = {
  730. isUnitlessNumber: isUnitlessNumber,
  731. shorthandPropertyExpansions: shorthandPropertyExpansions
  732. };
  733. module.exports = CSSProperty;
  734. },{}],6:[function(_dereq_,module,exports){
  735. /**
  736. * Copyright 2013-2015, Facebook, Inc.
  737. * All rights reserved.
  738. *
  739. * This source code is licensed under the BSD-style license found in the
  740. * LICENSE file in the root directory of this source tree. An additional grant
  741. * of patent rights can be found in the PATENTS file in the same directory.
  742. *
  743. * @providesModule CSSPropertyOperations
  744. * @typechecks static-only
  745. */
  746. 'use strict';
  747. var CSSProperty = _dereq_(5);
  748. var ExecutionEnvironment = _dereq_(22);
  749. var camelizeStyleName = _dereq_(121);
  750. var dangerousStyleValue = _dereq_(128);
  751. var hyphenateStyleName = _dereq_(148);
  752. var memoizeStringOnly = _dereq_(159);
  753. var warning = _dereq_(171);
  754. var processStyleName = memoizeStringOnly(function(styleName) {
  755. return hyphenateStyleName(styleName);
  756. });
  757. var styleFloatAccessor = 'cssFloat';
  758. if (ExecutionEnvironment.canUseDOM) {
  759. // IE8 only supports accessing cssFloat (standard) as styleFloat
  760. if (document.documentElement.style.cssFloat === undefined) {
  761. styleFloatAccessor = 'styleFloat';
  762. }
  763. }
  764. if ("production" !== "development") {
  765. // 'msTransform' is correct, but the other prefixes should be capitalized
  766. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  767. // style values shouldn't contain a semicolon
  768. var badStyleValueWithSemicolonPattern = /;\s*$/;
  769. var warnedStyleNames = {};
  770. var warnedStyleValues = {};
  771. var warnHyphenatedStyleName = function(name) {
  772. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  773. return;
  774. }
  775. warnedStyleNames[name] = true;
  776. ("production" !== "development" ? warning(
  777. false,
  778. 'Unsupported style property %s. Did you mean %s?',
  779. name,
  780. camelizeStyleName(name)
  781. ) : null);
  782. };
  783. var warnBadVendoredStyleName = function(name) {
  784. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  785. return;
  786. }
  787. warnedStyleNames[name] = true;
  788. ("production" !== "development" ? warning(
  789. false,
  790. 'Unsupported vendor-prefixed style property %s. Did you mean %s?',
  791. name,
  792. name.charAt(0).toUpperCase() + name.slice(1)
  793. ) : null);
  794. };
  795. var warnStyleValueWithSemicolon = function(name, value) {
  796. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  797. return;
  798. }
  799. warnedStyleValues[value] = true;
  800. ("production" !== "development" ? warning(
  801. false,
  802. 'Style property values shouldn\'t contain a semicolon. ' +
  803. 'Try "%s: %s" instead.',
  804. name,
  805. value.replace(badStyleValueWithSemicolonPattern, '')
  806. ) : null);
  807. };
  808. /**
  809. * @param {string} name
  810. * @param {*} value
  811. */
  812. var warnValidStyle = function(name, value) {
  813. if (name.indexOf('-') > -1) {
  814. warnHyphenatedStyleName(name);
  815. } else if (badVendoredStyleNamePattern.test(name)) {
  816. warnBadVendoredStyleName(name);
  817. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  818. warnStyleValueWithSemicolon(name, value);
  819. }
  820. };
  821. }
  822. /**
  823. * Operations for dealing with CSS properties.
  824. */
  825. var CSSPropertyOperations = {
  826. /**
  827. * Serializes a mapping of style properties for use as inline styles:
  828. *
  829. * > createMarkupForStyles({width: '200px', height: 0})
  830. * "width:200px;height:0;"
  831. *
  832. * Undefined values are ignored so that declarative programming is easier.
  833. * The result should be HTML-escaped before insertion into the DOM.
  834. *
  835. * @param {object} styles
  836. * @return {?string}
  837. */
  838. createMarkupForStyles: function(styles) {
  839. var serialized = '';
  840. for (var styleName in styles) {
  841. if (!styles.hasOwnProperty(styleName)) {
  842. continue;
  843. }
  844. var styleValue = styles[styleName];
  845. if ("production" !== "development") {
  846. warnValidStyle(styleName, styleValue);
  847. }
  848. if (styleValue != null) {
  849. serialized += processStyleName(styleName) + ':';
  850. serialized += dangerousStyleValue(styleName, styleValue) + ';';
  851. }
  852. }
  853. return serialized || null;
  854. },
  855. /**
  856. * Sets the value for multiple styles on a node. If a value is specified as
  857. * '' (empty string), the corresponding style property will be unset.
  858. *
  859. * @param {DOMElement} node
  860. * @param {object} styles
  861. */
  862. setValueForStyles: function(node, styles) {
  863. var style = node.style;
  864. for (var styleName in styles) {
  865. if (!styles.hasOwnProperty(styleName)) {
  866. continue;
  867. }
  868. if ("production" !== "development") {
  869. warnValidStyle(styleName, styles[styleName]);
  870. }
  871. var styleValue = dangerousStyleValue(styleName, styles[styleName]);
  872. if (styleName === 'float') {
  873. styleName = styleFloatAccessor;
  874. }
  875. if (styleValue) {
  876. style[styleName] = styleValue;
  877. } else {
  878. var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
  879. if (expansion) {
  880. // Shorthand property that IE8 won't like unsetting, so unset each
  881. // component to placate it
  882. for (var individualStyleName in expansion) {
  883. style[individualStyleName] = '';
  884. }
  885. } else {
  886. style[styleName] = '';
  887. }
  888. }
  889. }
  890. }
  891. };
  892. module.exports = CSSPropertyOperations;
  893. },{"121":121,"128":128,"148":148,"159":159,"171":171,"22":22,"5":5}],7:[function(_dereq_,module,exports){
  894. /**
  895. * Copyright 2013-2015, Facebook, Inc.
  896. * All rights reserved.
  897. *
  898. * This source code is licensed under the BSD-style license found in the
  899. * LICENSE file in the root directory of this source tree. An additional grant
  900. * of patent rights can be found in the PATENTS file in the same directory.
  901. *
  902. * @providesModule CallbackQueue
  903. */
  904. 'use strict';
  905. var PooledClass = _dereq_(30);
  906. var assign = _dereq_(29);
  907. var invariant = _dereq_(150);
  908. /**
  909. * A specialized pseudo-event module to help keep track of components waiting to
  910. * be notified when their DOM representations are available for use.
  911. *
  912. * This implements `PooledClass`, so you should never need to instantiate this.
  913. * Instead, use `CallbackQueue.getPooled()`.
  914. *
  915. * @class ReactMountReady
  916. * @implements PooledClass
  917. * @internal
  918. */
  919. function CallbackQueue() {
  920. this._callbacks = null;
  921. this._contexts = null;
  922. }
  923. assign(CallbackQueue.prototype, {
  924. /**
  925. * Enqueues a callback to be invoked when `notifyAll` is invoked.
  926. *
  927. * @param {function} callback Invoked when `notifyAll` is invoked.
  928. * @param {?object} context Context to call `callback` with.
  929. * @internal
  930. */
  931. enqueue: function(callback, context) {
  932. this._callbacks = this._callbacks || [];
  933. this._contexts = this._contexts || [];
  934. this._callbacks.push(callback);
  935. this._contexts.push(context);
  936. },
  937. /**
  938. * Invokes all enqueued callbacks and clears the queue. This is invoked after
  939. * the DOM representation of a component has been created or updated.
  940. *
  941. * @internal
  942. */
  943. notifyAll: function() {
  944. var callbacks = this._callbacks;
  945. var contexts = this._contexts;
  946. if (callbacks) {
  947. ("production" !== "development" ? invariant(
  948. callbacks.length === contexts.length,
  949. 'Mismatched list of contexts in callback queue'
  950. ) : invariant(callbacks.length === contexts.length));
  951. this._callbacks = null;
  952. this._contexts = null;
  953. for (var i = 0, l = callbacks.length; i < l; i++) {
  954. callbacks[i].call(contexts[i]);
  955. }
  956. callbacks.length = 0;
  957. contexts.length = 0;
  958. }
  959. },
  960. /**
  961. * Resets the internal queue.
  962. *
  963. * @internal
  964. */
  965. reset: function() {
  966. this._callbacks = null;
  967. this._contexts = null;
  968. },
  969. /**
  970. * `PooledClass` looks for this.
  971. */
  972. destructor: function() {
  973. this.reset();
  974. }
  975. });
  976. PooledClass.addPoolingTo(CallbackQueue);
  977. module.exports = CallbackQueue;
  978. },{"150":150,"29":29,"30":30}],8:[function(_dereq_,module,exports){
  979. /**
  980. * Copyright 2013-2015, Facebook, Inc.
  981. * All rights reserved.
  982. *
  983. * This source code is licensed under the BSD-style license found in the
  984. * LICENSE file in the root directory of this source tree. An additional grant
  985. * of patent rights can be found in the PATENTS file in the same directory.
  986. *
  987. * @providesModule ChangeEventPlugin
  988. */
  989. 'use strict';
  990. var EventConstants = _dereq_(16);
  991. var EventPluginHub = _dereq_(18);
  992. var EventPropagators = _dereq_(21);
  993. var ExecutionEnvironment = _dereq_(22);
  994. var ReactUpdates = _dereq_(100);
  995. var SyntheticEvent = _dereq_(108);
  996. var isEventSupported = _dereq_(151);
  997. var isTextInputElement = _dereq_(153);
  998. var keyOf = _dereq_(157);
  999. var topLevelTypes = EventConstants.topLevelTypes;
  1000. var eventTypes = {
  1001. change: {
  1002. phasedRegistrationNames: {
  1003. bubbled: keyOf({onChange: null}),
  1004. captured: keyOf({onChangeCapture: null})
  1005. },
  1006. dependencies: [
  1007. topLevelTypes.topBlur,
  1008. topLevelTypes.topChange,
  1009. topLevelTypes.topClick,
  1010. topLevelTypes.topFocus,
  1011. topLevelTypes.topInput,
  1012. topLevelTypes.topKeyDown,
  1013. topLevelTypes.topKeyUp,
  1014. topLevelTypes.topSelectionChange
  1015. ]
  1016. }
  1017. };
  1018. /**
  1019. * For IE shims
  1020. */
  1021. var activeElement = null;
  1022. var activeElementID = null;
  1023. var activeElementValue = null;
  1024. var activeElementValueProp = null;
  1025. /**
  1026. * SECTION: handle `change` event
  1027. */
  1028. function shouldUseChangeEvent(elem) {
  1029. return (
  1030. elem.nodeName === 'SELECT' ||
  1031. (elem.nodeName === 'INPUT' && elem.type === 'file')
  1032. );
  1033. }
  1034. var doesChangeEventBubble = false;
  1035. if (ExecutionEnvironment.canUseDOM) {
  1036. // See `handleChange` comment below
  1037. doesChangeEventBubble = isEventSupported('change') && (
  1038. (!('documentMode' in document) || document.documentMode > 8)
  1039. );
  1040. }
  1041. function manualDispatchChangeEvent(nativeEvent) {
  1042. var event = SyntheticEvent.getPooled(
  1043. eventTypes.change,
  1044. activeElementID,
  1045. nativeEvent
  1046. );
  1047. EventPropagators.accumulateTwoPhaseDispatches(event);
  1048. // If change and propertychange bubbled, we'd just bind to it like all the
  1049. // other events and have it go through ReactBrowserEventEmitter. Since it
  1050. // doesn't, we manually listen for the events and so we have to enqueue and
  1051. // process the abstract event manually.
  1052. //
  1053. // Batching is necessary here in order to ensure that all event handlers run
  1054. // before the next rerender (including event handlers attached to ancestor
  1055. // elements instead of directly on the input). Without this, controlled
  1056. // components don't work properly in conjunction with event bubbling because
  1057. // the component is rerendered and the value reverted before all the event
  1058. // handlers can run. See https://github.com/facebook/react/issues/708.
  1059. ReactUpdates.batchedUpdates(runEventInBatch, event);
  1060. }
  1061. function runEventInBatch(event) {
  1062. EventPluginHub.enqueueEvents(event);
  1063. EventPluginHub.processEventQueue();
  1064. }
  1065. function startWatchingForChangeEventIE8(target, targetID) {
  1066. activeElement = target;
  1067. activeElementID = targetID;
  1068. activeElement.attachEvent('onchange', manualDispatchChangeEvent);
  1069. }
  1070. function stopWatchingForChangeEventIE8() {
  1071. if (!activeElement) {
  1072. return;
  1073. }
  1074. activeElement.detachEvent('onchange', manualDispatchChangeEvent);
  1075. activeElement = null;
  1076. activeElementID = null;
  1077. }
  1078. function getTargetIDForChangeEvent(
  1079. topLevelType,
  1080. topLevelTarget,
  1081. topLevelTargetID) {
  1082. if (topLevelType === topLevelTypes.topChange) {
  1083. return topLevelTargetID;
  1084. }
  1085. }
  1086. function handleEventsForChangeEventIE8(
  1087. topLevelType,
  1088. topLevelTarget,
  1089. topLevelTargetID) {
  1090. if (topLevelType === topLevelTypes.topFocus) {
  1091. // stopWatching() should be a noop here but we call it just in case we
  1092. // missed a blur event somehow.
  1093. stopWatchingForChangeEventIE8();
  1094. startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
  1095. } else if (topLevelType === topLevelTypes.topBlur) {
  1096. stopWatchingForChangeEventIE8();
  1097. }
  1098. }
  1099. /**
  1100. * SECTION: handle `input` event
  1101. */
  1102. var isInputEventSupported = false;
  1103. if (ExecutionEnvironment.canUseDOM) {
  1104. // IE9 claims to support the input event but fails to trigger it when
  1105. // deleting text, so we ignore its input events
  1106. isInputEventSupported = isEventSupported('input') && (
  1107. (!('documentMode' in document) || document.documentMode > 9)
  1108. );
  1109. }
  1110. /**
  1111. * (For old IE.) Replacement getter/setter for the `value` property that gets
  1112. * set on the active element.
  1113. */
  1114. var newValueProp = {
  1115. get: function() {
  1116. return activeElementValueProp.get.call(this);
  1117. },
  1118. set: function(val) {
  1119. // Cast to a string so we can do equality checks.
  1120. activeElementValue = '' + val;
  1121. activeElementValueProp.set.call(this, val);
  1122. }
  1123. };
  1124. /**
  1125. * (For old IE.) Starts tracking propertychange events on the passed-in element
  1126. * and override the value property so that we can distinguish user events from
  1127. * value changes in JS.
  1128. */
  1129. function startWatchingForValueChange(target, targetID) {
  1130. activeElement = target;
  1131. activeElementID = targetID;
  1132. activeElementValue = target.value;
  1133. activeElementValueProp = Object.getOwnPropertyDescriptor(
  1134. target.constructor.prototype,
  1135. 'value'
  1136. );
  1137. Object.defineProperty(activeElement, 'value', newValueProp);
  1138. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  1139. }
  1140. /**
  1141. * (For old IE.) Removes the event listeners from the currently-tracked element,
  1142. * if any exists.
  1143. */
  1144. function stopWatchingForValueChange() {
  1145. if (!activeElement) {
  1146. return;
  1147. }
  1148. // delete restores the original property definition
  1149. delete activeElement.value;
  1150. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  1151. activeElement = null;
  1152. activeElementID = null;
  1153. activeElementValue = null;
  1154. activeElementValueProp = null;
  1155. }
  1156. /**
  1157. * (For old IE.) Handles a propertychange event, sending a `change` event if
  1158. * the value of the active element has changed.
  1159. */
  1160. function handlePropertyChange(nativeEvent) {
  1161. if (nativeEvent.propertyName !== 'value') {
  1162. return;
  1163. }
  1164. var value = nativeEvent.srcElement.value;
  1165. if (value === activeElementValue) {
  1166. return;
  1167. }
  1168. activeElementValue = value;
  1169. manualDispatchChangeEvent(nativeEvent);
  1170. }
  1171. /**
  1172. * If a `change` event should be fired, returns the target's ID.
  1173. */
  1174. function getTargetIDForInputEvent(
  1175. topLevelType,
  1176. topLevelTarget,
  1177. topLevelTargetID) {
  1178. if (topLevelType === topLevelTypes.topInput) {
  1179. // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
  1180. // what we want so fall through here and trigger an abstract event
  1181. return topLevelTargetID;
  1182. }
  1183. }
  1184. // For IE8 and IE9.
  1185. function handleEventsForInputEventIE(
  1186. topLevelType,
  1187. topLevelTarget,
  1188. topLevelTargetID) {
  1189. if (topLevelType === topLevelTypes.topFocus) {
  1190. // In IE8, we can capture almost all .value changes by adding a
  1191. // propertychange handler and looking for events with propertyName
  1192. // equal to 'value'
  1193. // In IE9, propertychange fires for most input events but is buggy and
  1194. // doesn't fire when text is deleted, but conveniently, selectionchange
  1195. // appears to fire in all of the remaining cases so we catch those and
  1196. // forward the event if the value has changed
  1197. // In either case, we don't want to call the event handler if the value
  1198. // is changed from JS so we redefine a setter for `.value` that updates
  1199. // our activeElementValue variable, allowing us to ignore those changes
  1200. //
  1201. // stopWatching() should be a noop here but we call it just in case we
  1202. // missed a blur event somehow.
  1203. stopWatchingForValueChange();
  1204. startWatchingForValueChange(topLevelTarget, topLevelTargetID);
  1205. } else if (topLevelType === topLevelTypes.topBlur) {
  1206. stopWatchingForValueChange();
  1207. }
  1208. }
  1209. // For IE8 and IE9.
  1210. function getTargetIDForInputEventIE(
  1211. topLevelType,
  1212. topLevelTarget,
  1213. topLevelTargetID) {
  1214. if (topLevelType === topLevelTypes.topSelectionChange ||
  1215. topLevelType === topLevelTypes.topKeyUp ||
  1216. topLevelType === topLevelTypes.topKeyDown) {
  1217. // On the selectionchange event, the target is just document which isn't
  1218. // helpful for us so just check activeElement instead.
  1219. //
  1220. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  1221. // propertychange on the first input event after setting `value` from a
  1222. // script and fires only keydown, keypress, keyup. Catching keyup usually
  1223. // gets it and catching keydown lets us fire an event for the first
  1224. // keystroke if user does a key repeat (it'll be a little delayed: right
  1225. // before the second keystroke). Other input methods (e.g., paste) seem to
  1226. // fire selectionchange normally.
  1227. if (activeElement && activeElement.value !== activeElementValue) {
  1228. activeElementValue = activeElement.value;
  1229. return activeElementID;
  1230. }
  1231. }
  1232. }
  1233. /**
  1234. * SECTION: handle `click` event
  1235. */
  1236. function shouldUseClickEvent(elem) {
  1237. // Use the `click` event to detect changes to checkbox and radio inputs.
  1238. // This approach works across all browsers, whereas `change` does not fire
  1239. // until `blur` in IE8.
  1240. return (
  1241. elem.nodeName === 'INPUT' &&
  1242. (elem.type === 'checkbox' || elem.type === 'radio')
  1243. );
  1244. }
  1245. function getTargetIDForClickEvent(
  1246. topLevelType,
  1247. topLevelTarget,
  1248. topLevelTargetID) {
  1249. if (topLevelType === topLevelTypes.topClick) {
  1250. return topLevelTargetID;
  1251. }
  1252. }
  1253. /**
  1254. * This plugin creates an `onChange` event that normalizes change events
  1255. * across form elements. This event fires at a time when it's possible to
  1256. * change the element's value without seeing a flicker.
  1257. *
  1258. * Supported elements are:
  1259. * - input (see `isTextInputElement`)
  1260. * - textarea
  1261. * - select
  1262. */
  1263. var ChangeEventPlugin = {
  1264. eventTypes: eventTypes,
  1265. /**
  1266. * @param {string} topLevelType Record from `EventConstants`.
  1267. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  1268. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  1269. * @param {object} nativeEvent Native browser event.
  1270. * @return {*} An accumulation of synthetic events.
  1271. * @see {EventPluginHub.extractEvents}
  1272. */
  1273. extractEvents: function(
  1274. topLevelType,
  1275. topLevelTarget,
  1276. topLevelTargetID,
  1277. nativeEvent) {
  1278. var getTargetIDFunc, handleEventFunc;
  1279. if (shouldUseChangeEvent(topLevelTarget)) {
  1280. if (doesChangeEventBubble) {
  1281. getTargetIDFunc = getTargetIDForChangeEvent;
  1282. } else {
  1283. handleEventFunc = handleEventsForChangeEventIE8;
  1284. }
  1285. } else if (isTextInputElement(topLevelTarget)) {
  1286. if (isInputEventSupported) {
  1287. getTargetIDFunc = getTargetIDForInputEvent;
  1288. } else {
  1289. getTargetIDFunc = getTargetIDForInputEventIE;
  1290. handleEventFunc = handleEventsForInputEventIE;
  1291. }
  1292. } else if (shouldUseClickEvent(topLevelTarget)) {
  1293. getTargetIDFunc = getTargetIDForClickEvent;
  1294. }
  1295. if (getTargetIDFunc) {
  1296. var targetID = getTargetIDFunc(
  1297. topLevelType,
  1298. topLevelTarget,
  1299. topLevelTargetID
  1300. );
  1301. if (targetID) {
  1302. var event = SyntheticEvent.getPooled(
  1303. eventTypes.change,
  1304. targetID,
  1305. nativeEvent
  1306. );
  1307. EventPropagators.accumulateTwoPhaseDispatches(event);
  1308. return event;
  1309. }
  1310. }
  1311. if (handleEventFunc) {
  1312. handleEventFunc(
  1313. topLevelType,
  1314. topLevelTarget,
  1315. topLevelTargetID
  1316. );
  1317. }
  1318. }
  1319. };
  1320. module.exports = ChangeEventPlugin;
  1321. },{"100":100,"108":108,"151":151,"153":153,"157":157,"16":16,"18":18,"21":21,"22":22}],9:[function(_dereq_,module,exports){
  1322. /**
  1323. * Copyright 2013-2015, Facebook, Inc.
  1324. * All rights reserved.
  1325. *
  1326. * This source code is licensed under the BSD-style license found in the
  1327. * LICENSE file in the root directory of this source tree. An additional grant
  1328. * of patent rights can be found in the PATENTS file in the same directory.
  1329. *
  1330. * @providesModule ClientReactRootIndex
  1331. * @typechecks
  1332. */
  1333. 'use strict';
  1334. var nextReactRootIndex = 0;
  1335. var ClientReactRootIndex = {
  1336. createReactRootIndex: function() {
  1337. return nextReactRootIndex++;
  1338. }
  1339. };
  1340. module.exports = ClientReactRootIndex;
  1341. },{}],10:[function(_dereq_,module,exports){
  1342. /**
  1343. * Copyright 2013-2015, Facebook, Inc.
  1344. * All rights reserved.
  1345. *
  1346. * This source code is licensed under the BSD-style license found in the
  1347. * LICENSE file in the root directory of this source tree. An additional grant
  1348. * of patent rights can be found in the PATENTS file in the same directory.
  1349. *
  1350. * @providesModule DOMChildrenOperations
  1351. * @typechecks static-only
  1352. */
  1353. 'use strict';
  1354. var Danger = _dereq_(13);
  1355. var ReactMultiChildUpdateTypes = _dereq_(79);
  1356. var setTextContent = _dereq_(165);
  1357. var invariant = _dereq_(150);
  1358. /**
  1359. * Inserts `childNode` as a child of `parentNode` at the `index`.
  1360. *
  1361. * @param {DOMElement} parentNode Parent node in which to insert.
  1362. * @param {DOMElement} childNode Child node to insert.
  1363. * @param {number} index Index at which to insert the child.
  1364. * @internal
  1365. */
  1366. function insertChildAt(parentNode, childNode, index) {
  1367. // By exploiting arrays returning `undefined` for an undefined index, we can
  1368. // rely exclusively on `insertBefore(node, null)` instead of also using
  1369. // `appendChild(node)`. However, using `undefined` is not allowed by all
  1370. // browsers so we must replace it with `null`.
  1371. parentNode.insertBefore(
  1372. childNode,
  1373. parentNode.childNodes[index] || null
  1374. );
  1375. }
  1376. /**
  1377. * Operations for updating with DOM children.
  1378. */
  1379. var DOMChildrenOperations = {
  1380. dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
  1381. updateTextContent: setTextContent,
  1382. /**
  1383. * Updates a component's children by processing a series of updates. The
  1384. * update configurations are each expected to have a `parentNode` property.
  1385. *
  1386. * @param {array<object>} updates List of update configurations.
  1387. * @param {array<string>} markupList List of markup strings.
  1388. * @internal
  1389. */
  1390. processUpdates: function(updates, markupList) {
  1391. var update;
  1392. // Mapping from parent IDs to initial child orderings.
  1393. var initialChildren = null;
  1394. // List of children that will be moved or removed.
  1395. var updatedChildren = null;
  1396. for (var i = 0; i < updates.length; i++) {
  1397. update = updates[i];
  1398. if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
  1399. update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
  1400. var updatedIndex = update.fromIndex;
  1401. var updatedChild = update.parentNode.childNodes[updatedIndex];
  1402. var parentID = update.parentID;
  1403. ("production" !== "development" ? invariant(
  1404. updatedChild,
  1405. 'processUpdates(): Unable to find child %s of element. This ' +
  1406. 'probably means the DOM was unexpectedly mutated (e.g., by the ' +
  1407. 'browser), usually due to forgetting a <tbody> when using tables, ' +
  1408. 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
  1409. 'in an <svg> parent. Try inspecting the child nodes of the element ' +
  1410. 'with React ID `%s`.',
  1411. updatedIndex,
  1412. parentID
  1413. ) : invariant(updatedChild));
  1414. initialChildren = initialChildren || {};
  1415. initialChildren[parentID] = initialChildren[parentID] || [];
  1416. initialChildren[parentID][updatedIndex] = updatedChild;
  1417. updatedChildren = updatedChildren || [];
  1418. updatedChildren.push(updatedChild);
  1419. }
  1420. }
  1421. var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
  1422. // Remove updated children first so that `toIndex` is consistent.
  1423. if (updatedChildren) {
  1424. for (var j = 0; j < updatedChildren.length; j++) {
  1425. updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
  1426. }
  1427. }
  1428. for (var k = 0; k < updates.length; k++) {
  1429. update = updates[k];
  1430. switch (update.type) {
  1431. case ReactMultiChildUpdateTypes.INSERT_MARKUP:
  1432. insertChildAt(
  1433. update.parentNode,
  1434. renderedMarkup[update.markupIndex],
  1435. update.toIndex
  1436. );
  1437. break;
  1438. case ReactMultiChildUpdateTypes.MOVE_EXISTING:
  1439. insertChildAt(
  1440. update.parentNode,
  1441. initialChildren[update.parentID][update.fromIndex],
  1442. update.toIndex
  1443. );
  1444. break;
  1445. case ReactMultiChildUpdateTypes.TEXT_CONTENT:
  1446. setTextContent(
  1447. update.parentNode,
  1448. update.textContent
  1449. );
  1450. break;
  1451. case ReactMultiChildUpdateTypes.REMOVE_NODE:
  1452. // Already removed by the for-loop above.
  1453. break;
  1454. }
  1455. }
  1456. }
  1457. };
  1458. module.exports = DOMChildrenOperations;
  1459. },{"13":13,"150":150,"165":165,"79":79}],11:[function(_dereq_,module,exports){
  1460. /**
  1461. * Copyright 2013-2015, Facebook, Inc.
  1462. * All rights reserved.
  1463. *
  1464. * This source code is licensed under the BSD-style license found in the
  1465. * LICENSE file in the root directory of this source tree. An additional grant
  1466. * of patent rights can be found in the PATENTS file in the same directory.
  1467. *
  1468. * @providesModule DOMProperty
  1469. * @typechecks static-only
  1470. */
  1471. /*jslint bitwise: true */
  1472. 'use strict';
  1473. var invariant = _dereq_(150);
  1474. function checkMask(value, bitmask) {
  1475. return (value & bitmask) === bitmask;
  1476. }
  1477. var DOMPropertyInjection = {
  1478. /**
  1479. * Mapping from normalized, camelcased property names to a configuration that
  1480. * specifies how the associated DOM property should be accessed or rendered.
  1481. */
  1482. MUST_USE_ATTRIBUTE: 0x1,
  1483. MUST_USE_PROPERTY: 0x2,
  1484. HAS_SIDE_EFFECTS: 0x4,
  1485. HAS_BOOLEAN_VALUE: 0x8,
  1486. HAS_NUMERIC_VALUE: 0x10,
  1487. HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
  1488. HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
  1489. /**
  1490. * Inject some specialized knowledge about the DOM. This takes a config object
  1491. * with the following properties:
  1492. *
  1493. * isCustomAttribute: function that given an attribute name will return true
  1494. * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
  1495. * attributes where it's impossible to enumerate all of the possible
  1496. * attribute names,
  1497. *
  1498. * Properties: object mapping DOM property name to one of the
  1499. * DOMPropertyInjection constants or null. If your attribute isn't in here,
  1500. * it won't get written to the DOM.
  1501. *
  1502. * DOMAttributeNames: object mapping React attribute name to the DOM
  1503. * attribute name. Attribute names not specified use the **lowercase**
  1504. * normalized name.
  1505. *
  1506. * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
  1507. * Property names not specified use the normalized name.
  1508. *
  1509. * DOMMutationMethods: Properties that require special mutation methods. If
  1510. * `value` is undefined, the mutation method should unset the property.
  1511. *
  1512. * @param {object} domPropertyConfig the config as described above.
  1513. */
  1514. injectDOMPropertyConfig: function(domPropertyConfig) {
  1515. var Properties = domPropertyConfig.Properties || {};
  1516. var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
  1517. var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
  1518. var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
  1519. if (domPropertyConfig.isCustomAttribute) {
  1520. DOMProperty._isCustomAttributeFunctions.push(
  1521. domPropertyConfig.isCustomAttribute
  1522. );
  1523. }
  1524. for (var propName in Properties) {
  1525. ("production" !== "development" ? invariant(
  1526. !DOMProperty.isStandardName.hasOwnProperty(propName),
  1527. 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
  1528. '\'%s\' which has already been injected. You may be accidentally ' +
  1529. 'injecting the same DOM property config twice, or you may be ' +
  1530. 'injecting two configs that have conflicting property names.',
  1531. propName
  1532. ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
  1533. DOMProperty.isStandardName[propName] = true;
  1534. var lowerCased = propName.toLowerCase();
  1535. DOMProperty.getPossibleStandardName[lowerCased] = propName;
  1536. if (DOMAttributeNames.hasOwnProperty(propName)) {
  1537. var attributeName = DOMAttributeNames[propName];
  1538. DOMProperty.getPossibleStandardName[attributeName] = propName;
  1539. DOMProperty.getAttributeName[propName] = attributeName;
  1540. } else {
  1541. DOMProperty.getAttributeName[propName] = lowerCased;
  1542. }
  1543. DOMProperty.getPropertyName[propName] =
  1544. DOMPropertyNames.hasOwnProperty(propName) ?
  1545. DOMPropertyNames[propName] :
  1546. propName;
  1547. if (DOMMutationMethods.hasOwnProperty(propName)) {
  1548. DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
  1549. } else {
  1550. DOMProperty.getMutationMethod[propName] = null;
  1551. }
  1552. var propConfig = Properties[propName];
  1553. DOMProperty.mustUseAttribute[propName] =
  1554. checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
  1555. DOMProperty.mustUseProperty[propName] =
  1556. checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
  1557. DOMProperty.hasSideEffects[propName] =
  1558. checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
  1559. DOMProperty.hasBooleanValue[propName] =
  1560. checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
  1561. DOMProperty.hasNumericValue[propName] =
  1562. checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
  1563. DOMProperty.hasPositiveNumericValue[propName] =
  1564. checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
  1565. DOMProperty.hasOverloadedBooleanValue[propName] =
  1566. checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
  1567. ("production" !== "development" ? invariant(
  1568. !DOMProperty.mustUseAttribute[propName] ||
  1569. !DOMProperty.mustUseProperty[propName],
  1570. 'DOMProperty: Cannot require using both attribute and property: %s',
  1571. propName
  1572. ) : invariant(!DOMProperty.mustUseAttribute[propName] ||
  1573. !DOMProperty.mustUseProperty[propName]));
  1574. ("production" !== "development" ? invariant(
  1575. DOMProperty.mustUseProperty[propName] ||
  1576. !DOMProperty.hasSideEffects[propName],
  1577. 'DOMProperty: Properties that have side effects must use property: %s',
  1578. propName
  1579. ) : invariant(DOMProperty.mustUseProperty[propName] ||
  1580. !DOMProperty.hasSideEffects[propName]));
  1581. ("production" !== "development" ? invariant(
  1582. !!DOMProperty.hasBooleanValue[propName] +
  1583. !!DOMProperty.hasNumericValue[propName] +
  1584. !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
  1585. 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
  1586. 'numeric value, but not a combination: %s',
  1587. propName
  1588. ) : invariant(!!DOMProperty.hasBooleanValue[propName] +
  1589. !!DOMProperty.hasNumericValue[propName] +
  1590. !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
  1591. }
  1592. }
  1593. };
  1594. var defaultValueCache = {};
  1595. /**
  1596. * DOMProperty exports lookup objects that can be used like functions:
  1597. *
  1598. * > DOMProperty.isValid['id']
  1599. * true
  1600. * > DOMProperty.isValid['foobar']
  1601. * undefined
  1602. *
  1603. * Although this may be confusing, it performs better in general.
  1604. *
  1605. * @see http://jsperf.com/key-exists
  1606. * @see http://jsperf.com/key-missing
  1607. */
  1608. var DOMProperty = {
  1609. ID_ATTRIBUTE_NAME: 'data-reactid',
  1610. /**
  1611. * Checks whether a property name is a standard property.
  1612. * @type {Object}
  1613. */
  1614. isStandardName: {},
  1615. /**
  1616. * Mapping from lowercase property names to the properly cased version, used
  1617. * to warn in the case of missing properties.
  1618. * @type {Object}
  1619. */
  1620. getPossibleStandardName: {},
  1621. /**
  1622. * Mapping from normalized names to attribute names that differ. Attribute
  1623. * names are used when rendering markup or with `*Attribute()`.
  1624. * @type {Object}
  1625. */
  1626. getAttributeName: {},
  1627. /**
  1628. * Mapping from normalized names to properties on DOM node instances.
  1629. * (This includes properties that mutate due to external factors.)
  1630. * @type {Object}
  1631. */
  1632. getPropertyName: {},
  1633. /**
  1634. * Mapping from normalized names to mutation methods. This will only exist if
  1635. * mutation cannot be set simply by the property or `setAttribute()`.
  1636. * @type {Object}
  1637. */
  1638. getMutationMethod: {},
  1639. /**
  1640. * Whether the property must be accessed and mutated as an object property.
  1641. * @type {Object}
  1642. */
  1643. mustUseAttribute: {},
  1644. /**
  1645. * Whether the property must be accessed and mutated using `*Attribute()`.
  1646. * (This includes anything that fails `<propName> in <element>`.)
  1647. * @type {Object}
  1648. */
  1649. mustUseProperty: {},
  1650. /**
  1651. * Whether or not setting a value causes side effects such as triggering
  1652. * resources to be loaded or text selection changes. We must ensure that
  1653. * the value is only set if it has changed.
  1654. * @type {Object}
  1655. */
  1656. hasSideEffects: {},
  1657. /**
  1658. * Whether the property should be removed when set to a falsey value.
  1659. * @type {Object}
  1660. */
  1661. hasBooleanValue: {},
  1662. /**
  1663. * Whether the property must be numeric or parse as a
  1664. * numeric and should be removed when set to a falsey value.
  1665. * @type {Object}
  1666. */
  1667. hasNumericValue: {},
  1668. /**
  1669. * Whether the property must be positive numeric or parse as a positive
  1670. * numeric and should be removed when set to a falsey value.
  1671. * @type {Object}
  1672. */
  1673. hasPositiveNumericValue: {},
  1674. /**
  1675. * Whether the property can be used as a flag as well as with a value. Removed
  1676. * when strictly equal to false; present without a value when strictly equal
  1677. * to true; present with a value otherwise.
  1678. * @type {Object}
  1679. */
  1680. hasOverloadedBooleanValue: {},
  1681. /**
  1682. * All of the isCustomAttribute() functions that have been injected.
  1683. */
  1684. _isCustomAttributeFunctions: [],
  1685. /**
  1686. * Checks whether a property name is a custom attribute.
  1687. * @method
  1688. */
  1689. isCustomAttribute: function(attributeName) {
  1690. for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
  1691. var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
  1692. if (isCustomAttributeFn(attributeName)) {
  1693. return true;
  1694. }
  1695. }
  1696. return false;
  1697. },
  1698. /**
  1699. * Returns the default property value for a DOM property (i.e., not an
  1700. * attribute). Most default values are '' or false, but not all. Worse yet,
  1701. * some (in particular, `type`) vary depending on the type of element.
  1702. *
  1703. * TODO: Is it better to grab all the possible properties when creating an
  1704. * element to avoid having to create the same element twice?
  1705. */
  1706. getDefaultValueForProperty: function(nodeName, prop) {
  1707. var nodeDefaults = defaultValueCache[nodeName];
  1708. var testElement;
  1709. if (!nodeDefaults) {
  1710. defaultValueCache[nodeName] = nodeDefaults = {};
  1711. }
  1712. if (!(prop in nodeDefaults)) {
  1713. testElement = document.createElement(nodeName);
  1714. nodeDefaults[prop] = testElement[prop];
  1715. }
  1716. return nodeDefaults[prop];
  1717. },
  1718. injection: DOMPropertyInjection
  1719. };
  1720. module.exports = DOMProperty;
  1721. },{"150":150}],12:[function(_dereq_,module,exports){
  1722. /**
  1723. * Copyright 2013-2015, Facebook, Inc.
  1724. * All rights reserved.
  1725. *
  1726. * This source code is licensed under the BSD-style license found in the
  1727. * LICENSE file in the root directory of this source tree. An additional grant
  1728. * of patent rights can be found in the PATENTS file in the same directory.
  1729. *
  1730. * @providesModule DOMPropertyOperations
  1731. * @typechecks static-only
  1732. */
  1733. 'use strict';
  1734. var DOMProperty = _dereq_(11);
  1735. var quoteAttributeValueForBrowser = _dereq_(163);
  1736. var warning = _dereq_(171);
  1737. function shouldIgnoreValue(name, value) {
  1738. return value == null ||
  1739. (DOMProperty.hasBooleanValue[name] && !value) ||
  1740. (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
  1741. (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
  1742. (DOMProperty.hasOverloadedBooleanValue[name] && value === false);
  1743. }
  1744. if ("production" !== "development") {
  1745. var reactProps = {
  1746. children: true,
  1747. dangerouslySetInnerHTML: true,
  1748. key: true,
  1749. ref: true
  1750. };
  1751. var warnedProperties = {};
  1752. var warnUnknownProperty = function(name) {
  1753. if (reactProps.hasOwnProperty(name) && reactProps[name] ||
  1754. warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
  1755. return;
  1756. }
  1757. warnedProperties[name] = true;
  1758. var lowerCasedName = name.toLowerCase();
  1759. // data-* attributes should be lowercase; suggest the lowercase version
  1760. var standardName = (
  1761. DOMProperty.isCustomAttribute(lowerCasedName) ?
  1762. lowerCasedName :
  1763. DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
  1764. DOMProperty.getPossibleStandardName[lowerCasedName] :
  1765. null
  1766. );
  1767. // For now, only warn when we have a suggested correction. This prevents
  1768. // logging too much when using transferPropsTo.
  1769. ("production" !== "development" ? warning(
  1770. standardName == null,
  1771. 'Unknown DOM property %s. Did you mean %s?',
  1772. name,
  1773. standardName
  1774. ) : null);
  1775. };
  1776. }
  1777. /**
  1778. * Operations for dealing with DOM properties.
  1779. */
  1780. var DOMPropertyOperations = {
  1781. /**
  1782. * Creates markup for the ID property.
  1783. *
  1784. * @param {string} id Unescaped ID.
  1785. * @return {string} Markup string.
  1786. */
  1787. createMarkupForID: function(id) {
  1788. return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
  1789. quoteAttributeValueForBrowser(id);
  1790. },
  1791. /**
  1792. * Creates markup for a property.
  1793. *
  1794. * @param {string} name
  1795. * @param {*} value
  1796. * @return {?string} Markup string, or null if the property was invalid.
  1797. */
  1798. createMarkupForProperty: function(name, value) {
  1799. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1800. DOMProperty.isStandardName[name]) {
  1801. if (shouldIgnoreValue(name, value)) {
  1802. return '';
  1803. }
  1804. var attributeName = DOMProperty.getAttributeName[name];
  1805. if (DOMProperty.hasBooleanValue[name] ||
  1806. (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
  1807. return attributeName;
  1808. }
  1809. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  1810. } else if (DOMProperty.isCustomAttribute(name)) {
  1811. if (value == null) {
  1812. return '';
  1813. }
  1814. return name + '=' + quoteAttributeValueForBrowser(value);
  1815. } else if ("production" !== "development") {
  1816. warnUnknownProperty(name);
  1817. }
  1818. return null;
  1819. },
  1820. /**
  1821. * Sets the value for a property on a node.
  1822. *
  1823. * @param {DOMElement} node
  1824. * @param {string} name
  1825. * @param {*} value
  1826. */
  1827. setValueForProperty: function(node, name, value) {
  1828. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1829. DOMProperty.isStandardName[name]) {
  1830. var mutationMethod = DOMProperty.getMutationMethod[name];
  1831. if (mutationMethod) {
  1832. mutationMethod(node, value);
  1833. } else if (shouldIgnoreValue(name, value)) {
  1834. this.deleteValueForProperty(node, name);
  1835. } else if (DOMProperty.mustUseAttribute[name]) {
  1836. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  1837. // ('' + value) makes it output the correct toString()-value.
  1838. node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
  1839. } else {
  1840. var propName = DOMProperty.getPropertyName[name];
  1841. // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
  1842. // property type before comparing; only `value` does and is string.
  1843. if (!DOMProperty.hasSideEffects[name] ||
  1844. ('' + node[propName]) !== ('' + value)) {
  1845. // Contrary to `setAttribute`, object properties are properly
  1846. // `toString`ed by IE8/9.
  1847. node[propName] = value;
  1848. }
  1849. }
  1850. } else if (DOMProperty.isCustomAttribute(name)) {
  1851. if (value == null) {
  1852. node.removeAttribute(name);
  1853. } else {
  1854. node.setAttribute(name, '' + value);
  1855. }
  1856. } else if ("production" !== "development") {
  1857. warnUnknownProperty(name);
  1858. }
  1859. },
  1860. /**
  1861. * Deletes the value for a property on a node.
  1862. *
  1863. * @param {DOMElement} node
  1864. * @param {string} name
  1865. */
  1866. deleteValueForProperty: function(node, name) {
  1867. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1868. DOMProperty.isStandardName[name]) {
  1869. var mutationMethod = DOMProperty.getMutationMethod[name];
  1870. if (mutationMethod) {
  1871. mutationMethod(node, undefined);
  1872. } else if (DOMProperty.mustUseAttribute[name]) {
  1873. node.removeAttribute(DOMProperty.getAttributeName[name]);
  1874. } else {
  1875. var propName = DOMProperty.getPropertyName[name];
  1876. var defaultValue = DOMProperty.getDefaultValueForProperty(
  1877. node.nodeName,
  1878. propName
  1879. );
  1880. if (!DOMProperty.hasSideEffects[name] ||
  1881. ('' + node[propName]) !== defaultValue) {
  1882. node[propName] = defaultValue;
  1883. }
  1884. }
  1885. } else if (DOMProperty.isCustomAttribute(name)) {
  1886. node.removeAttribute(name);
  1887. } else if ("production" !== "development") {
  1888. warnUnknownProperty(name);
  1889. }
  1890. }
  1891. };
  1892. module.exports = DOMPropertyOperations;
  1893. },{"11":11,"163":163,"171":171}],13:[function(_dereq_,module,exports){
  1894. /**
  1895. * Copyright 2013-2015, Facebook, Inc.
  1896. * All rights reserved.
  1897. *
  1898. * This source code is licensed under the BSD-style license found in the
  1899. * LICENSE file in the root directory of this source tree. An additional grant
  1900. * of patent rights can be found in the PATENTS file in the same directory.
  1901. *
  1902. * @providesModule Danger
  1903. * @typechecks static-only
  1904. */
  1905. /*jslint evil: true, sub: true */
  1906. 'use strict';
  1907. var ExecutionEnvironment = _dereq_(22);
  1908. var createNodesFromMarkup = _dereq_(126);
  1909. var emptyFunction = _dereq_(129);
  1910. var getMarkupWrap = _dereq_(142);
  1911. var invariant = _dereq_(150);
  1912. var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
  1913. var RESULT_INDEX_ATTR = 'data-danger-index';
  1914. /**
  1915. * Extracts the `nodeName` from a string of markup.
  1916. *
  1917. * NOTE: Extracting the `nodeName` does not require a regular expression match
  1918. * because we make assumptions about React-generated markup (i.e. there are no
  1919. * spaces surrounding the opening tag and there is at least one attribute).
  1920. *
  1921. * @param {string} markup String of markup.
  1922. * @return {string} Node name of the supplied markup.
  1923. * @see http://jsperf.com/extract-nodename
  1924. */
  1925. function getNodeName(markup) {
  1926. return markup.substring(1, markup.indexOf(' '));
  1927. }
  1928. var Danger = {
  1929. /**
  1930. * Renders markup into an array of nodes. The markup is expected to render
  1931. * into a list of root nodes. Also, the length of `resultList` and
  1932. * `markupList` should be the same.
  1933. *
  1934. * @param {array<string>} markupList List of markup strings to render.
  1935. * @return {array<DOMElement>} List of rendered nodes.
  1936. * @internal
  1937. */
  1938. dangerouslyRenderMarkup: function(markupList) {
  1939. ("production" !== "development" ? invariant(
  1940. ExecutionEnvironment.canUseDOM,
  1941. 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
  1942. 'thread. Make sure `window` and `document` are available globally ' +
  1943. 'before requiring React when unit testing or use ' +
  1944. 'React.renderToString for server rendering.'
  1945. ) : invariant(ExecutionEnvironment.canUseDOM));
  1946. var nodeName;
  1947. var markupByNodeName = {};
  1948. // Group markup by `nodeName` if a wrap is necessary, else by '*'.
  1949. for (var i = 0; i < markupList.length; i++) {
  1950. ("production" !== "development" ? invariant(
  1951. markupList[i],
  1952. 'dangerouslyRenderMarkup(...): Missing markup.'
  1953. ) : invariant(markupList[i]));
  1954. nodeName = getNodeName(markupList[i]);
  1955. nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
  1956. markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
  1957. markupByNodeName[nodeName][i] = markupList[i];
  1958. }
  1959. var resultList = [];
  1960. var resultListAssignmentCount = 0;
  1961. for (nodeName in markupByNodeName) {
  1962. if (!markupByNodeName.hasOwnProperty(nodeName)) {
  1963. continue;
  1964. }
  1965. var markupListByNodeName = markupByNodeName[nodeName];
  1966. // This for-in loop skips the holes of the sparse array. The order of
  1967. // iteration should follow the order of assignment, which happens to match
  1968. // numerical index order, but we don't rely on that.
  1969. var resultIndex;
  1970. for (resultIndex in markupListByNodeName) {
  1971. if (markupListByNodeName.hasOwnProperty(resultIndex)) {
  1972. var markup = markupListByNodeName[resultIndex];
  1973. // Push the requested markup with an additional RESULT_INDEX_ATTR
  1974. // attribute. If the markup does not start with a < character, it
  1975. // will be discarded below (with an appropriate console.error).
  1976. markupListByNodeName[resultIndex] = markup.replace(
  1977. OPEN_TAG_NAME_EXP,
  1978. // This index will be parsed back out below.
  1979. '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
  1980. );
  1981. }
  1982. }
  1983. // Render each group of markup with similar wrapping `nodeName`.
  1984. var renderNodes = createNodesFromMarkup(
  1985. markupListByNodeName.join(''),
  1986. emptyFunction // Do nothing special with <script> tags.
  1987. );
  1988. for (var j = 0; j < renderNodes.length; ++j) {
  1989. var renderNode = renderNodes[j];
  1990. if (renderNode.hasAttribute &&
  1991. renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
  1992. resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
  1993. renderNode.removeAttribute(RESULT_INDEX_ATTR);
  1994. ("production" !== "development" ? invariant(
  1995. !resultList.hasOwnProperty(resultIndex),
  1996. 'Danger: Assigning to an already-occupied result index.'
  1997. ) : invariant(!resultList.hasOwnProperty(resultIndex)));
  1998. resultList[resultIndex] = renderNode;
  1999. // This should match resultList.length and markupList.length when
  2000. // we're done.
  2001. resultListAssignmentCount += 1;
  2002. } else if ("production" !== "development") {
  2003. console.error(
  2004. 'Danger: Discarding unexpected node:',
  2005. renderNode
  2006. );
  2007. }
  2008. }
  2009. }
  2010. // Although resultList was populated out of order, it should now be a dense
  2011. // array.
  2012. ("production" !== "development" ? invariant(
  2013. resultListAssignmentCount === resultList.length,
  2014. 'Danger: Did not assign to every index of resultList.'
  2015. ) : invariant(resultListAssignmentCount === resultList.length));
  2016. ("production" !== "development" ? invariant(
  2017. resultList.length === markupList.length,
  2018. 'Danger: Expected markup to render %s nodes, but rendered %s.',
  2019. markupList.length,
  2020. resultList.length
  2021. ) : invariant(resultList.length === markupList.length));
  2022. return resultList;
  2023. },
  2024. /**
  2025. * Replaces a node with a string of markup at its current position within its
  2026. * parent. The markup must render into a single root node.
  2027. *
  2028. * @param {DOMElement} oldChild Child node to replace.
  2029. * @param {string} markup Markup to render in place of the child node.
  2030. * @internal
  2031. */
  2032. dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
  2033. ("production" !== "development" ? invariant(
  2034. ExecutionEnvironment.canUseDOM,
  2035. 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
  2036. 'worker thread. Make sure `window` and `document` are available ' +
  2037. 'globally before requiring React when unit testing or use ' +
  2038. 'React.renderToString for server rendering.'
  2039. ) : invariant(ExecutionEnvironment.canUseDOM));
  2040. ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
  2041. ("production" !== "development" ? invariant(
  2042. oldChild.tagName.toLowerCase() !== 'html',
  2043. 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
  2044. '<html> node. This is because browser quirks make this unreliable ' +
  2045. 'and/or slow. If you want to render to the root you must use ' +
  2046. 'server rendering. See React.renderToString().'
  2047. ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
  2048. var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
  2049. oldChild.parentNode.replaceChild(newChild, oldChild);
  2050. }
  2051. };
  2052. module.exports = Danger;
  2053. },{"126":126,"129":129,"142":142,"150":150,"22":22}],14:[function(_dereq_,module,exports){
  2054. /**
  2055. * Copyright 2013-2015, Facebook, Inc.
  2056. * All rights reserved.
  2057. *
  2058. * This source code is licensed under the BSD-style license found in the
  2059. * LICENSE file in the root directory of this source tree. An additional grant
  2060. * of patent rights can be found in the PATENTS file in the same directory.
  2061. *
  2062. * @providesModule DefaultEventPluginOrder
  2063. */
  2064. 'use strict';
  2065. var keyOf = _dereq_(157);
  2066. /**
  2067. * Module that is injectable into `EventPluginHub`, that specifies a
  2068. * deterministic ordering of `EventPlugin`s. A convenient way to reason about
  2069. * plugins, without having to package every one of them. This is better than
  2070. * having plugins be ordered in the same order that they are injected because
  2071. * that ordering would be influenced by the packaging order.
  2072. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  2073. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  2074. */
  2075. var DefaultEventPluginOrder = [
  2076. keyOf({ResponderEventPlugin: null}),
  2077. keyOf({SimpleEventPlugin: null}),
  2078. keyOf({TapEventPlugin: null}),
  2079. keyOf({EnterLeaveEventPlugin: null}),
  2080. keyOf({ChangeEventPlugin: null}),
  2081. keyOf({SelectEventPlugin: null}),
  2082. keyOf({BeforeInputEventPlugin: null}),
  2083. keyOf({AnalyticsEventPlugin: null}),
  2084. keyOf({MobileSafariClickEventPlugin: null})
  2085. ];
  2086. module.exports = DefaultEventPluginOrder;
  2087. },{"157":157}],15:[function(_dereq_,module,exports){
  2088. /**
  2089. * Copyright 2013-2015, Facebook, Inc.
  2090. * All rights reserved.
  2091. *
  2092. * This source code is licensed under the BSD-style license found in the
  2093. * LICENSE file in the root directory of this source tree. An additional grant
  2094. * of patent rights can be found in the PATENTS file in the same directory.
  2095. *
  2096. * @providesModule EnterLeaveEventPlugin
  2097. * @typechecks static-only
  2098. */
  2099. 'use strict';
  2100. var EventConstants = _dereq_(16);
  2101. var EventPropagators = _dereq_(21);
  2102. var SyntheticMouseEvent = _dereq_(112);
  2103. var ReactMount = _dereq_(77);
  2104. var keyOf = _dereq_(157);
  2105. var topLevelTypes = EventConstants.topLevelTypes;
  2106. var getFirstReactDOM = ReactMount.getFirstReactDOM;
  2107. var eventTypes = {
  2108. mouseEnter: {
  2109. registrationName: keyOf({onMouseEnter: null}),
  2110. dependencies: [
  2111. topLevelTypes.topMouseOut,
  2112. topLevelTypes.topMouseOver
  2113. ]
  2114. },
  2115. mouseLeave: {
  2116. registrationName: keyOf({onMouseLeave: null}),
  2117. dependencies: [
  2118. topLevelTypes.topMouseOut,
  2119. topLevelTypes.topMouseOver
  2120. ]
  2121. }
  2122. };
  2123. var extractedEvents = [null, null];
  2124. var EnterLeaveEventPlugin = {
  2125. eventTypes: eventTypes,
  2126. /**
  2127. * For almost every interaction we care about, there will be both a top-level
  2128. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  2129. * we do not extract duplicate events. However, moving the mouse into the
  2130. * browser from outside will not fire a `mouseout` event. In this case, we use
  2131. * the `mouseover` top-level event.
  2132. *
  2133. * @param {string} topLevelType Record from `EventConstants`.
  2134. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  2135. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  2136. * @param {object} nativeEvent Native browser event.
  2137. * @return {*} An accumulation of synthetic events.
  2138. * @see {EventPluginHub.extractEvents}
  2139. */
  2140. extractEvents: function(
  2141. topLevelType,
  2142. topLevelTarget,
  2143. topLevelTargetID,
  2144. nativeEvent) {
  2145. if (topLevelType === topLevelTypes.topMouseOver &&
  2146. (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  2147. return null;
  2148. }
  2149. if (topLevelType !== topLevelTypes.topMouseOut &&
  2150. topLevelType !== topLevelTypes.topMouseOver) {
  2151. // Must not be a mouse in or mouse out - ignoring.
  2152. return null;
  2153. }
  2154. var win;
  2155. if (topLevelTarget.window === topLevelTarget) {
  2156. // `topLevelTarget` is probably a window object.
  2157. win = topLevelTarget;
  2158. } else {
  2159. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  2160. var doc = topLevelTarget.ownerDocument;
  2161. if (doc) {
  2162. win = doc.defaultView || doc.parentWindow;
  2163. } else {
  2164. win = window;
  2165. }
  2166. }
  2167. var from, to;
  2168. if (topLevelType === topLevelTypes.topMouseOut) {
  2169. from = topLevelTarget;
  2170. to =
  2171. getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
  2172. win;
  2173. } else {
  2174. from = win;
  2175. to = topLevelTarget;
  2176. }
  2177. if (from === to) {
  2178. // Nothing pertains to our managed components.
  2179. return null;
  2180. }
  2181. var fromID = from ? ReactMount.getID(from) : '';
  2182. var toID = to ? ReactMount.getID(to) : '';
  2183. var leave = SyntheticMouseEvent.getPooled(
  2184. eventTypes.mouseLeave,
  2185. fromID,
  2186. nativeEvent
  2187. );
  2188. leave.type = 'mouseleave';
  2189. leave.target = from;
  2190. leave.relatedTarget = to;
  2191. var enter = SyntheticMouseEvent.getPooled(
  2192. eventTypes.mouseEnter,
  2193. toID,
  2194. nativeEvent
  2195. );
  2196. enter.type = 'mouseenter';
  2197. enter.target = to;
  2198. enter.relatedTarget = from;
  2199. EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
  2200. extractedEvents[0] = leave;
  2201. extractedEvents[1] = enter;
  2202. return extractedEvents;
  2203. }
  2204. };
  2205. module.exports = EnterLeaveEventPlugin;
  2206. },{"112":112,"157":157,"16":16,"21":21,"77":77}],16:[function(_dereq_,module,exports){
  2207. /**
  2208. * Copyright 2013-2015, Facebook, Inc.
  2209. * All rights reserved.
  2210. *
  2211. * This source code is licensed under the BSD-style license found in the
  2212. * LICENSE file in the root directory of this source tree. An additional grant
  2213. * of patent rights can be found in the PATENTS file in the same directory.
  2214. *
  2215. * @providesModule EventConstants
  2216. */
  2217. 'use strict';
  2218. var keyMirror = _dereq_(156);
  2219. var PropagationPhases = keyMirror({bubbled: null, captured: null});
  2220. /**
  2221. * Types of raw signals from the browser caught at the top level.
  2222. */
  2223. var topLevelTypes = keyMirror({
  2224. topBlur: null,
  2225. topChange: null,
  2226. topClick: null,
  2227. topCompositionEnd: null,
  2228. topCompositionStart: null,
  2229. topCompositionUpdate: null,
  2230. topContextMenu: null,
  2231. topCopy: null,
  2232. topCut: null,
  2233. topDoubleClick: null,
  2234. topDrag: null,
  2235. topDragEnd: null,
  2236. topDragEnter: null,
  2237. topDragExit: null,
  2238. topDragLeave: null,
  2239. topDragOver: null,
  2240. topDragStart: null,
  2241. topDrop: null,
  2242. topError: null,
  2243. topFocus: null,
  2244. topInput: null,
  2245. topKeyDown: null,
  2246. topKeyPress: null,
  2247. topKeyUp: null,
  2248. topLoad: null,
  2249. topMouseDown: null,
  2250. topMouseMove: null,
  2251. topMouseOut: null,
  2252. topMouseOver: null,
  2253. topMouseUp: null,
  2254. topPaste: null,
  2255. topReset: null,
  2256. topScroll: null,
  2257. topSelectionChange: null,
  2258. topSubmit: null,
  2259. topTextInput: null,
  2260. topTouchCancel: null,
  2261. topTouchEnd: null,
  2262. topTouchMove: null,
  2263. topTouchStart: null,
  2264. topWheel: null
  2265. });
  2266. var EventConstants = {
  2267. topLevelTypes: topLevelTypes,
  2268. PropagationPhases: PropagationPhases
  2269. };
  2270. module.exports = EventConstants;
  2271. },{"156":156}],17:[function(_dereq_,module,exports){
  2272. /**
  2273. * Copyright 2013-2015, Facebook, Inc.
  2274. *
  2275. * Licensed under the Apache License, Version 2.0 (the "License");
  2276. * you may not use this file except in compliance with the License.
  2277. * You may obtain a copy of the License at
  2278. *
  2279. * http://www.apache.org/licenses/LICENSE-2.0
  2280. *
  2281. * Unless required by applicable law or agreed to in writing, software
  2282. * distributed under the License is distributed on an "AS IS" BASIS,
  2283. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2284. * See the License for the specific language governing permissions and
  2285. * limitations under the License.
  2286. *
  2287. * @providesModule EventListener
  2288. * @typechecks
  2289. */
  2290. var emptyFunction = _dereq_(129);
  2291. /**
  2292. * Upstream version of event listener. Does not take into account specific
  2293. * nature of platform.
  2294. */
  2295. var EventListener = {
  2296. /**
  2297. * Listen to DOM events during the bubble phase.
  2298. *
  2299. * @param {DOMEventTarget} target DOM element to register listener on.
  2300. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  2301. * @param {function} callback Callback function.
  2302. * @return {object} Object with a `remove` method.
  2303. */
  2304. listen: function(target, eventType, callback) {
  2305. if (target.addEventListener) {
  2306. target.addEventListener(eventType, callback, false);
  2307. return {
  2308. remove: function() {
  2309. target.removeEventListener(eventType, callback, false);
  2310. }
  2311. };
  2312. } else if (target.attachEvent) {
  2313. target.attachEvent('on' + eventType, callback);
  2314. return {
  2315. remove: function() {
  2316. target.detachEvent('on' + eventType, callback);
  2317. }
  2318. };
  2319. }
  2320. },
  2321. /**
  2322. * Listen to DOM events during the capture phase.
  2323. *
  2324. * @param {DOMEventTarget} target DOM element to register listener on.
  2325. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  2326. * @param {function} callback Callback function.
  2327. * @return {object} Object with a `remove` method.
  2328. */
  2329. capture: function(target, eventType, callback) {
  2330. if (!target.addEventListener) {
  2331. if ("production" !== "development") {
  2332. console.error(
  2333. 'Attempted to listen to events during the capture phase on a ' +
  2334. 'browser that does not support the capture phase. Your application ' +
  2335. 'will not receive some events.'
  2336. );
  2337. }
  2338. return {
  2339. remove: emptyFunction
  2340. };
  2341. } else {
  2342. target.addEventListener(eventType, callback, true);
  2343. return {
  2344. remove: function() {
  2345. target.removeEventListener(eventType, callback, true);
  2346. }
  2347. };
  2348. }
  2349. },
  2350. registerDefault: function() {}
  2351. };
  2352. module.exports = EventListener;
  2353. },{"129":129}],18:[function(_dereq_,module,exports){
  2354. /**
  2355. * Copyright 2013-2015, Facebook, Inc.
  2356. * All rights reserved.
  2357. *
  2358. * This source code is licensed under the BSD-style license found in the
  2359. * LICENSE file in the root directory of this source tree. An additional grant
  2360. * of patent rights can be found in the PATENTS file in the same directory.
  2361. *
  2362. * @providesModule EventPluginHub
  2363. */
  2364. 'use strict';
  2365. var EventPluginRegistry = _dereq_(19);
  2366. var EventPluginUtils = _dereq_(20);
  2367. var accumulateInto = _dereq_(118);
  2368. var forEachAccumulated = _dereq_(135);
  2369. var invariant = _dereq_(150);
  2370. /**
  2371. * Internal store for event listeners
  2372. */
  2373. var listenerBank = {};
  2374. /**
  2375. * Internal queue of events that have accumulated their dispatches and are
  2376. * waiting to have their dispatches executed.
  2377. */
  2378. var eventQueue = null;
  2379. /**
  2380. * Dispatches an event and releases it back into the pool, unless persistent.
  2381. *
  2382. * @param {?object} event Synthetic event to be dispatched.
  2383. * @private
  2384. */
  2385. var executeDispatchesAndRelease = function(event) {
  2386. if (event) {
  2387. var executeDispatch = EventPluginUtils.executeDispatch;
  2388. // Plugins can provide custom behavior when dispatching events.
  2389. var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
  2390. if (PluginModule && PluginModule.executeDispatch) {
  2391. executeDispatch = PluginModule.executeDispatch;
  2392. }
  2393. EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
  2394. if (!event.isPersistent()) {
  2395. event.constructor.release(event);
  2396. }
  2397. }
  2398. };
  2399. /**
  2400. * - `InstanceHandle`: [required] Module that performs logical traversals of DOM
  2401. * hierarchy given ids of the logical DOM elements involved.
  2402. */
  2403. var InstanceHandle = null;
  2404. function validateInstanceHandle() {
  2405. var valid =
  2406. InstanceHandle &&
  2407. InstanceHandle.traverseTwoPhase &&
  2408. InstanceHandle.traverseEnterLeave;
  2409. ("production" !== "development" ? invariant(
  2410. valid,
  2411. 'InstanceHandle not injected before use!'
  2412. ) : invariant(valid));
  2413. }
  2414. /**
  2415. * This is a unified interface for event plugins to be installed and configured.
  2416. *
  2417. * Event plugins can implement the following properties:
  2418. *
  2419. * `extractEvents` {function(string, DOMEventTarget, string, object): *}
  2420. * Required. When a top-level event is fired, this method is expected to
  2421. * extract synthetic events that will in turn be queued and dispatched.
  2422. *
  2423. * `eventTypes` {object}
  2424. * Optional, plugins that fire events must publish a mapping of registration
  2425. * names that are used to register listeners. Values of this mapping must
  2426. * be objects that contain `registrationName` or `phasedRegistrationNames`.
  2427. *
  2428. * `executeDispatch` {function(object, function, string)}
  2429. * Optional, allows plugins to override how an event gets dispatched. By
  2430. * default, the listener is simply invoked.
  2431. *
  2432. * Each plugin that is injected into `EventsPluginHub` is immediately operable.
  2433. *
  2434. * @public
  2435. */
  2436. var EventPluginHub = {
  2437. /**
  2438. * Methods for injecting dependencies.
  2439. */
  2440. injection: {
  2441. /**
  2442. * @param {object} InjectedMount
  2443. * @public
  2444. */
  2445. injectMount: EventPluginUtils.injection.injectMount,
  2446. /**
  2447. * @param {object} InjectedInstanceHandle
  2448. * @public
  2449. */
  2450. injectInstanceHandle: function(InjectedInstanceHandle) {
  2451. InstanceHandle = InjectedInstanceHandle;
  2452. if ("production" !== "development") {
  2453. validateInstanceHandle();
  2454. }
  2455. },
  2456. getInstanceHandle: function() {
  2457. if ("production" !== "development") {
  2458. validateInstanceHandle();
  2459. }
  2460. return InstanceHandle;
  2461. },
  2462. /**
  2463. * @param {array} InjectedEventPluginOrder
  2464. * @public
  2465. */
  2466. injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
  2467. /**
  2468. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2469. */
  2470. injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
  2471. },
  2472. eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
  2473. registrationNameModules: EventPluginRegistry.registrationNameModules,
  2474. /**
  2475. * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
  2476. *
  2477. * @param {string} id ID of the DOM element.
  2478. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2479. * @param {?function} listener The callback to store.
  2480. */
  2481. putListener: function(id, registrationName, listener) {
  2482. ("production" !== "development" ? invariant(
  2483. !listener || typeof listener === 'function',
  2484. 'Expected %s listener to be a function, instead got type %s',
  2485. registrationName, typeof listener
  2486. ) : invariant(!listener || typeof listener === 'function'));
  2487. var bankForRegistrationName =
  2488. listenerBank[registrationName] || (listenerBank[registrationName] = {});
  2489. bankForRegistrationName[id] = listener;
  2490. },
  2491. /**
  2492. * @param {string} id ID of the DOM element.
  2493. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2494. * @return {?function} The stored callback.
  2495. */
  2496. getListener: function(id, registrationName) {
  2497. var bankForRegistrationName = listenerBank[registrationName];
  2498. return bankForRegistrationName && bankForRegistrationName[id];
  2499. },
  2500. /**
  2501. * Deletes a listener from the registration bank.
  2502. *
  2503. * @param {string} id ID of the DOM element.
  2504. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2505. */
  2506. deleteListener: function(id, registrationName) {
  2507. var bankForRegistrationName = listenerBank[registrationName];
  2508. if (bankForRegistrationName) {
  2509. delete bankForRegistrationName[id];
  2510. }
  2511. },
  2512. /**
  2513. * Deletes all listeners for the DOM element with the supplied ID.
  2514. *
  2515. * @param {string} id ID of the DOM element.
  2516. */
  2517. deleteAllListeners: function(id) {
  2518. for (var registrationName in listenerBank) {
  2519. delete listenerBank[registrationName][id];
  2520. }
  2521. },
  2522. /**
  2523. * Allows registered plugins an opportunity to extract events from top-level
  2524. * native browser events.
  2525. *
  2526. * @param {string} topLevelType Record from `EventConstants`.
  2527. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  2528. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  2529. * @param {object} nativeEvent Native browser event.
  2530. * @return {*} An accumulation of synthetic events.
  2531. * @internal
  2532. */
  2533. extractEvents: function(
  2534. topLevelType,
  2535. topLevelTarget,
  2536. topLevelTargetID,
  2537. nativeEvent) {
  2538. var events;
  2539. var plugins = EventPluginRegistry.plugins;
  2540. for (var i = 0, l = plugins.length; i < l; i++) {
  2541. // Not every plugin in the ordering may be loaded at runtime.
  2542. var possiblePlugin = plugins[i];
  2543. if (possiblePlugin) {
  2544. var extractedEvents = possiblePlugin.extractEvents(
  2545. topLevelType,
  2546. topLevelTarget,
  2547. topLevelTargetID,
  2548. nativeEvent
  2549. );
  2550. if (extractedEvents) {
  2551. events = accumulateInto(events, extractedEvents);
  2552. }
  2553. }
  2554. }
  2555. return events;
  2556. },
  2557. /**
  2558. * Enqueues a synthetic event that should be dispatched when
  2559. * `processEventQueue` is invoked.
  2560. *
  2561. * @param {*} events An accumulation of synthetic events.
  2562. * @internal
  2563. */
  2564. enqueueEvents: function(events) {
  2565. if (events) {
  2566. eventQueue = accumulateInto(eventQueue, events);
  2567. }
  2568. },
  2569. /**
  2570. * Dispatches all synthetic events on the event queue.
  2571. *
  2572. * @internal
  2573. */
  2574. processEventQueue: function() {
  2575. // Set `eventQueue` to null before processing it so that we can tell if more
  2576. // events get enqueued while processing.
  2577. var processingEventQueue = eventQueue;
  2578. eventQueue = null;
  2579. forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
  2580. ("production" !== "development" ? invariant(
  2581. !eventQueue,
  2582. 'processEventQueue(): Additional events were enqueued while processing ' +
  2583. 'an event queue. Support for this has not yet been implemented.'
  2584. ) : invariant(!eventQueue));
  2585. },
  2586. /**
  2587. * These are needed for tests only. Do not use!
  2588. */
  2589. __purge: function() {
  2590. listenerBank = {};
  2591. },
  2592. __getListenerBank: function() {
  2593. return listenerBank;
  2594. }
  2595. };
  2596. module.exports = EventPluginHub;
  2597. },{"118":118,"135":135,"150":150,"19":19,"20":20}],19:[function(_dereq_,module,exports){
  2598. /**
  2599. * Copyright 2013-2015, Facebook, Inc.
  2600. * All rights reserved.
  2601. *
  2602. * This source code is licensed under the BSD-style license found in the
  2603. * LICENSE file in the root directory of this source tree. An additional grant
  2604. * of patent rights can be found in the PATENTS file in the same directory.
  2605. *
  2606. * @providesModule EventPluginRegistry
  2607. * @typechecks static-only
  2608. */
  2609. 'use strict';
  2610. var invariant = _dereq_(150);
  2611. /**
  2612. * Injectable ordering of event plugins.
  2613. */
  2614. var EventPluginOrder = null;
  2615. /**
  2616. * Injectable mapping from names to event plugin modules.
  2617. */
  2618. var namesToPlugins = {};
  2619. /**
  2620. * Recomputes the plugin list using the injected plugins and plugin ordering.
  2621. *
  2622. * @private
  2623. */
  2624. function recomputePluginOrdering() {
  2625. if (!EventPluginOrder) {
  2626. // Wait until an `EventPluginOrder` is injected.
  2627. return;
  2628. }
  2629. for (var pluginName in namesToPlugins) {
  2630. var PluginModule = namesToPlugins[pluginName];
  2631. var pluginIndex = EventPluginOrder.indexOf(pluginName);
  2632. ("production" !== "development" ? invariant(
  2633. pluginIndex > -1,
  2634. 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
  2635. 'the plugin ordering, `%s`.',
  2636. pluginName
  2637. ) : invariant(pluginIndex > -1));
  2638. if (EventPluginRegistry.plugins[pluginIndex]) {
  2639. continue;
  2640. }
  2641. ("production" !== "development" ? invariant(
  2642. PluginModule.extractEvents,
  2643. 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
  2644. 'method, but `%s` does not.',
  2645. pluginName
  2646. ) : invariant(PluginModule.extractEvents));
  2647. EventPluginRegistry.plugins[pluginIndex] = PluginModule;
  2648. var publishedEvents = PluginModule.eventTypes;
  2649. for (var eventName in publishedEvents) {
  2650. ("production" !== "development" ? invariant(
  2651. publishEventForPlugin(
  2652. publishedEvents[eventName],
  2653. PluginModule,
  2654. eventName
  2655. ),
  2656. 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
  2657. eventName,
  2658. pluginName
  2659. ) : invariant(publishEventForPlugin(
  2660. publishedEvents[eventName],
  2661. PluginModule,
  2662. eventName
  2663. )));
  2664. }
  2665. }
  2666. }
  2667. /**
  2668. * Publishes an event so that it can be dispatched by the supplied plugin.
  2669. *
  2670. * @param {object} dispatchConfig Dispatch configuration for the event.
  2671. * @param {object} PluginModule Plugin publishing the event.
  2672. * @return {boolean} True if the event was successfully published.
  2673. * @private
  2674. */
  2675. function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
  2676. ("production" !== "development" ? invariant(
  2677. !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
  2678. 'EventPluginHub: More than one plugin attempted to publish the same ' +
  2679. 'event name, `%s`.',
  2680. eventName
  2681. ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
  2682. EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
  2683. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  2684. if (phasedRegistrationNames) {
  2685. for (var phaseName in phasedRegistrationNames) {
  2686. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  2687. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  2688. publishRegistrationName(
  2689. phasedRegistrationName,
  2690. PluginModule,
  2691. eventName
  2692. );
  2693. }
  2694. }
  2695. return true;
  2696. } else if (dispatchConfig.registrationName) {
  2697. publishRegistrationName(
  2698. dispatchConfig.registrationName,
  2699. PluginModule,
  2700. eventName
  2701. );
  2702. return true;
  2703. }
  2704. return false;
  2705. }
  2706. /**
  2707. * Publishes a registration name that is used to identify dispatched events and
  2708. * can be used with `EventPluginHub.putListener` to register listeners.
  2709. *
  2710. * @param {string} registrationName Registration name to add.
  2711. * @param {object} PluginModule Plugin publishing the event.
  2712. * @private
  2713. */
  2714. function publishRegistrationName(registrationName, PluginModule, eventName) {
  2715. ("production" !== "development" ? invariant(
  2716. !EventPluginRegistry.registrationNameModules[registrationName],
  2717. 'EventPluginHub: More than one plugin attempted to publish the same ' +
  2718. 'registration name, `%s`.',
  2719. registrationName
  2720. ) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
  2721. EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
  2722. EventPluginRegistry.registrationNameDependencies[registrationName] =
  2723. PluginModule.eventTypes[eventName].dependencies;
  2724. }
  2725. /**
  2726. * Registers plugins so that they can extract and dispatch events.
  2727. *
  2728. * @see {EventPluginHub}
  2729. */
  2730. var EventPluginRegistry = {
  2731. /**
  2732. * Ordered list of injected plugins.
  2733. */
  2734. plugins: [],
  2735. /**
  2736. * Mapping from event name to dispatch config
  2737. */
  2738. eventNameDispatchConfigs: {},
  2739. /**
  2740. * Mapping from registration name to plugin module
  2741. */
  2742. registrationNameModules: {},
  2743. /**
  2744. * Mapping from registration name to event name
  2745. */
  2746. registrationNameDependencies: {},
  2747. /**
  2748. * Injects an ordering of plugins (by plugin name). This allows the ordering
  2749. * to be decoupled from injection of the actual plugins so that ordering is
  2750. * always deterministic regardless of packaging, on-the-fly injection, etc.
  2751. *
  2752. * @param {array} InjectedEventPluginOrder
  2753. * @internal
  2754. * @see {EventPluginHub.injection.injectEventPluginOrder}
  2755. */
  2756. injectEventPluginOrder: function(InjectedEventPluginOrder) {
  2757. ("production" !== "development" ? invariant(
  2758. !EventPluginOrder,
  2759. 'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
  2760. 'once. You are likely trying to load more than one copy of React.'
  2761. ) : invariant(!EventPluginOrder));
  2762. // Clone the ordering so it cannot be dynamically mutated.
  2763. EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
  2764. recomputePluginOrdering();
  2765. },
  2766. /**
  2767. * Injects plugins to be used by `EventPluginHub`. The plugin names must be
  2768. * in the ordering injected by `injectEventPluginOrder`.
  2769. *
  2770. * Plugins can be injected as part of page initialization or on-the-fly.
  2771. *
  2772. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2773. * @internal
  2774. * @see {EventPluginHub.injection.injectEventPluginsByName}
  2775. */
  2776. injectEventPluginsByName: function(injectedNamesToPlugins) {
  2777. var isOrderingDirty = false;
  2778. for (var pluginName in injectedNamesToPlugins) {
  2779. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  2780. continue;
  2781. }
  2782. var PluginModule = injectedNamesToPlugins[pluginName];
  2783. if (!namesToPlugins.hasOwnProperty(pluginName) ||
  2784. namesToPlugins[pluginName] !== PluginModule) {
  2785. ("production" !== "development" ? invariant(
  2786. !namesToPlugins[pluginName],
  2787. 'EventPluginRegistry: Cannot inject two different event plugins ' +
  2788. 'using the same name, `%s`.',
  2789. pluginName
  2790. ) : invariant(!namesToPlugins[pluginName]));
  2791. namesToPlugins[pluginName] = PluginModule;
  2792. isOrderingDirty = true;
  2793. }
  2794. }
  2795. if (isOrderingDirty) {
  2796. recomputePluginOrdering();
  2797. }
  2798. },
  2799. /**
  2800. * Looks up the plugin for the supplied event.
  2801. *
  2802. * @param {object} event A synthetic event.
  2803. * @return {?object} The plugin that created the supplied event.
  2804. * @internal
  2805. */
  2806. getPluginModuleForEvent: function(event) {
  2807. var dispatchConfig = event.dispatchConfig;
  2808. if (dispatchConfig.registrationName) {
  2809. return EventPluginRegistry.registrationNameModules[
  2810. dispatchConfig.registrationName
  2811. ] || null;
  2812. }
  2813. for (var phase in dispatchConfig.phasedRegistrationNames) {
  2814. if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
  2815. continue;
  2816. }
  2817. var PluginModule = EventPluginRegistry.registrationNameModules[
  2818. dispatchConfig.phasedRegistrationNames[phase]
  2819. ];
  2820. if (PluginModule) {
  2821. return PluginModule;
  2822. }
  2823. }
  2824. return null;
  2825. },
  2826. /**
  2827. * Exposed for unit testing.
  2828. * @private
  2829. */
  2830. _resetEventPlugins: function() {
  2831. EventPluginOrder = null;
  2832. for (var pluginName in namesToPlugins) {
  2833. if (namesToPlugins.hasOwnProperty(pluginName)) {
  2834. delete namesToPlugins[pluginName];
  2835. }
  2836. }
  2837. EventPluginRegistry.plugins.length = 0;
  2838. var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
  2839. for (var eventName in eventNameDispatchConfigs) {
  2840. if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  2841. delete eventNameDispatchConfigs[eventName];
  2842. }
  2843. }
  2844. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  2845. for (var registrationName in registrationNameModules) {
  2846. if (registrationNameModules.hasOwnProperty(registrationName)) {
  2847. delete registrationNameModules[registrationName];
  2848. }
  2849. }
  2850. }
  2851. };
  2852. module.exports = EventPluginRegistry;
  2853. },{"150":150}],20:[function(_dereq_,module,exports){
  2854. /**
  2855. * Copyright 2013-2015, Facebook, Inc.
  2856. * All rights reserved.
  2857. *
  2858. * This source code is licensed under the BSD-style license found in the
  2859. * LICENSE file in the root directory of this source tree. An additional grant
  2860. * of patent rights can be found in the PATENTS file in the same directory.
  2861. *
  2862. * @providesModule EventPluginUtils
  2863. */
  2864. 'use strict';
  2865. var EventConstants = _dereq_(16);
  2866. var invariant = _dereq_(150);
  2867. /**
  2868. * Injected dependencies:
  2869. */
  2870. /**
  2871. * - `Mount`: [required] Module that can convert between React dom IDs and
  2872. * actual node references.
  2873. */
  2874. var injection = {
  2875. Mount: null,
  2876. injectMount: function(InjectedMount) {
  2877. injection.Mount = InjectedMount;
  2878. if ("production" !== "development") {
  2879. ("production" !== "development" ? invariant(
  2880. InjectedMount && InjectedMount.getNode,
  2881. 'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
  2882. 'is missing getNode.'
  2883. ) : invariant(InjectedMount && InjectedMount.getNode));
  2884. }
  2885. }
  2886. };
  2887. var topLevelTypes = EventConstants.topLevelTypes;
  2888. function isEndish(topLevelType) {
  2889. return topLevelType === topLevelTypes.topMouseUp ||
  2890. topLevelType === topLevelTypes.topTouchEnd ||
  2891. topLevelType === topLevelTypes.topTouchCancel;
  2892. }
  2893. function isMoveish(topLevelType) {
  2894. return topLevelType === topLevelTypes.topMouseMove ||
  2895. topLevelType === topLevelTypes.topTouchMove;
  2896. }
  2897. function isStartish(topLevelType) {
  2898. return topLevelType === topLevelTypes.topMouseDown ||
  2899. topLevelType === topLevelTypes.topTouchStart;
  2900. }
  2901. var validateEventDispatches;
  2902. if ("production" !== "development") {
  2903. validateEventDispatches = function(event) {
  2904. var dispatchListeners = event._dispatchListeners;
  2905. var dispatchIDs = event._dispatchIDs;
  2906. var listenersIsArr = Array.isArray(dispatchListeners);
  2907. var idsIsArr = Array.isArray(dispatchIDs);
  2908. var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
  2909. var listenersLen = listenersIsArr ?
  2910. dispatchListeners.length :
  2911. dispatchListeners ? 1 : 0;
  2912. ("production" !== "development" ? invariant(
  2913. idsIsArr === listenersIsArr && IDsLen === listenersLen,
  2914. 'EventPluginUtils: Invalid `event`.'
  2915. ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
  2916. };
  2917. }
  2918. /**
  2919. * Invokes `cb(event, listener, id)`. Avoids using call if no scope is
  2920. * provided. The `(listener,id)` pair effectively forms the "dispatch" but are
  2921. * kept separate to conserve memory.
  2922. */
  2923. function forEachEventDispatch(event, cb) {
  2924. var dispatchListeners = event._dispatchListeners;
  2925. var dispatchIDs = event._dispatchIDs;
  2926. if ("production" !== "development") {
  2927. validateEventDispatches(event);
  2928. }
  2929. if (Array.isArray(dispatchListeners)) {
  2930. for (var i = 0; i < dispatchListeners.length; i++) {
  2931. if (event.isPropagationStopped()) {
  2932. break;
  2933. }
  2934. // Listeners and IDs are two parallel arrays that are always in sync.
  2935. cb(event, dispatchListeners[i], dispatchIDs[i]);
  2936. }
  2937. } else if (dispatchListeners) {
  2938. cb(event, dispatchListeners, dispatchIDs);
  2939. }
  2940. }
  2941. /**
  2942. * Default implementation of PluginModule.executeDispatch().
  2943. * @param {SyntheticEvent} SyntheticEvent to handle
  2944. * @param {function} Application-level callback
  2945. * @param {string} domID DOM id to pass to the callback.
  2946. */
  2947. function executeDispatch(event, listener, domID) {
  2948. event.currentTarget = injection.Mount.getNode(domID);
  2949. var returnValue = listener(event, domID);
  2950. event.currentTarget = null;
  2951. return returnValue;
  2952. }
  2953. /**
  2954. * Standard/simple iteration through an event's collected dispatches.
  2955. */
  2956. function executeDispatchesInOrder(event, cb) {
  2957. forEachEventDispatch(event, cb);
  2958. event._dispatchListeners = null;
  2959. event._dispatchIDs = null;
  2960. }
  2961. /**
  2962. * Standard/simple iteration through an event's collected dispatches, but stops
  2963. * at the first dispatch execution returning true, and returns that id.
  2964. *
  2965. * @return id of the first dispatch execution who's listener returns true, or
  2966. * null if no listener returned true.
  2967. */
  2968. function executeDispatchesInOrderStopAtTrueImpl(event) {
  2969. var dispatchListeners = event._dispatchListeners;
  2970. var dispatchIDs = event._dispatchIDs;
  2971. if ("production" !== "development") {
  2972. validateEventDispatches(event);
  2973. }
  2974. if (Array.isArray(dispatchListeners)) {
  2975. for (var i = 0; i < dispatchListeners.length; i++) {
  2976. if (event.isPropagationStopped()) {
  2977. break;
  2978. }
  2979. // Listeners and IDs are two parallel arrays that are always in sync.
  2980. if (dispatchListeners[i](event, dispatchIDs[i])) {
  2981. return dispatchIDs[i];
  2982. }
  2983. }
  2984. } else if (dispatchListeners) {
  2985. if (dispatchListeners(event, dispatchIDs)) {
  2986. return dispatchIDs;
  2987. }
  2988. }
  2989. return null;
  2990. }
  2991. /**
  2992. * @see executeDispatchesInOrderStopAtTrueImpl
  2993. */
  2994. function executeDispatchesInOrderStopAtTrue(event) {
  2995. var ret = executeDispatchesInOrderStopAtTrueImpl(event);
  2996. event._dispatchIDs = null;
  2997. event._dispatchListeners = null;
  2998. return ret;
  2999. }
  3000. /**
  3001. * Execution of a "direct" dispatch - there must be at most one dispatch
  3002. * accumulated on the event or it is considered an error. It doesn't really make
  3003. * sense for an event with multiple dispatches (bubbled) to keep track of the
  3004. * return values at each dispatch execution, but it does tend to make sense when
  3005. * dealing with "direct" dispatches.
  3006. *
  3007. * @return The return value of executing the single dispatch.
  3008. */
  3009. function executeDirectDispatch(event) {
  3010. if ("production" !== "development") {
  3011. validateEventDispatches(event);
  3012. }
  3013. var dispatchListener = event._dispatchListeners;
  3014. var dispatchID = event._dispatchIDs;
  3015. ("production" !== "development" ? invariant(
  3016. !Array.isArray(dispatchListener),
  3017. 'executeDirectDispatch(...): Invalid `event`.'
  3018. ) : invariant(!Array.isArray(dispatchListener)));
  3019. var res = dispatchListener ?
  3020. dispatchListener(event, dispatchID) :
  3021. null;
  3022. event._dispatchListeners = null;
  3023. event._dispatchIDs = null;
  3024. return res;
  3025. }
  3026. /**
  3027. * @param {SyntheticEvent} event
  3028. * @return {bool} True iff number of dispatches accumulated is greater than 0.
  3029. */
  3030. function hasDispatches(event) {
  3031. return !!event._dispatchListeners;
  3032. }
  3033. /**
  3034. * General utilities that are useful in creating custom Event Plugins.
  3035. */
  3036. var EventPluginUtils = {
  3037. isEndish: isEndish,
  3038. isMoveish: isMoveish,
  3039. isStartish: isStartish,
  3040. executeDirectDispatch: executeDirectDispatch,
  3041. executeDispatch: executeDispatch,
  3042. executeDispatchesInOrder: executeDispatchesInOrder,
  3043. executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
  3044. hasDispatches: hasDispatches,
  3045. injection: injection,
  3046. useTouchEvents: false
  3047. };
  3048. module.exports = EventPluginUtils;
  3049. },{"150":150,"16":16}],21:[function(_dereq_,module,exports){
  3050. /**
  3051. * Copyright 2013-2015, Facebook, Inc.
  3052. * All rights reserved.
  3053. *
  3054. * This source code is licensed under the BSD-style license found in the
  3055. * LICENSE file in the root directory of this source tree. An additional grant
  3056. * of patent rights can be found in the PATENTS file in the same directory.
  3057. *
  3058. * @providesModule EventPropagators
  3059. */
  3060. 'use strict';
  3061. var EventConstants = _dereq_(16);
  3062. var EventPluginHub = _dereq_(18);
  3063. var accumulateInto = _dereq_(118);
  3064. var forEachAccumulated = _dereq_(135);
  3065. var PropagationPhases = EventConstants.PropagationPhases;
  3066. var getListener = EventPluginHub.getListener;
  3067. /**
  3068. * Some event types have a notion of different registration names for different
  3069. * "phases" of propagation. This finds listeners by a given phase.
  3070. */
  3071. function listenerAtPhase(id, event, propagationPhase) {
  3072. var registrationName =
  3073. event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  3074. return getListener(id, registrationName);
  3075. }
  3076. /**
  3077. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  3078. * here, allows us to not have to bind or create functions for each event.
  3079. * Mutating the event's members allows us to not have to create a wrapping
  3080. * "dispatch" object that pairs the event with the listener.
  3081. */
  3082. function accumulateDirectionalDispatches(domID, upwards, event) {
  3083. if ("production" !== "development") {
  3084. if (!domID) {
  3085. throw new Error('Dispatching id must not be null');
  3086. }
  3087. }
  3088. var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
  3089. var listener = listenerAtPhase(domID, event, phase);
  3090. if (listener) {
  3091. event._dispatchListeners =
  3092. accumulateInto(event._dispatchListeners, listener);
  3093. event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
  3094. }
  3095. }
  3096. /**
  3097. * Collect dispatches (must be entirely collected before dispatching - see unit
  3098. * tests). Lazily allocate the array to conserve memory. We must loop through
  3099. * each event and perform the traversal for each one. We can not perform a
  3100. * single traversal for the entire collection of events because each event may
  3101. * have a different target.
  3102. */
  3103. function accumulateTwoPhaseDispatchesSingle(event) {
  3104. if (event && event.dispatchConfig.phasedRegistrationNames) {
  3105. EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
  3106. event.dispatchMarker,
  3107. accumulateDirectionalDispatches,
  3108. event
  3109. );
  3110. }
  3111. }
  3112. /**
  3113. * Accumulates without regard to direction, does not look for phased
  3114. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  3115. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  3116. */
  3117. function accumulateDispatches(id, ignoredDirection, event) {
  3118. if (event && event.dispatchConfig.registrationName) {
  3119. var registrationName = event.dispatchConfig.registrationName;
  3120. var listener = getListener(id, registrationName);
  3121. if (listener) {
  3122. event._dispatchListeners =
  3123. accumulateInto(event._dispatchListeners, listener);
  3124. event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
  3125. }
  3126. }
  3127. }
  3128. /**
  3129. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  3130. * `dispatchMarker`.
  3131. * @param {SyntheticEvent} event
  3132. */
  3133. function accumulateDirectDispatchesSingle(event) {
  3134. if (event && event.dispatchConfig.registrationName) {
  3135. accumulateDispatches(event.dispatchMarker, null, event);
  3136. }
  3137. }
  3138. function accumulateTwoPhaseDispatches(events) {
  3139. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  3140. }
  3141. function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
  3142. EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
  3143. fromID,
  3144. toID,
  3145. accumulateDispatches,
  3146. leave,
  3147. enter
  3148. );
  3149. }
  3150. function accumulateDirectDispatches(events) {
  3151. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  3152. }
  3153. /**
  3154. * A small set of propagation patterns, each of which will accept a small amount
  3155. * of information, and generate a set of "dispatch ready event objects" - which
  3156. * are sets of events that have already been annotated with a set of dispatched
  3157. * listener functions/ids. The API is designed this way to discourage these
  3158. * propagation strategies from actually executing the dispatches, since we
  3159. * always want to collect the entire set of dispatches before executing event a
  3160. * single one.
  3161. *
  3162. * @constructor EventPropagators
  3163. */
  3164. var EventPropagators = {
  3165. accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
  3166. accumulateDirectDispatches: accumulateDirectDispatches,
  3167. accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
  3168. };
  3169. module.exports = EventPropagators;
  3170. },{"118":118,"135":135,"16":16,"18":18}],22:[function(_dereq_,module,exports){
  3171. /**
  3172. * Copyright 2013-2015, Facebook, Inc.
  3173. * All rights reserved.
  3174. *
  3175. * This source code is licensed under the BSD-style license found in the
  3176. * LICENSE file in the root directory of this source tree. An additional grant
  3177. * of patent rights can be found in the PATENTS file in the same directory.
  3178. *
  3179. * @providesModule ExecutionEnvironment
  3180. */
  3181. /*jslint evil: true */
  3182. "use strict";
  3183. var canUseDOM = !!(
  3184. (typeof window !== 'undefined' &&
  3185. window.document && window.document.createElement)
  3186. );
  3187. /**
  3188. * Simple, lightweight module assisting with the detection and context of
  3189. * Worker. Helps avoid circular dependencies and allows code to reason about
  3190. * whether or not they are in a Worker, even if they never include the main
  3191. * `ReactWorker` dependency.
  3192. */
  3193. var ExecutionEnvironment = {
  3194. canUseDOM: canUseDOM,
  3195. canUseWorkers: typeof Worker !== 'undefined',
  3196. canUseEventListeners:
  3197. canUseDOM && !!(window.addEventListener || window.attachEvent),
  3198. canUseViewport: canUseDOM && !!window.screen,
  3199. isInWorker: !canUseDOM // For now, this is true - might change in the future.
  3200. };
  3201. module.exports = ExecutionEnvironment;
  3202. },{}],23:[function(_dereq_,module,exports){
  3203. /**
  3204. * Copyright 2013-2015, Facebook, Inc.
  3205. * All rights reserved.
  3206. *
  3207. * This source code is licensed under the BSD-style license found in the
  3208. * LICENSE file in the root directory of this source tree. An additional grant
  3209. * of patent rights can be found in the PATENTS file in the same directory.
  3210. *
  3211. * @providesModule FallbackCompositionState
  3212. * @typechecks static-only
  3213. */
  3214. 'use strict';
  3215. var PooledClass = _dereq_(30);
  3216. var assign = _dereq_(29);
  3217. var getTextContentAccessor = _dereq_(145);
  3218. /**
  3219. * This helper class stores information about text content of a target node,
  3220. * allowing comparison of content before and after a given event.
  3221. *
  3222. * Identify the node where selection currently begins, then observe
  3223. * both its text content and its current position in the DOM. Since the
  3224. * browser may natively replace the target node during composition, we can
  3225. * use its position to find its replacement.
  3226. *
  3227. * @param {DOMEventTarget} root
  3228. */
  3229. function FallbackCompositionState(root) {
  3230. this._root = root;
  3231. this._startText = this.getText();
  3232. this._fallbackText = null;
  3233. }
  3234. assign(FallbackCompositionState.prototype, {
  3235. /**
  3236. * Get current text of input.
  3237. *
  3238. * @return {string}
  3239. */
  3240. getText: function() {
  3241. if ('value' in this._root) {
  3242. return this._root.value;
  3243. }
  3244. return this._root[getTextContentAccessor()];
  3245. },
  3246. /**
  3247. * Determine the differing substring between the initially stored
  3248. * text content and the current content.
  3249. *
  3250. * @return {string}
  3251. */
  3252. getData: function() {
  3253. if (this._fallbackText) {
  3254. return this._fallbackText;
  3255. }
  3256. var start;
  3257. var startValue = this._startText;
  3258. var startLength = startValue.length;
  3259. var end;
  3260. var endValue = this.getText();
  3261. var endLength = endValue.length;
  3262. for (start = 0; start < startLength; start++) {
  3263. if (startValue[start] !== endValue[start]) {
  3264. break;
  3265. }
  3266. }
  3267. var minEnd = startLength - start;
  3268. for (end = 1; end <= minEnd; end++) {
  3269. if (startValue[startLength - end] !== endValue[endLength - end]) {
  3270. break;
  3271. }
  3272. }
  3273. var sliceTail = end > 1 ? 1 - end : undefined;
  3274. this._fallbackText = endValue.slice(start, sliceTail);
  3275. return this._fallbackText;
  3276. }
  3277. });
  3278. PooledClass.addPoolingTo(FallbackCompositionState);
  3279. module.exports = FallbackCompositionState;
  3280. },{"145":145,"29":29,"30":30}],24:[function(_dereq_,module,exports){
  3281. /**
  3282. * Copyright 2013-2015, Facebook, Inc.
  3283. * All rights reserved.
  3284. *
  3285. * This source code is licensed under the BSD-style license found in the
  3286. * LICENSE file in the root directory of this source tree. An additional grant
  3287. * of patent rights can be found in the PATENTS file in the same directory.
  3288. *
  3289. * @providesModule HTMLDOMPropertyConfig
  3290. */
  3291. /*jslint bitwise: true*/
  3292. 'use strict';
  3293. var DOMProperty = _dereq_(11);
  3294. var ExecutionEnvironment = _dereq_(22);
  3295. var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
  3296. var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
  3297. var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
  3298. var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
  3299. var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
  3300. var HAS_POSITIVE_NUMERIC_VALUE =
  3301. DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
  3302. var HAS_OVERLOADED_BOOLEAN_VALUE =
  3303. DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
  3304. var hasSVG;
  3305. if (ExecutionEnvironment.canUseDOM) {
  3306. var implementation = document.implementation;
  3307. hasSVG = (
  3308. implementation &&
  3309. implementation.hasFeature &&
  3310. implementation.hasFeature(
  3311. 'http://www.w3.org/TR/SVG11/feature#BasicStructure',
  3312. '1.1'
  3313. )
  3314. );
  3315. }
  3316. var HTMLDOMPropertyConfig = {
  3317. isCustomAttribute: RegExp.prototype.test.bind(
  3318. /^(data|aria)-[a-z_][a-z\d_.\-]*$/
  3319. ),
  3320. Properties: {
  3321. /**
  3322. * Standard Properties
  3323. */
  3324. accept: null,
  3325. acceptCharset: null,
  3326. accessKey: null,
  3327. action: null,
  3328. allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3329. allowTransparency: MUST_USE_ATTRIBUTE,
  3330. alt: null,
  3331. async: HAS_BOOLEAN_VALUE,
  3332. autoComplete: null,
  3333. // autoFocus is polyfilled/normalized by AutoFocusMixin
  3334. // autoFocus: HAS_BOOLEAN_VALUE,
  3335. autoPlay: HAS_BOOLEAN_VALUE,
  3336. cellPadding: null,
  3337. cellSpacing: null,
  3338. charSet: MUST_USE_ATTRIBUTE,
  3339. checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3340. classID: MUST_USE_ATTRIBUTE,
  3341. // To set className on SVG elements, it's necessary to use .setAttribute;
  3342. // this works on HTML elements too in all browsers except IE8. Conveniently,
  3343. // IE8 doesn't support SVG and so we can simply use the attribute in
  3344. // browsers that support SVG and the property in browsers that don't,
  3345. // regardless of whether the element is HTML or SVG.
  3346. className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
  3347. cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3348. colSpan: null,
  3349. content: null,
  3350. contentEditable: null,
  3351. contextMenu: MUST_USE_ATTRIBUTE,
  3352. controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3353. coords: null,
  3354. crossOrigin: null,
  3355. data: null, // For `<object />` acts as `src`.
  3356. dateTime: MUST_USE_ATTRIBUTE,
  3357. defer: HAS_BOOLEAN_VALUE,
  3358. dir: null,
  3359. disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3360. download: HAS_OVERLOADED_BOOLEAN_VALUE,
  3361. draggable: null,
  3362. encType: null,
  3363. form: MUST_USE_ATTRIBUTE,
  3364. formAction: MUST_USE_ATTRIBUTE,
  3365. formEncType: MUST_USE_ATTRIBUTE,
  3366. formMethod: MUST_USE_ATTRIBUTE,
  3367. formNoValidate: HAS_BOOLEAN_VALUE,
  3368. formTarget: MUST_USE_ATTRIBUTE,
  3369. frameBorder: MUST_USE_ATTRIBUTE,
  3370. headers: null,
  3371. height: MUST_USE_ATTRIBUTE,
  3372. hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3373. high: null,
  3374. href: null,
  3375. hrefLang: null,
  3376. htmlFor: null,
  3377. httpEquiv: null,
  3378. icon: null,
  3379. id: MUST_USE_PROPERTY,
  3380. label: null,
  3381. lang: null,
  3382. list: MUST_USE_ATTRIBUTE,
  3383. loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3384. low: null,
  3385. manifest: MUST_USE_ATTRIBUTE,
  3386. marginHeight: null,
  3387. marginWidth: null,
  3388. max: null,
  3389. maxLength: MUST_USE_ATTRIBUTE,
  3390. media: MUST_USE_ATTRIBUTE,
  3391. mediaGroup: null,
  3392. method: null,
  3393. min: null,
  3394. multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3395. muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3396. name: null,
  3397. noValidate: HAS_BOOLEAN_VALUE,
  3398. open: HAS_BOOLEAN_VALUE,
  3399. optimum: null,
  3400. pattern: null,
  3401. placeholder: null,
  3402. poster: null,
  3403. preload: null,
  3404. radioGroup: null,
  3405. readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3406. rel: null,
  3407. required: HAS_BOOLEAN_VALUE,
  3408. role: MUST_USE_ATTRIBUTE,
  3409. rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3410. rowSpan: null,
  3411. sandbox: null,
  3412. scope: null,
  3413. scoped: HAS_BOOLEAN_VALUE,
  3414. scrolling: null,
  3415. seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3416. selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3417. shape: null,
  3418. size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3419. sizes: MUST_USE_ATTRIBUTE,
  3420. span: HAS_POSITIVE_NUMERIC_VALUE,
  3421. spellCheck: null,
  3422. src: null,
  3423. srcDoc: MUST_USE_PROPERTY,
  3424. srcSet: MUST_USE_ATTRIBUTE,
  3425. start: HAS_NUMERIC_VALUE,
  3426. step: null,
  3427. style: null,
  3428. tabIndex: null,
  3429. target: null,
  3430. title: null,
  3431. type: null,
  3432. useMap: null,
  3433. value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
  3434. width: MUST_USE_ATTRIBUTE,
  3435. wmode: MUST_USE_ATTRIBUTE,
  3436. /**
  3437. * Non-standard Properties
  3438. */
  3439. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  3440. // keyboard hints.
  3441. autoCapitalize: null,
  3442. autoCorrect: null,
  3443. // itemProp, itemScope, itemType are for
  3444. // Microdata support. See http://schema.org/docs/gs.html
  3445. itemProp: MUST_USE_ATTRIBUTE,
  3446. itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3447. itemType: MUST_USE_ATTRIBUTE,
  3448. // itemID and itemRef are for Microdata support as well but
  3449. // only specified in the the WHATWG spec document. See
  3450. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  3451. itemID: MUST_USE_ATTRIBUTE,
  3452. itemRef: MUST_USE_ATTRIBUTE,
  3453. // property is supported for OpenGraph in meta tags.
  3454. property: null,
  3455. // IE-only attribute that controls focus behavior
  3456. unselectable: MUST_USE_ATTRIBUTE
  3457. },
  3458. DOMAttributeNames: {
  3459. acceptCharset: 'accept-charset',
  3460. className: 'class',
  3461. htmlFor: 'for',
  3462. httpEquiv: 'http-equiv'
  3463. },
  3464. DOMPropertyNames: {
  3465. autoCapitalize: 'autocapitalize',
  3466. autoComplete: 'autocomplete',
  3467. autoCorrect: 'autocorrect',
  3468. autoFocus: 'autofocus',
  3469. autoPlay: 'autoplay',
  3470. // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
  3471. // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
  3472. encType: 'encoding',
  3473. hrefLang: 'hreflang',
  3474. radioGroup: 'radiogroup',
  3475. spellCheck: 'spellcheck',
  3476. srcDoc: 'srcdoc',
  3477. srcSet: 'srcset'
  3478. }
  3479. };
  3480. module.exports = HTMLDOMPropertyConfig;
  3481. },{"11":11,"22":22}],25:[function(_dereq_,module,exports){
  3482. /**
  3483. * Copyright 2013-2015, Facebook, Inc.
  3484. * All rights reserved.
  3485. *
  3486. * This source code is licensed under the BSD-style license found in the
  3487. * LICENSE file in the root directory of this source tree. An additional grant
  3488. * of patent rights can be found in the PATENTS file in the same directory.
  3489. *
  3490. * @providesModule LinkedStateMixin
  3491. * @typechecks static-only
  3492. */
  3493. 'use strict';
  3494. var ReactLink = _dereq_(75);
  3495. var ReactStateSetters = _dereq_(94);
  3496. /**
  3497. * A simple mixin around ReactLink.forState().
  3498. */
  3499. var LinkedStateMixin = {
  3500. /**
  3501. * Create a ReactLink that's linked to part of this component's state. The
  3502. * ReactLink will have the current value of this.state[key] and will call
  3503. * setState() when a change is requested.
  3504. *
  3505. * @param {string} key state key to update. Note: you may want to use keyOf()
  3506. * if you're using Google Closure Compiler advanced mode.
  3507. * @return {ReactLink} ReactLink instance linking to the state.
  3508. */
  3509. linkState: function(key) {
  3510. return new ReactLink(
  3511. this.state[key],
  3512. ReactStateSetters.createStateKeySetter(this, key)
  3513. );
  3514. }
  3515. };
  3516. module.exports = LinkedStateMixin;
  3517. },{"75":75,"94":94}],26:[function(_dereq_,module,exports){
  3518. /**
  3519. * Copyright 2013-2015, Facebook, Inc.
  3520. * All rights reserved.
  3521. *
  3522. * This source code is licensed under the BSD-style license found in the
  3523. * LICENSE file in the root directory of this source tree. An additional grant
  3524. * of patent rights can be found in the PATENTS file in the same directory.
  3525. *
  3526. * @providesModule LinkedValueUtils
  3527. * @typechecks static-only
  3528. */
  3529. 'use strict';
  3530. var ReactPropTypes = _dereq_(86);
  3531. var invariant = _dereq_(150);
  3532. var hasReadOnlyValue = {
  3533. 'button': true,
  3534. 'checkbox': true,
  3535. 'image': true,
  3536. 'hidden': true,
  3537. 'radio': true,
  3538. 'reset': true,
  3539. 'submit': true
  3540. };
  3541. function _assertSingleLink(input) {
  3542. ("production" !== "development" ? invariant(
  3543. input.props.checkedLink == null || input.props.valueLink == null,
  3544. 'Cannot provide a checkedLink and a valueLink. If you want to use ' +
  3545. 'checkedLink, you probably don\'t want to use valueLink and vice versa.'
  3546. ) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
  3547. }
  3548. function _assertValueLink(input) {
  3549. _assertSingleLink(input);
  3550. ("production" !== "development" ? invariant(
  3551. input.props.value == null && input.props.onChange == null,
  3552. 'Cannot provide a valueLink and a value or onChange event. If you want ' +
  3553. 'to use value or onChange, you probably don\'t want to use valueLink.'
  3554. ) : invariant(input.props.value == null && input.props.onChange == null));
  3555. }
  3556. function _assertCheckedLink(input) {
  3557. _assertSingleLink(input);
  3558. ("production" !== "development" ? invariant(
  3559. input.props.checked == null && input.props.onChange == null,
  3560. 'Cannot provide a checkedLink and a checked property or onChange event. ' +
  3561. 'If you want to use checked or onChange, you probably don\'t want to ' +
  3562. 'use checkedLink'
  3563. ) : invariant(input.props.checked == null && input.props.onChange == null));
  3564. }
  3565. /**
  3566. * @param {SyntheticEvent} e change event to handle
  3567. */
  3568. function _handleLinkedValueChange(e) {
  3569. /*jshint validthis:true */
  3570. this.props.valueLink.requestChange(e.target.value);
  3571. }
  3572. /**
  3573. * @param {SyntheticEvent} e change event to handle
  3574. */
  3575. function _handleLinkedCheckChange(e) {
  3576. /*jshint validthis:true */
  3577. this.props.checkedLink.requestChange(e.target.checked);
  3578. }
  3579. /**
  3580. * Provide a linked `value` attribute for controlled forms. You should not use
  3581. * this outside of the ReactDOM controlled form components.
  3582. */
  3583. var LinkedValueUtils = {
  3584. Mixin: {
  3585. propTypes: {
  3586. value: function(props, propName, componentName) {
  3587. if (!props[propName] ||
  3588. hasReadOnlyValue[props.type] ||
  3589. props.onChange ||
  3590. props.readOnly ||
  3591. props.disabled) {
  3592. return null;
  3593. }
  3594. return new Error(
  3595. 'You provided a `value` prop to a form field without an ' +
  3596. '`onChange` handler. This will render a read-only field. If ' +
  3597. 'the field should be mutable use `defaultValue`. Otherwise, ' +
  3598. 'set either `onChange` or `readOnly`.'
  3599. );
  3600. },
  3601. checked: function(props, propName, componentName) {
  3602. if (!props[propName] ||
  3603. props.onChange ||
  3604. props.readOnly ||
  3605. props.disabled) {
  3606. return null;
  3607. }
  3608. return new Error(
  3609. 'You provided a `checked` prop to a form field without an ' +
  3610. '`onChange` handler. This will render a read-only field. If ' +
  3611. 'the field should be mutable use `defaultChecked`. Otherwise, ' +
  3612. 'set either `onChange` or `readOnly`.'
  3613. );
  3614. },
  3615. onChange: ReactPropTypes.func
  3616. }
  3617. },
  3618. /**
  3619. * @param {ReactComponent} input Form component
  3620. * @return {*} current value of the input either from value prop or link.
  3621. */
  3622. getValue: function(input) {
  3623. if (input.props.valueLink) {
  3624. _assertValueLink(input);
  3625. return input.props.valueLink.value;
  3626. }
  3627. return input.props.value;
  3628. },
  3629. /**
  3630. * @param {ReactComponent} input Form component
  3631. * @return {*} current checked status of the input either from checked prop
  3632. * or link.
  3633. */
  3634. getChecked: function(input) {
  3635. if (input.props.checkedLink) {
  3636. _assertCheckedLink(input);
  3637. return input.props.checkedLink.value;
  3638. }
  3639. return input.props.checked;
  3640. },
  3641. /**
  3642. * @param {ReactComponent} input Form component
  3643. * @return {function} change callback either from onChange prop or link.
  3644. */
  3645. getOnChange: function(input) {
  3646. if (input.props.valueLink) {
  3647. _assertValueLink(input);
  3648. return _handleLinkedValueChange;
  3649. } else if (input.props.checkedLink) {
  3650. _assertCheckedLink(input);
  3651. return _handleLinkedCheckChange;
  3652. }
  3653. return input.props.onChange;
  3654. }
  3655. };
  3656. module.exports = LinkedValueUtils;
  3657. },{"150":150,"86":86}],27:[function(_dereq_,module,exports){
  3658. /**
  3659. * Copyright 2014-2015, Facebook, Inc.
  3660. * All rights reserved.
  3661. *
  3662. * This source code is licensed under the BSD-style license found in the
  3663. * LICENSE file in the root directory of this source tree. An additional grant
  3664. * of patent rights can be found in the PATENTS file in the same directory.
  3665. *
  3666. * @providesModule LocalEventTrapMixin
  3667. */
  3668. 'use strict';
  3669. var ReactBrowserEventEmitter = _dereq_(33);
  3670. var accumulateInto = _dereq_(118);
  3671. var forEachAccumulated = _dereq_(135);
  3672. var invariant = _dereq_(150);
  3673. function remove(event) {
  3674. event.remove();
  3675. }
  3676. var LocalEventTrapMixin = {
  3677. trapBubbledEvent:function(topLevelType, handlerBaseName) {
  3678. ("production" !== "development" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
  3679. // If a component renders to null or if another component fatals and causes
  3680. // the state of the tree to be corrupted, `node` here can be null.
  3681. var node = this.getDOMNode();
  3682. ("production" !== "development" ? invariant(
  3683. node,
  3684. 'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
  3685. ) : invariant(node));
  3686. var listener = ReactBrowserEventEmitter.trapBubbledEvent(
  3687. topLevelType,
  3688. handlerBaseName,
  3689. node
  3690. );
  3691. this._localEventListeners =
  3692. accumulateInto(this._localEventListeners, listener);
  3693. },
  3694. // trapCapturedEvent would look nearly identical. We don't implement that
  3695. // method because it isn't currently needed.
  3696. componentWillUnmount:function() {
  3697. if (this._localEventListeners) {
  3698. forEachAccumulated(this._localEventListeners, remove);
  3699. }
  3700. }
  3701. };
  3702. module.exports = LocalEventTrapMixin;
  3703. },{"118":118,"135":135,"150":150,"33":33}],28:[function(_dereq_,module,exports){
  3704. /**
  3705. * Copyright 2013-2015, Facebook, Inc.
  3706. * All rights reserved.
  3707. *
  3708. * This source code is licensed under the BSD-style license found in the
  3709. * LICENSE file in the root directory of this source tree. An additional grant
  3710. * of patent rights can be found in the PATENTS file in the same directory.
  3711. *
  3712. * @providesModule MobileSafariClickEventPlugin
  3713. * @typechecks static-only
  3714. */
  3715. 'use strict';
  3716. var EventConstants = _dereq_(16);
  3717. var emptyFunction = _dereq_(129);
  3718. var topLevelTypes = EventConstants.topLevelTypes;
  3719. /**
  3720. * Mobile Safari does not fire properly bubble click events on non-interactive
  3721. * elements, which means delegated click listeners do not fire. The workaround
  3722. * for this bug involves attaching an empty click listener on the target node.
  3723. *
  3724. * This particular plugin works around the bug by attaching an empty click
  3725. * listener on `touchstart` (which does fire on every element).
  3726. */
  3727. var MobileSafariClickEventPlugin = {
  3728. eventTypes: null,
  3729. /**
  3730. * @param {string} topLevelType Record from `EventConstants`.
  3731. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  3732. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  3733. * @param {object} nativeEvent Native browser event.
  3734. * @return {*} An accumulation of synthetic events.
  3735. * @see {EventPluginHub.extractEvents}
  3736. */
  3737. extractEvents: function(
  3738. topLevelType,
  3739. topLevelTarget,
  3740. topLevelTargetID,
  3741. nativeEvent) {
  3742. if (topLevelType === topLevelTypes.topTouchStart) {
  3743. var target = nativeEvent.target;
  3744. if (target && !target.onclick) {
  3745. target.onclick = emptyFunction;
  3746. }
  3747. }
  3748. }
  3749. };
  3750. module.exports = MobileSafariClickEventPlugin;
  3751. },{"129":129,"16":16}],29:[function(_dereq_,module,exports){
  3752. /**
  3753. * Copyright 2014-2015, Facebook, Inc.
  3754. * All rights reserved.
  3755. *
  3756. * This source code is licensed under the BSD-style license found in the
  3757. * LICENSE file in the root directory of this source tree. An additional grant
  3758. * of patent rights can be found in the PATENTS file in the same directory.
  3759. *
  3760. * @providesModule Object.assign
  3761. */
  3762. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
  3763. 'use strict';
  3764. function assign(target, sources) {
  3765. if (target == null) {
  3766. throw new TypeError('Object.assign target cannot be null or undefined');
  3767. }
  3768. var to = Object(target);
  3769. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3770. for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
  3771. var nextSource = arguments[nextIndex];
  3772. if (nextSource == null) {
  3773. continue;
  3774. }
  3775. var from = Object(nextSource);
  3776. // We don't currently support accessors nor proxies. Therefore this
  3777. // copy cannot throw. If we ever supported this then we must handle
  3778. // exceptions and side-effects. We don't support symbols so they won't
  3779. // be transferred.
  3780. for (var key in from) {
  3781. if (hasOwnProperty.call(from, key)) {
  3782. to[key] = from[key];
  3783. }
  3784. }
  3785. }
  3786. return to;
  3787. }
  3788. module.exports = assign;
  3789. },{}],30:[function(_dereq_,module,exports){
  3790. /**
  3791. * Copyright 2013-2015, Facebook, Inc.
  3792. * All rights reserved.
  3793. *
  3794. * This source code is licensed under the BSD-style license found in the
  3795. * LICENSE file in the root directory of this source tree. An additional grant
  3796. * of patent rights can be found in the PATENTS file in the same directory.
  3797. *
  3798. * @providesModule PooledClass
  3799. */
  3800. 'use strict';
  3801. var invariant = _dereq_(150);
  3802. /**
  3803. * Static poolers. Several custom versions for each potential number of
  3804. * arguments. A completely generic pooler is easy to implement, but would
  3805. * require accessing the `arguments` object. In each of these, `this` refers to
  3806. * the Class itself, not an instance. If any others are needed, simply add them
  3807. * here, or in their own files.
  3808. */
  3809. var oneArgumentPooler = function(copyFieldsFrom) {
  3810. var Klass = this;
  3811. if (Klass.instancePool.length) {
  3812. var instance = Klass.instancePool.pop();
  3813. Klass.call(instance, copyFieldsFrom);
  3814. return instance;
  3815. } else {
  3816. return new Klass(copyFieldsFrom);
  3817. }
  3818. };
  3819. var twoArgumentPooler = function(a1, a2) {
  3820. var Klass = this;
  3821. if (Klass.instancePool.length) {
  3822. var instance = Klass.instancePool.pop();
  3823. Klass.call(instance, a1, a2);
  3824. return instance;
  3825. } else {
  3826. return new Klass(a1, a2);
  3827. }
  3828. };
  3829. var threeArgumentPooler = function(a1, a2, a3) {
  3830. var Klass = this;
  3831. if (Klass.instancePool.length) {
  3832. var instance = Klass.instancePool.pop();
  3833. Klass.call(instance, a1, a2, a3);
  3834. return instance;
  3835. } else {
  3836. return new Klass(a1, a2, a3);
  3837. }
  3838. };
  3839. var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
  3840. var Klass = this;
  3841. if (Klass.instancePool.length) {
  3842. var instance = Klass.instancePool.pop();
  3843. Klass.call(instance, a1, a2, a3, a4, a5);
  3844. return instance;
  3845. } else {
  3846. return new Klass(a1, a2, a3, a4, a5);
  3847. }
  3848. };
  3849. var standardReleaser = function(instance) {
  3850. var Klass = this;
  3851. ("production" !== "development" ? invariant(
  3852. instance instanceof Klass,
  3853. 'Trying to release an instance into a pool of a different type.'
  3854. ) : invariant(instance instanceof Klass));
  3855. if (instance.destructor) {
  3856. instance.destructor();
  3857. }
  3858. if (Klass.instancePool.length < Klass.poolSize) {
  3859. Klass.instancePool.push(instance);
  3860. }
  3861. };
  3862. var DEFAULT_POOL_SIZE = 10;
  3863. var DEFAULT_POOLER = oneArgumentPooler;
  3864. /**
  3865. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  3866. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  3867. * you give this may have a `poolSize` property, and will look for a
  3868. * prototypical `destructor` on instances (optional).
  3869. *
  3870. * @param {Function} CopyConstructor Constructor that can be used to reset.
  3871. * @param {Function} pooler Customizable pooler.
  3872. */
  3873. var addPoolingTo = function(CopyConstructor, pooler) {
  3874. var NewKlass = CopyConstructor;
  3875. NewKlass.instancePool = [];
  3876. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  3877. if (!NewKlass.poolSize) {
  3878. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  3879. }
  3880. NewKlass.release = standardReleaser;
  3881. return NewKlass;
  3882. };
  3883. var PooledClass = {
  3884. addPoolingTo: addPoolingTo,
  3885. oneArgumentPooler: oneArgumentPooler,
  3886. twoArgumentPooler: twoArgumentPooler,
  3887. threeArgumentPooler: threeArgumentPooler,
  3888. fiveArgumentPooler: fiveArgumentPooler
  3889. };
  3890. module.exports = PooledClass;
  3891. },{"150":150}],31:[function(_dereq_,module,exports){
  3892. /**
  3893. * Copyright 2013-2015, Facebook, Inc.
  3894. * All rights reserved.
  3895. *
  3896. * This source code is licensed under the BSD-style license found in the
  3897. * LICENSE file in the root directory of this source tree. An additional grant
  3898. * of patent rights can be found in the PATENTS file in the same directory.
  3899. *
  3900. * @providesModule React
  3901. */
  3902. /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
  3903. 'use strict';
  3904. var EventPluginUtils = _dereq_(20);
  3905. var ReactChildren = _dereq_(37);
  3906. var ReactComponent = _dereq_(39);
  3907. var ReactClass = _dereq_(38);
  3908. var ReactContext = _dereq_(44);
  3909. var ReactCurrentOwner = _dereq_(45);
  3910. var ReactElement = _dereq_(63);
  3911. var ReactElementValidator = _dereq_(64);
  3912. var ReactDOM = _dereq_(46);
  3913. var ReactDOMTextComponent = _dereq_(57);
  3914. var ReactDefaultInjection = _dereq_(60);
  3915. var ReactInstanceHandles = _dereq_(72);
  3916. var ReactMount = _dereq_(77);
  3917. var ReactPerf = _dereq_(82);
  3918. var ReactPropTypes = _dereq_(86);
  3919. var ReactReconciler = _dereq_(89);
  3920. var ReactServerRendering = _dereq_(92);
  3921. var assign = _dereq_(29);
  3922. var findDOMNode = _dereq_(132);
  3923. var onlyChild = _dereq_(160);
  3924. ReactDefaultInjection.inject();
  3925. var createElement = ReactElement.createElement;
  3926. var createFactory = ReactElement.createFactory;
  3927. var cloneElement = ReactElement.cloneElement;
  3928. if ("production" !== "development") {
  3929. createElement = ReactElementValidator.createElement;
  3930. createFactory = ReactElementValidator.createFactory;
  3931. cloneElement = ReactElementValidator.cloneElement;
  3932. }
  3933. var render = ReactPerf.measure('React', 'render', ReactMount.render);
  3934. var React = {
  3935. Children: {
  3936. map: ReactChildren.map,
  3937. forEach: ReactChildren.forEach,
  3938. count: ReactChildren.count,
  3939. only: onlyChild
  3940. },
  3941. Component: ReactComponent,
  3942. DOM: ReactDOM,
  3943. PropTypes: ReactPropTypes,
  3944. initializeTouchEvents: function(shouldUseTouch) {
  3945. EventPluginUtils.useTouchEvents = shouldUseTouch;
  3946. },
  3947. createClass: ReactClass.createClass,
  3948. createElement: createElement,
  3949. cloneElement: cloneElement,
  3950. createFactory: createFactory,
  3951. createMixin: function(mixin) {
  3952. // Currently a noop. Will be used to validate and trace mixins.
  3953. return mixin;
  3954. },
  3955. constructAndRenderComponent: ReactMount.constructAndRenderComponent,
  3956. constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
  3957. findDOMNode: findDOMNode,
  3958. render: render,
  3959. renderToString: ReactServerRendering.renderToString,
  3960. renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
  3961. unmountComponentAtNode: ReactMount.unmountComponentAtNode,
  3962. isValidElement: ReactElement.isValidElement,
  3963. withContext: ReactContext.withContext,
  3964. // Hook for JSX spread, don't use this for anything else.
  3965. __spread: assign
  3966. };
  3967. // Inject the runtime into a devtools global hook regardless of browser.
  3968. // Allows for debugging when the hook is injected on the page.
  3969. if (
  3970. typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
  3971. typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
  3972. __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
  3973. CurrentOwner: ReactCurrentOwner,
  3974. InstanceHandles: ReactInstanceHandles,
  3975. Mount: ReactMount,
  3976. Reconciler: ReactReconciler,
  3977. TextComponent: ReactDOMTextComponent
  3978. });
  3979. }
  3980. if ("production" !== "development") {
  3981. var ExecutionEnvironment = _dereq_(22);
  3982. if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
  3983. // If we're in Chrome, look for the devtools marker and provide a download
  3984. // link if not installed.
  3985. if (navigator.userAgent.indexOf('Chrome') > -1) {
  3986. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  3987. console.debug(
  3988. 'Download the React DevTools for a better development experience: ' +
  3989. 'https://fb.me/react-devtools'
  3990. );
  3991. }
  3992. }
  3993. var expectedFeatures = [
  3994. // shims
  3995. Array.isArray,
  3996. Array.prototype.every,
  3997. Array.prototype.forEach,
  3998. Array.prototype.indexOf,
  3999. Array.prototype.map,
  4000. Date.now,
  4001. Function.prototype.bind,
  4002. Object.keys,
  4003. String.prototype.split,
  4004. String.prototype.trim,
  4005. // shams
  4006. Object.create,
  4007. Object.freeze
  4008. ];
  4009. for (var i = 0; i < expectedFeatures.length; i++) {
  4010. if (!expectedFeatures[i]) {
  4011. console.error(
  4012. 'One or more ES5 shim/shams expected by React are not available: ' +
  4013. 'https://fb.me/react-warning-polyfills'
  4014. );
  4015. break;
  4016. }
  4017. }
  4018. }
  4019. }
  4020. React.version = '0.13.3';
  4021. module.exports = React;
  4022. },{"132":132,"160":160,"20":20,"22":22,"29":29,"37":37,"38":38,"39":39,"44":44,"45":45,"46":46,"57":57,"60":60,"63":63,"64":64,"72":72,"77":77,"82":82,"86":86,"89":89,"92":92}],32:[function(_dereq_,module,exports){
  4023. /**
  4024. * Copyright 2013-2015, Facebook, Inc.
  4025. * All rights reserved.
  4026. *
  4027. * This source code is licensed under the BSD-style license found in the
  4028. * LICENSE file in the root directory of this source tree. An additional grant
  4029. * of patent rights can be found in the PATENTS file in the same directory.
  4030. *
  4031. * @providesModule ReactBrowserComponentMixin
  4032. */
  4033. 'use strict';
  4034. var findDOMNode = _dereq_(132);
  4035. var ReactBrowserComponentMixin = {
  4036. /**
  4037. * Returns the DOM node rendered by this component.
  4038. *
  4039. * @return {DOMElement} The root node of this component.
  4040. * @final
  4041. * @protected
  4042. */
  4043. getDOMNode: function() {
  4044. return findDOMNode(this);
  4045. }
  4046. };
  4047. module.exports = ReactBrowserComponentMixin;
  4048. },{"132":132}],33:[function(_dereq_,module,exports){
  4049. /**
  4050. * Copyright 2013-2015, Facebook, Inc.
  4051. * All rights reserved.
  4052. *
  4053. * This source code is licensed under the BSD-style license found in the
  4054. * LICENSE file in the root directory of this source tree. An additional grant
  4055. * of patent rights can be found in the PATENTS file in the same directory.
  4056. *
  4057. * @providesModule ReactBrowserEventEmitter
  4058. * @typechecks static-only
  4059. */
  4060. 'use strict';
  4061. var EventConstants = _dereq_(16);
  4062. var EventPluginHub = _dereq_(18);
  4063. var EventPluginRegistry = _dereq_(19);
  4064. var ReactEventEmitterMixin = _dereq_(67);
  4065. var ViewportMetrics = _dereq_(117);
  4066. var assign = _dereq_(29);
  4067. var isEventSupported = _dereq_(151);
  4068. /**
  4069. * Summary of `ReactBrowserEventEmitter` event handling:
  4070. *
  4071. * - Top-level delegation is used to trap most native browser events. This
  4072. * may only occur in the main thread and is the responsibility of
  4073. * ReactEventListener, which is injected and can therefore support pluggable
  4074. * event sources. This is the only work that occurs in the main thread.
  4075. *
  4076. * - We normalize and de-duplicate events to account for browser quirks. This
  4077. * may be done in the worker thread.
  4078. *
  4079. * - Forward these native events (with the associated top-level type used to
  4080. * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
  4081. * to extract any synthetic events.
  4082. *
  4083. * - The `EventPluginHub` will then process each event by annotating them with
  4084. * "dispatches", a sequence of listeners and IDs that care about that event.
  4085. *
  4086. * - The `EventPluginHub` then dispatches the events.
  4087. *
  4088. * Overview of React and the event system:
  4089. *
  4090. * +------------+ .
  4091. * | DOM | .
  4092. * +------------+ .
  4093. * | .
  4094. * v .
  4095. * +------------+ .
  4096. * | ReactEvent | .
  4097. * | Listener | .
  4098. * +------------+ . +-----------+
  4099. * | . +--------+|SimpleEvent|
  4100. * | . | |Plugin |
  4101. * +-----|------+ . v +-----------+
  4102. * | | | . +--------------+ +------------+
  4103. * | +-----------.--->|EventPluginHub| | Event |
  4104. * | | . | | +-----------+ | Propagators|
  4105. * | ReactEvent | . | | |TapEvent | |------------|
  4106. * | Emitter | . | |<---+|Plugin | |other plugin|
  4107. * | | . | | +-----------+ | utilities |
  4108. * | +-----------.--->| | +------------+
  4109. * | | | . +--------------+
  4110. * +-----|------+ . ^ +-----------+
  4111. * | . | |Enter/Leave|
  4112. * + . +-------+|Plugin |
  4113. * +-------------+ . +-----------+
  4114. * | application | .
  4115. * |-------------| .
  4116. * | | .
  4117. * | | .
  4118. * +-------------+ .
  4119. * .
  4120. * React Core . General Purpose Event Plugin System
  4121. */
  4122. var alreadyListeningTo = {};
  4123. var isMonitoringScrollValue = false;
  4124. var reactTopListenersCounter = 0;
  4125. // For events like 'submit' which don't consistently bubble (which we trap at a
  4126. // lower node than `document`), binding at `document` would cause duplicate
  4127. // events so we don't include them here
  4128. var topEventMapping = {
  4129. topBlur: 'blur',
  4130. topChange: 'change',
  4131. topClick: 'click',
  4132. topCompositionEnd: 'compositionend',
  4133. topCompositionStart: 'compositionstart',
  4134. topCompositionUpdate: 'compositionupdate',
  4135. topContextMenu: 'contextmenu',
  4136. topCopy: 'copy',
  4137. topCut: 'cut',
  4138. topDoubleClick: 'dblclick',
  4139. topDrag: 'drag',
  4140. topDragEnd: 'dragend',
  4141. topDragEnter: 'dragenter',
  4142. topDragExit: 'dragexit',
  4143. topDragLeave: 'dragleave',
  4144. topDragOver: 'dragover',
  4145. topDragStart: 'dragstart',
  4146. topDrop: 'drop',
  4147. topFocus: 'focus',
  4148. topInput: 'input',
  4149. topKeyDown: 'keydown',
  4150. topKeyPress: 'keypress',
  4151. topKeyUp: 'keyup',
  4152. topMouseDown: 'mousedown',
  4153. topMouseMove: 'mousemove',
  4154. topMouseOut: 'mouseout',
  4155. topMouseOver: 'mouseover',
  4156. topMouseUp: 'mouseup',
  4157. topPaste: 'paste',
  4158. topScroll: 'scroll',
  4159. topSelectionChange: 'selectionchange',
  4160. topTextInput: 'textInput',
  4161. topTouchCancel: 'touchcancel',
  4162. topTouchEnd: 'touchend',
  4163. topTouchMove: 'touchmove',
  4164. topTouchStart: 'touchstart',
  4165. topWheel: 'wheel'
  4166. };
  4167. /**
  4168. * To ensure no conflicts with other potential React instances on the page
  4169. */
  4170. var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
  4171. function getListeningForDocument(mountAt) {
  4172. // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  4173. // directly.
  4174. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
  4175. mountAt[topListenersIDKey] = reactTopListenersCounter++;
  4176. alreadyListeningTo[mountAt[topListenersIDKey]] = {};
  4177. }
  4178. return alreadyListeningTo[mountAt[topListenersIDKey]];
  4179. }
  4180. /**
  4181. * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
  4182. * example:
  4183. *
  4184. * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
  4185. *
  4186. * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
  4187. *
  4188. * @internal
  4189. */
  4190. var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
  4191. /**
  4192. * Injectable event backend
  4193. */
  4194. ReactEventListener: null,
  4195. injection: {
  4196. /**
  4197. * @param {object} ReactEventListener
  4198. */
  4199. injectReactEventListener: function(ReactEventListener) {
  4200. ReactEventListener.setHandleTopLevel(
  4201. ReactBrowserEventEmitter.handleTopLevel
  4202. );
  4203. ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
  4204. }
  4205. },
  4206. /**
  4207. * Sets whether or not any created callbacks should be enabled.
  4208. *
  4209. * @param {boolean} enabled True if callbacks should be enabled.
  4210. */
  4211. setEnabled: function(enabled) {
  4212. if (ReactBrowserEventEmitter.ReactEventListener) {
  4213. ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
  4214. }
  4215. },
  4216. /**
  4217. * @return {boolean} True if callbacks are enabled.
  4218. */
  4219. isEnabled: function() {
  4220. return !!(
  4221. (ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
  4222. );
  4223. },
  4224. /**
  4225. * We listen for bubbled touch events on the document object.
  4226. *
  4227. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  4228. * mounting `onmousemove` events at some node that was not the document
  4229. * element. The symptoms were that if your mouse is not moving over something
  4230. * contained within that mount point (for example on the background) the
  4231. * top-level listeners for `onmousemove` won't be called. However, if you
  4232. * register the `mousemove` on the document object, then it will of course
  4233. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  4234. * top-level listeners to the document object only, at least for these
  4235. * movement types of events and possibly all events.
  4236. *
  4237. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  4238. *
  4239. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  4240. * they bubble to document.
  4241. *
  4242. * @param {string} registrationName Name of listener (e.g. `onClick`).
  4243. * @param {object} contentDocumentHandle Document which owns the container
  4244. */
  4245. listenTo: function(registrationName, contentDocumentHandle) {
  4246. var mountAt = contentDocumentHandle;
  4247. var isListening = getListeningForDocument(mountAt);
  4248. var dependencies = EventPluginRegistry.
  4249. registrationNameDependencies[registrationName];
  4250. var topLevelTypes = EventConstants.topLevelTypes;
  4251. for (var i = 0, l = dependencies.length; i < l; i++) {
  4252. var dependency = dependencies[i];
  4253. if (!(
  4254. (isListening.hasOwnProperty(dependency) && isListening[dependency])
  4255. )) {
  4256. if (dependency === topLevelTypes.topWheel) {
  4257. if (isEventSupported('wheel')) {
  4258. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4259. topLevelTypes.topWheel,
  4260. 'wheel',
  4261. mountAt
  4262. );
  4263. } else if (isEventSupported('mousewheel')) {
  4264. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4265. topLevelTypes.topWheel,
  4266. 'mousewheel',
  4267. mountAt
  4268. );
  4269. } else {
  4270. // Firefox needs to capture a different mouse scroll event.
  4271. // @see http://www.quirksmode.org/dom/events/tests/scroll.html
  4272. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4273. topLevelTypes.topWheel,
  4274. 'DOMMouseScroll',
  4275. mountAt
  4276. );
  4277. }
  4278. } else if (dependency === topLevelTypes.topScroll) {
  4279. if (isEventSupported('scroll', true)) {
  4280. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4281. topLevelTypes.topScroll,
  4282. 'scroll',
  4283. mountAt
  4284. );
  4285. } else {
  4286. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4287. topLevelTypes.topScroll,
  4288. 'scroll',
  4289. ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
  4290. );
  4291. }
  4292. } else if (dependency === topLevelTypes.topFocus ||
  4293. dependency === topLevelTypes.topBlur) {
  4294. if (isEventSupported('focus', true)) {
  4295. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4296. topLevelTypes.topFocus,
  4297. 'focus',
  4298. mountAt
  4299. );
  4300. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4301. topLevelTypes.topBlur,
  4302. 'blur',
  4303. mountAt
  4304. );
  4305. } else if (isEventSupported('focusin')) {
  4306. // IE has `focusin` and `focusout` events which bubble.
  4307. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
  4308. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4309. topLevelTypes.topFocus,
  4310. 'focusin',
  4311. mountAt
  4312. );
  4313. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4314. topLevelTypes.topBlur,
  4315. 'focusout',
  4316. mountAt
  4317. );
  4318. }
  4319. // to make sure blur and focus event listeners are only attached once
  4320. isListening[topLevelTypes.topBlur] = true;
  4321. isListening[topLevelTypes.topFocus] = true;
  4322. } else if (topEventMapping.hasOwnProperty(dependency)) {
  4323. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4324. dependency,
  4325. topEventMapping[dependency],
  4326. mountAt
  4327. );
  4328. }
  4329. isListening[dependency] = true;
  4330. }
  4331. }
  4332. },
  4333. trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
  4334. return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4335. topLevelType,
  4336. handlerBaseName,
  4337. handle
  4338. );
  4339. },
  4340. trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
  4341. return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4342. topLevelType,
  4343. handlerBaseName,
  4344. handle
  4345. );
  4346. },
  4347. /**
  4348. * Listens to window scroll and resize events. We cache scroll values so that
  4349. * application code can access them without triggering reflows.
  4350. *
  4351. * NOTE: Scroll events do not bubble.
  4352. *
  4353. * @see http://www.quirksmode.org/dom/events/scroll.html
  4354. */
  4355. ensureScrollValueMonitoring: function() {
  4356. if (!isMonitoringScrollValue) {
  4357. var refresh = ViewportMetrics.refreshScrollValues;
  4358. ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
  4359. isMonitoringScrollValue = true;
  4360. }
  4361. },
  4362. eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
  4363. registrationNameModules: EventPluginHub.registrationNameModules,
  4364. putListener: EventPluginHub.putListener,
  4365. getListener: EventPluginHub.getListener,
  4366. deleteListener: EventPluginHub.deleteListener,
  4367. deleteAllListeners: EventPluginHub.deleteAllListeners
  4368. });
  4369. module.exports = ReactBrowserEventEmitter;
  4370. },{"117":117,"151":151,"16":16,"18":18,"19":19,"29":29,"67":67}],34:[function(_dereq_,module,exports){
  4371. /**
  4372. * Copyright 2013-2015, Facebook, Inc.
  4373. * All rights reserved.
  4374. *
  4375. * This source code is licensed under the BSD-style license found in the
  4376. * LICENSE file in the root directory of this source tree. An additional grant
  4377. * of patent rights can be found in the PATENTS file in the same directory.
  4378. *
  4379. * @typechecks
  4380. * @providesModule ReactCSSTransitionGroup
  4381. */
  4382. 'use strict';
  4383. var React = _dereq_(31);
  4384. var assign = _dereq_(29);
  4385. var ReactTransitionGroup = React.createFactory(
  4386. _dereq_(98)
  4387. );
  4388. var ReactCSSTransitionGroupChild = React.createFactory(
  4389. _dereq_(35)
  4390. );
  4391. var ReactCSSTransitionGroup = React.createClass({
  4392. displayName: 'ReactCSSTransitionGroup',
  4393. propTypes: {
  4394. transitionName: React.PropTypes.string.isRequired,
  4395. transitionAppear: React.PropTypes.bool,
  4396. transitionEnter: React.PropTypes.bool,
  4397. transitionLeave: React.PropTypes.bool
  4398. },
  4399. getDefaultProps: function() {
  4400. return {
  4401. transitionAppear: false,
  4402. transitionEnter: true,
  4403. transitionLeave: true
  4404. };
  4405. },
  4406. _wrapChild: function(child) {
  4407. // We need to provide this childFactory so that
  4408. // ReactCSSTransitionGroupChild can receive updates to name, enter, and
  4409. // leave while it is leaving.
  4410. return ReactCSSTransitionGroupChild(
  4411. {
  4412. name: this.props.transitionName,
  4413. appear: this.props.transitionAppear,
  4414. enter: this.props.transitionEnter,
  4415. leave: this.props.transitionLeave
  4416. },
  4417. child
  4418. );
  4419. },
  4420. render: function() {
  4421. return (
  4422. ReactTransitionGroup(
  4423. assign({}, this.props, {childFactory: this._wrapChild})
  4424. )
  4425. );
  4426. }
  4427. });
  4428. module.exports = ReactCSSTransitionGroup;
  4429. },{"29":29,"31":31,"35":35,"98":98}],35:[function(_dereq_,module,exports){
  4430. /**
  4431. * Copyright 2013-2015, Facebook, Inc.
  4432. * All rights reserved.
  4433. *
  4434. * This source code is licensed under the BSD-style license found in the
  4435. * LICENSE file in the root directory of this source tree. An additional grant
  4436. * of patent rights can be found in the PATENTS file in the same directory.
  4437. *
  4438. * @typechecks
  4439. * @providesModule ReactCSSTransitionGroupChild
  4440. */
  4441. 'use strict';
  4442. var React = _dereq_(31);
  4443. var CSSCore = _dereq_(4);
  4444. var ReactTransitionEvents = _dereq_(97);
  4445. var onlyChild = _dereq_(160);
  4446. var warning = _dereq_(171);
  4447. // We don't remove the element from the DOM until we receive an animationend or
  4448. // transitionend event. If the user screws up and forgets to add an animation
  4449. // their node will be stuck in the DOM forever, so we detect if an animation
  4450. // does not start and if it doesn't, we just call the end listener immediately.
  4451. var TICK = 17;
  4452. var NO_EVENT_TIMEOUT = 5000;
  4453. var noEventListener = null;
  4454. if ("production" !== "development") {
  4455. noEventListener = function() {
  4456. ("production" !== "development" ? warning(
  4457. false,
  4458. 'transition(): tried to perform an animation without ' +
  4459. 'an animationend or transitionend event after timeout (' +
  4460. '%sms). You should either disable this ' +
  4461. 'transition in JS or add a CSS animation/transition.',
  4462. NO_EVENT_TIMEOUT
  4463. ) : null);
  4464. };
  4465. }
  4466. var ReactCSSTransitionGroupChild = React.createClass({
  4467. displayName: 'ReactCSSTransitionGroupChild',
  4468. transition: function(animationType, finishCallback) {
  4469. var node = this.getDOMNode();
  4470. var className = this.props.name + '-' + animationType;
  4471. var activeClassName = className + '-active';
  4472. var noEventTimeout = null;
  4473. var endListener = function(e) {
  4474. if (e && e.target !== node) {
  4475. return;
  4476. }
  4477. if ("production" !== "development") {
  4478. clearTimeout(noEventTimeout);
  4479. }
  4480. CSSCore.removeClass(node, className);
  4481. CSSCore.removeClass(node, activeClassName);
  4482. ReactTransitionEvents.removeEndEventListener(node, endListener);
  4483. // Usually this optional callback is used for informing an owner of
  4484. // a leave animation and telling it to remove the child.
  4485. if (finishCallback) {
  4486. finishCallback();
  4487. }
  4488. };
  4489. ReactTransitionEvents.addEndEventListener(node, endListener);
  4490. CSSCore.addClass(node, className);
  4491. // Need to do this to actually trigger a transition.
  4492. this.queueClass(activeClassName);
  4493. if ("production" !== "development") {
  4494. noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT);
  4495. }
  4496. },
  4497. queueClass: function(className) {
  4498. this.classNameQueue.push(className);
  4499. if (!this.timeout) {
  4500. this.timeout = setTimeout(this.flushClassNameQueue, TICK);
  4501. }
  4502. },
  4503. flushClassNameQueue: function() {
  4504. if (this.isMounted()) {
  4505. this.classNameQueue.forEach(
  4506. CSSCore.addClass.bind(CSSCore, this.getDOMNode())
  4507. );
  4508. }
  4509. this.classNameQueue.length = 0;
  4510. this.timeout = null;
  4511. },
  4512. componentWillMount: function() {
  4513. this.classNameQueue = [];
  4514. },
  4515. componentWillUnmount: function() {
  4516. if (this.timeout) {
  4517. clearTimeout(this.timeout);
  4518. }
  4519. },
  4520. componentWillAppear: function(done) {
  4521. if (this.props.appear) {
  4522. this.transition('appear', done);
  4523. } else {
  4524. done();
  4525. }
  4526. },
  4527. componentWillEnter: function(done) {
  4528. if (this.props.enter) {
  4529. this.transition('enter', done);
  4530. } else {
  4531. done();
  4532. }
  4533. },
  4534. componentWillLeave: function(done) {
  4535. if (this.props.leave) {
  4536. this.transition('leave', done);
  4537. } else {
  4538. done();
  4539. }
  4540. },
  4541. render: function() {
  4542. return onlyChild(this.props.children);
  4543. }
  4544. });
  4545. module.exports = ReactCSSTransitionGroupChild;
  4546. },{"160":160,"171":171,"31":31,"4":4,"97":97}],36:[function(_dereq_,module,exports){
  4547. /**
  4548. * Copyright 2014-2015, Facebook, Inc.
  4549. * All rights reserved.
  4550. *
  4551. * This source code is licensed under the BSD-style license found in the
  4552. * LICENSE file in the root directory of this source tree. An additional grant
  4553. * of patent rights can be found in the PATENTS file in the same directory.
  4554. *
  4555. * @providesModule ReactChildReconciler
  4556. * @typechecks static-only
  4557. */
  4558. 'use strict';
  4559. var ReactReconciler = _dereq_(89);
  4560. var flattenChildren = _dereq_(133);
  4561. var instantiateReactComponent = _dereq_(149);
  4562. var shouldUpdateReactComponent = _dereq_(167);
  4563. /**
  4564. * ReactChildReconciler provides helpers for initializing or updating a set of
  4565. * children. Its output is suitable for passing it onto ReactMultiChild which
  4566. * does diffed reordering and insertion.
  4567. */
  4568. var ReactChildReconciler = {
  4569. /**
  4570. * Generates a "mount image" for each of the supplied children. In the case
  4571. * of `ReactDOMComponent`, a mount image is a string of markup.
  4572. *
  4573. * @param {?object} nestedChildNodes Nested child maps.
  4574. * @return {?object} A set of child instances.
  4575. * @internal
  4576. */
  4577. instantiateChildren: function(nestedChildNodes, transaction, context) {
  4578. var children = flattenChildren(nestedChildNodes);
  4579. for (var name in children) {
  4580. if (children.hasOwnProperty(name)) {
  4581. var child = children[name];
  4582. // The rendered children must be turned into instances as they're
  4583. // mounted.
  4584. var childInstance = instantiateReactComponent(child, null);
  4585. children[name] = childInstance;
  4586. }
  4587. }
  4588. return children;
  4589. },
  4590. /**
  4591. * Updates the rendered children and returns a new set of children.
  4592. *
  4593. * @param {?object} prevChildren Previously initialized set of children.
  4594. * @param {?object} nextNestedChildNodes Nested child maps.
  4595. * @param {ReactReconcileTransaction} transaction
  4596. * @param {object} context
  4597. * @return {?object} A new set of child instances.
  4598. * @internal
  4599. */
  4600. updateChildren: function(
  4601. prevChildren,
  4602. nextNestedChildNodes,
  4603. transaction,
  4604. context) {
  4605. // We currently don't have a way to track moves here but if we use iterators
  4606. // instead of for..in we can zip the iterators and check if an item has
  4607. // moved.
  4608. // TODO: If nothing has changed, return the prevChildren object so that we
  4609. // can quickly bailout if nothing has changed.
  4610. var nextChildren = flattenChildren(nextNestedChildNodes);
  4611. if (!nextChildren && !prevChildren) {
  4612. return null;
  4613. }
  4614. var name;
  4615. for (name in nextChildren) {
  4616. if (!nextChildren.hasOwnProperty(name)) {
  4617. continue;
  4618. }
  4619. var prevChild = prevChildren && prevChildren[name];
  4620. var prevElement = prevChild && prevChild._currentElement;
  4621. var nextElement = nextChildren[name];
  4622. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  4623. ReactReconciler.receiveComponent(
  4624. prevChild, nextElement, transaction, context
  4625. );
  4626. nextChildren[name] = prevChild;
  4627. } else {
  4628. if (prevChild) {
  4629. ReactReconciler.unmountComponent(prevChild, name);
  4630. }
  4631. // The child must be instantiated before it's mounted.
  4632. var nextChildInstance = instantiateReactComponent(
  4633. nextElement,
  4634. null
  4635. );
  4636. nextChildren[name] = nextChildInstance;
  4637. }
  4638. }
  4639. // Unmount children that are no longer present.
  4640. for (name in prevChildren) {
  4641. if (prevChildren.hasOwnProperty(name) &&
  4642. !(nextChildren && nextChildren.hasOwnProperty(name))) {
  4643. ReactReconciler.unmountComponent(prevChildren[name]);
  4644. }
  4645. }
  4646. return nextChildren;
  4647. },
  4648. /**
  4649. * Unmounts all rendered children. This should be used to clean up children
  4650. * when this component is unmounted.
  4651. *
  4652. * @param {?object} renderedChildren Previously initialized set of children.
  4653. * @internal
  4654. */
  4655. unmountChildren: function(renderedChildren) {
  4656. for (var name in renderedChildren) {
  4657. var renderedChild = renderedChildren[name];
  4658. ReactReconciler.unmountComponent(renderedChild);
  4659. }
  4660. }
  4661. };
  4662. module.exports = ReactChildReconciler;
  4663. },{"133":133,"149":149,"167":167,"89":89}],37:[function(_dereq_,module,exports){
  4664. /**
  4665. * Copyright 2013-2015, Facebook, Inc.
  4666. * All rights reserved.
  4667. *
  4668. * This source code is licensed under the BSD-style license found in the
  4669. * LICENSE file in the root directory of this source tree. An additional grant
  4670. * of patent rights can be found in the PATENTS file in the same directory.
  4671. *
  4672. * @providesModule ReactChildren
  4673. */
  4674. 'use strict';
  4675. var PooledClass = _dereq_(30);
  4676. var ReactFragment = _dereq_(69);
  4677. var traverseAllChildren = _dereq_(169);
  4678. var warning = _dereq_(171);
  4679. var twoArgumentPooler = PooledClass.twoArgumentPooler;
  4680. var threeArgumentPooler = PooledClass.threeArgumentPooler;
  4681. /**
  4682. * PooledClass representing the bookkeeping associated with performing a child
  4683. * traversal. Allows avoiding binding callbacks.
  4684. *
  4685. * @constructor ForEachBookKeeping
  4686. * @param {!function} forEachFunction Function to perform traversal with.
  4687. * @param {?*} forEachContext Context to perform context with.
  4688. */
  4689. function ForEachBookKeeping(forEachFunction, forEachContext) {
  4690. this.forEachFunction = forEachFunction;
  4691. this.forEachContext = forEachContext;
  4692. }
  4693. PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
  4694. function forEachSingleChild(traverseContext, child, name, i) {
  4695. var forEachBookKeeping = traverseContext;
  4696. forEachBookKeeping.forEachFunction.call(
  4697. forEachBookKeeping.forEachContext, child, i);
  4698. }
  4699. /**
  4700. * Iterates through children that are typically specified as `props.children`.
  4701. *
  4702. * The provided forEachFunc(child, index) will be called for each
  4703. * leaf child.
  4704. *
  4705. * @param {?*} children Children tree container.
  4706. * @param {function(*, int)} forEachFunc.
  4707. * @param {*} forEachContext Context for forEachContext.
  4708. */
  4709. function forEachChildren(children, forEachFunc, forEachContext) {
  4710. if (children == null) {
  4711. return children;
  4712. }
  4713. var traverseContext =
  4714. ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
  4715. traverseAllChildren(children, forEachSingleChild, traverseContext);
  4716. ForEachBookKeeping.release(traverseContext);
  4717. }
  4718. /**
  4719. * PooledClass representing the bookkeeping associated with performing a child
  4720. * mapping. Allows avoiding binding callbacks.
  4721. *
  4722. * @constructor MapBookKeeping
  4723. * @param {!*} mapResult Object containing the ordered map of results.
  4724. * @param {!function} mapFunction Function to perform mapping with.
  4725. * @param {?*} mapContext Context to perform mapping with.
  4726. */
  4727. function MapBookKeeping(mapResult, mapFunction, mapContext) {
  4728. this.mapResult = mapResult;
  4729. this.mapFunction = mapFunction;
  4730. this.mapContext = mapContext;
  4731. }
  4732. PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
  4733. function mapSingleChildIntoContext(traverseContext, child, name, i) {
  4734. var mapBookKeeping = traverseContext;
  4735. var mapResult = mapBookKeeping.mapResult;
  4736. var keyUnique = !mapResult.hasOwnProperty(name);
  4737. if ("production" !== "development") {
  4738. ("production" !== "development" ? warning(
  4739. keyUnique,
  4740. 'ReactChildren.map(...): Encountered two children with the same key, ' +
  4741. '`%s`. Child keys must be unique; when two children share a key, only ' +
  4742. 'the first child will be used.',
  4743. name
  4744. ) : null);
  4745. }
  4746. if (keyUnique) {
  4747. var mappedChild =
  4748. mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
  4749. mapResult[name] = mappedChild;
  4750. }
  4751. }
  4752. /**
  4753. * Maps children that are typically specified as `props.children`.
  4754. *
  4755. * The provided mapFunction(child, key, index) will be called for each
  4756. * leaf child.
  4757. *
  4758. * TODO: This may likely break any calls to `ReactChildren.map` that were
  4759. * previously relying on the fact that we guarded against null children.
  4760. *
  4761. * @param {?*} children Children tree container.
  4762. * @param {function(*, int)} mapFunction.
  4763. * @param {*} mapContext Context for mapFunction.
  4764. * @return {object} Object containing the ordered map of results.
  4765. */
  4766. function mapChildren(children, func, context) {
  4767. if (children == null) {
  4768. return children;
  4769. }
  4770. var mapResult = {};
  4771. var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
  4772. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  4773. MapBookKeeping.release(traverseContext);
  4774. return ReactFragment.create(mapResult);
  4775. }
  4776. function forEachSingleChildDummy(traverseContext, child, name, i) {
  4777. return null;
  4778. }
  4779. /**
  4780. * Count the number of children that are typically specified as
  4781. * `props.children`.
  4782. *
  4783. * @param {?*} children Children tree container.
  4784. * @return {number} The number of children.
  4785. */
  4786. function countChildren(children, context) {
  4787. return traverseAllChildren(children, forEachSingleChildDummy, null);
  4788. }
  4789. var ReactChildren = {
  4790. forEach: forEachChildren,
  4791. map: mapChildren,
  4792. count: countChildren
  4793. };
  4794. module.exports = ReactChildren;
  4795. },{"169":169,"171":171,"30":30,"69":69}],38:[function(_dereq_,module,exports){
  4796. /**
  4797. * Copyright 2013-2015, Facebook, Inc.
  4798. * All rights reserved.
  4799. *
  4800. * This source code is licensed under the BSD-style license found in the
  4801. * LICENSE file in the root directory of this source tree. An additional grant
  4802. * of patent rights can be found in the PATENTS file in the same directory.
  4803. *
  4804. * @providesModule ReactClass
  4805. */
  4806. 'use strict';
  4807. var ReactComponent = _dereq_(39);
  4808. var ReactCurrentOwner = _dereq_(45);
  4809. var ReactElement = _dereq_(63);
  4810. var ReactErrorUtils = _dereq_(66);
  4811. var ReactInstanceMap = _dereq_(73);
  4812. var ReactLifeCycle = _dereq_(74);
  4813. var ReactPropTypeLocations = _dereq_(85);
  4814. var ReactPropTypeLocationNames = _dereq_(84);
  4815. var ReactUpdateQueue = _dereq_(99);
  4816. var assign = _dereq_(29);
  4817. var invariant = _dereq_(150);
  4818. var keyMirror = _dereq_(156);
  4819. var keyOf = _dereq_(157);
  4820. var warning = _dereq_(171);
  4821. var MIXINS_KEY = keyOf({mixins: null});
  4822. /**
  4823. * Policies that describe methods in `ReactClassInterface`.
  4824. */
  4825. var SpecPolicy = keyMirror({
  4826. /**
  4827. * These methods may be defined only once by the class specification or mixin.
  4828. */
  4829. DEFINE_ONCE: null,
  4830. /**
  4831. * These methods may be defined by both the class specification and mixins.
  4832. * Subsequent definitions will be chained. These methods must return void.
  4833. */
  4834. DEFINE_MANY: null,
  4835. /**
  4836. * These methods are overriding the base class.
  4837. */
  4838. OVERRIDE_BASE: null,
  4839. /**
  4840. * These methods are similar to DEFINE_MANY, except we assume they return
  4841. * objects. We try to merge the keys of the return values of all the mixed in
  4842. * functions. If there is a key conflict we throw.
  4843. */
  4844. DEFINE_MANY_MERGED: null
  4845. });
  4846. var injectedMixins = [];
  4847. /**
  4848. * Composite components are higher-level components that compose other composite
  4849. * or native components.
  4850. *
  4851. * To create a new type of `ReactClass`, pass a specification of
  4852. * your new class to `React.createClass`. The only requirement of your class
  4853. * specification is that you implement a `render` method.
  4854. *
  4855. * var MyComponent = React.createClass({
  4856. * render: function() {
  4857. * return <div>Hello World</div>;
  4858. * }
  4859. * });
  4860. *
  4861. * The class specification supports a specific protocol of methods that have
  4862. * special meaning (e.g. `render`). See `ReactClassInterface` for
  4863. * more the comprehensive protocol. Any other properties and methods in the
  4864. * class specification will available on the prototype.
  4865. *
  4866. * @interface ReactClassInterface
  4867. * @internal
  4868. */
  4869. var ReactClassInterface = {
  4870. /**
  4871. * An array of Mixin objects to include when defining your component.
  4872. *
  4873. * @type {array}
  4874. * @optional
  4875. */
  4876. mixins: SpecPolicy.DEFINE_MANY,
  4877. /**
  4878. * An object containing properties and methods that should be defined on
  4879. * the component's constructor instead of its prototype (static methods).
  4880. *
  4881. * @type {object}
  4882. * @optional
  4883. */
  4884. statics: SpecPolicy.DEFINE_MANY,
  4885. /**
  4886. * Definition of prop types for this component.
  4887. *
  4888. * @type {object}
  4889. * @optional
  4890. */
  4891. propTypes: SpecPolicy.DEFINE_MANY,
  4892. /**
  4893. * Definition of context types for this component.
  4894. *
  4895. * @type {object}
  4896. * @optional
  4897. */
  4898. contextTypes: SpecPolicy.DEFINE_MANY,
  4899. /**
  4900. * Definition of context types this component sets for its children.
  4901. *
  4902. * @type {object}
  4903. * @optional
  4904. */
  4905. childContextTypes: SpecPolicy.DEFINE_MANY,
  4906. // ==== Definition methods ====
  4907. /**
  4908. * Invoked when the component is mounted. Values in the mapping will be set on
  4909. * `this.props` if that prop is not specified (i.e. using an `in` check).
  4910. *
  4911. * This method is invoked before `getInitialState` and therefore cannot rely
  4912. * on `this.state` or use `this.setState`.
  4913. *
  4914. * @return {object}
  4915. * @optional
  4916. */
  4917. getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
  4918. /**
  4919. * Invoked once before the component is mounted. The return value will be used
  4920. * as the initial value of `this.state`.
  4921. *
  4922. * getInitialState: function() {
  4923. * return {
  4924. * isOn: false,
  4925. * fooBaz: new BazFoo()
  4926. * }
  4927. * }
  4928. *
  4929. * @return {object}
  4930. * @optional
  4931. */
  4932. getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
  4933. /**
  4934. * @return {object}
  4935. * @optional
  4936. */
  4937. getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
  4938. /**
  4939. * Uses props from `this.props` and state from `this.state` to render the
  4940. * structure of the component.
  4941. *
  4942. * No guarantees are made about when or how often this method is invoked, so
  4943. * it must not have side effects.
  4944. *
  4945. * render: function() {
  4946. * var name = this.props.name;
  4947. * return <div>Hello, {name}!</div>;
  4948. * }
  4949. *
  4950. * @return {ReactComponent}
  4951. * @nosideeffects
  4952. * @required
  4953. */
  4954. render: SpecPolicy.DEFINE_ONCE,
  4955. // ==== Delegate methods ====
  4956. /**
  4957. * Invoked when the component is initially created and about to be mounted.
  4958. * This may have side effects, but any external subscriptions or data created
  4959. * by this method must be cleaned up in `componentWillUnmount`.
  4960. *
  4961. * @optional
  4962. */
  4963. componentWillMount: SpecPolicy.DEFINE_MANY,
  4964. /**
  4965. * Invoked when the component has been mounted and has a DOM representation.
  4966. * However, there is no guarantee that the DOM node is in the document.
  4967. *
  4968. * Use this as an opportunity to operate on the DOM when the component has
  4969. * been mounted (initialized and rendered) for the first time.
  4970. *
  4971. * @param {DOMElement} rootNode DOM element representing the component.
  4972. * @optional
  4973. */
  4974. componentDidMount: SpecPolicy.DEFINE_MANY,
  4975. /**
  4976. * Invoked before the component receives new props.
  4977. *
  4978. * Use this as an opportunity to react to a prop transition by updating the
  4979. * state using `this.setState`. Current props are accessed via `this.props`.
  4980. *
  4981. * componentWillReceiveProps: function(nextProps, nextContext) {
  4982. * this.setState({
  4983. * likesIncreasing: nextProps.likeCount > this.props.likeCount
  4984. * });
  4985. * }
  4986. *
  4987. * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
  4988. * transition may cause a state change, but the opposite is not true. If you
  4989. * need it, you are probably looking for `componentWillUpdate`.
  4990. *
  4991. * @param {object} nextProps
  4992. * @optional
  4993. */
  4994. componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
  4995. /**
  4996. * Invoked while deciding if the component should be updated as a result of
  4997. * receiving new props, state and/or context.
  4998. *
  4999. * Use this as an opportunity to `return false` when you're certain that the
  5000. * transition to the new props/state/context will not require a component
  5001. * update.
  5002. *
  5003. * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
  5004. * return !equal(nextProps, this.props) ||
  5005. * !equal(nextState, this.state) ||
  5006. * !equal(nextContext, this.context);
  5007. * }
  5008. *
  5009. * @param {object} nextProps
  5010. * @param {?object} nextState
  5011. * @param {?object} nextContext
  5012. * @return {boolean} True if the component should update.
  5013. * @optional
  5014. */
  5015. shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
  5016. /**
  5017. * Invoked when the component is about to update due to a transition from
  5018. * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
  5019. * and `nextContext`.
  5020. *
  5021. * Use this as an opportunity to perform preparation before an update occurs.
  5022. *
  5023. * NOTE: You **cannot** use `this.setState()` in this method.
  5024. *
  5025. * @param {object} nextProps
  5026. * @param {?object} nextState
  5027. * @param {?object} nextContext
  5028. * @param {ReactReconcileTransaction} transaction
  5029. * @optional
  5030. */
  5031. componentWillUpdate: SpecPolicy.DEFINE_MANY,
  5032. /**
  5033. * Invoked when the component's DOM representation has been updated.
  5034. *
  5035. * Use this as an opportunity to operate on the DOM when the component has
  5036. * been updated.
  5037. *
  5038. * @param {object} prevProps
  5039. * @param {?object} prevState
  5040. * @param {?object} prevContext
  5041. * @param {DOMElement} rootNode DOM element representing the component.
  5042. * @optional
  5043. */
  5044. componentDidUpdate: SpecPolicy.DEFINE_MANY,
  5045. /**
  5046. * Invoked when the component is about to be removed from its parent and have
  5047. * its DOM representation destroyed.
  5048. *
  5049. * Use this as an opportunity to deallocate any external resources.
  5050. *
  5051. * NOTE: There is no `componentDidUnmount` since your component will have been
  5052. * destroyed by that point.
  5053. *
  5054. * @optional
  5055. */
  5056. componentWillUnmount: SpecPolicy.DEFINE_MANY,
  5057. // ==== Advanced methods ====
  5058. /**
  5059. * Updates the component's currently mounted DOM representation.
  5060. *
  5061. * By default, this implements React's rendering and reconciliation algorithm.
  5062. * Sophisticated clients may wish to override this.
  5063. *
  5064. * @param {ReactReconcileTransaction} transaction
  5065. * @internal
  5066. * @overridable
  5067. */
  5068. updateComponent: SpecPolicy.OVERRIDE_BASE
  5069. };
  5070. /**
  5071. * Mapping from class specification keys to special processing functions.
  5072. *
  5073. * Although these are declared like instance properties in the specification
  5074. * when defining classes using `React.createClass`, they are actually static
  5075. * and are accessible on the constructor instead of the prototype. Despite
  5076. * being static, they must be defined outside of the "statics" key under
  5077. * which all other static methods are defined.
  5078. */
  5079. var RESERVED_SPEC_KEYS = {
  5080. displayName: function(Constructor, displayName) {
  5081. Constructor.displayName = displayName;
  5082. },
  5083. mixins: function(Constructor, mixins) {
  5084. if (mixins) {
  5085. for (var i = 0; i < mixins.length; i++) {
  5086. mixSpecIntoComponent(Constructor, mixins[i]);
  5087. }
  5088. }
  5089. },
  5090. childContextTypes: function(Constructor, childContextTypes) {
  5091. if ("production" !== "development") {
  5092. validateTypeDef(
  5093. Constructor,
  5094. childContextTypes,
  5095. ReactPropTypeLocations.childContext
  5096. );
  5097. }
  5098. Constructor.childContextTypes = assign(
  5099. {},
  5100. Constructor.childContextTypes,
  5101. childContextTypes
  5102. );
  5103. },
  5104. contextTypes: function(Constructor, contextTypes) {
  5105. if ("production" !== "development") {
  5106. validateTypeDef(
  5107. Constructor,
  5108. contextTypes,
  5109. ReactPropTypeLocations.context
  5110. );
  5111. }
  5112. Constructor.contextTypes = assign(
  5113. {},
  5114. Constructor.contextTypes,
  5115. contextTypes
  5116. );
  5117. },
  5118. /**
  5119. * Special case getDefaultProps which should move into statics but requires
  5120. * automatic merging.
  5121. */
  5122. getDefaultProps: function(Constructor, getDefaultProps) {
  5123. if (Constructor.getDefaultProps) {
  5124. Constructor.getDefaultProps = createMergedResultFunction(
  5125. Constructor.getDefaultProps,
  5126. getDefaultProps
  5127. );
  5128. } else {
  5129. Constructor.getDefaultProps = getDefaultProps;
  5130. }
  5131. },
  5132. propTypes: function(Constructor, propTypes) {
  5133. if ("production" !== "development") {
  5134. validateTypeDef(
  5135. Constructor,
  5136. propTypes,
  5137. ReactPropTypeLocations.prop
  5138. );
  5139. }
  5140. Constructor.propTypes = assign(
  5141. {},
  5142. Constructor.propTypes,
  5143. propTypes
  5144. );
  5145. },
  5146. statics: function(Constructor, statics) {
  5147. mixStaticSpecIntoComponent(Constructor, statics);
  5148. }
  5149. };
  5150. function validateTypeDef(Constructor, typeDef, location) {
  5151. for (var propName in typeDef) {
  5152. if (typeDef.hasOwnProperty(propName)) {
  5153. // use a warning instead of an invariant so components
  5154. // don't show up in prod but not in __DEV__
  5155. ("production" !== "development" ? warning(
  5156. typeof typeDef[propName] === 'function',
  5157. '%s: %s type `%s` is invalid; it must be a function, usually from ' +
  5158. 'React.PropTypes.',
  5159. Constructor.displayName || 'ReactClass',
  5160. ReactPropTypeLocationNames[location],
  5161. propName
  5162. ) : null);
  5163. }
  5164. }
  5165. }
  5166. function validateMethodOverride(proto, name) {
  5167. var specPolicy = ReactClassInterface.hasOwnProperty(name) ?
  5168. ReactClassInterface[name] :
  5169. null;
  5170. // Disallow overriding of base class methods unless explicitly allowed.
  5171. if (ReactClassMixin.hasOwnProperty(name)) {
  5172. ("production" !== "development" ? invariant(
  5173. specPolicy === SpecPolicy.OVERRIDE_BASE,
  5174. 'ReactClassInterface: You are attempting to override ' +
  5175. '`%s` from your class specification. Ensure that your method names ' +
  5176. 'do not overlap with React methods.',
  5177. name
  5178. ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
  5179. }
  5180. // Disallow defining methods more than once unless explicitly allowed.
  5181. if (proto.hasOwnProperty(name)) {
  5182. ("production" !== "development" ? invariant(
  5183. specPolicy === SpecPolicy.DEFINE_MANY ||
  5184. specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
  5185. 'ReactClassInterface: You are attempting to define ' +
  5186. '`%s` on your component more than once. This conflict may be due ' +
  5187. 'to a mixin.',
  5188. name
  5189. ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
  5190. specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
  5191. }
  5192. }
  5193. /**
  5194. * Mixin helper which handles policy validation and reserved
  5195. * specification keys when building React classses.
  5196. */
  5197. function mixSpecIntoComponent(Constructor, spec) {
  5198. if (!spec) {
  5199. return;
  5200. }
  5201. ("production" !== "development" ? invariant(
  5202. typeof spec !== 'function',
  5203. 'ReactClass: You\'re attempting to ' +
  5204. 'use a component class as a mixin. Instead, just use a regular object.'
  5205. ) : invariant(typeof spec !== 'function'));
  5206. ("production" !== "development" ? invariant(
  5207. !ReactElement.isValidElement(spec),
  5208. 'ReactClass: You\'re attempting to ' +
  5209. 'use a component as a mixin. Instead, just use a regular object.'
  5210. ) : invariant(!ReactElement.isValidElement(spec)));
  5211. var proto = Constructor.prototype;
  5212. // By handling mixins before any other properties, we ensure the same
  5213. // chaining order is applied to methods with DEFINE_MANY policy, whether
  5214. // mixins are listed before or after these methods in the spec.
  5215. if (spec.hasOwnProperty(MIXINS_KEY)) {
  5216. RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
  5217. }
  5218. for (var name in spec) {
  5219. if (!spec.hasOwnProperty(name)) {
  5220. continue;
  5221. }
  5222. if (name === MIXINS_KEY) {
  5223. // We have already handled mixins in a special case above
  5224. continue;
  5225. }
  5226. var property = spec[name];
  5227. validateMethodOverride(proto, name);
  5228. if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
  5229. RESERVED_SPEC_KEYS[name](Constructor, property);
  5230. } else {
  5231. // Setup methods on prototype:
  5232. // The following member methods should not be automatically bound:
  5233. // 1. Expected ReactClass methods (in the "interface").
  5234. // 2. Overridden methods (that were mixed in).
  5235. var isReactClassMethod =
  5236. ReactClassInterface.hasOwnProperty(name);
  5237. var isAlreadyDefined = proto.hasOwnProperty(name);
  5238. var markedDontBind = property && property.__reactDontBind;
  5239. var isFunction = typeof property === 'function';
  5240. var shouldAutoBind =
  5241. isFunction &&
  5242. !isReactClassMethod &&
  5243. !isAlreadyDefined &&
  5244. !markedDontBind;
  5245. if (shouldAutoBind) {
  5246. if (!proto.__reactAutoBindMap) {
  5247. proto.__reactAutoBindMap = {};
  5248. }
  5249. proto.__reactAutoBindMap[name] = property;
  5250. proto[name] = property;
  5251. } else {
  5252. if (isAlreadyDefined) {
  5253. var specPolicy = ReactClassInterface[name];
  5254. // These cases should already be caught by validateMethodOverride
  5255. ("production" !== "development" ? invariant(
  5256. isReactClassMethod && (
  5257. (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
  5258. ),
  5259. 'ReactClass: Unexpected spec policy %s for key %s ' +
  5260. 'when mixing in component specs.',
  5261. specPolicy,
  5262. name
  5263. ) : invariant(isReactClassMethod && (
  5264. (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
  5265. )));
  5266. // For methods which are defined more than once, call the existing
  5267. // methods before calling the new property, merging if appropriate.
  5268. if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
  5269. proto[name] = createMergedResultFunction(proto[name], property);
  5270. } else if (specPolicy === SpecPolicy.DEFINE_MANY) {
  5271. proto[name] = createChainedFunction(proto[name], property);
  5272. }
  5273. } else {
  5274. proto[name] = property;
  5275. if ("production" !== "development") {
  5276. // Add verbose displayName to the function, which helps when looking
  5277. // at profiling tools.
  5278. if (typeof property === 'function' && spec.displayName) {
  5279. proto[name].displayName = spec.displayName + '_' + name;
  5280. }
  5281. }
  5282. }
  5283. }
  5284. }
  5285. }
  5286. }
  5287. function mixStaticSpecIntoComponent(Constructor, statics) {
  5288. if (!statics) {
  5289. return;
  5290. }
  5291. for (var name in statics) {
  5292. var property = statics[name];
  5293. if (!statics.hasOwnProperty(name)) {
  5294. continue;
  5295. }
  5296. var isReserved = name in RESERVED_SPEC_KEYS;
  5297. ("production" !== "development" ? invariant(
  5298. !isReserved,
  5299. 'ReactClass: You are attempting to define a reserved ' +
  5300. 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
  5301. 'as an instance property instead; it will still be accessible on the ' +
  5302. 'constructor.',
  5303. name
  5304. ) : invariant(!isReserved));
  5305. var isInherited = name in Constructor;
  5306. ("production" !== "development" ? invariant(
  5307. !isInherited,
  5308. 'ReactClass: You are attempting to define ' +
  5309. '`%s` on your component more than once. This conflict may be ' +
  5310. 'due to a mixin.',
  5311. name
  5312. ) : invariant(!isInherited));
  5313. Constructor[name] = property;
  5314. }
  5315. }
  5316. /**
  5317. * Merge two objects, but throw if both contain the same key.
  5318. *
  5319. * @param {object} one The first object, which is mutated.
  5320. * @param {object} two The second object
  5321. * @return {object} one after it has been mutated to contain everything in two.
  5322. */
  5323. function mergeIntoWithNoDuplicateKeys(one, two) {
  5324. ("production" !== "development" ? invariant(
  5325. one && two && typeof one === 'object' && typeof two === 'object',
  5326. 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
  5327. ) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));
  5328. for (var key in two) {
  5329. if (two.hasOwnProperty(key)) {
  5330. ("production" !== "development" ? invariant(
  5331. one[key] === undefined,
  5332. 'mergeIntoWithNoDuplicateKeys(): ' +
  5333. 'Tried to merge two objects with the same key: `%s`. This conflict ' +
  5334. 'may be due to a mixin; in particular, this may be caused by two ' +
  5335. 'getInitialState() or getDefaultProps() methods returning objects ' +
  5336. 'with clashing keys.',
  5337. key
  5338. ) : invariant(one[key] === undefined));
  5339. one[key] = two[key];
  5340. }
  5341. }
  5342. return one;
  5343. }
  5344. /**
  5345. * Creates a function that invokes two functions and merges their return values.
  5346. *
  5347. * @param {function} one Function to invoke first.
  5348. * @param {function} two Function to invoke second.
  5349. * @return {function} Function that invokes the two argument functions.
  5350. * @private
  5351. */
  5352. function createMergedResultFunction(one, two) {
  5353. return function mergedResult() {
  5354. var a = one.apply(this, arguments);
  5355. var b = two.apply(this, arguments);
  5356. if (a == null) {
  5357. return b;
  5358. } else if (b == null) {
  5359. return a;
  5360. }
  5361. var c = {};
  5362. mergeIntoWithNoDuplicateKeys(c, a);
  5363. mergeIntoWithNoDuplicateKeys(c, b);
  5364. return c;
  5365. };
  5366. }
  5367. /**
  5368. * Creates a function that invokes two functions and ignores their return vales.
  5369. *
  5370. * @param {function} one Function to invoke first.
  5371. * @param {function} two Function to invoke second.
  5372. * @return {function} Function that invokes the two argument functions.
  5373. * @private
  5374. */
  5375. function createChainedFunction(one, two) {
  5376. return function chainedFunction() {
  5377. one.apply(this, arguments);
  5378. two.apply(this, arguments);
  5379. };
  5380. }
  5381. /**
  5382. * Binds a method to the component.
  5383. *
  5384. * @param {object} component Component whose method is going to be bound.
  5385. * @param {function} method Method to be bound.
  5386. * @return {function} The bound method.
  5387. */
  5388. function bindAutoBindMethod(component, method) {
  5389. var boundMethod = method.bind(component);
  5390. if ("production" !== "development") {
  5391. boundMethod.__reactBoundContext = component;
  5392. boundMethod.__reactBoundMethod = method;
  5393. boundMethod.__reactBoundArguments = null;
  5394. var componentName = component.constructor.displayName;
  5395. var _bind = boundMethod.bind;
  5396. /* eslint-disable block-scoped-var, no-undef */
  5397. boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  5398. // User is trying to bind() an autobound method; we effectively will
  5399. // ignore the value of "this" that the user is trying to use, so
  5400. // let's warn.
  5401. if (newThis !== component && newThis !== null) {
  5402. ("production" !== "development" ? warning(
  5403. false,
  5404. 'bind(): React component methods may only be bound to the ' +
  5405. 'component instance. See %s',
  5406. componentName
  5407. ) : null);
  5408. } else if (!args.length) {
  5409. ("production" !== "development" ? warning(
  5410. false,
  5411. 'bind(): You are binding a component method to the component. ' +
  5412. 'React does this for you automatically in a high-performance ' +
  5413. 'way, so you can safely remove this call. See %s',
  5414. componentName
  5415. ) : null);
  5416. return boundMethod;
  5417. }
  5418. var reboundMethod = _bind.apply(boundMethod, arguments);
  5419. reboundMethod.__reactBoundContext = component;
  5420. reboundMethod.__reactBoundMethod = method;
  5421. reboundMethod.__reactBoundArguments = args;
  5422. return reboundMethod;
  5423. /* eslint-enable */
  5424. };
  5425. }
  5426. return boundMethod;
  5427. }
  5428. /**
  5429. * Binds all auto-bound methods in a component.
  5430. *
  5431. * @param {object} component Component whose method is going to be bound.
  5432. */
  5433. function bindAutoBindMethods(component) {
  5434. for (var autoBindKey in component.__reactAutoBindMap) {
  5435. if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
  5436. var method = component.__reactAutoBindMap[autoBindKey];
  5437. component[autoBindKey] = bindAutoBindMethod(
  5438. component,
  5439. ReactErrorUtils.guard(
  5440. method,
  5441. component.constructor.displayName + '.' + autoBindKey
  5442. )
  5443. );
  5444. }
  5445. }
  5446. }
  5447. var typeDeprecationDescriptor = {
  5448. enumerable: false,
  5449. get: function() {
  5450. var displayName = this.displayName || this.name || 'Component';
  5451. ("production" !== "development" ? warning(
  5452. false,
  5453. '%s.type is deprecated. Use %s directly to access the class.',
  5454. displayName,
  5455. displayName
  5456. ) : null);
  5457. Object.defineProperty(this, 'type', {
  5458. value: this
  5459. });
  5460. return this;
  5461. }
  5462. };
  5463. /**
  5464. * Add more to the ReactClass base class. These are all legacy features and
  5465. * therefore not already part of the modern ReactComponent.
  5466. */
  5467. var ReactClassMixin = {
  5468. /**
  5469. * TODO: This will be deprecated because state should always keep a consistent
  5470. * type signature and the only use case for this, is to avoid that.
  5471. */
  5472. replaceState: function(newState, callback) {
  5473. ReactUpdateQueue.enqueueReplaceState(this, newState);
  5474. if (callback) {
  5475. ReactUpdateQueue.enqueueCallback(this, callback);
  5476. }
  5477. },
  5478. /**
  5479. * Checks whether or not this composite component is mounted.
  5480. * @return {boolean} True if mounted, false otherwise.
  5481. * @protected
  5482. * @final
  5483. */
  5484. isMounted: function() {
  5485. if ("production" !== "development") {
  5486. var owner = ReactCurrentOwner.current;
  5487. if (owner !== null) {
  5488. ("production" !== "development" ? warning(
  5489. owner._warnedAboutRefsInRender,
  5490. '%s is accessing isMounted inside its render() function. ' +
  5491. 'render() should be a pure function of props and state. It should ' +
  5492. 'never access something that requires stale data from the previous ' +
  5493. 'render, such as refs. Move this logic to componentDidMount and ' +
  5494. 'componentDidUpdate instead.',
  5495. owner.getName() || 'A component'
  5496. ) : null);
  5497. owner._warnedAboutRefsInRender = true;
  5498. }
  5499. }
  5500. var internalInstance = ReactInstanceMap.get(this);
  5501. return (
  5502. internalInstance &&
  5503. internalInstance !== ReactLifeCycle.currentlyMountingInstance
  5504. );
  5505. },
  5506. /**
  5507. * Sets a subset of the props.
  5508. *
  5509. * @param {object} partialProps Subset of the next props.
  5510. * @param {?function} callback Called after props are updated.
  5511. * @final
  5512. * @public
  5513. * @deprecated
  5514. */
  5515. setProps: function(partialProps, callback) {
  5516. ReactUpdateQueue.enqueueSetProps(this, partialProps);
  5517. if (callback) {
  5518. ReactUpdateQueue.enqueueCallback(this, callback);
  5519. }
  5520. },
  5521. /**
  5522. * Replace all the props.
  5523. *
  5524. * @param {object} newProps Subset of the next props.
  5525. * @param {?function} callback Called after props are updated.
  5526. * @final
  5527. * @public
  5528. * @deprecated
  5529. */
  5530. replaceProps: function(newProps, callback) {
  5531. ReactUpdateQueue.enqueueReplaceProps(this, newProps);
  5532. if (callback) {
  5533. ReactUpdateQueue.enqueueCallback(this, callback);
  5534. }
  5535. }
  5536. };
  5537. var ReactClassComponent = function() {};
  5538. assign(
  5539. ReactClassComponent.prototype,
  5540. ReactComponent.prototype,
  5541. ReactClassMixin
  5542. );
  5543. /**
  5544. * Module for creating composite components.
  5545. *
  5546. * @class ReactClass
  5547. */
  5548. var ReactClass = {
  5549. /**
  5550. * Creates a composite component class given a class specification.
  5551. *
  5552. * @param {object} spec Class specification (which must define `render`).
  5553. * @return {function} Component constructor function.
  5554. * @public
  5555. */
  5556. createClass: function(spec) {
  5557. var Constructor = function(props, context) {
  5558. // This constructor is overridden by mocks. The argument is used
  5559. // by mocks to assert on what gets mounted.
  5560. if ("production" !== "development") {
  5561. ("production" !== "development" ? warning(
  5562. this instanceof Constructor,
  5563. 'Something is calling a React component directly. Use a factory or ' +
  5564. 'JSX instead. See: https://fb.me/react-legacyfactory'
  5565. ) : null);
  5566. }
  5567. // Wire up auto-binding
  5568. if (this.__reactAutoBindMap) {
  5569. bindAutoBindMethods(this);
  5570. }
  5571. this.props = props;
  5572. this.context = context;
  5573. this.state = null;
  5574. // ReactClasses doesn't have constructors. Instead, they use the
  5575. // getInitialState and componentWillMount methods for initialization.
  5576. var initialState = this.getInitialState ? this.getInitialState() : null;
  5577. if ("production" !== "development") {
  5578. // We allow auto-mocks to proceed as if they're returning null.
  5579. if (typeof initialState === 'undefined' &&
  5580. this.getInitialState._isMockFunction) {
  5581. // This is probably bad practice. Consider warning here and
  5582. // deprecating this convenience.
  5583. initialState = null;
  5584. }
  5585. }
  5586. ("production" !== "development" ? invariant(
  5587. typeof initialState === 'object' && !Array.isArray(initialState),
  5588. '%s.getInitialState(): must return an object or null',
  5589. Constructor.displayName || 'ReactCompositeComponent'
  5590. ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
  5591. this.state = initialState;
  5592. };
  5593. Constructor.prototype = new ReactClassComponent();
  5594. Constructor.prototype.constructor = Constructor;
  5595. injectedMixins.forEach(
  5596. mixSpecIntoComponent.bind(null, Constructor)
  5597. );
  5598. mixSpecIntoComponent(Constructor, spec);
  5599. // Initialize the defaultProps property after all mixins have been merged
  5600. if (Constructor.getDefaultProps) {
  5601. Constructor.defaultProps = Constructor.getDefaultProps();
  5602. }
  5603. if ("production" !== "development") {
  5604. // This is a tag to indicate that the use of these method names is ok,
  5605. // since it's used with createClass. If it's not, then it's likely a
  5606. // mistake so we'll warn you to use the static property, property
  5607. // initializer or constructor respectively.
  5608. if (Constructor.getDefaultProps) {
  5609. Constructor.getDefaultProps.isReactClassApproved = {};
  5610. }
  5611. if (Constructor.prototype.getInitialState) {
  5612. Constructor.prototype.getInitialState.isReactClassApproved = {};
  5613. }
  5614. }
  5615. ("production" !== "development" ? invariant(
  5616. Constructor.prototype.render,
  5617. 'createClass(...): Class specification must implement a `render` method.'
  5618. ) : invariant(Constructor.prototype.render));
  5619. if ("production" !== "development") {
  5620. ("production" !== "development" ? warning(
  5621. !Constructor.prototype.componentShouldUpdate,
  5622. '%s has a method called ' +
  5623. 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
  5624. 'The name is phrased as a question because the function is ' +
  5625. 'expected to return a value.',
  5626. spec.displayName || 'A component'
  5627. ) : null);
  5628. }
  5629. // Reduce time spent doing lookups by setting these on the prototype.
  5630. for (var methodName in ReactClassInterface) {
  5631. if (!Constructor.prototype[methodName]) {
  5632. Constructor.prototype[methodName] = null;
  5633. }
  5634. }
  5635. // Legacy hook
  5636. Constructor.type = Constructor;
  5637. if ("production" !== "development") {
  5638. try {
  5639. Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);
  5640. } catch (x) {
  5641. // IE will fail on defineProperty (es5-shim/sham too)
  5642. }
  5643. }
  5644. return Constructor;
  5645. },
  5646. injection: {
  5647. injectMixin: function(mixin) {
  5648. injectedMixins.push(mixin);
  5649. }
  5650. }
  5651. };
  5652. module.exports = ReactClass;
  5653. },{"150":150,"156":156,"157":157,"171":171,"29":29,"39":39,"45":45,"63":63,"66":66,"73":73,"74":74,"84":84,"85":85,"99":99}],39:[function(_dereq_,module,exports){
  5654. /**
  5655. * Copyright 2013-2015, Facebook, Inc.
  5656. * All rights reserved.
  5657. *
  5658. * This source code is licensed under the BSD-style license found in the
  5659. * LICENSE file in the root directory of this source tree. An additional grant
  5660. * of patent rights can be found in the PATENTS file in the same directory.
  5661. *
  5662. * @providesModule ReactComponent
  5663. */
  5664. 'use strict';
  5665. var ReactUpdateQueue = _dereq_(99);
  5666. var invariant = _dereq_(150);
  5667. var warning = _dereq_(171);
  5668. /**
  5669. * Base class helpers for the updating state of a component.
  5670. */
  5671. function ReactComponent(props, context) {
  5672. this.props = props;
  5673. this.context = context;
  5674. }
  5675. /**
  5676. * Sets a subset of the state. Always use this to mutate
  5677. * state. You should treat `this.state` as immutable.
  5678. *
  5679. * There is no guarantee that `this.state` will be immediately updated, so
  5680. * accessing `this.state` after calling this method may return the old value.
  5681. *
  5682. * There is no guarantee that calls to `setState` will run synchronously,
  5683. * as they may eventually be batched together. You can provide an optional
  5684. * callback that will be executed when the call to setState is actually
  5685. * completed.
  5686. *
  5687. * When a function is provided to setState, it will be called at some point in
  5688. * the future (not synchronously). It will be called with the up to date
  5689. * component arguments (state, props, context). These values can be different
  5690. * from this.* because your function may be called after receiveProps but before
  5691. * shouldComponentUpdate, and this new state, props, and context will not yet be
  5692. * assigned to this.
  5693. *
  5694. * @param {object|function} partialState Next partial state or function to
  5695. * produce next partial state to be merged with current state.
  5696. * @param {?function} callback Called after state is updated.
  5697. * @final
  5698. * @protected
  5699. */
  5700. ReactComponent.prototype.setState = function(partialState, callback) {
  5701. ("production" !== "development" ? invariant(
  5702. typeof partialState === 'object' ||
  5703. typeof partialState === 'function' ||
  5704. partialState == null,
  5705. 'setState(...): takes an object of state variables to update or a ' +
  5706. 'function which returns an object of state variables.'
  5707. ) : invariant(typeof partialState === 'object' ||
  5708. typeof partialState === 'function' ||
  5709. partialState == null));
  5710. if ("production" !== "development") {
  5711. ("production" !== "development" ? warning(
  5712. partialState != null,
  5713. 'setState(...): You passed an undefined or null state object; ' +
  5714. 'instead, use forceUpdate().'
  5715. ) : null);
  5716. }
  5717. ReactUpdateQueue.enqueueSetState(this, partialState);
  5718. if (callback) {
  5719. ReactUpdateQueue.enqueueCallback(this, callback);
  5720. }
  5721. };
  5722. /**
  5723. * Forces an update. This should only be invoked when it is known with
  5724. * certainty that we are **not** in a DOM transaction.
  5725. *
  5726. * You may want to call this when you know that some deeper aspect of the
  5727. * component's state has changed but `setState` was not called.
  5728. *
  5729. * This will not invoke `shouldComponentUpdate`, but it will invoke
  5730. * `componentWillUpdate` and `componentDidUpdate`.
  5731. *
  5732. * @param {?function} callback Called after update is complete.
  5733. * @final
  5734. * @protected
  5735. */
  5736. ReactComponent.prototype.forceUpdate = function(callback) {
  5737. ReactUpdateQueue.enqueueForceUpdate(this);
  5738. if (callback) {
  5739. ReactUpdateQueue.enqueueCallback(this, callback);
  5740. }
  5741. };
  5742. /**
  5743. * Deprecated APIs. These APIs used to exist on classic React classes but since
  5744. * we would like to deprecate them, we're not going to move them over to this
  5745. * modern base class. Instead, we define a getter that warns if it's accessed.
  5746. */
  5747. if ("production" !== "development") {
  5748. var deprecatedAPIs = {
  5749. getDOMNode: [
  5750. 'getDOMNode',
  5751. 'Use React.findDOMNode(component) instead.'
  5752. ],
  5753. isMounted: [
  5754. 'isMounted',
  5755. 'Instead, make sure to clean up subscriptions and pending requests in ' +
  5756. 'componentWillUnmount to prevent memory leaks.'
  5757. ],
  5758. replaceProps: [
  5759. 'replaceProps',
  5760. 'Instead call React.render again at the top level.'
  5761. ],
  5762. replaceState: [
  5763. 'replaceState',
  5764. 'Refactor your code to use setState instead (see ' +
  5765. 'https://github.com/facebook/react/issues/3236).'
  5766. ],
  5767. setProps: [
  5768. 'setProps',
  5769. 'Instead call React.render again at the top level.'
  5770. ]
  5771. };
  5772. var defineDeprecationWarning = function(methodName, info) {
  5773. try {
  5774. Object.defineProperty(ReactComponent.prototype, methodName, {
  5775. get: function() {
  5776. ("production" !== "development" ? warning(
  5777. false,
  5778. '%s(...) is deprecated in plain JavaScript React classes. %s',
  5779. info[0],
  5780. info[1]
  5781. ) : null);
  5782. return undefined;
  5783. }
  5784. });
  5785. } catch (x) {
  5786. // IE will fail on defineProperty (es5-shim/sham too)
  5787. }
  5788. };
  5789. for (var fnName in deprecatedAPIs) {
  5790. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  5791. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  5792. }
  5793. }
  5794. }
  5795. module.exports = ReactComponent;
  5796. },{"150":150,"171":171,"99":99}],40:[function(_dereq_,module,exports){
  5797. /**
  5798. * Copyright 2013-2015, Facebook, Inc.
  5799. * All rights reserved.
  5800. *
  5801. * This source code is licensed under the BSD-style license found in the
  5802. * LICENSE file in the root directory of this source tree. An additional grant
  5803. * of patent rights can be found in the PATENTS file in the same directory.
  5804. *
  5805. * @providesModule ReactComponentBrowserEnvironment
  5806. */
  5807. /*jslint evil: true */
  5808. 'use strict';
  5809. var ReactDOMIDOperations = _dereq_(50);
  5810. var ReactMount = _dereq_(77);
  5811. /**
  5812. * Abstracts away all functionality of the reconciler that requires knowledge of
  5813. * the browser context. TODO: These callers should be refactored to avoid the
  5814. * need for this injection.
  5815. */
  5816. var ReactComponentBrowserEnvironment = {
  5817. processChildrenUpdates:
  5818. ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
  5819. replaceNodeWithMarkupByID:
  5820. ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
  5821. /**
  5822. * If a particular environment requires that some resources be cleaned up,
  5823. * specify this in the injected Mixin. In the DOM, we would likely want to
  5824. * purge any cached node ID lookups.
  5825. *
  5826. * @private
  5827. */
  5828. unmountIDFromEnvironment: function(rootNodeID) {
  5829. ReactMount.purgeID(rootNodeID);
  5830. }
  5831. };
  5832. module.exports = ReactComponentBrowserEnvironment;
  5833. },{"50":50,"77":77}],41:[function(_dereq_,module,exports){
  5834. /**
  5835. * Copyright 2014-2015, Facebook, Inc.
  5836. * All rights reserved.
  5837. *
  5838. * This source code is licensed under the BSD-style license found in the
  5839. * LICENSE file in the root directory of this source tree. An additional grant
  5840. * of patent rights can be found in the PATENTS file in the same directory.
  5841. *
  5842. * @providesModule ReactComponentEnvironment
  5843. */
  5844. 'use strict';
  5845. var invariant = _dereq_(150);
  5846. var injected = false;
  5847. var ReactComponentEnvironment = {
  5848. /**
  5849. * Optionally injectable environment dependent cleanup hook. (server vs.
  5850. * browser etc). Example: A browser system caches DOM nodes based on component
  5851. * ID and must remove that cache entry when this instance is unmounted.
  5852. */
  5853. unmountIDFromEnvironment: null,
  5854. /**
  5855. * Optionally injectable hook for swapping out mount images in the middle of
  5856. * the tree.
  5857. */
  5858. replaceNodeWithMarkupByID: null,
  5859. /**
  5860. * Optionally injectable hook for processing a queue of child updates. Will
  5861. * later move into MultiChildComponents.
  5862. */
  5863. processChildrenUpdates: null,
  5864. injection: {
  5865. injectEnvironment: function(environment) {
  5866. ("production" !== "development" ? invariant(
  5867. !injected,
  5868. 'ReactCompositeComponent: injectEnvironment() can only be called once.'
  5869. ) : invariant(!injected));
  5870. ReactComponentEnvironment.unmountIDFromEnvironment =
  5871. environment.unmountIDFromEnvironment;
  5872. ReactComponentEnvironment.replaceNodeWithMarkupByID =
  5873. environment.replaceNodeWithMarkupByID;
  5874. ReactComponentEnvironment.processChildrenUpdates =
  5875. environment.processChildrenUpdates;
  5876. injected = true;
  5877. }
  5878. }
  5879. };
  5880. module.exports = ReactComponentEnvironment;
  5881. },{"150":150}],42:[function(_dereq_,module,exports){
  5882. /**
  5883. * Copyright 2013-2015, Facebook, Inc.
  5884. * All rights reserved.
  5885. *
  5886. * This source code is licensed under the BSD-style license found in the
  5887. * LICENSE file in the root directory of this source tree. An additional grant
  5888. * of patent rights can be found in the PATENTS file in the same directory.
  5889. *
  5890. * @providesModule ReactComponentWithPureRenderMixin
  5891. */
  5892. 'use strict';
  5893. var shallowEqual = _dereq_(166);
  5894. /**
  5895. * If your React component's render function is "pure", e.g. it will render the
  5896. * same result given the same props and state, provide this Mixin for a
  5897. * considerable performance boost.
  5898. *
  5899. * Most React components have pure render functions.
  5900. *
  5901. * Example:
  5902. *
  5903. * var ReactComponentWithPureRenderMixin =
  5904. * require('ReactComponentWithPureRenderMixin');
  5905. * React.createClass({
  5906. * mixins: [ReactComponentWithPureRenderMixin],
  5907. *
  5908. * render: function() {
  5909. * return <div className={this.props.className}>foo</div>;
  5910. * }
  5911. * });
  5912. *
  5913. * Note: This only checks shallow equality for props and state. If these contain
  5914. * complex data structures this mixin may have false-negatives for deeper
  5915. * differences. Only mixin to components which have simple props and state, or
  5916. * use `forceUpdate()` when you know deep data structures have changed.
  5917. */
  5918. var ReactComponentWithPureRenderMixin = {
  5919. shouldComponentUpdate: function(nextProps, nextState) {
  5920. return !shallowEqual(this.props, nextProps) ||
  5921. !shallowEqual(this.state, nextState);
  5922. }
  5923. };
  5924. module.exports = ReactComponentWithPureRenderMixin;
  5925. },{"166":166}],43:[function(_dereq_,module,exports){
  5926. /**
  5927. * Copyright 2013-2015, Facebook, Inc.
  5928. * All rights reserved.
  5929. *
  5930. * This source code is licensed under the BSD-style license found in the
  5931. * LICENSE file in the root directory of this source tree. An additional grant
  5932. * of patent rights can be found in the PATENTS file in the same directory.
  5933. *
  5934. * @providesModule ReactCompositeComponent
  5935. */
  5936. 'use strict';
  5937. var ReactComponentEnvironment = _dereq_(41);
  5938. var ReactContext = _dereq_(44);
  5939. var ReactCurrentOwner = _dereq_(45);
  5940. var ReactElement = _dereq_(63);
  5941. var ReactElementValidator = _dereq_(64);
  5942. var ReactInstanceMap = _dereq_(73);
  5943. var ReactLifeCycle = _dereq_(74);
  5944. var ReactNativeComponent = _dereq_(80);
  5945. var ReactPerf = _dereq_(82);
  5946. var ReactPropTypeLocations = _dereq_(85);
  5947. var ReactPropTypeLocationNames = _dereq_(84);
  5948. var ReactReconciler = _dereq_(89);
  5949. var ReactUpdates = _dereq_(100);
  5950. var assign = _dereq_(29);
  5951. var emptyObject = _dereq_(130);
  5952. var invariant = _dereq_(150);
  5953. var shouldUpdateReactComponent = _dereq_(167);
  5954. var warning = _dereq_(171);
  5955. function getDeclarationErrorAddendum(component) {
  5956. var owner = component._currentElement._owner || null;
  5957. if (owner) {
  5958. var name = owner.getName();
  5959. if (name) {
  5960. return ' Check the render method of `' + name + '`.';
  5961. }
  5962. }
  5963. return '';
  5964. }
  5965. /**
  5966. * ------------------ The Life-Cycle of a Composite Component ------------------
  5967. *
  5968. * - constructor: Initialization of state. The instance is now retained.
  5969. * - componentWillMount
  5970. * - render
  5971. * - [children's constructors]
  5972. * - [children's componentWillMount and render]
  5973. * - [children's componentDidMount]
  5974. * - componentDidMount
  5975. *
  5976. * Update Phases:
  5977. * - componentWillReceiveProps (only called if parent updated)
  5978. * - shouldComponentUpdate
  5979. * - componentWillUpdate
  5980. * - render
  5981. * - [children's constructors or receive props phases]
  5982. * - componentDidUpdate
  5983. *
  5984. * - componentWillUnmount
  5985. * - [children's componentWillUnmount]
  5986. * - [children destroyed]
  5987. * - (destroyed): The instance is now blank, released by React and ready for GC.
  5988. *
  5989. * -----------------------------------------------------------------------------
  5990. */
  5991. /**
  5992. * An incrementing ID assigned to each component when it is mounted. This is
  5993. * used to enforce the order in which `ReactUpdates` updates dirty components.
  5994. *
  5995. * @private
  5996. */
  5997. var nextMountID = 1;
  5998. /**
  5999. * @lends {ReactCompositeComponent.prototype}
  6000. */
  6001. var ReactCompositeComponentMixin = {
  6002. /**
  6003. * Base constructor for all composite component.
  6004. *
  6005. * @param {ReactElement} element
  6006. * @final
  6007. * @internal
  6008. */
  6009. construct: function(element) {
  6010. this._currentElement = element;
  6011. this._rootNodeID = null;
  6012. this._instance = null;
  6013. // See ReactUpdateQueue
  6014. this._pendingElement = null;
  6015. this._pendingStateQueue = null;
  6016. this._pendingReplaceState = false;
  6017. this._pendingForceUpdate = false;
  6018. this._renderedComponent = null;
  6019. this._context = null;
  6020. this._mountOrder = 0;
  6021. this._isTopLevel = false;
  6022. // See ReactUpdates and ReactUpdateQueue.
  6023. this._pendingCallbacks = null;
  6024. },
  6025. /**
  6026. * Initializes the component, renders markup, and registers event listeners.
  6027. *
  6028. * @param {string} rootID DOM ID of the root node.
  6029. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6030. * @return {?string} Rendered markup to be inserted into the DOM.
  6031. * @final
  6032. * @internal
  6033. */
  6034. mountComponent: function(rootID, transaction, context) {
  6035. this._context = context;
  6036. this._mountOrder = nextMountID++;
  6037. this._rootNodeID = rootID;
  6038. var publicProps = this._processProps(this._currentElement.props);
  6039. var publicContext = this._processContext(this._currentElement._context);
  6040. var Component = ReactNativeComponent.getComponentClassForElement(
  6041. this._currentElement
  6042. );
  6043. // Initialize the public class
  6044. var inst = new Component(publicProps, publicContext);
  6045. if ("production" !== "development") {
  6046. // This will throw later in _renderValidatedComponent, but add an early
  6047. // warning now to help debugging
  6048. ("production" !== "development" ? warning(
  6049. inst.render != null,
  6050. '%s(...): No `render` method found on the returned component ' +
  6051. 'instance: you may have forgotten to define `render` in your ' +
  6052. 'component or you may have accidentally tried to render an element ' +
  6053. 'whose type is a function that isn\'t a React component.',
  6054. Component.displayName || Component.name || 'Component'
  6055. ) : null);
  6056. }
  6057. // These should be set up in the constructor, but as a convenience for
  6058. // simpler class abstractions, we set them up after the fact.
  6059. inst.props = publicProps;
  6060. inst.context = publicContext;
  6061. inst.refs = emptyObject;
  6062. this._instance = inst;
  6063. // Store a reference from the instance back to the internal representation
  6064. ReactInstanceMap.set(inst, this);
  6065. if ("production" !== "development") {
  6066. this._warnIfContextsDiffer(this._currentElement._context, context);
  6067. }
  6068. if ("production" !== "development") {
  6069. // Since plain JS classes are defined without any special initialization
  6070. // logic, we can not catch common errors early. Therefore, we have to
  6071. // catch them here, at initialization time, instead.
  6072. ("production" !== "development" ? warning(
  6073. !inst.getInitialState ||
  6074. inst.getInitialState.isReactClassApproved,
  6075. 'getInitialState was defined on %s, a plain JavaScript class. ' +
  6076. 'This is only supported for classes created using React.createClass. ' +
  6077. 'Did you mean to define a state property instead?',
  6078. this.getName() || 'a component'
  6079. ) : null);
  6080. ("production" !== "development" ? warning(
  6081. !inst.getDefaultProps ||
  6082. inst.getDefaultProps.isReactClassApproved,
  6083. 'getDefaultProps was defined on %s, a plain JavaScript class. ' +
  6084. 'This is only supported for classes created using React.createClass. ' +
  6085. 'Use a static property to define defaultProps instead.',
  6086. this.getName() || 'a component'
  6087. ) : null);
  6088. ("production" !== "development" ? warning(
  6089. !inst.propTypes,
  6090. 'propTypes was defined as an instance property on %s. Use a static ' +
  6091. 'property to define propTypes instead.',
  6092. this.getName() || 'a component'
  6093. ) : null);
  6094. ("production" !== "development" ? warning(
  6095. !inst.contextTypes,
  6096. 'contextTypes was defined as an instance property on %s. Use a ' +
  6097. 'static property to define contextTypes instead.',
  6098. this.getName() || 'a component'
  6099. ) : null);
  6100. ("production" !== "development" ? warning(
  6101. typeof inst.componentShouldUpdate !== 'function',
  6102. '%s has a method called ' +
  6103. 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
  6104. 'The name is phrased as a question because the function is ' +
  6105. 'expected to return a value.',
  6106. (this.getName() || 'A component')
  6107. ) : null);
  6108. }
  6109. var initialState = inst.state;
  6110. if (initialState === undefined) {
  6111. inst.state = initialState = null;
  6112. }
  6113. ("production" !== "development" ? invariant(
  6114. typeof initialState === 'object' && !Array.isArray(initialState),
  6115. '%s.state: must be set to an object or null',
  6116. this.getName() || 'ReactCompositeComponent'
  6117. ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
  6118. this._pendingStateQueue = null;
  6119. this._pendingReplaceState = false;
  6120. this._pendingForceUpdate = false;
  6121. var childContext;
  6122. var renderedElement;
  6123. var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
  6124. ReactLifeCycle.currentlyMountingInstance = this;
  6125. try {
  6126. if (inst.componentWillMount) {
  6127. inst.componentWillMount();
  6128. // When mounting, calls to `setState` by `componentWillMount` will set
  6129. // `this._pendingStateQueue` without triggering a re-render.
  6130. if (this._pendingStateQueue) {
  6131. inst.state = this._processPendingState(inst.props, inst.context);
  6132. }
  6133. }
  6134. childContext = this._getValidatedChildContext(context);
  6135. renderedElement = this._renderValidatedComponent(childContext);
  6136. } finally {
  6137. ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
  6138. }
  6139. this._renderedComponent = this._instantiateReactComponent(
  6140. renderedElement,
  6141. this._currentElement.type // The wrapping type
  6142. );
  6143. var markup = ReactReconciler.mountComponent(
  6144. this._renderedComponent,
  6145. rootID,
  6146. transaction,
  6147. this._mergeChildContext(context, childContext)
  6148. );
  6149. if (inst.componentDidMount) {
  6150. transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
  6151. }
  6152. return markup;
  6153. },
  6154. /**
  6155. * Releases any resources allocated by `mountComponent`.
  6156. *
  6157. * @final
  6158. * @internal
  6159. */
  6160. unmountComponent: function() {
  6161. var inst = this._instance;
  6162. if (inst.componentWillUnmount) {
  6163. var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;
  6164. ReactLifeCycle.currentlyUnmountingInstance = this;
  6165. try {
  6166. inst.componentWillUnmount();
  6167. } finally {
  6168. ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;
  6169. }
  6170. }
  6171. ReactReconciler.unmountComponent(this._renderedComponent);
  6172. this._renderedComponent = null;
  6173. // Reset pending fields
  6174. this._pendingStateQueue = null;
  6175. this._pendingReplaceState = false;
  6176. this._pendingForceUpdate = false;
  6177. this._pendingCallbacks = null;
  6178. this._pendingElement = null;
  6179. // These fields do not really need to be reset since this object is no
  6180. // longer accessible.
  6181. this._context = null;
  6182. this._rootNodeID = null;
  6183. // Delete the reference from the instance to this internal representation
  6184. // which allow the internals to be properly cleaned up even if the user
  6185. // leaks a reference to the public instance.
  6186. ReactInstanceMap.remove(inst);
  6187. // Some existing components rely on inst.props even after they've been
  6188. // destroyed (in event handlers).
  6189. // TODO: inst.props = null;
  6190. // TODO: inst.state = null;
  6191. // TODO: inst.context = null;
  6192. },
  6193. /**
  6194. * Schedule a partial update to the props. Only used for internal testing.
  6195. *
  6196. * @param {object} partialProps Subset of the next props.
  6197. * @param {?function} callback Called after props are updated.
  6198. * @final
  6199. * @internal
  6200. */
  6201. _setPropsInternal: function(partialProps, callback) {
  6202. // This is a deoptimized path. We optimize for always having an element.
  6203. // This creates an extra internal element.
  6204. var element = this._pendingElement || this._currentElement;
  6205. this._pendingElement = ReactElement.cloneAndReplaceProps(
  6206. element,
  6207. assign({}, element.props, partialProps)
  6208. );
  6209. ReactUpdates.enqueueUpdate(this, callback);
  6210. },
  6211. /**
  6212. * Filters the context object to only contain keys specified in
  6213. * `contextTypes`
  6214. *
  6215. * @param {object} context
  6216. * @return {?object}
  6217. * @private
  6218. */
  6219. _maskContext: function(context) {
  6220. var maskedContext = null;
  6221. // This really should be getting the component class for the element,
  6222. // but we know that we're not going to need it for built-ins.
  6223. if (typeof this._currentElement.type === 'string') {
  6224. return emptyObject;
  6225. }
  6226. var contextTypes = this._currentElement.type.contextTypes;
  6227. if (!contextTypes) {
  6228. return emptyObject;
  6229. }
  6230. maskedContext = {};
  6231. for (var contextName in contextTypes) {
  6232. maskedContext[contextName] = context[contextName];
  6233. }
  6234. return maskedContext;
  6235. },
  6236. /**
  6237. * Filters the context object to only contain keys specified in
  6238. * `contextTypes`, and asserts that they are valid.
  6239. *
  6240. * @param {object} context
  6241. * @return {?object}
  6242. * @private
  6243. */
  6244. _processContext: function(context) {
  6245. var maskedContext = this._maskContext(context);
  6246. if ("production" !== "development") {
  6247. var Component = ReactNativeComponent.getComponentClassForElement(
  6248. this._currentElement
  6249. );
  6250. if (Component.contextTypes) {
  6251. this._checkPropTypes(
  6252. Component.contextTypes,
  6253. maskedContext,
  6254. ReactPropTypeLocations.context
  6255. );
  6256. }
  6257. }
  6258. return maskedContext;
  6259. },
  6260. /**
  6261. * @param {object} currentContext
  6262. * @return {object}
  6263. * @private
  6264. */
  6265. _getValidatedChildContext: function(currentContext) {
  6266. var inst = this._instance;
  6267. var childContext = inst.getChildContext && inst.getChildContext();
  6268. if (childContext) {
  6269. ("production" !== "development" ? invariant(
  6270. typeof inst.constructor.childContextTypes === 'object',
  6271. '%s.getChildContext(): childContextTypes must be defined in order to ' +
  6272. 'use getChildContext().',
  6273. this.getName() || 'ReactCompositeComponent'
  6274. ) : invariant(typeof inst.constructor.childContextTypes === 'object'));
  6275. if ("production" !== "development") {
  6276. this._checkPropTypes(
  6277. inst.constructor.childContextTypes,
  6278. childContext,
  6279. ReactPropTypeLocations.childContext
  6280. );
  6281. }
  6282. for (var name in childContext) {
  6283. ("production" !== "development" ? invariant(
  6284. name in inst.constructor.childContextTypes,
  6285. '%s.getChildContext(): key "%s" is not defined in childContextTypes.',
  6286. this.getName() || 'ReactCompositeComponent',
  6287. name
  6288. ) : invariant(name in inst.constructor.childContextTypes));
  6289. }
  6290. return childContext;
  6291. }
  6292. return null;
  6293. },
  6294. _mergeChildContext: function(currentContext, childContext) {
  6295. if (childContext) {
  6296. return assign({}, currentContext, childContext);
  6297. }
  6298. return currentContext;
  6299. },
  6300. /**
  6301. * Processes props by setting default values for unspecified props and
  6302. * asserting that the props are valid. Does not mutate its argument; returns
  6303. * a new props object with defaults merged in.
  6304. *
  6305. * @param {object} newProps
  6306. * @return {object}
  6307. * @private
  6308. */
  6309. _processProps: function(newProps) {
  6310. if ("production" !== "development") {
  6311. var Component = ReactNativeComponent.getComponentClassForElement(
  6312. this._currentElement
  6313. );
  6314. if (Component.propTypes) {
  6315. this._checkPropTypes(
  6316. Component.propTypes,
  6317. newProps,
  6318. ReactPropTypeLocations.prop
  6319. );
  6320. }
  6321. }
  6322. return newProps;
  6323. },
  6324. /**
  6325. * Assert that the props are valid
  6326. *
  6327. * @param {object} propTypes Map of prop name to a ReactPropType
  6328. * @param {object} props
  6329. * @param {string} location e.g. "prop", "context", "child context"
  6330. * @private
  6331. */
  6332. _checkPropTypes: function(propTypes, props, location) {
  6333. // TODO: Stop validating prop types here and only use the element
  6334. // validation.
  6335. var componentName = this.getName();
  6336. for (var propName in propTypes) {
  6337. if (propTypes.hasOwnProperty(propName)) {
  6338. var error;
  6339. try {
  6340. // This is intentionally an invariant that gets caught. It's the same
  6341. // behavior as without this statement except with a better message.
  6342. ("production" !== "development" ? invariant(
  6343. typeof propTypes[propName] === 'function',
  6344. '%s: %s type `%s` is invalid; it must be a function, usually ' +
  6345. 'from React.PropTypes.',
  6346. componentName || 'React class',
  6347. ReactPropTypeLocationNames[location],
  6348. propName
  6349. ) : invariant(typeof propTypes[propName] === 'function'));
  6350. error = propTypes[propName](props, propName, componentName, location);
  6351. } catch (ex) {
  6352. error = ex;
  6353. }
  6354. if (error instanceof Error) {
  6355. // We may want to extend this logic for similar errors in
  6356. // React.render calls, so I'm abstracting it away into
  6357. // a function to minimize refactoring in the future
  6358. var addendum = getDeclarationErrorAddendum(this);
  6359. if (location === ReactPropTypeLocations.prop) {
  6360. // Preface gives us something to blacklist in warning module
  6361. ("production" !== "development" ? warning(
  6362. false,
  6363. 'Failed Composite propType: %s%s',
  6364. error.message,
  6365. addendum
  6366. ) : null);
  6367. } else {
  6368. ("production" !== "development" ? warning(
  6369. false,
  6370. 'Failed Context Types: %s%s',
  6371. error.message,
  6372. addendum
  6373. ) : null);
  6374. }
  6375. }
  6376. }
  6377. }
  6378. },
  6379. receiveComponent: function(nextElement, transaction, nextContext) {
  6380. var prevElement = this._currentElement;
  6381. var prevContext = this._context;
  6382. this._pendingElement = null;
  6383. this.updateComponent(
  6384. transaction,
  6385. prevElement,
  6386. nextElement,
  6387. prevContext,
  6388. nextContext
  6389. );
  6390. },
  6391. /**
  6392. * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
  6393. * is set, update the component.
  6394. *
  6395. * @param {ReactReconcileTransaction} transaction
  6396. * @internal
  6397. */
  6398. performUpdateIfNecessary: function(transaction) {
  6399. if (this._pendingElement != null) {
  6400. ReactReconciler.receiveComponent(
  6401. this,
  6402. this._pendingElement || this._currentElement,
  6403. transaction,
  6404. this._context
  6405. );
  6406. }
  6407. if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
  6408. if ("production" !== "development") {
  6409. ReactElementValidator.checkAndWarnForMutatedProps(
  6410. this._currentElement
  6411. );
  6412. }
  6413. this.updateComponent(
  6414. transaction,
  6415. this._currentElement,
  6416. this._currentElement,
  6417. this._context,
  6418. this._context
  6419. );
  6420. }
  6421. },
  6422. /**
  6423. * Compare two contexts, warning if they are different
  6424. * TODO: Remove this check when owner-context is removed
  6425. */
  6426. _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
  6427. ownerBasedContext = this._maskContext(ownerBasedContext);
  6428. parentBasedContext = this._maskContext(parentBasedContext);
  6429. var parentKeys = Object.keys(parentBasedContext).sort();
  6430. var displayName = this.getName() || 'ReactCompositeComponent';
  6431. for (var i = 0; i < parentKeys.length; i++) {
  6432. var key = parentKeys[i];
  6433. ("production" !== "development" ? warning(
  6434. ownerBasedContext[key] === parentBasedContext[key],
  6435. 'owner-based and parent-based contexts differ ' +
  6436. '(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
  6437. '(see: http://fb.me/react-context-by-parent)',
  6438. ownerBasedContext[key],
  6439. parentBasedContext[key],
  6440. key,
  6441. displayName
  6442. ) : null);
  6443. }
  6444. },
  6445. /**
  6446. * Perform an update to a mounted component. The componentWillReceiveProps and
  6447. * shouldComponentUpdate methods are called, then (assuming the update isn't
  6448. * skipped) the remaining update lifecycle methods are called and the DOM
  6449. * representation is updated.
  6450. *
  6451. * By default, this implements React's rendering and reconciliation algorithm.
  6452. * Sophisticated clients may wish to override this.
  6453. *
  6454. * @param {ReactReconcileTransaction} transaction
  6455. * @param {ReactElement} prevParentElement
  6456. * @param {ReactElement} nextParentElement
  6457. * @internal
  6458. * @overridable
  6459. */
  6460. updateComponent: function(
  6461. transaction,
  6462. prevParentElement,
  6463. nextParentElement,
  6464. prevUnmaskedContext,
  6465. nextUnmaskedContext
  6466. ) {
  6467. var inst = this._instance;
  6468. var nextContext = inst.context;
  6469. var nextProps = inst.props;
  6470. // Distinguish between a props update versus a simple state update
  6471. if (prevParentElement !== nextParentElement) {
  6472. nextContext = this._processContext(nextParentElement._context);
  6473. nextProps = this._processProps(nextParentElement.props);
  6474. if ("production" !== "development") {
  6475. if (nextUnmaskedContext != null) {
  6476. this._warnIfContextsDiffer(
  6477. nextParentElement._context,
  6478. nextUnmaskedContext
  6479. );
  6480. }
  6481. }
  6482. // An update here will schedule an update but immediately set
  6483. // _pendingStateQueue which will ensure that any state updates gets
  6484. // immediately reconciled instead of waiting for the next batch.
  6485. if (inst.componentWillReceiveProps) {
  6486. inst.componentWillReceiveProps(nextProps, nextContext);
  6487. }
  6488. }
  6489. var nextState = this._processPendingState(nextProps, nextContext);
  6490. var shouldUpdate =
  6491. this._pendingForceUpdate ||
  6492. !inst.shouldComponentUpdate ||
  6493. inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  6494. if ("production" !== "development") {
  6495. ("production" !== "development" ? warning(
  6496. typeof shouldUpdate !== 'undefined',
  6497. '%s.shouldComponentUpdate(): Returned undefined instead of a ' +
  6498. 'boolean value. Make sure to return true or false.',
  6499. this.getName() || 'ReactCompositeComponent'
  6500. ) : null);
  6501. }
  6502. if (shouldUpdate) {
  6503. this._pendingForceUpdate = false;
  6504. // Will set `this.props`, `this.state` and `this.context`.
  6505. this._performComponentUpdate(
  6506. nextParentElement,
  6507. nextProps,
  6508. nextState,
  6509. nextContext,
  6510. transaction,
  6511. nextUnmaskedContext
  6512. );
  6513. } else {
  6514. // If it's determined that a component should not update, we still want
  6515. // to set props and state but we shortcut the rest of the update.
  6516. this._currentElement = nextParentElement;
  6517. this._context = nextUnmaskedContext;
  6518. inst.props = nextProps;
  6519. inst.state = nextState;
  6520. inst.context = nextContext;
  6521. }
  6522. },
  6523. _processPendingState: function(props, context) {
  6524. var inst = this._instance;
  6525. var queue = this._pendingStateQueue;
  6526. var replace = this._pendingReplaceState;
  6527. this._pendingReplaceState = false;
  6528. this._pendingStateQueue = null;
  6529. if (!queue) {
  6530. return inst.state;
  6531. }
  6532. if (replace && queue.length === 1) {
  6533. return queue[0];
  6534. }
  6535. var nextState = assign({}, replace ? queue[0] : inst.state);
  6536. for (var i = replace ? 1 : 0; i < queue.length; i++) {
  6537. var partial = queue[i];
  6538. assign(
  6539. nextState,
  6540. typeof partial === 'function' ?
  6541. partial.call(inst, nextState, props, context) :
  6542. partial
  6543. );
  6544. }
  6545. return nextState;
  6546. },
  6547. /**
  6548. * Merges new props and state, notifies delegate methods of update and
  6549. * performs update.
  6550. *
  6551. * @param {ReactElement} nextElement Next element
  6552. * @param {object} nextProps Next public object to set as properties.
  6553. * @param {?object} nextState Next object to set as state.
  6554. * @param {?object} nextContext Next public object to set as context.
  6555. * @param {ReactReconcileTransaction} transaction
  6556. * @param {?object} unmaskedContext
  6557. * @private
  6558. */
  6559. _performComponentUpdate: function(
  6560. nextElement,
  6561. nextProps,
  6562. nextState,
  6563. nextContext,
  6564. transaction,
  6565. unmaskedContext
  6566. ) {
  6567. var inst = this._instance;
  6568. var prevProps = inst.props;
  6569. var prevState = inst.state;
  6570. var prevContext = inst.context;
  6571. if (inst.componentWillUpdate) {
  6572. inst.componentWillUpdate(nextProps, nextState, nextContext);
  6573. }
  6574. this._currentElement = nextElement;
  6575. this._context = unmaskedContext;
  6576. inst.props = nextProps;
  6577. inst.state = nextState;
  6578. inst.context = nextContext;
  6579. this._updateRenderedComponent(transaction, unmaskedContext);
  6580. if (inst.componentDidUpdate) {
  6581. transaction.getReactMountReady().enqueue(
  6582. inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
  6583. inst
  6584. );
  6585. }
  6586. },
  6587. /**
  6588. * Call the component's `render` method and update the DOM accordingly.
  6589. *
  6590. * @param {ReactReconcileTransaction} transaction
  6591. * @internal
  6592. */
  6593. _updateRenderedComponent: function(transaction, context) {
  6594. var prevComponentInstance = this._renderedComponent;
  6595. var prevRenderedElement = prevComponentInstance._currentElement;
  6596. var childContext = this._getValidatedChildContext();
  6597. var nextRenderedElement = this._renderValidatedComponent(childContext);
  6598. if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
  6599. ReactReconciler.receiveComponent(
  6600. prevComponentInstance,
  6601. nextRenderedElement,
  6602. transaction,
  6603. this._mergeChildContext(context, childContext)
  6604. );
  6605. } else {
  6606. // These two IDs are actually the same! But nothing should rely on that.
  6607. var thisID = this._rootNodeID;
  6608. var prevComponentID = prevComponentInstance._rootNodeID;
  6609. ReactReconciler.unmountComponent(prevComponentInstance);
  6610. this._renderedComponent = this._instantiateReactComponent(
  6611. nextRenderedElement,
  6612. this._currentElement.type
  6613. );
  6614. var nextMarkup = ReactReconciler.mountComponent(
  6615. this._renderedComponent,
  6616. thisID,
  6617. transaction,
  6618. this._mergeChildContext(context, childContext)
  6619. );
  6620. this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
  6621. }
  6622. },
  6623. /**
  6624. * @protected
  6625. */
  6626. _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
  6627. ReactComponentEnvironment.replaceNodeWithMarkupByID(
  6628. prevComponentID,
  6629. nextMarkup
  6630. );
  6631. },
  6632. /**
  6633. * @protected
  6634. */
  6635. _renderValidatedComponentWithoutOwnerOrContext: function() {
  6636. var inst = this._instance;
  6637. var renderedComponent = inst.render();
  6638. if ("production" !== "development") {
  6639. // We allow auto-mocks to proceed as if they're returning null.
  6640. if (typeof renderedComponent === 'undefined' &&
  6641. inst.render._isMockFunction) {
  6642. // This is probably bad practice. Consider warning here and
  6643. // deprecating this convenience.
  6644. renderedComponent = null;
  6645. }
  6646. }
  6647. return renderedComponent;
  6648. },
  6649. /**
  6650. * @private
  6651. */
  6652. _renderValidatedComponent: function(childContext) {
  6653. var renderedComponent;
  6654. var previousContext = ReactContext.current;
  6655. ReactContext.current = this._mergeChildContext(
  6656. this._currentElement._context,
  6657. childContext
  6658. );
  6659. ReactCurrentOwner.current = this;
  6660. try {
  6661. renderedComponent =
  6662. this._renderValidatedComponentWithoutOwnerOrContext();
  6663. } finally {
  6664. ReactContext.current = previousContext;
  6665. ReactCurrentOwner.current = null;
  6666. }
  6667. ("production" !== "development" ? invariant(
  6668. // TODO: An `isValidNode` function would probably be more appropriate
  6669. renderedComponent === null || renderedComponent === false ||
  6670. ReactElement.isValidElement(renderedComponent),
  6671. '%s.render(): A valid ReactComponent must be returned. You may have ' +
  6672. 'returned undefined, an array or some other invalid object.',
  6673. this.getName() || 'ReactCompositeComponent'
  6674. ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
  6675. renderedComponent === null || renderedComponent === false ||
  6676. ReactElement.isValidElement(renderedComponent)));
  6677. return renderedComponent;
  6678. },
  6679. /**
  6680. * Lazily allocates the refs object and stores `component` as `ref`.
  6681. *
  6682. * @param {string} ref Reference name.
  6683. * @param {component} component Component to store as `ref`.
  6684. * @final
  6685. * @private
  6686. */
  6687. attachRef: function(ref, component) {
  6688. var inst = this.getPublicInstance();
  6689. var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
  6690. refs[ref] = component.getPublicInstance();
  6691. },
  6692. /**
  6693. * Detaches a reference name.
  6694. *
  6695. * @param {string} ref Name to dereference.
  6696. * @final
  6697. * @private
  6698. */
  6699. detachRef: function(ref) {
  6700. var refs = this.getPublicInstance().refs;
  6701. delete refs[ref];
  6702. },
  6703. /**
  6704. * Get a text description of the component that can be used to identify it
  6705. * in error messages.
  6706. * @return {string} The name or null.
  6707. * @internal
  6708. */
  6709. getName: function() {
  6710. var type = this._currentElement.type;
  6711. var constructor = this._instance && this._instance.constructor;
  6712. return (
  6713. type.displayName || (constructor && constructor.displayName) ||
  6714. type.name || (constructor && constructor.name) ||
  6715. null
  6716. );
  6717. },
  6718. /**
  6719. * Get the publicly accessible representation of this component - i.e. what
  6720. * is exposed by refs and returned by React.render. Can be null for stateless
  6721. * components.
  6722. *
  6723. * @return {ReactComponent} the public component instance.
  6724. * @internal
  6725. */
  6726. getPublicInstance: function() {
  6727. return this._instance;
  6728. },
  6729. // Stub
  6730. _instantiateReactComponent: null
  6731. };
  6732. ReactPerf.measureMethods(
  6733. ReactCompositeComponentMixin,
  6734. 'ReactCompositeComponent',
  6735. {
  6736. mountComponent: 'mountComponent',
  6737. updateComponent: 'updateComponent',
  6738. _renderValidatedComponent: '_renderValidatedComponent'
  6739. }
  6740. );
  6741. var ReactCompositeComponent = {
  6742. Mixin: ReactCompositeComponentMixin
  6743. };
  6744. module.exports = ReactCompositeComponent;
  6745. },{"100":100,"130":130,"150":150,"167":167,"171":171,"29":29,"41":41,"44":44,"45":45,"63":63,"64":64,"73":73,"74":74,"80":80,"82":82,"84":84,"85":85,"89":89}],44:[function(_dereq_,module,exports){
  6746. /**
  6747. * Copyright 2013-2015, Facebook, Inc.
  6748. * All rights reserved.
  6749. *
  6750. * This source code is licensed under the BSD-style license found in the
  6751. * LICENSE file in the root directory of this source tree. An additional grant
  6752. * of patent rights can be found in the PATENTS file in the same directory.
  6753. *
  6754. * @providesModule ReactContext
  6755. */
  6756. 'use strict';
  6757. var assign = _dereq_(29);
  6758. var emptyObject = _dereq_(130);
  6759. var warning = _dereq_(171);
  6760. var didWarn = false;
  6761. /**
  6762. * Keeps track of the current context.
  6763. *
  6764. * The context is automatically passed down the component ownership hierarchy
  6765. * and is accessible via `this.context` on ReactCompositeComponents.
  6766. */
  6767. var ReactContext = {
  6768. /**
  6769. * @internal
  6770. * @type {object}
  6771. */
  6772. current: emptyObject,
  6773. /**
  6774. * Temporarily extends the current context while executing scopedCallback.
  6775. *
  6776. * A typical use case might look like
  6777. *
  6778. * render: function() {
  6779. * var children = ReactContext.withContext({foo: 'foo'}, () => (
  6780. *
  6781. * ));
  6782. * return <div>{children}</div>;
  6783. * }
  6784. *
  6785. * @param {object} newContext New context to merge into the existing context
  6786. * @param {function} scopedCallback Callback to run with the new context
  6787. * @return {ReactComponent|array<ReactComponent>}
  6788. */
  6789. withContext: function(newContext, scopedCallback) {
  6790. if ("production" !== "development") {
  6791. ("production" !== "development" ? warning(
  6792. didWarn,
  6793. 'withContext is deprecated and will be removed in a future version. ' +
  6794. 'Use a wrapper component with getChildContext instead.'
  6795. ) : null);
  6796. didWarn = true;
  6797. }
  6798. var result;
  6799. var previousContext = ReactContext.current;
  6800. ReactContext.current = assign({}, previousContext, newContext);
  6801. try {
  6802. result = scopedCallback();
  6803. } finally {
  6804. ReactContext.current = previousContext;
  6805. }
  6806. return result;
  6807. }
  6808. };
  6809. module.exports = ReactContext;
  6810. },{"130":130,"171":171,"29":29}],45:[function(_dereq_,module,exports){
  6811. /**
  6812. * Copyright 2013-2015, Facebook, Inc.
  6813. * All rights reserved.
  6814. *
  6815. * This source code is licensed under the BSD-style license found in the
  6816. * LICENSE file in the root directory of this source tree. An additional grant
  6817. * of patent rights can be found in the PATENTS file in the same directory.
  6818. *
  6819. * @providesModule ReactCurrentOwner
  6820. */
  6821. 'use strict';
  6822. /**
  6823. * Keeps track of the current owner.
  6824. *
  6825. * The current owner is the component who should own any components that are
  6826. * currently being constructed.
  6827. *
  6828. * The depth indicate how many composite components are above this render level.
  6829. */
  6830. var ReactCurrentOwner = {
  6831. /**
  6832. * @internal
  6833. * @type {ReactComponent}
  6834. */
  6835. current: null
  6836. };
  6837. module.exports = ReactCurrentOwner;
  6838. },{}],46:[function(_dereq_,module,exports){
  6839. /**
  6840. * Copyright 2013-2015, Facebook, Inc.
  6841. * All rights reserved.
  6842. *
  6843. * This source code is licensed under the BSD-style license found in the
  6844. * LICENSE file in the root directory of this source tree. An additional grant
  6845. * of patent rights can be found in the PATENTS file in the same directory.
  6846. *
  6847. * @providesModule ReactDOM
  6848. * @typechecks static-only
  6849. */
  6850. 'use strict';
  6851. var ReactElement = _dereq_(63);
  6852. var ReactElementValidator = _dereq_(64);
  6853. var mapObject = _dereq_(158);
  6854. /**
  6855. * Create a factory that creates HTML tag elements.
  6856. *
  6857. * @param {string} tag Tag name (e.g. `div`).
  6858. * @private
  6859. */
  6860. function createDOMFactory(tag) {
  6861. if ("production" !== "development") {
  6862. return ReactElementValidator.createFactory(tag);
  6863. }
  6864. return ReactElement.createFactory(tag);
  6865. }
  6866. /**
  6867. * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
  6868. * This is also accessible via `React.DOM`.
  6869. *
  6870. * @public
  6871. */
  6872. var ReactDOM = mapObject({
  6873. a: 'a',
  6874. abbr: 'abbr',
  6875. address: 'address',
  6876. area: 'area',
  6877. article: 'article',
  6878. aside: 'aside',
  6879. audio: 'audio',
  6880. b: 'b',
  6881. base: 'base',
  6882. bdi: 'bdi',
  6883. bdo: 'bdo',
  6884. big: 'big',
  6885. blockquote: 'blockquote',
  6886. body: 'body',
  6887. br: 'br',
  6888. button: 'button',
  6889. canvas: 'canvas',
  6890. caption: 'caption',
  6891. cite: 'cite',
  6892. code: 'code',
  6893. col: 'col',
  6894. colgroup: 'colgroup',
  6895. data: 'data',
  6896. datalist: 'datalist',
  6897. dd: 'dd',
  6898. del: 'del',
  6899. details: 'details',
  6900. dfn: 'dfn',
  6901. dialog: 'dialog',
  6902. div: 'div',
  6903. dl: 'dl',
  6904. dt: 'dt',
  6905. em: 'em',
  6906. embed: 'embed',
  6907. fieldset: 'fieldset',
  6908. figcaption: 'figcaption',
  6909. figure: 'figure',
  6910. footer: 'footer',
  6911. form: 'form',
  6912. h1: 'h1',
  6913. h2: 'h2',
  6914. h3: 'h3',
  6915. h4: 'h4',
  6916. h5: 'h5',
  6917. h6: 'h6',
  6918. head: 'head',
  6919. header: 'header',
  6920. hr: 'hr',
  6921. html: 'html',
  6922. i: 'i',
  6923. iframe: 'iframe',
  6924. img: 'img',
  6925. input: 'input',
  6926. ins: 'ins',
  6927. kbd: 'kbd',
  6928. keygen: 'keygen',
  6929. label: 'label',
  6930. legend: 'legend',
  6931. li: 'li',
  6932. link: 'link',
  6933. main: 'main',
  6934. map: 'map',
  6935. mark: 'mark',
  6936. menu: 'menu',
  6937. menuitem: 'menuitem',
  6938. meta: 'meta',
  6939. meter: 'meter',
  6940. nav: 'nav',
  6941. noscript: 'noscript',
  6942. object: 'object',
  6943. ol: 'ol',
  6944. optgroup: 'optgroup',
  6945. option: 'option',
  6946. output: 'output',
  6947. p: 'p',
  6948. param: 'param',
  6949. picture: 'picture',
  6950. pre: 'pre',
  6951. progress: 'progress',
  6952. q: 'q',
  6953. rp: 'rp',
  6954. rt: 'rt',
  6955. ruby: 'ruby',
  6956. s: 's',
  6957. samp: 'samp',
  6958. script: 'script',
  6959. section: 'section',
  6960. select: 'select',
  6961. small: 'small',
  6962. source: 'source',
  6963. span: 'span',
  6964. strong: 'strong',
  6965. style: 'style',
  6966. sub: 'sub',
  6967. summary: 'summary',
  6968. sup: 'sup',
  6969. table: 'table',
  6970. tbody: 'tbody',
  6971. td: 'td',
  6972. textarea: 'textarea',
  6973. tfoot: 'tfoot',
  6974. th: 'th',
  6975. thead: 'thead',
  6976. time: 'time',
  6977. title: 'title',
  6978. tr: 'tr',
  6979. track: 'track',
  6980. u: 'u',
  6981. ul: 'ul',
  6982. 'var': 'var',
  6983. video: 'video',
  6984. wbr: 'wbr',
  6985. // SVG
  6986. circle: 'circle',
  6987. clipPath: 'clipPath',
  6988. defs: 'defs',
  6989. ellipse: 'ellipse',
  6990. g: 'g',
  6991. line: 'line',
  6992. linearGradient: 'linearGradient',
  6993. mask: 'mask',
  6994. path: 'path',
  6995. pattern: 'pattern',
  6996. polygon: 'polygon',
  6997. polyline: 'polyline',
  6998. radialGradient: 'radialGradient',
  6999. rect: 'rect',
  7000. stop: 'stop',
  7001. svg: 'svg',
  7002. text: 'text',
  7003. tspan: 'tspan'
  7004. }, createDOMFactory);
  7005. module.exports = ReactDOM;
  7006. },{"158":158,"63":63,"64":64}],47:[function(_dereq_,module,exports){
  7007. /**
  7008. * Copyright 2013-2015, Facebook, Inc.
  7009. * All rights reserved.
  7010. *
  7011. * This source code is licensed under the BSD-style license found in the
  7012. * LICENSE file in the root directory of this source tree. An additional grant
  7013. * of patent rights can be found in the PATENTS file in the same directory.
  7014. *
  7015. * @providesModule ReactDOMButton
  7016. */
  7017. 'use strict';
  7018. var AutoFocusMixin = _dereq_(2);
  7019. var ReactBrowserComponentMixin = _dereq_(32);
  7020. var ReactClass = _dereq_(38);
  7021. var ReactElement = _dereq_(63);
  7022. var keyMirror = _dereq_(156);
  7023. var button = ReactElement.createFactory('button');
  7024. var mouseListenerNames = keyMirror({
  7025. onClick: true,
  7026. onDoubleClick: true,
  7027. onMouseDown: true,
  7028. onMouseMove: true,
  7029. onMouseUp: true,
  7030. onClickCapture: true,
  7031. onDoubleClickCapture: true,
  7032. onMouseDownCapture: true,
  7033. onMouseMoveCapture: true,
  7034. onMouseUpCapture: true
  7035. });
  7036. /**
  7037. * Implements a <button> native component that does not receive mouse events
  7038. * when `disabled` is set.
  7039. */
  7040. var ReactDOMButton = ReactClass.createClass({
  7041. displayName: 'ReactDOMButton',
  7042. tagName: 'BUTTON',
  7043. mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
  7044. render: function() {
  7045. var props = {};
  7046. // Copy the props; except the mouse listeners if we're disabled
  7047. for (var key in this.props) {
  7048. if (this.props.hasOwnProperty(key) &&
  7049. (!this.props.disabled || !mouseListenerNames[key])) {
  7050. props[key] = this.props[key];
  7051. }
  7052. }
  7053. return button(props, this.props.children);
  7054. }
  7055. });
  7056. module.exports = ReactDOMButton;
  7057. },{"156":156,"2":2,"32":32,"38":38,"63":63}],48:[function(_dereq_,module,exports){
  7058. /**
  7059. * Copyright 2013-2015, Facebook, Inc.
  7060. * All rights reserved.
  7061. *
  7062. * This source code is licensed under the BSD-style license found in the
  7063. * LICENSE file in the root directory of this source tree. An additional grant
  7064. * of patent rights can be found in the PATENTS file in the same directory.
  7065. *
  7066. * @providesModule ReactDOMComponent
  7067. * @typechecks static-only
  7068. */
  7069. /* global hasOwnProperty:true */
  7070. 'use strict';
  7071. var CSSPropertyOperations = _dereq_(6);
  7072. var DOMProperty = _dereq_(11);
  7073. var DOMPropertyOperations = _dereq_(12);
  7074. var ReactBrowserEventEmitter = _dereq_(33);
  7075. var ReactComponentBrowserEnvironment =
  7076. _dereq_(40);
  7077. var ReactMount = _dereq_(77);
  7078. var ReactMultiChild = _dereq_(78);
  7079. var ReactPerf = _dereq_(82);
  7080. var assign = _dereq_(29);
  7081. var escapeTextContentForBrowser = _dereq_(131);
  7082. var invariant = _dereq_(150);
  7083. var isEventSupported = _dereq_(151);
  7084. var keyOf = _dereq_(157);
  7085. var warning = _dereq_(171);
  7086. var deleteListener = ReactBrowserEventEmitter.deleteListener;
  7087. var listenTo = ReactBrowserEventEmitter.listenTo;
  7088. var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
  7089. // For quickly matching children type, to test if can be treated as content.
  7090. var CONTENT_TYPES = {'string': true, 'number': true};
  7091. var STYLE = keyOf({style: null});
  7092. var ELEMENT_NODE_TYPE = 1;
  7093. /**
  7094. * Optionally injectable operations for mutating the DOM
  7095. */
  7096. var BackendIDOperations = null;
  7097. /**
  7098. * @param {?object} props
  7099. */
  7100. function assertValidProps(props) {
  7101. if (!props) {
  7102. return;
  7103. }
  7104. // Note the use of `==` which checks for null or undefined.
  7105. if (props.dangerouslySetInnerHTML != null) {
  7106. ("production" !== "development" ? invariant(
  7107. props.children == null,
  7108. 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
  7109. ) : invariant(props.children == null));
  7110. ("production" !== "development" ? invariant(
  7111. typeof props.dangerouslySetInnerHTML === 'object' &&
  7112. '__html' in props.dangerouslySetInnerHTML,
  7113. '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
  7114. 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' +
  7115. 'for more information.'
  7116. ) : invariant(typeof props.dangerouslySetInnerHTML === 'object' &&
  7117. '__html' in props.dangerouslySetInnerHTML));
  7118. }
  7119. if ("production" !== "development") {
  7120. ("production" !== "development" ? warning(
  7121. props.innerHTML == null,
  7122. 'Directly setting property `innerHTML` is not permitted. ' +
  7123. 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
  7124. ) : null);
  7125. ("production" !== "development" ? warning(
  7126. !props.contentEditable || props.children == null,
  7127. 'A component is `contentEditable` and contains `children` managed by ' +
  7128. 'React. It is now your responsibility to guarantee that none of ' +
  7129. 'those nodes are unexpectedly modified or duplicated. This is ' +
  7130. 'probably not intentional.'
  7131. ) : null);
  7132. }
  7133. ("production" !== "development" ? invariant(
  7134. props.style == null || typeof props.style === 'object',
  7135. 'The `style` prop expects a mapping from style properties to values, ' +
  7136. 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
  7137. 'using JSX.'
  7138. ) : invariant(props.style == null || typeof props.style === 'object'));
  7139. }
  7140. function putListener(id, registrationName, listener, transaction) {
  7141. if ("production" !== "development") {
  7142. // IE8 has no API for event capturing and the `onScroll` event doesn't
  7143. // bubble.
  7144. ("production" !== "development" ? warning(
  7145. registrationName !== 'onScroll' || isEventSupported('scroll', true),
  7146. 'This browser doesn\'t support the `onScroll` event'
  7147. ) : null);
  7148. }
  7149. var container = ReactMount.findReactContainerForID(id);
  7150. if (container) {
  7151. var doc = container.nodeType === ELEMENT_NODE_TYPE ?
  7152. container.ownerDocument :
  7153. container;
  7154. listenTo(registrationName, doc);
  7155. }
  7156. transaction.getPutListenerQueue().enqueuePutListener(
  7157. id,
  7158. registrationName,
  7159. listener
  7160. );
  7161. }
  7162. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  7163. // those special cased tags.
  7164. var omittedCloseTags = {
  7165. 'area': true,
  7166. 'base': true,
  7167. 'br': true,
  7168. 'col': true,
  7169. 'embed': true,
  7170. 'hr': true,
  7171. 'img': true,
  7172. 'input': true,
  7173. 'keygen': true,
  7174. 'link': true,
  7175. 'meta': true,
  7176. 'param': true,
  7177. 'source': true,
  7178. 'track': true,
  7179. 'wbr': true
  7180. // NOTE: menuitem's close tag should be omitted, but that causes problems.
  7181. };
  7182. // We accept any tag to be rendered but since this gets injected into abitrary
  7183. // HTML, we want to make sure that it's a safe tag.
  7184. // http://www.w3.org/TR/REC-xml/#NT-Name
  7185. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  7186. var validatedTagCache = {};
  7187. var hasOwnProperty = {}.hasOwnProperty;
  7188. function validateDangerousTag(tag) {
  7189. if (!hasOwnProperty.call(validatedTagCache, tag)) {
  7190. ("production" !== "development" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag)));
  7191. validatedTagCache[tag] = true;
  7192. }
  7193. }
  7194. /**
  7195. * Creates a new React class that is idempotent and capable of containing other
  7196. * React components. It accepts event listeners and DOM properties that are
  7197. * valid according to `DOMProperty`.
  7198. *
  7199. * - Event listeners: `onClick`, `onMouseDown`, etc.
  7200. * - DOM properties: `className`, `name`, `title`, etc.
  7201. *
  7202. * The `style` property functions differently from the DOM API. It accepts an
  7203. * object mapping of style properties to values.
  7204. *
  7205. * @constructor ReactDOMComponent
  7206. * @extends ReactMultiChild
  7207. */
  7208. function ReactDOMComponent(tag) {
  7209. validateDangerousTag(tag);
  7210. this._tag = tag;
  7211. this._renderedChildren = null;
  7212. this._previousStyleCopy = null;
  7213. this._rootNodeID = null;
  7214. }
  7215. ReactDOMComponent.displayName = 'ReactDOMComponent';
  7216. ReactDOMComponent.Mixin = {
  7217. construct: function(element) {
  7218. this._currentElement = element;
  7219. },
  7220. /**
  7221. * Generates root tag markup then recurses. This method has side effects and
  7222. * is not idempotent.
  7223. *
  7224. * @internal
  7225. * @param {string} rootID The root DOM ID for this node.
  7226. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  7227. * @return {string} The computed markup.
  7228. */
  7229. mountComponent: function(rootID, transaction, context) {
  7230. this._rootNodeID = rootID;
  7231. assertValidProps(this._currentElement.props);
  7232. var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';
  7233. return (
  7234. this._createOpenTagMarkupAndPutListeners(transaction) +
  7235. this._createContentMarkup(transaction, context) +
  7236. closeTag
  7237. );
  7238. },
  7239. /**
  7240. * Creates markup for the open tag and all attributes.
  7241. *
  7242. * This method has side effects because events get registered.
  7243. *
  7244. * Iterating over object properties is faster than iterating over arrays.
  7245. * @see http://jsperf.com/obj-vs-arr-iteration
  7246. *
  7247. * @private
  7248. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  7249. * @return {string} Markup of opening tag.
  7250. */
  7251. _createOpenTagMarkupAndPutListeners: function(transaction) {
  7252. var props = this._currentElement.props;
  7253. var ret = '<' + this._tag;
  7254. for (var propKey in props) {
  7255. if (!props.hasOwnProperty(propKey)) {
  7256. continue;
  7257. }
  7258. var propValue = props[propKey];
  7259. if (propValue == null) {
  7260. continue;
  7261. }
  7262. if (registrationNameModules.hasOwnProperty(propKey)) {
  7263. putListener(this._rootNodeID, propKey, propValue, transaction);
  7264. } else {
  7265. if (propKey === STYLE) {
  7266. if (propValue) {
  7267. propValue = this._previousStyleCopy = assign({}, props.style);
  7268. }
  7269. propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
  7270. }
  7271. var markup =
  7272. DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
  7273. if (markup) {
  7274. ret += ' ' + markup;
  7275. }
  7276. }
  7277. }
  7278. // For static pages, no need to put React ID and checksum. Saves lots of
  7279. // bytes.
  7280. if (transaction.renderToStaticMarkup) {
  7281. return ret + '>';
  7282. }
  7283. var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
  7284. return ret + ' ' + markupForID + '>';
  7285. },
  7286. /**
  7287. * Creates markup for the content between the tags.
  7288. *
  7289. * @private
  7290. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  7291. * @param {object} context
  7292. * @return {string} Content markup.
  7293. */
  7294. _createContentMarkup: function(transaction, context) {
  7295. var prefix = '';
  7296. if (this._tag === 'listing' ||
  7297. this._tag === 'pre' ||
  7298. this._tag === 'textarea') {
  7299. // Add an initial newline because browsers ignore the first newline in
  7300. // a <listing>, <pre>, or <textarea> as an "authoring convenience" -- see
  7301. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.
  7302. prefix = '\n';
  7303. }
  7304. var props = this._currentElement.props;
  7305. // Intentional use of != to avoid catching zero/false.
  7306. var innerHTML = props.dangerouslySetInnerHTML;
  7307. if (innerHTML != null) {
  7308. if (innerHTML.__html != null) {
  7309. return prefix + innerHTML.__html;
  7310. }
  7311. } else {
  7312. var contentToUse =
  7313. CONTENT_TYPES[typeof props.children] ? props.children : null;
  7314. var childrenToUse = contentToUse != null ? null : props.children;
  7315. if (contentToUse != null) {
  7316. return prefix + escapeTextContentForBrowser(contentToUse);
  7317. } else if (childrenToUse != null) {
  7318. var mountImages = this.mountChildren(
  7319. childrenToUse,
  7320. transaction,
  7321. context
  7322. );
  7323. return prefix + mountImages.join('');
  7324. }
  7325. }
  7326. return prefix;
  7327. },
  7328. receiveComponent: function(nextElement, transaction, context) {
  7329. var prevElement = this._currentElement;
  7330. this._currentElement = nextElement;
  7331. this.updateComponent(transaction, prevElement, nextElement, context);
  7332. },
  7333. /**
  7334. * Updates a native DOM component after it has already been allocated and
  7335. * attached to the DOM. Reconciles the root DOM node, then recurses.
  7336. *
  7337. * @param {ReactReconcileTransaction} transaction
  7338. * @param {ReactElement} prevElement
  7339. * @param {ReactElement} nextElement
  7340. * @internal
  7341. * @overridable
  7342. */
  7343. updateComponent: function(transaction, prevElement, nextElement, context) {
  7344. assertValidProps(this._currentElement.props);
  7345. this._updateDOMProperties(prevElement.props, transaction);
  7346. this._updateDOMChildren(prevElement.props, transaction, context);
  7347. },
  7348. /**
  7349. * Reconciles the properties by detecting differences in property values and
  7350. * updating the DOM as necessary. This function is probably the single most
  7351. * critical path for performance optimization.
  7352. *
  7353. * TODO: Benchmark whether checking for changed values in memory actually
  7354. * improves performance (especially statically positioned elements).
  7355. * TODO: Benchmark the effects of putting this at the top since 99% of props
  7356. * do not change for a given reconciliation.
  7357. * TODO: Benchmark areas that can be improved with caching.
  7358. *
  7359. * @private
  7360. * @param {object} lastProps
  7361. * @param {ReactReconcileTransaction} transaction
  7362. */
  7363. _updateDOMProperties: function(lastProps, transaction) {
  7364. var nextProps = this._currentElement.props;
  7365. var propKey;
  7366. var styleName;
  7367. var styleUpdates;
  7368. for (propKey in lastProps) {
  7369. if (nextProps.hasOwnProperty(propKey) ||
  7370. !lastProps.hasOwnProperty(propKey)) {
  7371. continue;
  7372. }
  7373. if (propKey === STYLE) {
  7374. var lastStyle = this._previousStyleCopy;
  7375. for (styleName in lastStyle) {
  7376. if (lastStyle.hasOwnProperty(styleName)) {
  7377. styleUpdates = styleUpdates || {};
  7378. styleUpdates[styleName] = '';
  7379. }
  7380. }
  7381. this._previousStyleCopy = null;
  7382. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  7383. deleteListener(this._rootNodeID, propKey);
  7384. } else if (
  7385. DOMProperty.isStandardName[propKey] ||
  7386. DOMProperty.isCustomAttribute(propKey)) {
  7387. BackendIDOperations.deletePropertyByID(
  7388. this._rootNodeID,
  7389. propKey
  7390. );
  7391. }
  7392. }
  7393. for (propKey in nextProps) {
  7394. var nextProp = nextProps[propKey];
  7395. var lastProp = propKey === STYLE ?
  7396. this._previousStyleCopy :
  7397. lastProps[propKey];
  7398. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
  7399. continue;
  7400. }
  7401. if (propKey === STYLE) {
  7402. if (nextProp) {
  7403. nextProp = this._previousStyleCopy = assign({}, nextProp);
  7404. } else {
  7405. this._previousStyleCopy = null;
  7406. }
  7407. if (lastProp) {
  7408. // Unset styles on `lastProp` but not on `nextProp`.
  7409. for (styleName in lastProp) {
  7410. if (lastProp.hasOwnProperty(styleName) &&
  7411. (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  7412. styleUpdates = styleUpdates || {};
  7413. styleUpdates[styleName] = '';
  7414. }
  7415. }
  7416. // Update styles that changed since `lastProp`.
  7417. for (styleName in nextProp) {
  7418. if (nextProp.hasOwnProperty(styleName) &&
  7419. lastProp[styleName] !== nextProp[styleName]) {
  7420. styleUpdates = styleUpdates || {};
  7421. styleUpdates[styleName] = nextProp[styleName];
  7422. }
  7423. }
  7424. } else {
  7425. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  7426. styleUpdates = nextProp;
  7427. }
  7428. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  7429. putListener(this._rootNodeID, propKey, nextProp, transaction);
  7430. } else if (
  7431. DOMProperty.isStandardName[propKey] ||
  7432. DOMProperty.isCustomAttribute(propKey)) {
  7433. BackendIDOperations.updatePropertyByID(
  7434. this._rootNodeID,
  7435. propKey,
  7436. nextProp
  7437. );
  7438. }
  7439. }
  7440. if (styleUpdates) {
  7441. BackendIDOperations.updateStylesByID(
  7442. this._rootNodeID,
  7443. styleUpdates
  7444. );
  7445. }
  7446. },
  7447. /**
  7448. * Reconciles the children with the various properties that affect the
  7449. * children content.
  7450. *
  7451. * @param {object} lastProps
  7452. * @param {ReactReconcileTransaction} transaction
  7453. */
  7454. _updateDOMChildren: function(lastProps, transaction, context) {
  7455. var nextProps = this._currentElement.props;
  7456. var lastContent =
  7457. CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
  7458. var nextContent =
  7459. CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
  7460. var lastHtml =
  7461. lastProps.dangerouslySetInnerHTML &&
  7462. lastProps.dangerouslySetInnerHTML.__html;
  7463. var nextHtml =
  7464. nextProps.dangerouslySetInnerHTML &&
  7465. nextProps.dangerouslySetInnerHTML.__html;
  7466. // Note the use of `!=` which checks for null or undefined.
  7467. var lastChildren = lastContent != null ? null : lastProps.children;
  7468. var nextChildren = nextContent != null ? null : nextProps.children;
  7469. // If we're switching from children to content/html or vice versa, remove
  7470. // the old content
  7471. var lastHasContentOrHtml = lastContent != null || lastHtml != null;
  7472. var nextHasContentOrHtml = nextContent != null || nextHtml != null;
  7473. if (lastChildren != null && nextChildren == null) {
  7474. this.updateChildren(null, transaction, context);
  7475. } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
  7476. this.updateTextContent('');
  7477. }
  7478. if (nextContent != null) {
  7479. if (lastContent !== nextContent) {
  7480. this.updateTextContent('' + nextContent);
  7481. }
  7482. } else if (nextHtml != null) {
  7483. if (lastHtml !== nextHtml) {
  7484. BackendIDOperations.updateInnerHTMLByID(
  7485. this._rootNodeID,
  7486. nextHtml
  7487. );
  7488. }
  7489. } else if (nextChildren != null) {
  7490. this.updateChildren(nextChildren, transaction, context);
  7491. }
  7492. },
  7493. /**
  7494. * Destroys all event registrations for this instance. Does not remove from
  7495. * the DOM. That must be done by the parent.
  7496. *
  7497. * @internal
  7498. */
  7499. unmountComponent: function() {
  7500. this.unmountChildren();
  7501. ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
  7502. ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
  7503. this._rootNodeID = null;
  7504. }
  7505. };
  7506. ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
  7507. mountComponent: 'mountComponent',
  7508. updateComponent: 'updateComponent'
  7509. });
  7510. assign(
  7511. ReactDOMComponent.prototype,
  7512. ReactDOMComponent.Mixin,
  7513. ReactMultiChild.Mixin
  7514. );
  7515. ReactDOMComponent.injection = {
  7516. injectIDOperations: function(IDOperations) {
  7517. ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;
  7518. }
  7519. };
  7520. module.exports = ReactDOMComponent;
  7521. },{"11":11,"12":12,"131":131,"150":150,"151":151,"157":157,"171":171,"29":29,"33":33,"40":40,"6":6,"77":77,"78":78,"82":82}],49:[function(_dereq_,module,exports){
  7522. /**
  7523. * Copyright 2013-2015, Facebook, Inc.
  7524. * All rights reserved.
  7525. *
  7526. * This source code is licensed under the BSD-style license found in the
  7527. * LICENSE file in the root directory of this source tree. An additional grant
  7528. * of patent rights can be found in the PATENTS file in the same directory.
  7529. *
  7530. * @providesModule ReactDOMForm
  7531. */
  7532. 'use strict';
  7533. var EventConstants = _dereq_(16);
  7534. var LocalEventTrapMixin = _dereq_(27);
  7535. var ReactBrowserComponentMixin = _dereq_(32);
  7536. var ReactClass = _dereq_(38);
  7537. var ReactElement = _dereq_(63);
  7538. var form = ReactElement.createFactory('form');
  7539. /**
  7540. * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
  7541. * to capture it on the <form> element itself. There are lots of hacks we could
  7542. * do to accomplish this, but the most reliable is to make <form> a
  7543. * composite component and use `componentDidMount` to attach the event handlers.
  7544. */
  7545. var ReactDOMForm = ReactClass.createClass({
  7546. displayName: 'ReactDOMForm',
  7547. tagName: 'FORM',
  7548. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7549. render: function() {
  7550. // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
  7551. // `jshint` fails to parse JSX so in order for linting to work in the open
  7552. // source repo, we need to just use `ReactDOM.form`.
  7553. return form(this.props);
  7554. },
  7555. componentDidMount: function() {
  7556. this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
  7557. this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
  7558. }
  7559. });
  7560. module.exports = ReactDOMForm;
  7561. },{"16":16,"27":27,"32":32,"38":38,"63":63}],50:[function(_dereq_,module,exports){
  7562. /**
  7563. * Copyright 2013-2015, Facebook, Inc.
  7564. * All rights reserved.
  7565. *
  7566. * This source code is licensed under the BSD-style license found in the
  7567. * LICENSE file in the root directory of this source tree. An additional grant
  7568. * of patent rights can be found in the PATENTS file in the same directory.
  7569. *
  7570. * @providesModule ReactDOMIDOperations
  7571. * @typechecks static-only
  7572. */
  7573. /*jslint evil: true */
  7574. 'use strict';
  7575. var CSSPropertyOperations = _dereq_(6);
  7576. var DOMChildrenOperations = _dereq_(10);
  7577. var DOMPropertyOperations = _dereq_(12);
  7578. var ReactMount = _dereq_(77);
  7579. var ReactPerf = _dereq_(82);
  7580. var invariant = _dereq_(150);
  7581. var setInnerHTML = _dereq_(164);
  7582. /**
  7583. * Errors for properties that should not be updated with `updatePropertyById()`.
  7584. *
  7585. * @type {object}
  7586. * @private
  7587. */
  7588. var INVALID_PROPERTY_ERRORS = {
  7589. dangerouslySetInnerHTML:
  7590. '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
  7591. style: '`style` must be set using `updateStylesByID()`.'
  7592. };
  7593. /**
  7594. * Operations used to process updates to DOM nodes. This is made injectable via
  7595. * `ReactDOMComponent.BackendIDOperations`.
  7596. */
  7597. var ReactDOMIDOperations = {
  7598. /**
  7599. * Updates a DOM node with new property values. This should only be used to
  7600. * update DOM properties in `DOMProperty`.
  7601. *
  7602. * @param {string} id ID of the node to update.
  7603. * @param {string} name A valid property name, see `DOMProperty`.
  7604. * @param {*} value New value of the property.
  7605. * @internal
  7606. */
  7607. updatePropertyByID: function(id, name, value) {
  7608. var node = ReactMount.getNode(id);
  7609. ("production" !== "development" ? invariant(
  7610. !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
  7611. 'updatePropertyByID(...): %s',
  7612. INVALID_PROPERTY_ERRORS[name]
  7613. ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
  7614. // If we're updating to null or undefined, we should remove the property
  7615. // from the DOM node instead of inadvertantly setting to a string. This
  7616. // brings us in line with the same behavior we have on initial render.
  7617. if (value != null) {
  7618. DOMPropertyOperations.setValueForProperty(node, name, value);
  7619. } else {
  7620. DOMPropertyOperations.deleteValueForProperty(node, name);
  7621. }
  7622. },
  7623. /**
  7624. * Updates a DOM node to remove a property. This should only be used to remove
  7625. * DOM properties in `DOMProperty`.
  7626. *
  7627. * @param {string} id ID of the node to update.
  7628. * @param {string} name A property name to remove, see `DOMProperty`.
  7629. * @internal
  7630. */
  7631. deletePropertyByID: function(id, name, value) {
  7632. var node = ReactMount.getNode(id);
  7633. ("production" !== "development" ? invariant(
  7634. !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
  7635. 'updatePropertyByID(...): %s',
  7636. INVALID_PROPERTY_ERRORS[name]
  7637. ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
  7638. DOMPropertyOperations.deleteValueForProperty(node, name, value);
  7639. },
  7640. /**
  7641. * Updates a DOM node with new style values. If a value is specified as '',
  7642. * the corresponding style property will be unset.
  7643. *
  7644. * @param {string} id ID of the node to update.
  7645. * @param {object} styles Mapping from styles to values.
  7646. * @internal
  7647. */
  7648. updateStylesByID: function(id, styles) {
  7649. var node = ReactMount.getNode(id);
  7650. CSSPropertyOperations.setValueForStyles(node, styles);
  7651. },
  7652. /**
  7653. * Updates a DOM node's innerHTML.
  7654. *
  7655. * @param {string} id ID of the node to update.
  7656. * @param {string} html An HTML string.
  7657. * @internal
  7658. */
  7659. updateInnerHTMLByID: function(id, html) {
  7660. var node = ReactMount.getNode(id);
  7661. setInnerHTML(node, html);
  7662. },
  7663. /**
  7664. * Updates a DOM node's text content set by `props.content`.
  7665. *
  7666. * @param {string} id ID of the node to update.
  7667. * @param {string} content Text content.
  7668. * @internal
  7669. */
  7670. updateTextContentByID: function(id, content) {
  7671. var node = ReactMount.getNode(id);
  7672. DOMChildrenOperations.updateTextContent(node, content);
  7673. },
  7674. /**
  7675. * Replaces a DOM node that exists in the document with markup.
  7676. *
  7677. * @param {string} id ID of child to be replaced.
  7678. * @param {string} markup Dangerous markup to inject in place of child.
  7679. * @internal
  7680. * @see {Danger.dangerouslyReplaceNodeWithMarkup}
  7681. */
  7682. dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
  7683. var node = ReactMount.getNode(id);
  7684. DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
  7685. },
  7686. /**
  7687. * Updates a component's children by processing a series of updates.
  7688. *
  7689. * @param {array<object>} updates List of update configurations.
  7690. * @param {array<string>} markup List of markup strings.
  7691. * @internal
  7692. */
  7693. dangerouslyProcessChildrenUpdates: function(updates, markup) {
  7694. for (var i = 0; i < updates.length; i++) {
  7695. updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
  7696. }
  7697. DOMChildrenOperations.processUpdates(updates, markup);
  7698. }
  7699. };
  7700. ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
  7701. updatePropertyByID: 'updatePropertyByID',
  7702. deletePropertyByID: 'deletePropertyByID',
  7703. updateStylesByID: 'updateStylesByID',
  7704. updateInnerHTMLByID: 'updateInnerHTMLByID',
  7705. updateTextContentByID: 'updateTextContentByID',
  7706. dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
  7707. dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
  7708. });
  7709. module.exports = ReactDOMIDOperations;
  7710. },{"10":10,"12":12,"150":150,"164":164,"6":6,"77":77,"82":82}],51:[function(_dereq_,module,exports){
  7711. /**
  7712. * Copyright 2013-2015, Facebook, Inc.
  7713. * All rights reserved.
  7714. *
  7715. * This source code is licensed under the BSD-style license found in the
  7716. * LICENSE file in the root directory of this source tree. An additional grant
  7717. * of patent rights can be found in the PATENTS file in the same directory.
  7718. *
  7719. * @providesModule ReactDOMIframe
  7720. */
  7721. 'use strict';
  7722. var EventConstants = _dereq_(16);
  7723. var LocalEventTrapMixin = _dereq_(27);
  7724. var ReactBrowserComponentMixin = _dereq_(32);
  7725. var ReactClass = _dereq_(38);
  7726. var ReactElement = _dereq_(63);
  7727. var iframe = ReactElement.createFactory('iframe');
  7728. /**
  7729. * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
  7730. * capture it on the <iframe> element itself. There are lots of hacks we could
  7731. * do to accomplish this, but the most reliable is to make <iframe> a composite
  7732. * component and use `componentDidMount` to attach the event handlers.
  7733. */
  7734. var ReactDOMIframe = ReactClass.createClass({
  7735. displayName: 'ReactDOMIframe',
  7736. tagName: 'IFRAME',
  7737. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7738. render: function() {
  7739. return iframe(this.props);
  7740. },
  7741. componentDidMount: function() {
  7742. this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
  7743. }
  7744. });
  7745. module.exports = ReactDOMIframe;
  7746. },{"16":16,"27":27,"32":32,"38":38,"63":63}],52:[function(_dereq_,module,exports){
  7747. /**
  7748. * Copyright 2013-2015, Facebook, Inc.
  7749. * All rights reserved.
  7750. *
  7751. * This source code is licensed under the BSD-style license found in the
  7752. * LICENSE file in the root directory of this source tree. An additional grant
  7753. * of patent rights can be found in the PATENTS file in the same directory.
  7754. *
  7755. * @providesModule ReactDOMImg
  7756. */
  7757. 'use strict';
  7758. var EventConstants = _dereq_(16);
  7759. var LocalEventTrapMixin = _dereq_(27);
  7760. var ReactBrowserComponentMixin = _dereq_(32);
  7761. var ReactClass = _dereq_(38);
  7762. var ReactElement = _dereq_(63);
  7763. var img = ReactElement.createFactory('img');
  7764. /**
  7765. * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
  7766. * capture it on the <img> element itself. There are lots of hacks we could do
  7767. * to accomplish this, but the most reliable is to make <img> a composite
  7768. * component and use `componentDidMount` to attach the event handlers.
  7769. */
  7770. var ReactDOMImg = ReactClass.createClass({
  7771. displayName: 'ReactDOMImg',
  7772. tagName: 'IMG',
  7773. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7774. render: function() {
  7775. return img(this.props);
  7776. },
  7777. componentDidMount: function() {
  7778. this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
  7779. this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
  7780. }
  7781. });
  7782. module.exports = ReactDOMImg;
  7783. },{"16":16,"27":27,"32":32,"38":38,"63":63}],53:[function(_dereq_,module,exports){
  7784. /**
  7785. * Copyright 2013-2015, Facebook, Inc.
  7786. * All rights reserved.
  7787. *
  7788. * This source code is licensed under the BSD-style license found in the
  7789. * LICENSE file in the root directory of this source tree. An additional grant
  7790. * of patent rights can be found in the PATENTS file in the same directory.
  7791. *
  7792. * @providesModule ReactDOMInput
  7793. */
  7794. 'use strict';
  7795. var AutoFocusMixin = _dereq_(2);
  7796. var DOMPropertyOperations = _dereq_(12);
  7797. var LinkedValueUtils = _dereq_(26);
  7798. var ReactBrowserComponentMixin = _dereq_(32);
  7799. var ReactClass = _dereq_(38);
  7800. var ReactElement = _dereq_(63);
  7801. var ReactMount = _dereq_(77);
  7802. var ReactUpdates = _dereq_(100);
  7803. var assign = _dereq_(29);
  7804. var invariant = _dereq_(150);
  7805. var input = ReactElement.createFactory('input');
  7806. var instancesByReactID = {};
  7807. function forceUpdateIfMounted() {
  7808. /*jshint validthis:true */
  7809. if (this.isMounted()) {
  7810. this.forceUpdate();
  7811. }
  7812. }
  7813. /**
  7814. * Implements an <input> native component that allows setting these optional
  7815. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  7816. *
  7817. * If `checked` or `value` are not supplied (or null/undefined), user actions
  7818. * that affect the checked state or value will trigger updates to the element.
  7819. *
  7820. * If they are supplied (and not null/undefined), the rendered element will not
  7821. * trigger updates to the element. Instead, the props must change in order for
  7822. * the rendered element to be updated.
  7823. *
  7824. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  7825. * with an empty value (or `defaultValue`).
  7826. *
  7827. * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  7828. */
  7829. var ReactDOMInput = ReactClass.createClass({
  7830. displayName: 'ReactDOMInput',
  7831. tagName: 'INPUT',
  7832. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  7833. getInitialState: function() {
  7834. var defaultValue = this.props.defaultValue;
  7835. return {
  7836. initialChecked: this.props.defaultChecked || false,
  7837. initialValue: defaultValue != null ? defaultValue : null
  7838. };
  7839. },
  7840. render: function() {
  7841. // Clone `this.props` so we don't mutate the input.
  7842. var props = assign({}, this.props);
  7843. props.defaultChecked = null;
  7844. props.defaultValue = null;
  7845. var value = LinkedValueUtils.getValue(this);
  7846. props.value = value != null ? value : this.state.initialValue;
  7847. var checked = LinkedValueUtils.getChecked(this);
  7848. props.checked = checked != null ? checked : this.state.initialChecked;
  7849. props.onChange = this._handleChange;
  7850. return input(props, this.props.children);
  7851. },
  7852. componentDidMount: function() {
  7853. var id = ReactMount.getID(this.getDOMNode());
  7854. instancesByReactID[id] = this;
  7855. },
  7856. componentWillUnmount: function() {
  7857. var rootNode = this.getDOMNode();
  7858. var id = ReactMount.getID(rootNode);
  7859. delete instancesByReactID[id];
  7860. },
  7861. componentDidUpdate: function(prevProps, prevState, prevContext) {
  7862. var rootNode = this.getDOMNode();
  7863. if (this.props.checked != null) {
  7864. DOMPropertyOperations.setValueForProperty(
  7865. rootNode,
  7866. 'checked',
  7867. this.props.checked || false
  7868. );
  7869. }
  7870. var value = LinkedValueUtils.getValue(this);
  7871. if (value != null) {
  7872. // Cast `value` to a string to ensure the value is set correctly. While
  7873. // browsers typically do this as necessary, jsdom doesn't.
  7874. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
  7875. }
  7876. },
  7877. _handleChange: function(event) {
  7878. var returnValue;
  7879. var onChange = LinkedValueUtils.getOnChange(this);
  7880. if (onChange) {
  7881. returnValue = onChange.call(this, event);
  7882. }
  7883. // Here we use asap to wait until all updates have propagated, which
  7884. // is important when using controlled components within layers:
  7885. // https://github.com/facebook/react/issues/1698
  7886. ReactUpdates.asap(forceUpdateIfMounted, this);
  7887. var name = this.props.name;
  7888. if (this.props.type === 'radio' && name != null) {
  7889. var rootNode = this.getDOMNode();
  7890. var queryRoot = rootNode;
  7891. while (queryRoot.parentNode) {
  7892. queryRoot = queryRoot.parentNode;
  7893. }
  7894. // If `rootNode.form` was non-null, then we could try `form.elements`,
  7895. // but that sometimes behaves strangely in IE8. We could also try using
  7896. // `form.getElementsByName`, but that will only return direct children
  7897. // and won't include inputs that use the HTML5 `form=` attribute. Since
  7898. // the input might not even be in a form, let's just use the global
  7899. // `querySelectorAll` to ensure we don't miss anything.
  7900. var group = queryRoot.querySelectorAll(
  7901. 'input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  7902. for (var i = 0, groupLen = group.length; i < groupLen; i++) {
  7903. var otherNode = group[i];
  7904. if (otherNode === rootNode ||
  7905. otherNode.form !== rootNode.form) {
  7906. continue;
  7907. }
  7908. var otherID = ReactMount.getID(otherNode);
  7909. ("production" !== "development" ? invariant(
  7910. otherID,
  7911. 'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
  7912. 'same `name` is not supported.'
  7913. ) : invariant(otherID));
  7914. var otherInstance = instancesByReactID[otherID];
  7915. ("production" !== "development" ? invariant(
  7916. otherInstance,
  7917. 'ReactDOMInput: Unknown radio button ID %s.',
  7918. otherID
  7919. ) : invariant(otherInstance));
  7920. // If this is a controlled radio button group, forcing the input that
  7921. // was previously checked to update will cause it to be come re-checked
  7922. // as appropriate.
  7923. ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
  7924. }
  7925. }
  7926. return returnValue;
  7927. }
  7928. });
  7929. module.exports = ReactDOMInput;
  7930. },{"100":100,"12":12,"150":150,"2":2,"26":26,"29":29,"32":32,"38":38,"63":63,"77":77}],54:[function(_dereq_,module,exports){
  7931. /**
  7932. * Copyright 2013-2015, Facebook, Inc.
  7933. * All rights reserved.
  7934. *
  7935. * This source code is licensed under the BSD-style license found in the
  7936. * LICENSE file in the root directory of this source tree. An additional grant
  7937. * of patent rights can be found in the PATENTS file in the same directory.
  7938. *
  7939. * @providesModule ReactDOMOption
  7940. */
  7941. 'use strict';
  7942. var ReactBrowserComponentMixin = _dereq_(32);
  7943. var ReactClass = _dereq_(38);
  7944. var ReactElement = _dereq_(63);
  7945. var warning = _dereq_(171);
  7946. var option = ReactElement.createFactory('option');
  7947. /**
  7948. * Implements an <option> native component that warns when `selected` is set.
  7949. */
  7950. var ReactDOMOption = ReactClass.createClass({
  7951. displayName: 'ReactDOMOption',
  7952. tagName: 'OPTION',
  7953. mixins: [ReactBrowserComponentMixin],
  7954. componentWillMount: function() {
  7955. // TODO (yungsters): Remove support for `selected` in <option>.
  7956. if ("production" !== "development") {
  7957. ("production" !== "development" ? warning(
  7958. this.props.selected == null,
  7959. 'Use the `defaultValue` or `value` props on <select> instead of ' +
  7960. 'setting `selected` on <option>.'
  7961. ) : null);
  7962. }
  7963. },
  7964. render: function() {
  7965. return option(this.props, this.props.children);
  7966. }
  7967. });
  7968. module.exports = ReactDOMOption;
  7969. },{"171":171,"32":32,"38":38,"63":63}],55:[function(_dereq_,module,exports){
  7970. /**
  7971. * Copyright 2013-2015, Facebook, Inc.
  7972. * All rights reserved.
  7973. *
  7974. * This source code is licensed under the BSD-style license found in the
  7975. * LICENSE file in the root directory of this source tree. An additional grant
  7976. * of patent rights can be found in the PATENTS file in the same directory.
  7977. *
  7978. * @providesModule ReactDOMSelect
  7979. */
  7980. 'use strict';
  7981. var AutoFocusMixin = _dereq_(2);
  7982. var LinkedValueUtils = _dereq_(26);
  7983. var ReactBrowserComponentMixin = _dereq_(32);
  7984. var ReactClass = _dereq_(38);
  7985. var ReactElement = _dereq_(63);
  7986. var ReactUpdates = _dereq_(100);
  7987. var assign = _dereq_(29);
  7988. var select = ReactElement.createFactory('select');
  7989. function updateOptionsIfPendingUpdateAndMounted() {
  7990. /*jshint validthis:true */
  7991. if (this._pendingUpdate) {
  7992. this._pendingUpdate = false;
  7993. var value = LinkedValueUtils.getValue(this);
  7994. if (value != null && this.isMounted()) {
  7995. updateOptions(this, value);
  7996. }
  7997. }
  7998. }
  7999. /**
  8000. * Validation function for `value` and `defaultValue`.
  8001. * @private
  8002. */
  8003. function selectValueType(props, propName, componentName) {
  8004. if (props[propName] == null) {
  8005. return null;
  8006. }
  8007. if (props.multiple) {
  8008. if (!Array.isArray(props[propName])) {
  8009. return new Error(
  8010. ("The `" + propName + "` prop supplied to <select> must be an array if ") +
  8011. ("`multiple` is true.")
  8012. );
  8013. }
  8014. } else {
  8015. if (Array.isArray(props[propName])) {
  8016. return new Error(
  8017. ("The `" + propName + "` prop supplied to <select> must be a scalar ") +
  8018. ("value if `multiple` is false.")
  8019. );
  8020. }
  8021. }
  8022. }
  8023. /**
  8024. * @param {ReactComponent} component Instance of ReactDOMSelect
  8025. * @param {*} propValue A stringable (with `multiple`, a list of stringables).
  8026. * @private
  8027. */
  8028. function updateOptions(component, propValue) {
  8029. var selectedValue, i, l;
  8030. var options = component.getDOMNode().options;
  8031. if (component.props.multiple) {
  8032. selectedValue = {};
  8033. for (i = 0, l = propValue.length; i < l; i++) {
  8034. selectedValue['' + propValue[i]] = true;
  8035. }
  8036. for (i = 0, l = options.length; i < l; i++) {
  8037. var selected = selectedValue.hasOwnProperty(options[i].value);
  8038. if (options[i].selected !== selected) {
  8039. options[i].selected = selected;
  8040. }
  8041. }
  8042. } else {
  8043. // Do not set `select.value` as exact behavior isn't consistent across all
  8044. // browsers for all cases.
  8045. selectedValue = '' + propValue;
  8046. for (i = 0, l = options.length; i < l; i++) {
  8047. if (options[i].value === selectedValue) {
  8048. options[i].selected = true;
  8049. return;
  8050. }
  8051. }
  8052. if (options.length) {
  8053. options[0].selected = true;
  8054. }
  8055. }
  8056. }
  8057. /**
  8058. * Implements a <select> native component that allows optionally setting the
  8059. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  8060. * stringable. If `multiple` is true, the prop must be an array of stringables.
  8061. *
  8062. * If `value` is not supplied (or null/undefined), user actions that change the
  8063. * selected option will trigger updates to the rendered options.
  8064. *
  8065. * If it is supplied (and not null/undefined), the rendered options will not
  8066. * update in response to user actions. Instead, the `value` prop must change in
  8067. * order for the rendered options to update.
  8068. *
  8069. * If `defaultValue` is provided, any options with the supplied values will be
  8070. * selected.
  8071. */
  8072. var ReactDOMSelect = ReactClass.createClass({
  8073. displayName: 'ReactDOMSelect',
  8074. tagName: 'SELECT',
  8075. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  8076. propTypes: {
  8077. defaultValue: selectValueType,
  8078. value: selectValueType
  8079. },
  8080. render: function() {
  8081. // Clone `this.props` so we don't mutate the input.
  8082. var props = assign({}, this.props);
  8083. props.onChange = this._handleChange;
  8084. props.value = null;
  8085. return select(props, this.props.children);
  8086. },
  8087. componentWillMount: function() {
  8088. this._pendingUpdate = false;
  8089. },
  8090. componentDidMount: function() {
  8091. var value = LinkedValueUtils.getValue(this);
  8092. if (value != null) {
  8093. updateOptions(this, value);
  8094. } else if (this.props.defaultValue != null) {
  8095. updateOptions(this, this.props.defaultValue);
  8096. }
  8097. },
  8098. componentDidUpdate: function(prevProps) {
  8099. var value = LinkedValueUtils.getValue(this);
  8100. if (value != null) {
  8101. this._pendingUpdate = false;
  8102. updateOptions(this, value);
  8103. } else if (!prevProps.multiple !== !this.props.multiple) {
  8104. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  8105. if (this.props.defaultValue != null) {
  8106. updateOptions(this, this.props.defaultValue);
  8107. } else {
  8108. // Revert the select back to its default unselected state.
  8109. updateOptions(this, this.props.multiple ? [] : '');
  8110. }
  8111. }
  8112. },
  8113. _handleChange: function(event) {
  8114. var returnValue;
  8115. var onChange = LinkedValueUtils.getOnChange(this);
  8116. if (onChange) {
  8117. returnValue = onChange.call(this, event);
  8118. }
  8119. this._pendingUpdate = true;
  8120. ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
  8121. return returnValue;
  8122. }
  8123. });
  8124. module.exports = ReactDOMSelect;
  8125. },{"100":100,"2":2,"26":26,"29":29,"32":32,"38":38,"63":63}],56:[function(_dereq_,module,exports){
  8126. /**
  8127. * Copyright 2013-2015, Facebook, Inc.
  8128. * All rights reserved.
  8129. *
  8130. * This source code is licensed under the BSD-style license found in the
  8131. * LICENSE file in the root directory of this source tree. An additional grant
  8132. * of patent rights can be found in the PATENTS file in the same directory.
  8133. *
  8134. * @providesModule ReactDOMSelection
  8135. */
  8136. 'use strict';
  8137. var ExecutionEnvironment = _dereq_(22);
  8138. var getNodeForCharacterOffset = _dereq_(143);
  8139. var getTextContentAccessor = _dereq_(145);
  8140. /**
  8141. * While `isCollapsed` is available on the Selection object and `collapsed`
  8142. * is available on the Range object, IE11 sometimes gets them wrong.
  8143. * If the anchor/focus nodes and offsets are the same, the range is collapsed.
  8144. */
  8145. function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  8146. return anchorNode === focusNode && anchorOffset === focusOffset;
  8147. }
  8148. /**
  8149. * Get the appropriate anchor and focus node/offset pairs for IE.
  8150. *
  8151. * The catch here is that IE's selection API doesn't provide information
  8152. * about whether the selection is forward or backward, so we have to
  8153. * behave as though it's always forward.
  8154. *
  8155. * IE text differs from modern selection in that it behaves as though
  8156. * block elements end with a new line. This means character offsets will
  8157. * differ between the two APIs.
  8158. *
  8159. * @param {DOMElement} node
  8160. * @return {object}
  8161. */
  8162. function getIEOffsets(node) {
  8163. var selection = document.selection;
  8164. var selectedRange = selection.createRange();
  8165. var selectedLength = selectedRange.text.length;
  8166. // Duplicate selection so we can move range without breaking user selection.
  8167. var fromStart = selectedRange.duplicate();
  8168. fromStart.moveToElementText(node);
  8169. fromStart.setEndPoint('EndToStart', selectedRange);
  8170. var startOffset = fromStart.text.length;
  8171. var endOffset = startOffset + selectedLength;
  8172. return {
  8173. start: startOffset,
  8174. end: endOffset
  8175. };
  8176. }
  8177. /**
  8178. * @param {DOMElement} node
  8179. * @return {?object}
  8180. */
  8181. function getModernOffsets(node) {
  8182. var selection = window.getSelection && window.getSelection();
  8183. if (!selection || selection.rangeCount === 0) {
  8184. return null;
  8185. }
  8186. var anchorNode = selection.anchorNode;
  8187. var anchorOffset = selection.anchorOffset;
  8188. var focusNode = selection.focusNode;
  8189. var focusOffset = selection.focusOffset;
  8190. var currentRange = selection.getRangeAt(0);
  8191. // If the node and offset values are the same, the selection is collapsed.
  8192. // `Selection.isCollapsed` is available natively, but IE sometimes gets
  8193. // this value wrong.
  8194. var isSelectionCollapsed = isCollapsed(
  8195. selection.anchorNode,
  8196. selection.anchorOffset,
  8197. selection.focusNode,
  8198. selection.focusOffset
  8199. );
  8200. var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
  8201. var tempRange = currentRange.cloneRange();
  8202. tempRange.selectNodeContents(node);
  8203. tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
  8204. var isTempRangeCollapsed = isCollapsed(
  8205. tempRange.startContainer,
  8206. tempRange.startOffset,
  8207. tempRange.endContainer,
  8208. tempRange.endOffset
  8209. );
  8210. var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
  8211. var end = start + rangeLength;
  8212. // Detect whether the selection is backward.
  8213. var detectionRange = document.createRange();
  8214. detectionRange.setStart(anchorNode, anchorOffset);
  8215. detectionRange.setEnd(focusNode, focusOffset);
  8216. var isBackward = detectionRange.collapsed;
  8217. return {
  8218. start: isBackward ? end : start,
  8219. end: isBackward ? start : end
  8220. };
  8221. }
  8222. /**
  8223. * @param {DOMElement|DOMTextNode} node
  8224. * @param {object} offsets
  8225. */
  8226. function setIEOffsets(node, offsets) {
  8227. var range = document.selection.createRange().duplicate();
  8228. var start, end;
  8229. if (typeof offsets.end === 'undefined') {
  8230. start = offsets.start;
  8231. end = start;
  8232. } else if (offsets.start > offsets.end) {
  8233. start = offsets.end;
  8234. end = offsets.start;
  8235. } else {
  8236. start = offsets.start;
  8237. end = offsets.end;
  8238. }
  8239. range.moveToElementText(node);
  8240. range.moveStart('character', start);
  8241. range.setEndPoint('EndToStart', range);
  8242. range.moveEnd('character', end - start);
  8243. range.select();
  8244. }
  8245. /**
  8246. * In modern non-IE browsers, we can support both forward and backward
  8247. * selections.
  8248. *
  8249. * Note: IE10+ supports the Selection object, but it does not support
  8250. * the `extend` method, which means that even in modern IE, it's not possible
  8251. * to programatically create a backward selection. Thus, for all IE
  8252. * versions, we use the old IE API to create our selections.
  8253. *
  8254. * @param {DOMElement|DOMTextNode} node
  8255. * @param {object} offsets
  8256. */
  8257. function setModernOffsets(node, offsets) {
  8258. if (!window.getSelection) {
  8259. return;
  8260. }
  8261. var selection = window.getSelection();
  8262. var length = node[getTextContentAccessor()].length;
  8263. var start = Math.min(offsets.start, length);
  8264. var end = typeof offsets.end === 'undefined' ?
  8265. start : Math.min(offsets.end, length);
  8266. // IE 11 uses modern selection, but doesn't support the extend method.
  8267. // Flip backward selections, so we can set with a single range.
  8268. if (!selection.extend && start > end) {
  8269. var temp = end;
  8270. end = start;
  8271. start = temp;
  8272. }
  8273. var startMarker = getNodeForCharacterOffset(node, start);
  8274. var endMarker = getNodeForCharacterOffset(node, end);
  8275. if (startMarker && endMarker) {
  8276. var range = document.createRange();
  8277. range.setStart(startMarker.node, startMarker.offset);
  8278. selection.removeAllRanges();
  8279. if (start > end) {
  8280. selection.addRange(range);
  8281. selection.extend(endMarker.node, endMarker.offset);
  8282. } else {
  8283. range.setEnd(endMarker.node, endMarker.offset);
  8284. selection.addRange(range);
  8285. }
  8286. }
  8287. }
  8288. var useIEOffsets = (
  8289. ExecutionEnvironment.canUseDOM &&
  8290. 'selection' in document &&
  8291. !('getSelection' in window)
  8292. );
  8293. var ReactDOMSelection = {
  8294. /**
  8295. * @param {DOMElement} node
  8296. */
  8297. getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
  8298. /**
  8299. * @param {DOMElement|DOMTextNode} node
  8300. * @param {object} offsets
  8301. */
  8302. setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
  8303. };
  8304. module.exports = ReactDOMSelection;
  8305. },{"143":143,"145":145,"22":22}],57:[function(_dereq_,module,exports){
  8306. /**
  8307. * Copyright 2013-2015, Facebook, Inc.
  8308. * All rights reserved.
  8309. *
  8310. * This source code is licensed under the BSD-style license found in the
  8311. * LICENSE file in the root directory of this source tree. An additional grant
  8312. * of patent rights can be found in the PATENTS file in the same directory.
  8313. *
  8314. * @providesModule ReactDOMTextComponent
  8315. * @typechecks static-only
  8316. */
  8317. 'use strict';
  8318. var DOMPropertyOperations = _dereq_(12);
  8319. var ReactComponentBrowserEnvironment =
  8320. _dereq_(40);
  8321. var ReactDOMComponent = _dereq_(48);
  8322. var assign = _dereq_(29);
  8323. var escapeTextContentForBrowser = _dereq_(131);
  8324. /**
  8325. * Text nodes violate a couple assumptions that React makes about components:
  8326. *
  8327. * - When mounting text into the DOM, adjacent text nodes are merged.
  8328. * - Text nodes cannot be assigned a React root ID.
  8329. *
  8330. * This component is used to wrap strings in elements so that they can undergo
  8331. * the same reconciliation that is applied to elements.
  8332. *
  8333. * TODO: Investigate representing React components in the DOM with text nodes.
  8334. *
  8335. * @class ReactDOMTextComponent
  8336. * @extends ReactComponent
  8337. * @internal
  8338. */
  8339. var ReactDOMTextComponent = function(props) {
  8340. // This constructor and its argument is currently used by mocks.
  8341. };
  8342. assign(ReactDOMTextComponent.prototype, {
  8343. /**
  8344. * @param {ReactText} text
  8345. * @internal
  8346. */
  8347. construct: function(text) {
  8348. // TODO: This is really a ReactText (ReactNode), not a ReactElement
  8349. this._currentElement = text;
  8350. this._stringText = '' + text;
  8351. // Properties
  8352. this._rootNodeID = null;
  8353. this._mountIndex = 0;
  8354. },
  8355. /**
  8356. * Creates the markup for this text node. This node is not intended to have
  8357. * any features besides containing text content.
  8358. *
  8359. * @param {string} rootID DOM ID of the root node.
  8360. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  8361. * @return {string} Markup for this text node.
  8362. * @internal
  8363. */
  8364. mountComponent: function(rootID, transaction, context) {
  8365. this._rootNodeID = rootID;
  8366. var escapedText = escapeTextContentForBrowser(this._stringText);
  8367. if (transaction.renderToStaticMarkup) {
  8368. // Normally we'd wrap this in a `span` for the reasons stated above, but
  8369. // since this is a situation where React won't take over (static pages),
  8370. // we can simply return the text as it is.
  8371. return escapedText;
  8372. }
  8373. return (
  8374. '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
  8375. escapedText +
  8376. '</span>'
  8377. );
  8378. },
  8379. /**
  8380. * Updates this component by updating the text content.
  8381. *
  8382. * @param {ReactText} nextText The next text content
  8383. * @param {ReactReconcileTransaction} transaction
  8384. * @internal
  8385. */
  8386. receiveComponent: function(nextText, transaction) {
  8387. if (nextText !== this._currentElement) {
  8388. this._currentElement = nextText;
  8389. var nextStringText = '' + nextText;
  8390. if (nextStringText !== this._stringText) {
  8391. // TODO: Save this as pending props and use performUpdateIfNecessary
  8392. // and/or updateComponent to do the actual update for consistency with
  8393. // other component types?
  8394. this._stringText = nextStringText;
  8395. ReactDOMComponent.BackendIDOperations.updateTextContentByID(
  8396. this._rootNodeID,
  8397. nextStringText
  8398. );
  8399. }
  8400. }
  8401. },
  8402. unmountComponent: function() {
  8403. ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
  8404. }
  8405. });
  8406. module.exports = ReactDOMTextComponent;
  8407. },{"12":12,"131":131,"29":29,"40":40,"48":48}],58:[function(_dereq_,module,exports){
  8408. /**
  8409. * Copyright 2013-2015, Facebook, Inc.
  8410. * All rights reserved.
  8411. *
  8412. * This source code is licensed under the BSD-style license found in the
  8413. * LICENSE file in the root directory of this source tree. An additional grant
  8414. * of patent rights can be found in the PATENTS file in the same directory.
  8415. *
  8416. * @providesModule ReactDOMTextarea
  8417. */
  8418. 'use strict';
  8419. var AutoFocusMixin = _dereq_(2);
  8420. var DOMPropertyOperations = _dereq_(12);
  8421. var LinkedValueUtils = _dereq_(26);
  8422. var ReactBrowserComponentMixin = _dereq_(32);
  8423. var ReactClass = _dereq_(38);
  8424. var ReactElement = _dereq_(63);
  8425. var ReactUpdates = _dereq_(100);
  8426. var assign = _dereq_(29);
  8427. var invariant = _dereq_(150);
  8428. var warning = _dereq_(171);
  8429. var textarea = ReactElement.createFactory('textarea');
  8430. function forceUpdateIfMounted() {
  8431. /*jshint validthis:true */
  8432. if (this.isMounted()) {
  8433. this.forceUpdate();
  8434. }
  8435. }
  8436. /**
  8437. * Implements a <textarea> native component that allows setting `value`, and
  8438. * `defaultValue`. This differs from the traditional DOM API because value is
  8439. * usually set as PCDATA children.
  8440. *
  8441. * If `value` is not supplied (or null/undefined), user actions that affect the
  8442. * value will trigger updates to the element.
  8443. *
  8444. * If `value` is supplied (and not null/undefined), the rendered element will
  8445. * not trigger updates to the element. Instead, the `value` prop must change in
  8446. * order for the rendered element to be updated.
  8447. *
  8448. * The rendered element will be initialized with an empty value, the prop
  8449. * `defaultValue` if specified, or the children content (deprecated).
  8450. */
  8451. var ReactDOMTextarea = ReactClass.createClass({
  8452. displayName: 'ReactDOMTextarea',
  8453. tagName: 'TEXTAREA',
  8454. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  8455. getInitialState: function() {
  8456. var defaultValue = this.props.defaultValue;
  8457. // TODO (yungsters): Remove support for children content in <textarea>.
  8458. var children = this.props.children;
  8459. if (children != null) {
  8460. if ("production" !== "development") {
  8461. ("production" !== "development" ? warning(
  8462. false,
  8463. 'Use the `defaultValue` or `value` props instead of setting ' +
  8464. 'children on <textarea>.'
  8465. ) : null);
  8466. }
  8467. ("production" !== "development" ? invariant(
  8468. defaultValue == null,
  8469. 'If you supply `defaultValue` on a <textarea>, do not pass children.'
  8470. ) : invariant(defaultValue == null));
  8471. if (Array.isArray(children)) {
  8472. ("production" !== "development" ? invariant(
  8473. children.length <= 1,
  8474. '<textarea> can only have at most one child.'
  8475. ) : invariant(children.length <= 1));
  8476. children = children[0];
  8477. }
  8478. defaultValue = '' + children;
  8479. }
  8480. if (defaultValue == null) {
  8481. defaultValue = '';
  8482. }
  8483. var value = LinkedValueUtils.getValue(this);
  8484. return {
  8485. // We save the initial value so that `ReactDOMComponent` doesn't update
  8486. // `textContent` (unnecessary since we update value).
  8487. // The initial value can be a boolean or object so that's why it's
  8488. // forced to be a string.
  8489. initialValue: '' + (value != null ? value : defaultValue)
  8490. };
  8491. },
  8492. render: function() {
  8493. // Clone `this.props` so we don't mutate the input.
  8494. var props = assign({}, this.props);
  8495. ("production" !== "development" ? invariant(
  8496. props.dangerouslySetInnerHTML == null,
  8497. '`dangerouslySetInnerHTML` does not make sense on <textarea>.'
  8498. ) : invariant(props.dangerouslySetInnerHTML == null));
  8499. props.defaultValue = null;
  8500. props.value = null;
  8501. props.onChange = this._handleChange;
  8502. // Always set children to the same thing. In IE9, the selection range will
  8503. // get reset if `textContent` is mutated.
  8504. return textarea(props, this.state.initialValue);
  8505. },
  8506. componentDidUpdate: function(prevProps, prevState, prevContext) {
  8507. var value = LinkedValueUtils.getValue(this);
  8508. if (value != null) {
  8509. var rootNode = this.getDOMNode();
  8510. // Cast `value` to a string to ensure the value is set correctly. While
  8511. // browsers typically do this as necessary, jsdom doesn't.
  8512. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
  8513. }
  8514. },
  8515. _handleChange: function(event) {
  8516. var returnValue;
  8517. var onChange = LinkedValueUtils.getOnChange(this);
  8518. if (onChange) {
  8519. returnValue = onChange.call(this, event);
  8520. }
  8521. ReactUpdates.asap(forceUpdateIfMounted, this);
  8522. return returnValue;
  8523. }
  8524. });
  8525. module.exports = ReactDOMTextarea;
  8526. },{"100":100,"12":12,"150":150,"171":171,"2":2,"26":26,"29":29,"32":32,"38":38,"63":63}],59:[function(_dereq_,module,exports){
  8527. /**
  8528. * Copyright 2013-2015, Facebook, Inc.
  8529. * All rights reserved.
  8530. *
  8531. * This source code is licensed under the BSD-style license found in the
  8532. * LICENSE file in the root directory of this source tree. An additional grant
  8533. * of patent rights can be found in the PATENTS file in the same directory.
  8534. *
  8535. * @providesModule ReactDefaultBatchingStrategy
  8536. */
  8537. 'use strict';
  8538. var ReactUpdates = _dereq_(100);
  8539. var Transaction = _dereq_(116);
  8540. var assign = _dereq_(29);
  8541. var emptyFunction = _dereq_(129);
  8542. var RESET_BATCHED_UPDATES = {
  8543. initialize: emptyFunction,
  8544. close: function() {
  8545. ReactDefaultBatchingStrategy.isBatchingUpdates = false;
  8546. }
  8547. };
  8548. var FLUSH_BATCHED_UPDATES = {
  8549. initialize: emptyFunction,
  8550. close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
  8551. };
  8552. var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
  8553. function ReactDefaultBatchingStrategyTransaction() {
  8554. this.reinitializeTransaction();
  8555. }
  8556. assign(
  8557. ReactDefaultBatchingStrategyTransaction.prototype,
  8558. Transaction.Mixin,
  8559. {
  8560. getTransactionWrappers: function() {
  8561. return TRANSACTION_WRAPPERS;
  8562. }
  8563. }
  8564. );
  8565. var transaction = new ReactDefaultBatchingStrategyTransaction();
  8566. var ReactDefaultBatchingStrategy = {
  8567. isBatchingUpdates: false,
  8568. /**
  8569. * Call the provided function in a context within which calls to `setState`
  8570. * and friends are batched such that components aren't updated unnecessarily.
  8571. */
  8572. batchedUpdates: function(callback, a, b, c, d) {
  8573. var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
  8574. ReactDefaultBatchingStrategy.isBatchingUpdates = true;
  8575. // The code is written this way to avoid extra allocations
  8576. if (alreadyBatchingUpdates) {
  8577. callback(a, b, c, d);
  8578. } else {
  8579. transaction.perform(callback, null, a, b, c, d);
  8580. }
  8581. }
  8582. };
  8583. module.exports = ReactDefaultBatchingStrategy;
  8584. },{"100":100,"116":116,"129":129,"29":29}],60:[function(_dereq_,module,exports){
  8585. /**
  8586. * Copyright 2013-2015, Facebook, Inc.
  8587. * All rights reserved.
  8588. *
  8589. * This source code is licensed under the BSD-style license found in the
  8590. * LICENSE file in the root directory of this source tree. An additional grant
  8591. * of patent rights can be found in the PATENTS file in the same directory.
  8592. *
  8593. * @providesModule ReactDefaultInjection
  8594. */
  8595. 'use strict';
  8596. var BeforeInputEventPlugin = _dereq_(3);
  8597. var ChangeEventPlugin = _dereq_(8);
  8598. var ClientReactRootIndex = _dereq_(9);
  8599. var DefaultEventPluginOrder = _dereq_(14);
  8600. var EnterLeaveEventPlugin = _dereq_(15);
  8601. var ExecutionEnvironment = _dereq_(22);
  8602. var HTMLDOMPropertyConfig = _dereq_(24);
  8603. var MobileSafariClickEventPlugin = _dereq_(28);
  8604. var ReactBrowserComponentMixin = _dereq_(32);
  8605. var ReactClass = _dereq_(38);
  8606. var ReactComponentBrowserEnvironment =
  8607. _dereq_(40);
  8608. var ReactDefaultBatchingStrategy = _dereq_(59);
  8609. var ReactDOMComponent = _dereq_(48);
  8610. var ReactDOMButton = _dereq_(47);
  8611. var ReactDOMForm = _dereq_(49);
  8612. var ReactDOMImg = _dereq_(52);
  8613. var ReactDOMIDOperations = _dereq_(50);
  8614. var ReactDOMIframe = _dereq_(51);
  8615. var ReactDOMInput = _dereq_(53);
  8616. var ReactDOMOption = _dereq_(54);
  8617. var ReactDOMSelect = _dereq_(55);
  8618. var ReactDOMTextarea = _dereq_(58);
  8619. var ReactDOMTextComponent = _dereq_(57);
  8620. var ReactElement = _dereq_(63);
  8621. var ReactEventListener = _dereq_(68);
  8622. var ReactInjection = _dereq_(70);
  8623. var ReactInstanceHandles = _dereq_(72);
  8624. var ReactMount = _dereq_(77);
  8625. var ReactReconcileTransaction = _dereq_(88);
  8626. var SelectEventPlugin = _dereq_(102);
  8627. var ServerReactRootIndex = _dereq_(103);
  8628. var SimpleEventPlugin = _dereq_(104);
  8629. var SVGDOMPropertyConfig = _dereq_(101);
  8630. var createFullPageComponent = _dereq_(125);
  8631. function autoGenerateWrapperClass(type) {
  8632. return ReactClass.createClass({
  8633. tagName: type.toUpperCase(),
  8634. render: function() {
  8635. return new ReactElement(
  8636. type,
  8637. null,
  8638. null,
  8639. null,
  8640. null,
  8641. this.props
  8642. );
  8643. }
  8644. });
  8645. }
  8646. function inject() {
  8647. ReactInjection.EventEmitter.injectReactEventListener(
  8648. ReactEventListener
  8649. );
  8650. /**
  8651. * Inject modules for resolving DOM hierarchy and plugin ordering.
  8652. */
  8653. ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
  8654. ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
  8655. ReactInjection.EventPluginHub.injectMount(ReactMount);
  8656. /**
  8657. * Some important event plugins included by default (without having to require
  8658. * them).
  8659. */
  8660. ReactInjection.EventPluginHub.injectEventPluginsByName({
  8661. SimpleEventPlugin: SimpleEventPlugin,
  8662. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  8663. ChangeEventPlugin: ChangeEventPlugin,
  8664. MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
  8665. SelectEventPlugin: SelectEventPlugin,
  8666. BeforeInputEventPlugin: BeforeInputEventPlugin
  8667. });
  8668. ReactInjection.NativeComponent.injectGenericComponentClass(
  8669. ReactDOMComponent
  8670. );
  8671. ReactInjection.NativeComponent.injectTextComponentClass(
  8672. ReactDOMTextComponent
  8673. );
  8674. ReactInjection.NativeComponent.injectAutoWrapper(
  8675. autoGenerateWrapperClass
  8676. );
  8677. // This needs to happen before createFullPageComponent() otherwise the mixin
  8678. // won't be included.
  8679. ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
  8680. ReactInjection.NativeComponent.injectComponentClasses({
  8681. 'button': ReactDOMButton,
  8682. 'form': ReactDOMForm,
  8683. 'iframe': ReactDOMIframe,
  8684. 'img': ReactDOMImg,
  8685. 'input': ReactDOMInput,
  8686. 'option': ReactDOMOption,
  8687. 'select': ReactDOMSelect,
  8688. 'textarea': ReactDOMTextarea,
  8689. 'html': createFullPageComponent('html'),
  8690. 'head': createFullPageComponent('head'),
  8691. 'body': createFullPageComponent('body')
  8692. });
  8693. ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
  8694. ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
  8695. ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
  8696. ReactInjection.Updates.injectReconcileTransaction(
  8697. ReactReconcileTransaction
  8698. );
  8699. ReactInjection.Updates.injectBatchingStrategy(
  8700. ReactDefaultBatchingStrategy
  8701. );
  8702. ReactInjection.RootIndex.injectCreateReactRootIndex(
  8703. ExecutionEnvironment.canUseDOM ?
  8704. ClientReactRootIndex.createReactRootIndex :
  8705. ServerReactRootIndex.createReactRootIndex
  8706. );
  8707. ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
  8708. ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
  8709. if ("production" !== "development") {
  8710. var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
  8711. if ((/[?&]react_perf\b/).test(url)) {
  8712. var ReactDefaultPerf = _dereq_(61);
  8713. ReactDefaultPerf.start();
  8714. }
  8715. }
  8716. }
  8717. module.exports = {
  8718. inject: inject
  8719. };
  8720. },{"101":101,"102":102,"103":103,"104":104,"125":125,"14":14,"15":15,"22":22,"24":24,"28":28,"3":3,"32":32,"38":38,"40":40,"47":47,"48":48,"49":49,"50":50,"51":51,"52":52,"53":53,"54":54,"55":55,"57":57,"58":58,"59":59,"61":61,"63":63,"68":68,"70":70,"72":72,"77":77,"8":8,"88":88,"9":9}],61:[function(_dereq_,module,exports){
  8721. /**
  8722. * Copyright 2013-2015, Facebook, Inc.
  8723. * All rights reserved.
  8724. *
  8725. * This source code is licensed under the BSD-style license found in the
  8726. * LICENSE file in the root directory of this source tree. An additional grant
  8727. * of patent rights can be found in the PATENTS file in the same directory.
  8728. *
  8729. * @providesModule ReactDefaultPerf
  8730. * @typechecks static-only
  8731. */
  8732. 'use strict';
  8733. var DOMProperty = _dereq_(11);
  8734. var ReactDefaultPerfAnalysis = _dereq_(62);
  8735. var ReactMount = _dereq_(77);
  8736. var ReactPerf = _dereq_(82);
  8737. var performanceNow = _dereq_(162);
  8738. function roundFloat(val) {
  8739. return Math.floor(val * 100) / 100;
  8740. }
  8741. function addValue(obj, key, val) {
  8742. obj[key] = (obj[key] || 0) + val;
  8743. }
  8744. var ReactDefaultPerf = {
  8745. _allMeasurements: [], // last item in the list is the current one
  8746. _mountStack: [0],
  8747. _injected: false,
  8748. start: function() {
  8749. if (!ReactDefaultPerf._injected) {
  8750. ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
  8751. }
  8752. ReactDefaultPerf._allMeasurements.length = 0;
  8753. ReactPerf.enableMeasure = true;
  8754. },
  8755. stop: function() {
  8756. ReactPerf.enableMeasure = false;
  8757. },
  8758. getLastMeasurements: function() {
  8759. return ReactDefaultPerf._allMeasurements;
  8760. },
  8761. printExclusive: function(measurements) {
  8762. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8763. var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
  8764. console.table(summary.map(function(item) {
  8765. return {
  8766. 'Component class name': item.componentName,
  8767. 'Total inclusive time (ms)': roundFloat(item.inclusive),
  8768. 'Exclusive mount time (ms)': roundFloat(item.exclusive),
  8769. 'Exclusive render time (ms)': roundFloat(item.render),
  8770. 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
  8771. 'Render time per instance (ms)': roundFloat(item.render / item.count),
  8772. 'Instances': item.count
  8773. };
  8774. }));
  8775. // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
  8776. // number.
  8777. },
  8778. printInclusive: function(measurements) {
  8779. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8780. var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
  8781. console.table(summary.map(function(item) {
  8782. return {
  8783. 'Owner > component': item.componentName,
  8784. 'Inclusive time (ms)': roundFloat(item.time),
  8785. 'Instances': item.count
  8786. };
  8787. }));
  8788. console.log(
  8789. 'Total time:',
  8790. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8791. );
  8792. },
  8793. getMeasurementsSummaryMap: function(measurements) {
  8794. var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
  8795. measurements,
  8796. true
  8797. );
  8798. return summary.map(function(item) {
  8799. return {
  8800. 'Owner > component': item.componentName,
  8801. 'Wasted time (ms)': item.time,
  8802. 'Instances': item.count
  8803. };
  8804. });
  8805. },
  8806. printWasted: function(measurements) {
  8807. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8808. console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
  8809. console.log(
  8810. 'Total time:',
  8811. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8812. );
  8813. },
  8814. printDOM: function(measurements) {
  8815. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8816. var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
  8817. console.table(summary.map(function(item) {
  8818. var result = {};
  8819. result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
  8820. result['type'] = item.type;
  8821. result['args'] = JSON.stringify(item.args);
  8822. return result;
  8823. }));
  8824. console.log(
  8825. 'Total time:',
  8826. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8827. );
  8828. },
  8829. _recordWrite: function(id, fnName, totalTime, args) {
  8830. // TODO: totalTime isn't that useful since it doesn't count paints/reflows
  8831. var writes =
  8832. ReactDefaultPerf
  8833. ._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]
  8834. .writes;
  8835. writes[id] = writes[id] || [];
  8836. writes[id].push({
  8837. type: fnName,
  8838. time: totalTime,
  8839. args: args
  8840. });
  8841. },
  8842. measure: function(moduleName, fnName, func) {
  8843. return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  8844. var totalTime;
  8845. var rv;
  8846. var start;
  8847. if (fnName === '_renderNewRootComponent' ||
  8848. fnName === 'flushBatchedUpdates') {
  8849. // A "measurement" is a set of metrics recorded for each flush. We want
  8850. // to group the metrics for a given flush together so we can look at the
  8851. // components that rendered and the DOM operations that actually
  8852. // happened to determine the amount of "wasted work" performed.
  8853. ReactDefaultPerf._allMeasurements.push({
  8854. exclusive: {},
  8855. inclusive: {},
  8856. render: {},
  8857. counts: {},
  8858. writes: {},
  8859. displayNames: {},
  8860. totalTime: 0
  8861. });
  8862. start = performanceNow();
  8863. rv = func.apply(this, args);
  8864. ReactDefaultPerf._allMeasurements[
  8865. ReactDefaultPerf._allMeasurements.length - 1
  8866. ].totalTime = performanceNow() - start;
  8867. return rv;
  8868. } else if (fnName === '_mountImageIntoNode' ||
  8869. moduleName === 'ReactDOMIDOperations') {
  8870. start = performanceNow();
  8871. rv = func.apply(this, args);
  8872. totalTime = performanceNow() - start;
  8873. if (fnName === '_mountImageIntoNode') {
  8874. var mountID = ReactMount.getID(args[1]);
  8875. ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
  8876. } else if (fnName === 'dangerouslyProcessChildrenUpdates') {
  8877. // special format
  8878. args[0].forEach(function(update) {
  8879. var writeArgs = {};
  8880. if (update.fromIndex !== null) {
  8881. writeArgs.fromIndex = update.fromIndex;
  8882. }
  8883. if (update.toIndex !== null) {
  8884. writeArgs.toIndex = update.toIndex;
  8885. }
  8886. if (update.textContent !== null) {
  8887. writeArgs.textContent = update.textContent;
  8888. }
  8889. if (update.markupIndex !== null) {
  8890. writeArgs.markup = args[1][update.markupIndex];
  8891. }
  8892. ReactDefaultPerf._recordWrite(
  8893. update.parentID,
  8894. update.type,
  8895. totalTime,
  8896. writeArgs
  8897. );
  8898. });
  8899. } else {
  8900. // basic format
  8901. ReactDefaultPerf._recordWrite(
  8902. args[0],
  8903. fnName,
  8904. totalTime,
  8905. Array.prototype.slice.call(args, 1)
  8906. );
  8907. }
  8908. return rv;
  8909. } else if (moduleName === 'ReactCompositeComponent' && (
  8910. (// TODO: receiveComponent()?
  8911. (fnName === 'mountComponent' ||
  8912. fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {
  8913. if (typeof this._currentElement.type === 'string') {
  8914. return func.apply(this, args);
  8915. }
  8916. var rootNodeID = fnName === 'mountComponent' ?
  8917. args[0] :
  8918. this._rootNodeID;
  8919. var isRender = fnName === '_renderValidatedComponent';
  8920. var isMount = fnName === 'mountComponent';
  8921. var mountStack = ReactDefaultPerf._mountStack;
  8922. var entry = ReactDefaultPerf._allMeasurements[
  8923. ReactDefaultPerf._allMeasurements.length - 1
  8924. ];
  8925. if (isRender) {
  8926. addValue(entry.counts, rootNodeID, 1);
  8927. } else if (isMount) {
  8928. mountStack.push(0);
  8929. }
  8930. start = performanceNow();
  8931. rv = func.apply(this, args);
  8932. totalTime = performanceNow() - start;
  8933. if (isRender) {
  8934. addValue(entry.render, rootNodeID, totalTime);
  8935. } else if (isMount) {
  8936. var subMountTime = mountStack.pop();
  8937. mountStack[mountStack.length - 1] += totalTime;
  8938. addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
  8939. addValue(entry.inclusive, rootNodeID, totalTime);
  8940. } else {
  8941. addValue(entry.inclusive, rootNodeID, totalTime);
  8942. }
  8943. entry.displayNames[rootNodeID] = {
  8944. current: this.getName(),
  8945. owner: this._currentElement._owner ?
  8946. this._currentElement._owner.getName() :
  8947. '<root>'
  8948. };
  8949. return rv;
  8950. } else {
  8951. return func.apply(this, args);
  8952. }
  8953. };
  8954. }
  8955. };
  8956. module.exports = ReactDefaultPerf;
  8957. },{"11":11,"162":162,"62":62,"77":77,"82":82}],62:[function(_dereq_,module,exports){
  8958. /**
  8959. * Copyright 2013-2015, Facebook, Inc.
  8960. * All rights reserved.
  8961. *
  8962. * This source code is licensed under the BSD-style license found in the
  8963. * LICENSE file in the root directory of this source tree. An additional grant
  8964. * of patent rights can be found in the PATENTS file in the same directory.
  8965. *
  8966. * @providesModule ReactDefaultPerfAnalysis
  8967. */
  8968. var assign = _dereq_(29);
  8969. // Don't try to save users less than 1.2ms (a number I made up)
  8970. var DONT_CARE_THRESHOLD = 1.2;
  8971. var DOM_OPERATION_TYPES = {
  8972. '_mountImageIntoNode': 'set innerHTML',
  8973. INSERT_MARKUP: 'set innerHTML',
  8974. MOVE_EXISTING: 'move',
  8975. REMOVE_NODE: 'remove',
  8976. TEXT_CONTENT: 'set textContent',
  8977. 'updatePropertyByID': 'update attribute',
  8978. 'deletePropertyByID': 'delete attribute',
  8979. 'updateStylesByID': 'update styles',
  8980. 'updateInnerHTMLByID': 'set innerHTML',
  8981. 'dangerouslyReplaceNodeWithMarkupByID': 'replace'
  8982. };
  8983. function getTotalTime(measurements) {
  8984. // TODO: return number of DOM ops? could be misleading.
  8985. // TODO: measure dropped frames after reconcile?
  8986. // TODO: log total time of each reconcile and the top-level component
  8987. // class that triggered it.
  8988. var totalTime = 0;
  8989. for (var i = 0; i < measurements.length; i++) {
  8990. var measurement = measurements[i];
  8991. totalTime += measurement.totalTime;
  8992. }
  8993. return totalTime;
  8994. }
  8995. function getDOMSummary(measurements) {
  8996. var items = [];
  8997. for (var i = 0; i < measurements.length; i++) {
  8998. var measurement = measurements[i];
  8999. var id;
  9000. for (id in measurement.writes) {
  9001. measurement.writes[id].forEach(function(write) {
  9002. items.push({
  9003. id: id,
  9004. type: DOM_OPERATION_TYPES[write.type] || write.type,
  9005. args: write.args
  9006. });
  9007. });
  9008. }
  9009. }
  9010. return items;
  9011. }
  9012. function getExclusiveSummary(measurements) {
  9013. var candidates = {};
  9014. var displayName;
  9015. for (var i = 0; i < measurements.length; i++) {
  9016. var measurement = measurements[i];
  9017. var allIDs = assign(
  9018. {},
  9019. measurement.exclusive,
  9020. measurement.inclusive
  9021. );
  9022. for (var id in allIDs) {
  9023. displayName = measurement.displayNames[id].current;
  9024. candidates[displayName] = candidates[displayName] || {
  9025. componentName: displayName,
  9026. inclusive: 0,
  9027. exclusive: 0,
  9028. render: 0,
  9029. count: 0
  9030. };
  9031. if (measurement.render[id]) {
  9032. candidates[displayName].render += measurement.render[id];
  9033. }
  9034. if (measurement.exclusive[id]) {
  9035. candidates[displayName].exclusive += measurement.exclusive[id];
  9036. }
  9037. if (measurement.inclusive[id]) {
  9038. candidates[displayName].inclusive += measurement.inclusive[id];
  9039. }
  9040. if (measurement.counts[id]) {
  9041. candidates[displayName].count += measurement.counts[id];
  9042. }
  9043. }
  9044. }
  9045. // Now make a sorted array with the results.
  9046. var arr = [];
  9047. for (displayName in candidates) {
  9048. if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
  9049. arr.push(candidates[displayName]);
  9050. }
  9051. }
  9052. arr.sort(function(a, b) {
  9053. return b.exclusive - a.exclusive;
  9054. });
  9055. return arr;
  9056. }
  9057. function getInclusiveSummary(measurements, onlyClean) {
  9058. var candidates = {};
  9059. var inclusiveKey;
  9060. for (var i = 0; i < measurements.length; i++) {
  9061. var measurement = measurements[i];
  9062. var allIDs = assign(
  9063. {},
  9064. measurement.exclusive,
  9065. measurement.inclusive
  9066. );
  9067. var cleanComponents;
  9068. if (onlyClean) {
  9069. cleanComponents = getUnchangedComponents(measurement);
  9070. }
  9071. for (var id in allIDs) {
  9072. if (onlyClean && !cleanComponents[id]) {
  9073. continue;
  9074. }
  9075. var displayName = measurement.displayNames[id];
  9076. // Inclusive time is not useful for many components without knowing where
  9077. // they are instantiated. So we aggregate inclusive time with both the
  9078. // owner and current displayName as the key.
  9079. inclusiveKey = displayName.owner + ' > ' + displayName.current;
  9080. candidates[inclusiveKey] = candidates[inclusiveKey] || {
  9081. componentName: inclusiveKey,
  9082. time: 0,
  9083. count: 0
  9084. };
  9085. if (measurement.inclusive[id]) {
  9086. candidates[inclusiveKey].time += measurement.inclusive[id];
  9087. }
  9088. if (measurement.counts[id]) {
  9089. candidates[inclusiveKey].count += measurement.counts[id];
  9090. }
  9091. }
  9092. }
  9093. // Now make a sorted array with the results.
  9094. var arr = [];
  9095. for (inclusiveKey in candidates) {
  9096. if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
  9097. arr.push(candidates[inclusiveKey]);
  9098. }
  9099. }
  9100. arr.sort(function(a, b) {
  9101. return b.time - a.time;
  9102. });
  9103. return arr;
  9104. }
  9105. function getUnchangedComponents(measurement) {
  9106. // For a given reconcile, look at which components did not actually
  9107. // render anything to the DOM and return a mapping of their ID to
  9108. // the amount of time it took to render the entire subtree.
  9109. var cleanComponents = {};
  9110. var dirtyLeafIDs = Object.keys(measurement.writes);
  9111. var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
  9112. for (var id in allIDs) {
  9113. var isDirty = false;
  9114. // For each component that rendered, see if a component that triggered
  9115. // a DOM op is in its subtree.
  9116. for (var i = 0; i < dirtyLeafIDs.length; i++) {
  9117. if (dirtyLeafIDs[i].indexOf(id) === 0) {
  9118. isDirty = true;
  9119. break;
  9120. }
  9121. }
  9122. if (!isDirty && measurement.counts[id] > 0) {
  9123. cleanComponents[id] = true;
  9124. }
  9125. }
  9126. return cleanComponents;
  9127. }
  9128. var ReactDefaultPerfAnalysis = {
  9129. getExclusiveSummary: getExclusiveSummary,
  9130. getInclusiveSummary: getInclusiveSummary,
  9131. getDOMSummary: getDOMSummary,
  9132. getTotalTime: getTotalTime
  9133. };
  9134. module.exports = ReactDefaultPerfAnalysis;
  9135. },{"29":29}],63:[function(_dereq_,module,exports){
  9136. /**
  9137. * Copyright 2014-2015, Facebook, Inc.
  9138. * All rights reserved.
  9139. *
  9140. * This source code is licensed under the BSD-style license found in the
  9141. * LICENSE file in the root directory of this source tree. An additional grant
  9142. * of patent rights can be found in the PATENTS file in the same directory.
  9143. *
  9144. * @providesModule ReactElement
  9145. */
  9146. 'use strict';
  9147. var ReactContext = _dereq_(44);
  9148. var ReactCurrentOwner = _dereq_(45);
  9149. var assign = _dereq_(29);
  9150. var warning = _dereq_(171);
  9151. var RESERVED_PROPS = {
  9152. key: true,
  9153. ref: true
  9154. };
  9155. /**
  9156. * Warn for mutations.
  9157. *
  9158. * @internal
  9159. * @param {object} object
  9160. * @param {string} key
  9161. */
  9162. function defineWarningProperty(object, key) {
  9163. Object.defineProperty(object, key, {
  9164. configurable: false,
  9165. enumerable: true,
  9166. get: function() {
  9167. if (!this._store) {
  9168. return null;
  9169. }
  9170. return this._store[key];
  9171. },
  9172. set: function(value) {
  9173. ("production" !== "development" ? warning(
  9174. false,
  9175. 'Don\'t set the %s property of the React element. Instead, ' +
  9176. 'specify the correct value when initially creating the element.',
  9177. key
  9178. ) : null);
  9179. this._store[key] = value;
  9180. }
  9181. });
  9182. }
  9183. /**
  9184. * This is updated to true if the membrane is successfully created.
  9185. */
  9186. var useMutationMembrane = false;
  9187. /**
  9188. * Warn for mutations.
  9189. *
  9190. * @internal
  9191. * @param {object} element
  9192. */
  9193. function defineMutationMembrane(prototype) {
  9194. try {
  9195. var pseudoFrozenProperties = {
  9196. props: true
  9197. };
  9198. for (var key in pseudoFrozenProperties) {
  9199. defineWarningProperty(prototype, key);
  9200. }
  9201. useMutationMembrane = true;
  9202. } catch (x) {
  9203. // IE will fail on defineProperty
  9204. }
  9205. }
  9206. /**
  9207. * Base constructor for all React elements. This is only used to make this
  9208. * work with a dynamic instanceof check. Nothing should live on this prototype.
  9209. *
  9210. * @param {*} type
  9211. * @param {string|object} ref
  9212. * @param {*} key
  9213. * @param {*} props
  9214. * @internal
  9215. */
  9216. var ReactElement = function(type, key, ref, owner, context, props) {
  9217. // Built-in properties that belong on the element
  9218. this.type = type;
  9219. this.key = key;
  9220. this.ref = ref;
  9221. // Record the component responsible for creating this element.
  9222. this._owner = owner;
  9223. // TODO: Deprecate withContext, and then the context becomes accessible
  9224. // through the owner.
  9225. this._context = context;
  9226. if ("production" !== "development") {
  9227. // The validation flag and props are currently mutative. We put them on
  9228. // an external backing store so that we can freeze the whole object.
  9229. // This can be replaced with a WeakMap once they are implemented in
  9230. // commonly used development environments.
  9231. this._store = {props: props, originalProps: assign({}, props)};
  9232. // To make comparing ReactElements easier for testing purposes, we make
  9233. // the validation flag non-enumerable (where possible, which should
  9234. // include every environment we run tests in), so the test framework
  9235. // ignores it.
  9236. try {
  9237. Object.defineProperty(this._store, 'validated', {
  9238. configurable: false,
  9239. enumerable: false,
  9240. writable: true
  9241. });
  9242. } catch (x) {
  9243. }
  9244. this._store.validated = false;
  9245. // We're not allowed to set props directly on the object so we early
  9246. // return and rely on the prototype membrane to forward to the backing
  9247. // store.
  9248. if (useMutationMembrane) {
  9249. Object.freeze(this);
  9250. return;
  9251. }
  9252. }
  9253. this.props = props;
  9254. };
  9255. // We intentionally don't expose the function on the constructor property.
  9256. // ReactElement should be indistinguishable from a plain object.
  9257. ReactElement.prototype = {
  9258. _isReactElement: true
  9259. };
  9260. if ("production" !== "development") {
  9261. defineMutationMembrane(ReactElement.prototype);
  9262. }
  9263. ReactElement.createElement = function(type, config, children) {
  9264. var propName;
  9265. // Reserved names are extracted
  9266. var props = {};
  9267. var key = null;
  9268. var ref = null;
  9269. if (config != null) {
  9270. ref = config.ref === undefined ? null : config.ref;
  9271. key = config.key === undefined ? null : '' + config.key;
  9272. // Remaining properties are added to a new props object
  9273. for (propName in config) {
  9274. if (config.hasOwnProperty(propName) &&
  9275. !RESERVED_PROPS.hasOwnProperty(propName)) {
  9276. props[propName] = config[propName];
  9277. }
  9278. }
  9279. }
  9280. // Children can be more than one argument, and those are transferred onto
  9281. // the newly allocated props object.
  9282. var childrenLength = arguments.length - 2;
  9283. if (childrenLength === 1) {
  9284. props.children = children;
  9285. } else if (childrenLength > 1) {
  9286. var childArray = Array(childrenLength);
  9287. for (var i = 0; i < childrenLength; i++) {
  9288. childArray[i] = arguments[i + 2];
  9289. }
  9290. props.children = childArray;
  9291. }
  9292. // Resolve default props
  9293. if (type && type.defaultProps) {
  9294. var defaultProps = type.defaultProps;
  9295. for (propName in defaultProps) {
  9296. if (typeof props[propName] === 'undefined') {
  9297. props[propName] = defaultProps[propName];
  9298. }
  9299. }
  9300. }
  9301. return new ReactElement(
  9302. type,
  9303. key,
  9304. ref,
  9305. ReactCurrentOwner.current,
  9306. ReactContext.current,
  9307. props
  9308. );
  9309. };
  9310. ReactElement.createFactory = function(type) {
  9311. var factory = ReactElement.createElement.bind(null, type);
  9312. // Expose the type on the factory and the prototype so that it can be
  9313. // easily accessed on elements. E.g. <Foo />.type === Foo.type.
  9314. // This should not be named `constructor` since this may not be the function
  9315. // that created the element, and it may not even be a constructor.
  9316. // Legacy hook TODO: Warn if this is accessed
  9317. factory.type = type;
  9318. return factory;
  9319. };
  9320. ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {
  9321. var newElement = new ReactElement(
  9322. oldElement.type,
  9323. oldElement.key,
  9324. oldElement.ref,
  9325. oldElement._owner,
  9326. oldElement._context,
  9327. newProps
  9328. );
  9329. if ("production" !== "development") {
  9330. // If the key on the original is valid, then the clone is valid
  9331. newElement._store.validated = oldElement._store.validated;
  9332. }
  9333. return newElement;
  9334. };
  9335. ReactElement.cloneElement = function(element, config, children) {
  9336. var propName;
  9337. // Original props are copied
  9338. var props = assign({}, element.props);
  9339. // Reserved names are extracted
  9340. var key = element.key;
  9341. var ref = element.ref;
  9342. // Owner will be preserved, unless ref is overridden
  9343. var owner = element._owner;
  9344. if (config != null) {
  9345. if (config.ref !== undefined) {
  9346. // Silently steal the ref from the parent.
  9347. ref = config.ref;
  9348. owner = ReactCurrentOwner.current;
  9349. }
  9350. if (config.key !== undefined) {
  9351. key = '' + config.key;
  9352. }
  9353. // Remaining properties override existing props
  9354. for (propName in config) {
  9355. if (config.hasOwnProperty(propName) &&
  9356. !RESERVED_PROPS.hasOwnProperty(propName)) {
  9357. props[propName] = config[propName];
  9358. }
  9359. }
  9360. }
  9361. // Children can be more than one argument, and those are transferred onto
  9362. // the newly allocated props object.
  9363. var childrenLength = arguments.length - 2;
  9364. if (childrenLength === 1) {
  9365. props.children = children;
  9366. } else if (childrenLength > 1) {
  9367. var childArray = Array(childrenLength);
  9368. for (var i = 0; i < childrenLength; i++) {
  9369. childArray[i] = arguments[i + 2];
  9370. }
  9371. props.children = childArray;
  9372. }
  9373. return new ReactElement(
  9374. element.type,
  9375. key,
  9376. ref,
  9377. owner,
  9378. element._context,
  9379. props
  9380. );
  9381. };
  9382. /**
  9383. * @param {?object} object
  9384. * @return {boolean} True if `object` is a valid component.
  9385. * @final
  9386. */
  9387. ReactElement.isValidElement = function(object) {
  9388. // ReactTestUtils is often used outside of beforeEach where as React is
  9389. // within it. This leads to two different instances of React on the same
  9390. // page. To identify a element from a different React instance we use
  9391. // a flag instead of an instanceof check.
  9392. var isElement = !!(object && object._isReactElement);
  9393. // if (isElement && !(object instanceof ReactElement)) {
  9394. // This is an indicator that you're using multiple versions of React at the
  9395. // same time. This will screw with ownership and stuff. Fix it, please.
  9396. // TODO: We could possibly warn here.
  9397. // }
  9398. return isElement;
  9399. };
  9400. module.exports = ReactElement;
  9401. },{"171":171,"29":29,"44":44,"45":45}],64:[function(_dereq_,module,exports){
  9402. /**
  9403. * Copyright 2014-2015, Facebook, Inc.
  9404. * All rights reserved.
  9405. *
  9406. * This source code is licensed under the BSD-style license found in the
  9407. * LICENSE file in the root directory of this source tree. An additional grant
  9408. * of patent rights can be found in the PATENTS file in the same directory.
  9409. *
  9410. * @providesModule ReactElementValidator
  9411. */
  9412. /**
  9413. * ReactElementValidator provides a wrapper around a element factory
  9414. * which validates the props passed to the element. This is intended to be
  9415. * used only in DEV and could be replaced by a static type checker for languages
  9416. * that support it.
  9417. */
  9418. 'use strict';
  9419. var ReactElement = _dereq_(63);
  9420. var ReactFragment = _dereq_(69);
  9421. var ReactPropTypeLocations = _dereq_(85);
  9422. var ReactPropTypeLocationNames = _dereq_(84);
  9423. var ReactCurrentOwner = _dereq_(45);
  9424. var ReactNativeComponent = _dereq_(80);
  9425. var getIteratorFn = _dereq_(141);
  9426. var invariant = _dereq_(150);
  9427. var warning = _dereq_(171);
  9428. function getDeclarationErrorAddendum() {
  9429. if (ReactCurrentOwner.current) {
  9430. var name = ReactCurrentOwner.current.getName();
  9431. if (name) {
  9432. return ' Check the render method of `' + name + '`.';
  9433. }
  9434. }
  9435. return '';
  9436. }
  9437. /**
  9438. * Warn if there's no key explicitly set on dynamic arrays of children or
  9439. * object keys are not valid. This allows us to keep track of children between
  9440. * updates.
  9441. */
  9442. var ownerHasKeyUseWarning = {};
  9443. var loggedTypeFailures = {};
  9444. var NUMERIC_PROPERTY_REGEX = /^\d+$/;
  9445. /**
  9446. * Gets the instance's name for use in warnings.
  9447. *
  9448. * @internal
  9449. * @return {?string} Display name or undefined
  9450. */
  9451. function getName(instance) {
  9452. var publicInstance = instance && instance.getPublicInstance();
  9453. if (!publicInstance) {
  9454. return undefined;
  9455. }
  9456. var constructor = publicInstance.constructor;
  9457. if (!constructor) {
  9458. return undefined;
  9459. }
  9460. return constructor.displayName || constructor.name || undefined;
  9461. }
  9462. /**
  9463. * Gets the current owner's displayName for use in warnings.
  9464. *
  9465. * @internal
  9466. * @return {?string} Display name or undefined
  9467. */
  9468. function getCurrentOwnerDisplayName() {
  9469. var current = ReactCurrentOwner.current;
  9470. return (
  9471. current && getName(current) || undefined
  9472. );
  9473. }
  9474. /**
  9475. * Warn if the element doesn't have an explicit key assigned to it.
  9476. * This element is in an array. The array could grow and shrink or be
  9477. * reordered. All children that haven't already been validated are required to
  9478. * have a "key" property assigned to it.
  9479. *
  9480. * @internal
  9481. * @param {ReactElement} element Element that requires a key.
  9482. * @param {*} parentType element's parent's type.
  9483. */
  9484. function validateExplicitKey(element, parentType) {
  9485. if (element._store.validated || element.key != null) {
  9486. return;
  9487. }
  9488. element._store.validated = true;
  9489. warnAndMonitorForKeyUse(
  9490. 'Each child in an array or iterator should have a unique "key" prop.',
  9491. element,
  9492. parentType
  9493. );
  9494. }
  9495. /**
  9496. * Warn if the key is being defined as an object property but has an incorrect
  9497. * value.
  9498. *
  9499. * @internal
  9500. * @param {string} name Property name of the key.
  9501. * @param {ReactElement} element Component that requires a key.
  9502. * @param {*} parentType element's parent's type.
  9503. */
  9504. function validatePropertyKey(name, element, parentType) {
  9505. if (!NUMERIC_PROPERTY_REGEX.test(name)) {
  9506. return;
  9507. }
  9508. warnAndMonitorForKeyUse(
  9509. 'Child objects should have non-numeric keys so ordering is preserved.',
  9510. element,
  9511. parentType
  9512. );
  9513. }
  9514. /**
  9515. * Shared warning and monitoring code for the key warnings.
  9516. *
  9517. * @internal
  9518. * @param {string} message The base warning that gets output.
  9519. * @param {ReactElement} element Component that requires a key.
  9520. * @param {*} parentType element's parent's type.
  9521. */
  9522. function warnAndMonitorForKeyUse(message, element, parentType) {
  9523. var ownerName = getCurrentOwnerDisplayName();
  9524. var parentName = typeof parentType === 'string' ?
  9525. parentType : parentType.displayName || parentType.name;
  9526. var useName = ownerName || parentName;
  9527. var memoizer = ownerHasKeyUseWarning[message] || (
  9528. (ownerHasKeyUseWarning[message] = {})
  9529. );
  9530. if (memoizer.hasOwnProperty(useName)) {
  9531. return;
  9532. }
  9533. memoizer[useName] = true;
  9534. var parentOrOwnerAddendum =
  9535. ownerName ? (" Check the render method of " + ownerName + ".") :
  9536. parentName ? (" Check the React.render call using <" + parentName + ">.") :
  9537. '';
  9538. // Usually the current owner is the offender, but if it accepts children as a
  9539. // property, it may be the creator of the child that's responsible for
  9540. // assigning it a key.
  9541. var childOwnerAddendum = '';
  9542. if (element &&
  9543. element._owner &&
  9544. element._owner !== ReactCurrentOwner.current) {
  9545. // Name of the component that originally created this child.
  9546. var childOwnerName = getName(element._owner);
  9547. childOwnerAddendum = (" It was passed a child from " + childOwnerName + ".");
  9548. }
  9549. ("production" !== "development" ? warning(
  9550. false,
  9551. message + '%s%s See https://fb.me/react-warning-keys for more information.',
  9552. parentOrOwnerAddendum,
  9553. childOwnerAddendum
  9554. ) : null);
  9555. }
  9556. /**
  9557. * Ensure that every element either is passed in a static location, in an
  9558. * array with an explicit keys property defined, or in an object literal
  9559. * with valid key property.
  9560. *
  9561. * @internal
  9562. * @param {ReactNode} node Statically passed child of any type.
  9563. * @param {*} parentType node's parent's type.
  9564. */
  9565. function validateChildKeys(node, parentType) {
  9566. if (Array.isArray(node)) {
  9567. for (var i = 0; i < node.length; i++) {
  9568. var child = node[i];
  9569. if (ReactElement.isValidElement(child)) {
  9570. validateExplicitKey(child, parentType);
  9571. }
  9572. }
  9573. } else if (ReactElement.isValidElement(node)) {
  9574. // This element was passed in a valid location.
  9575. node._store.validated = true;
  9576. } else if (node) {
  9577. var iteratorFn = getIteratorFn(node);
  9578. // Entry iterators provide implicit keys.
  9579. if (iteratorFn) {
  9580. if (iteratorFn !== node.entries) {
  9581. var iterator = iteratorFn.call(node);
  9582. var step;
  9583. while (!(step = iterator.next()).done) {
  9584. if (ReactElement.isValidElement(step.value)) {
  9585. validateExplicitKey(step.value, parentType);
  9586. }
  9587. }
  9588. }
  9589. } else if (typeof node === 'object') {
  9590. var fragment = ReactFragment.extractIfFragment(node);
  9591. for (var key in fragment) {
  9592. if (fragment.hasOwnProperty(key)) {
  9593. validatePropertyKey(key, fragment[key], parentType);
  9594. }
  9595. }
  9596. }
  9597. }
  9598. }
  9599. /**
  9600. * Assert that the props are valid
  9601. *
  9602. * @param {string} componentName Name of the component for error messages.
  9603. * @param {object} propTypes Map of prop name to a ReactPropType
  9604. * @param {object} props
  9605. * @param {string} location e.g. "prop", "context", "child context"
  9606. * @private
  9607. */
  9608. function checkPropTypes(componentName, propTypes, props, location) {
  9609. for (var propName in propTypes) {
  9610. if (propTypes.hasOwnProperty(propName)) {
  9611. var error;
  9612. // Prop type validation may throw. In case they do, we don't want to
  9613. // fail the render phase where it didn't fail before. So we log it.
  9614. // After these have been cleaned up, we'll let them throw.
  9615. try {
  9616. // This is intentionally an invariant that gets caught. It's the same
  9617. // behavior as without this statement except with a better message.
  9618. ("production" !== "development" ? invariant(
  9619. typeof propTypes[propName] === 'function',
  9620. '%s: %s type `%s` is invalid; it must be a function, usually from ' +
  9621. 'React.PropTypes.',
  9622. componentName || 'React class',
  9623. ReactPropTypeLocationNames[location],
  9624. propName
  9625. ) : invariant(typeof propTypes[propName] === 'function'));
  9626. error = propTypes[propName](props, propName, componentName, location);
  9627. } catch (ex) {
  9628. error = ex;
  9629. }
  9630. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  9631. // Only monitor this failure once because there tends to be a lot of the
  9632. // same error.
  9633. loggedTypeFailures[error.message] = true;
  9634. var addendum = getDeclarationErrorAddendum(this);
  9635. ("production" !== "development" ? warning(false, 'Failed propType: %s%s', error.message, addendum) : null);
  9636. }
  9637. }
  9638. }
  9639. }
  9640. var warnedPropsMutations = {};
  9641. /**
  9642. * Warn about mutating props when setting `propName` on `element`.
  9643. *
  9644. * @param {string} propName The string key within props that was set
  9645. * @param {ReactElement} element
  9646. */
  9647. function warnForPropsMutation(propName, element) {
  9648. var type = element.type;
  9649. var elementName = typeof type === 'string' ? type : type.displayName;
  9650. var ownerName = element._owner ?
  9651. element._owner.getPublicInstance().constructor.displayName : null;
  9652. var warningKey = propName + '|' + elementName + '|' + ownerName;
  9653. if (warnedPropsMutations.hasOwnProperty(warningKey)) {
  9654. return;
  9655. }
  9656. warnedPropsMutations[warningKey] = true;
  9657. var elementInfo = '';
  9658. if (elementName) {
  9659. elementInfo = ' <' + elementName + ' />';
  9660. }
  9661. var ownerInfo = '';
  9662. if (ownerName) {
  9663. ownerInfo = ' The element was created by ' + ownerName + '.';
  9664. }
  9665. ("production" !== "development" ? warning(
  9666. false,
  9667. 'Don\'t set .props.%s of the React component%s. Instead, specify the ' +
  9668. 'correct value when initially creating the element or use ' +
  9669. 'React.cloneElement to make a new element with updated props.%s',
  9670. propName,
  9671. elementInfo,
  9672. ownerInfo
  9673. ) : null);
  9674. }
  9675. // Inline Object.is polyfill
  9676. function is(a, b) {
  9677. if (a !== a) {
  9678. // NaN
  9679. return b !== b;
  9680. }
  9681. if (a === 0 && b === 0) {
  9682. // +-0
  9683. return 1 / a === 1 / b;
  9684. }
  9685. return a === b;
  9686. }
  9687. /**
  9688. * Given an element, check if its props have been mutated since element
  9689. * creation (or the last call to this function). In particular, check if any
  9690. * new props have been added, which we can't directly catch by defining warning
  9691. * properties on the props object.
  9692. *
  9693. * @param {ReactElement} element
  9694. */
  9695. function checkAndWarnForMutatedProps(element) {
  9696. if (!element._store) {
  9697. // Element was created using `new ReactElement` directly or with
  9698. // `ReactElement.createElement`; skip mutation checking
  9699. return;
  9700. }
  9701. var originalProps = element._store.originalProps;
  9702. var props = element.props;
  9703. for (var propName in props) {
  9704. if (props.hasOwnProperty(propName)) {
  9705. if (!originalProps.hasOwnProperty(propName) ||
  9706. !is(originalProps[propName], props[propName])) {
  9707. warnForPropsMutation(propName, element);
  9708. // Copy over the new value so that the two props objects match again
  9709. originalProps[propName] = props[propName];
  9710. }
  9711. }
  9712. }
  9713. }
  9714. /**
  9715. * Given an element, validate that its props follow the propTypes definition,
  9716. * provided by the type.
  9717. *
  9718. * @param {ReactElement} element
  9719. */
  9720. function validatePropTypes(element) {
  9721. if (element.type == null) {
  9722. // This has already warned. Don't throw.
  9723. return;
  9724. }
  9725. // Extract the component class from the element. Converts string types
  9726. // to a composite class which may have propTypes.
  9727. // TODO: Validating a string's propTypes is not decoupled from the
  9728. // rendering target which is problematic.
  9729. var componentClass = ReactNativeComponent.getComponentClassForElement(
  9730. element
  9731. );
  9732. var name = componentClass.displayName || componentClass.name;
  9733. if (componentClass.propTypes) {
  9734. checkPropTypes(
  9735. name,
  9736. componentClass.propTypes,
  9737. element.props,
  9738. ReactPropTypeLocations.prop
  9739. );
  9740. }
  9741. if (typeof componentClass.getDefaultProps === 'function') {
  9742. ("production" !== "development" ? warning(
  9743. componentClass.getDefaultProps.isReactClassApproved,
  9744. 'getDefaultProps is only used on classic React.createClass ' +
  9745. 'definitions. Use a static property named `defaultProps` instead.'
  9746. ) : null);
  9747. }
  9748. }
  9749. var ReactElementValidator = {
  9750. checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,
  9751. createElement: function(type, props, children) {
  9752. // We warn in this case but don't throw. We expect the element creation to
  9753. // succeed and there will likely be errors in render.
  9754. ("production" !== "development" ? warning(
  9755. type != null,
  9756. 'React.createElement: type should not be null or undefined. It should ' +
  9757. 'be a string (for DOM elements) or a ReactClass (for composite ' +
  9758. 'components).'
  9759. ) : null);
  9760. var element = ReactElement.createElement.apply(this, arguments);
  9761. // The result can be nullish if a mock or a custom function is used.
  9762. // TODO: Drop this when these are no longer allowed as the type argument.
  9763. if (element == null) {
  9764. return element;
  9765. }
  9766. for (var i = 2; i < arguments.length; i++) {
  9767. validateChildKeys(arguments[i], type);
  9768. }
  9769. validatePropTypes(element);
  9770. return element;
  9771. },
  9772. createFactory: function(type) {
  9773. var validatedFactory = ReactElementValidator.createElement.bind(
  9774. null,
  9775. type
  9776. );
  9777. // Legacy hook TODO: Warn if this is accessed
  9778. validatedFactory.type = type;
  9779. if ("production" !== "development") {
  9780. try {
  9781. Object.defineProperty(
  9782. validatedFactory,
  9783. 'type',
  9784. {
  9785. enumerable: false,
  9786. get: function() {
  9787. ("production" !== "development" ? warning(
  9788. false,
  9789. 'Factory.type is deprecated. Access the class directly ' +
  9790. 'before passing it to createFactory.'
  9791. ) : null);
  9792. Object.defineProperty(this, 'type', {
  9793. value: type
  9794. });
  9795. return type;
  9796. }
  9797. }
  9798. );
  9799. } catch (x) {
  9800. // IE will fail on defineProperty (es5-shim/sham too)
  9801. }
  9802. }
  9803. return validatedFactory;
  9804. },
  9805. cloneElement: function(element, props, children) {
  9806. var newElement = ReactElement.cloneElement.apply(this, arguments);
  9807. for (var i = 2; i < arguments.length; i++) {
  9808. validateChildKeys(arguments[i], newElement.type);
  9809. }
  9810. validatePropTypes(newElement);
  9811. return newElement;
  9812. }
  9813. };
  9814. module.exports = ReactElementValidator;
  9815. },{"141":141,"150":150,"171":171,"45":45,"63":63,"69":69,"80":80,"84":84,"85":85}],65:[function(_dereq_,module,exports){
  9816. /**
  9817. * Copyright 2014-2015, Facebook, Inc.
  9818. * All rights reserved.
  9819. *
  9820. * This source code is licensed under the BSD-style license found in the
  9821. * LICENSE file in the root directory of this source tree. An additional grant
  9822. * of patent rights can be found in the PATENTS file in the same directory.
  9823. *
  9824. * @providesModule ReactEmptyComponent
  9825. */
  9826. 'use strict';
  9827. var ReactElement = _dereq_(63);
  9828. var ReactInstanceMap = _dereq_(73);
  9829. var invariant = _dereq_(150);
  9830. var component;
  9831. // This registry keeps track of the React IDs of the components that rendered to
  9832. // `null` (in reality a placeholder such as `noscript`)
  9833. var nullComponentIDsRegistry = {};
  9834. var ReactEmptyComponentInjection = {
  9835. injectEmptyComponent: function(emptyComponent) {
  9836. component = ReactElement.createFactory(emptyComponent);
  9837. }
  9838. };
  9839. var ReactEmptyComponentType = function() {};
  9840. ReactEmptyComponentType.prototype.componentDidMount = function() {
  9841. var internalInstance = ReactInstanceMap.get(this);
  9842. // TODO: Make sure we run these methods in the correct order, we shouldn't
  9843. // need this check. We're going to assume if we're here it means we ran
  9844. // componentWillUnmount already so there is no internal instance (it gets
  9845. // removed as part of the unmounting process).
  9846. if (!internalInstance) {
  9847. return;
  9848. }
  9849. registerNullComponentID(internalInstance._rootNodeID);
  9850. };
  9851. ReactEmptyComponentType.prototype.componentWillUnmount = function() {
  9852. var internalInstance = ReactInstanceMap.get(this);
  9853. // TODO: Get rid of this check. See TODO in componentDidMount.
  9854. if (!internalInstance) {
  9855. return;
  9856. }
  9857. deregisterNullComponentID(internalInstance._rootNodeID);
  9858. };
  9859. ReactEmptyComponentType.prototype.render = function() {
  9860. ("production" !== "development" ? invariant(
  9861. component,
  9862. 'Trying to return null from a render, but no null placeholder component ' +
  9863. 'was injected.'
  9864. ) : invariant(component));
  9865. return component();
  9866. };
  9867. var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
  9868. /**
  9869. * Mark the component as having rendered to null.
  9870. * @param {string} id Component's `_rootNodeID`.
  9871. */
  9872. function registerNullComponentID(id) {
  9873. nullComponentIDsRegistry[id] = true;
  9874. }
  9875. /**
  9876. * Unmark the component as having rendered to null: it renders to something now.
  9877. * @param {string} id Component's `_rootNodeID`.
  9878. */
  9879. function deregisterNullComponentID(id) {
  9880. delete nullComponentIDsRegistry[id];
  9881. }
  9882. /**
  9883. * @param {string} id Component's `_rootNodeID`.
  9884. * @return {boolean} True if the component is rendered to null.
  9885. */
  9886. function isNullComponentID(id) {
  9887. return !!nullComponentIDsRegistry[id];
  9888. }
  9889. var ReactEmptyComponent = {
  9890. emptyElement: emptyElement,
  9891. injection: ReactEmptyComponentInjection,
  9892. isNullComponentID: isNullComponentID
  9893. };
  9894. module.exports = ReactEmptyComponent;
  9895. },{"150":150,"63":63,"73":73}],66:[function(_dereq_,module,exports){
  9896. /**
  9897. * Copyright 2013-2015, Facebook, Inc.
  9898. * All rights reserved.
  9899. *
  9900. * This source code is licensed under the BSD-style license found in the
  9901. * LICENSE file in the root directory of this source tree. An additional grant
  9902. * of patent rights can be found in the PATENTS file in the same directory.
  9903. *
  9904. * @providesModule ReactErrorUtils
  9905. * @typechecks
  9906. */
  9907. "use strict";
  9908. var ReactErrorUtils = {
  9909. /**
  9910. * Creates a guarded version of a function. This is supposed to make debugging
  9911. * of event handlers easier. To aid debugging with the browser's debugger,
  9912. * this currently simply returns the original function.
  9913. *
  9914. * @param {function} func Function to be executed
  9915. * @param {string} name The name of the guard
  9916. * @return {function}
  9917. */
  9918. guard: function(func, name) {
  9919. return func;
  9920. }
  9921. };
  9922. module.exports = ReactErrorUtils;
  9923. },{}],67:[function(_dereq_,module,exports){
  9924. /**
  9925. * Copyright 2013-2015, Facebook, Inc.
  9926. * All rights reserved.
  9927. *
  9928. * This source code is licensed under the BSD-style license found in the
  9929. * LICENSE file in the root directory of this source tree. An additional grant
  9930. * of patent rights can be found in the PATENTS file in the same directory.
  9931. *
  9932. * @providesModule ReactEventEmitterMixin
  9933. */
  9934. 'use strict';
  9935. var EventPluginHub = _dereq_(18);
  9936. function runEventQueueInBatch(events) {
  9937. EventPluginHub.enqueueEvents(events);
  9938. EventPluginHub.processEventQueue();
  9939. }
  9940. var ReactEventEmitterMixin = {
  9941. /**
  9942. * Streams a fired top-level event to `EventPluginHub` where plugins have the
  9943. * opportunity to create `ReactEvent`s to be dispatched.
  9944. *
  9945. * @param {string} topLevelType Record from `EventConstants`.
  9946. * @param {object} topLevelTarget The listening component root node.
  9947. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  9948. * @param {object} nativeEvent Native environment event.
  9949. */
  9950. handleTopLevel: function(
  9951. topLevelType,
  9952. topLevelTarget,
  9953. topLevelTargetID,
  9954. nativeEvent) {
  9955. var events = EventPluginHub.extractEvents(
  9956. topLevelType,
  9957. topLevelTarget,
  9958. topLevelTargetID,
  9959. nativeEvent
  9960. );
  9961. runEventQueueInBatch(events);
  9962. }
  9963. };
  9964. module.exports = ReactEventEmitterMixin;
  9965. },{"18":18}],68:[function(_dereq_,module,exports){
  9966. /**
  9967. * Copyright 2013-2015, Facebook, Inc.
  9968. * All rights reserved.
  9969. *
  9970. * This source code is licensed under the BSD-style license found in the
  9971. * LICENSE file in the root directory of this source tree. An additional grant
  9972. * of patent rights can be found in the PATENTS file in the same directory.
  9973. *
  9974. * @providesModule ReactEventListener
  9975. * @typechecks static-only
  9976. */
  9977. 'use strict';
  9978. var EventListener = _dereq_(17);
  9979. var ExecutionEnvironment = _dereq_(22);
  9980. var PooledClass = _dereq_(30);
  9981. var ReactInstanceHandles = _dereq_(72);
  9982. var ReactMount = _dereq_(77);
  9983. var ReactUpdates = _dereq_(100);
  9984. var assign = _dereq_(29);
  9985. var getEventTarget = _dereq_(140);
  9986. var getUnboundedScrollPosition = _dereq_(146);
  9987. /**
  9988. * Finds the parent React component of `node`.
  9989. *
  9990. * @param {*} node
  9991. * @return {?DOMEventTarget} Parent container, or `null` if the specified node
  9992. * is not nested.
  9993. */
  9994. function findParent(node) {
  9995. // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  9996. // traversal, but caching is difficult to do correctly without using a
  9997. // mutation observer to listen for all DOM changes.
  9998. var nodeID = ReactMount.getID(node);
  9999. var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
  10000. var container = ReactMount.findReactContainerForID(rootID);
  10001. var parent = ReactMount.getFirstReactDOM(container);
  10002. return parent;
  10003. }
  10004. // Used to store ancestor hierarchy in top level callback
  10005. function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  10006. this.topLevelType = topLevelType;
  10007. this.nativeEvent = nativeEvent;
  10008. this.ancestors = [];
  10009. }
  10010. assign(TopLevelCallbackBookKeeping.prototype, {
  10011. destructor: function() {
  10012. this.topLevelType = null;
  10013. this.nativeEvent = null;
  10014. this.ancestors.length = 0;
  10015. }
  10016. });
  10017. PooledClass.addPoolingTo(
  10018. TopLevelCallbackBookKeeping,
  10019. PooledClass.twoArgumentPooler
  10020. );
  10021. function handleTopLevelImpl(bookKeeping) {
  10022. var topLevelTarget = ReactMount.getFirstReactDOM(
  10023. getEventTarget(bookKeeping.nativeEvent)
  10024. ) || window;
  10025. // Loop through the hierarchy, in case there's any nested components.
  10026. // It's important that we build the array of ancestors before calling any
  10027. // event handlers, because event handlers can modify the DOM, leading to
  10028. // inconsistencies with ReactMount's node cache. See #1105.
  10029. var ancestor = topLevelTarget;
  10030. while (ancestor) {
  10031. bookKeeping.ancestors.push(ancestor);
  10032. ancestor = findParent(ancestor);
  10033. }
  10034. for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
  10035. topLevelTarget = bookKeeping.ancestors[i];
  10036. var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
  10037. ReactEventListener._handleTopLevel(
  10038. bookKeeping.topLevelType,
  10039. topLevelTarget,
  10040. topLevelTargetID,
  10041. bookKeeping.nativeEvent
  10042. );
  10043. }
  10044. }
  10045. function scrollValueMonitor(cb) {
  10046. var scrollPosition = getUnboundedScrollPosition(window);
  10047. cb(scrollPosition);
  10048. }
  10049. var ReactEventListener = {
  10050. _enabled: true,
  10051. _handleTopLevel: null,
  10052. WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
  10053. setHandleTopLevel: function(handleTopLevel) {
  10054. ReactEventListener._handleTopLevel = handleTopLevel;
  10055. },
  10056. setEnabled: function(enabled) {
  10057. ReactEventListener._enabled = !!enabled;
  10058. },
  10059. isEnabled: function() {
  10060. return ReactEventListener._enabled;
  10061. },
  10062. /**
  10063. * Traps top-level events by using event bubbling.
  10064. *
  10065. * @param {string} topLevelType Record from `EventConstants`.
  10066. * @param {string} handlerBaseName Event name (e.g. "click").
  10067. * @param {object} handle Element on which to attach listener.
  10068. * @return {object} An object with a remove function which will forcefully
  10069. * remove the listener.
  10070. * @internal
  10071. */
  10072. trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
  10073. var element = handle;
  10074. if (!element) {
  10075. return null;
  10076. }
  10077. return EventListener.listen(
  10078. element,
  10079. handlerBaseName,
  10080. ReactEventListener.dispatchEvent.bind(null, topLevelType)
  10081. );
  10082. },
  10083. /**
  10084. * Traps a top-level event by using event capturing.
  10085. *
  10086. * @param {string} topLevelType Record from `EventConstants`.
  10087. * @param {string} handlerBaseName Event name (e.g. "click").
  10088. * @param {object} handle Element on which to attach listener.
  10089. * @return {object} An object with a remove function which will forcefully
  10090. * remove the listener.
  10091. * @internal
  10092. */
  10093. trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
  10094. var element = handle;
  10095. if (!element) {
  10096. return null;
  10097. }
  10098. return EventListener.capture(
  10099. element,
  10100. handlerBaseName,
  10101. ReactEventListener.dispatchEvent.bind(null, topLevelType)
  10102. );
  10103. },
  10104. monitorScrollValue: function(refresh) {
  10105. var callback = scrollValueMonitor.bind(null, refresh);
  10106. EventListener.listen(window, 'scroll', callback);
  10107. },
  10108. dispatchEvent: function(topLevelType, nativeEvent) {
  10109. if (!ReactEventListener._enabled) {
  10110. return;
  10111. }
  10112. var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
  10113. topLevelType,
  10114. nativeEvent
  10115. );
  10116. try {
  10117. // Event queue being processed in the same cycle allows
  10118. // `preventDefault`.
  10119. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
  10120. } finally {
  10121. TopLevelCallbackBookKeeping.release(bookKeeping);
  10122. }
  10123. }
  10124. };
  10125. module.exports = ReactEventListener;
  10126. },{"100":100,"140":140,"146":146,"17":17,"22":22,"29":29,"30":30,"72":72,"77":77}],69:[function(_dereq_,module,exports){
  10127. /**
  10128. * Copyright 2015, Facebook, Inc.
  10129. * All rights reserved.
  10130. *
  10131. * This source code is licensed under the BSD-style license found in the
  10132. * LICENSE file in the root directory of this source tree. An additional grant
  10133. * of patent rights can be found in the PATENTS file in the same directory.
  10134. *
  10135. * @providesModule ReactFragment
  10136. */
  10137. 'use strict';
  10138. var ReactElement = _dereq_(63);
  10139. var warning = _dereq_(171);
  10140. /**
  10141. * We used to allow keyed objects to serve as a collection of ReactElements,
  10142. * or nested sets. This allowed us a way to explicitly key a set a fragment of
  10143. * components. This is now being replaced with an opaque data structure.
  10144. * The upgrade path is to call React.addons.createFragment({ key: value }) to
  10145. * create a keyed fragment. The resulting data structure is opaque, for now.
  10146. */
  10147. if ("production" !== "development") {
  10148. var fragmentKey = '_reactFragment';
  10149. var didWarnKey = '_reactDidWarn';
  10150. var canWarnForReactFragment = false;
  10151. try {
  10152. // Feature test. Don't even try to issue this warning if we can't use
  10153. // enumerable: false.
  10154. var dummy = function() {
  10155. return 1;
  10156. };
  10157. Object.defineProperty(
  10158. {},
  10159. fragmentKey,
  10160. {enumerable: false, value: true}
  10161. );
  10162. Object.defineProperty(
  10163. {},
  10164. 'key',
  10165. {enumerable: true, get: dummy}
  10166. );
  10167. canWarnForReactFragment = true;
  10168. } catch (x) { }
  10169. var proxyPropertyAccessWithWarning = function(obj, key) {
  10170. Object.defineProperty(obj, key, {
  10171. enumerable: true,
  10172. get: function() {
  10173. ("production" !== "development" ? warning(
  10174. this[didWarnKey],
  10175. 'A ReactFragment is an opaque type. Accessing any of its ' +
  10176. 'properties is deprecated. Pass it to one of the React.Children ' +
  10177. 'helpers.'
  10178. ) : null);
  10179. this[didWarnKey] = true;
  10180. return this[fragmentKey][key];
  10181. },
  10182. set: function(value) {
  10183. ("production" !== "development" ? warning(
  10184. this[didWarnKey],
  10185. 'A ReactFragment is an immutable opaque type. Mutating its ' +
  10186. 'properties is deprecated.'
  10187. ) : null);
  10188. this[didWarnKey] = true;
  10189. this[fragmentKey][key] = value;
  10190. }
  10191. });
  10192. };
  10193. var issuedWarnings = {};
  10194. var didWarnForFragment = function(fragment) {
  10195. // We use the keys and the type of the value as a heuristic to dedupe the
  10196. // warning to avoid spamming too much.
  10197. var fragmentCacheKey = '';
  10198. for (var key in fragment) {
  10199. fragmentCacheKey += key + ':' + (typeof fragment[key]) + ',';
  10200. }
  10201. var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
  10202. issuedWarnings[fragmentCacheKey] = true;
  10203. return alreadyWarnedOnce;
  10204. };
  10205. }
  10206. var ReactFragment = {
  10207. // Wrap a keyed object in an opaque proxy that warns you if you access any
  10208. // of its properties.
  10209. create: function(object) {
  10210. if ("production" !== "development") {
  10211. if (typeof object !== 'object' || !object || Array.isArray(object)) {
  10212. ("production" !== "development" ? warning(
  10213. false,
  10214. 'React.addons.createFragment only accepts a single object.',
  10215. object
  10216. ) : null);
  10217. return object;
  10218. }
  10219. if (ReactElement.isValidElement(object)) {
  10220. ("production" !== "development" ? warning(
  10221. false,
  10222. 'React.addons.createFragment does not accept a ReactElement ' +
  10223. 'without a wrapper object.'
  10224. ) : null);
  10225. return object;
  10226. }
  10227. if (canWarnForReactFragment) {
  10228. var proxy = {};
  10229. Object.defineProperty(proxy, fragmentKey, {
  10230. enumerable: false,
  10231. value: object
  10232. });
  10233. Object.defineProperty(proxy, didWarnKey, {
  10234. writable: true,
  10235. enumerable: false,
  10236. value: false
  10237. });
  10238. for (var key in object) {
  10239. proxyPropertyAccessWithWarning(proxy, key);
  10240. }
  10241. Object.preventExtensions(proxy);
  10242. return proxy;
  10243. }
  10244. }
  10245. return object;
  10246. },
  10247. // Extract the original keyed object from the fragment opaque type. Warn if
  10248. // a plain object is passed here.
  10249. extract: function(fragment) {
  10250. if ("production" !== "development") {
  10251. if (canWarnForReactFragment) {
  10252. if (!fragment[fragmentKey]) {
  10253. ("production" !== "development" ? warning(
  10254. didWarnForFragment(fragment),
  10255. 'Any use of a keyed object should be wrapped in ' +
  10256. 'React.addons.createFragment(object) before being passed as a ' +
  10257. 'child.'
  10258. ) : null);
  10259. return fragment;
  10260. }
  10261. return fragment[fragmentKey];
  10262. }
  10263. }
  10264. return fragment;
  10265. },
  10266. // Check if this is a fragment and if so, extract the keyed object. If it
  10267. // is a fragment-like object, warn that it should be wrapped. Ignore if we
  10268. // can't determine what kind of object this is.
  10269. extractIfFragment: function(fragment) {
  10270. if ("production" !== "development") {
  10271. if (canWarnForReactFragment) {
  10272. // If it is the opaque type, return the keyed object.
  10273. if (fragment[fragmentKey]) {
  10274. return fragment[fragmentKey];
  10275. }
  10276. // Otherwise, check each property if it has an element, if it does
  10277. // it is probably meant as a fragment, so we can warn early. Defer,
  10278. // the warning to extract.
  10279. for (var key in fragment) {
  10280. if (fragment.hasOwnProperty(key) &&
  10281. ReactElement.isValidElement(fragment[key])) {
  10282. // This looks like a fragment object, we should provide an
  10283. // early warning.
  10284. return ReactFragment.extract(fragment);
  10285. }
  10286. }
  10287. }
  10288. }
  10289. return fragment;
  10290. }
  10291. };
  10292. module.exports = ReactFragment;
  10293. },{"171":171,"63":63}],70:[function(_dereq_,module,exports){
  10294. /**
  10295. * Copyright 2013-2015, Facebook, Inc.
  10296. * All rights reserved.
  10297. *
  10298. * This source code is licensed under the BSD-style license found in the
  10299. * LICENSE file in the root directory of this source tree. An additional grant
  10300. * of patent rights can be found in the PATENTS file in the same directory.
  10301. *
  10302. * @providesModule ReactInjection
  10303. */
  10304. 'use strict';
  10305. var DOMProperty = _dereq_(11);
  10306. var EventPluginHub = _dereq_(18);
  10307. var ReactComponentEnvironment = _dereq_(41);
  10308. var ReactClass = _dereq_(38);
  10309. var ReactEmptyComponent = _dereq_(65);
  10310. var ReactBrowserEventEmitter = _dereq_(33);
  10311. var ReactNativeComponent = _dereq_(80);
  10312. var ReactDOMComponent = _dereq_(48);
  10313. var ReactPerf = _dereq_(82);
  10314. var ReactRootIndex = _dereq_(91);
  10315. var ReactUpdates = _dereq_(100);
  10316. var ReactInjection = {
  10317. Component: ReactComponentEnvironment.injection,
  10318. Class: ReactClass.injection,
  10319. DOMComponent: ReactDOMComponent.injection,
  10320. DOMProperty: DOMProperty.injection,
  10321. EmptyComponent: ReactEmptyComponent.injection,
  10322. EventPluginHub: EventPluginHub.injection,
  10323. EventEmitter: ReactBrowserEventEmitter.injection,
  10324. NativeComponent: ReactNativeComponent.injection,
  10325. Perf: ReactPerf.injection,
  10326. RootIndex: ReactRootIndex.injection,
  10327. Updates: ReactUpdates.injection
  10328. };
  10329. module.exports = ReactInjection;
  10330. },{"100":100,"11":11,"18":18,"33":33,"38":38,"41":41,"48":48,"65":65,"80":80,"82":82,"91":91}],71:[function(_dereq_,module,exports){
  10331. /**
  10332. * Copyright 2013-2015, Facebook, Inc.
  10333. * All rights reserved.
  10334. *
  10335. * This source code is licensed under the BSD-style license found in the
  10336. * LICENSE file in the root directory of this source tree. An additional grant
  10337. * of patent rights can be found in the PATENTS file in the same directory.
  10338. *
  10339. * @providesModule ReactInputSelection
  10340. */
  10341. 'use strict';
  10342. var ReactDOMSelection = _dereq_(56);
  10343. var containsNode = _dereq_(123);
  10344. var focusNode = _dereq_(134);
  10345. var getActiveElement = _dereq_(136);
  10346. function isInDocument(node) {
  10347. return containsNode(document.documentElement, node);
  10348. }
  10349. /**
  10350. * @ReactInputSelection: React input selection module. Based on Selection.js,
  10351. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  10352. * assume buttons have range selections allowed).
  10353. * Input selection module for React.
  10354. */
  10355. var ReactInputSelection = {
  10356. hasSelectionCapabilities: function(elem) {
  10357. return elem && (
  10358. ((elem.nodeName === 'INPUT' && elem.type === 'text') ||
  10359. elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')
  10360. );
  10361. },
  10362. getSelectionInformation: function() {
  10363. var focusedElem = getActiveElement();
  10364. return {
  10365. focusedElem: focusedElem,
  10366. selectionRange:
  10367. ReactInputSelection.hasSelectionCapabilities(focusedElem) ?
  10368. ReactInputSelection.getSelection(focusedElem) :
  10369. null
  10370. };
  10371. },
  10372. /**
  10373. * @restoreSelection: If any selection information was potentially lost,
  10374. * restore it. This is useful when performing operations that could remove dom
  10375. * nodes and place them back in, resulting in focus being lost.
  10376. */
  10377. restoreSelection: function(priorSelectionInformation) {
  10378. var curFocusedElem = getActiveElement();
  10379. var priorFocusedElem = priorSelectionInformation.focusedElem;
  10380. var priorSelectionRange = priorSelectionInformation.selectionRange;
  10381. if (curFocusedElem !== priorFocusedElem &&
  10382. isInDocument(priorFocusedElem)) {
  10383. if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
  10384. ReactInputSelection.setSelection(
  10385. priorFocusedElem,
  10386. priorSelectionRange
  10387. );
  10388. }
  10389. focusNode(priorFocusedElem);
  10390. }
  10391. },
  10392. /**
  10393. * @getSelection: Gets the selection bounds of a focused textarea, input or
  10394. * contentEditable node.
  10395. * -@input: Look up selection bounds of this input
  10396. * -@return {start: selectionStart, end: selectionEnd}
  10397. */
  10398. getSelection: function(input) {
  10399. var selection;
  10400. if ('selectionStart' in input) {
  10401. // Modern browser with input or textarea.
  10402. selection = {
  10403. start: input.selectionStart,
  10404. end: input.selectionEnd
  10405. };
  10406. } else if (document.selection && input.nodeName === 'INPUT') {
  10407. // IE8 input.
  10408. var range = document.selection.createRange();
  10409. // There can only be one selection per document in IE, so it must
  10410. // be in our element.
  10411. if (range.parentElement() === input) {
  10412. selection = {
  10413. start: -range.moveStart('character', -input.value.length),
  10414. end: -range.moveEnd('character', -input.value.length)
  10415. };
  10416. }
  10417. } else {
  10418. // Content editable or old IE textarea.
  10419. selection = ReactDOMSelection.getOffsets(input);
  10420. }
  10421. return selection || {start: 0, end: 0};
  10422. },
  10423. /**
  10424. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  10425. * the input.
  10426. * -@input Set selection bounds of this input or textarea
  10427. * -@offsets Object of same form that is returned from get*
  10428. */
  10429. setSelection: function(input, offsets) {
  10430. var start = offsets.start;
  10431. var end = offsets.end;
  10432. if (typeof end === 'undefined') {
  10433. end = start;
  10434. }
  10435. if ('selectionStart' in input) {
  10436. input.selectionStart = start;
  10437. input.selectionEnd = Math.min(end, input.value.length);
  10438. } else if (document.selection && input.nodeName === 'INPUT') {
  10439. var range = input.createTextRange();
  10440. range.collapse(true);
  10441. range.moveStart('character', start);
  10442. range.moveEnd('character', end - start);
  10443. range.select();
  10444. } else {
  10445. ReactDOMSelection.setOffsets(input, offsets);
  10446. }
  10447. }
  10448. };
  10449. module.exports = ReactInputSelection;
  10450. },{"123":123,"134":134,"136":136,"56":56}],72:[function(_dereq_,module,exports){
  10451. /**
  10452. * Copyright 2013-2015, Facebook, Inc.
  10453. * All rights reserved.
  10454. *
  10455. * This source code is licensed under the BSD-style license found in the
  10456. * LICENSE file in the root directory of this source tree. An additional grant
  10457. * of patent rights can be found in the PATENTS file in the same directory.
  10458. *
  10459. * @providesModule ReactInstanceHandles
  10460. * @typechecks static-only
  10461. */
  10462. 'use strict';
  10463. var ReactRootIndex = _dereq_(91);
  10464. var invariant = _dereq_(150);
  10465. var SEPARATOR = '.';
  10466. var SEPARATOR_LENGTH = SEPARATOR.length;
  10467. /**
  10468. * Maximum depth of traversals before we consider the possibility of a bad ID.
  10469. */
  10470. var MAX_TREE_DEPTH = 100;
  10471. /**
  10472. * Creates a DOM ID prefix to use when mounting React components.
  10473. *
  10474. * @param {number} index A unique integer
  10475. * @return {string} React root ID.
  10476. * @internal
  10477. */
  10478. function getReactRootIDString(index) {
  10479. return SEPARATOR + index.toString(36);
  10480. }
  10481. /**
  10482. * Checks if a character in the supplied ID is a separator or the end.
  10483. *
  10484. * @param {string} id A React DOM ID.
  10485. * @param {number} index Index of the character to check.
  10486. * @return {boolean} True if the character is a separator or end of the ID.
  10487. * @private
  10488. */
  10489. function isBoundary(id, index) {
  10490. return id.charAt(index) === SEPARATOR || index === id.length;
  10491. }
  10492. /**
  10493. * Checks if the supplied string is a valid React DOM ID.
  10494. *
  10495. * @param {string} id A React DOM ID, maybe.
  10496. * @return {boolean} True if the string is a valid React DOM ID.
  10497. * @private
  10498. */
  10499. function isValidID(id) {
  10500. return id === '' || (
  10501. id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
  10502. );
  10503. }
  10504. /**
  10505. * Checks if the first ID is an ancestor of or equal to the second ID.
  10506. *
  10507. * @param {string} ancestorID
  10508. * @param {string} descendantID
  10509. * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
  10510. * @internal
  10511. */
  10512. function isAncestorIDOf(ancestorID, descendantID) {
  10513. return (
  10514. descendantID.indexOf(ancestorID) === 0 &&
  10515. isBoundary(descendantID, ancestorID.length)
  10516. );
  10517. }
  10518. /**
  10519. * Gets the parent ID of the supplied React DOM ID, `id`.
  10520. *
  10521. * @param {string} id ID of a component.
  10522. * @return {string} ID of the parent, or an empty string.
  10523. * @private
  10524. */
  10525. function getParentID(id) {
  10526. return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
  10527. }
  10528. /**
  10529. * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
  10530. * supplied `destinationID`. If they are equal, the ID is returned.
  10531. *
  10532. * @param {string} ancestorID ID of an ancestor node of `destinationID`.
  10533. * @param {string} destinationID ID of the destination node.
  10534. * @return {string} Next ID on the path from `ancestorID` to `destinationID`.
  10535. * @private
  10536. */
  10537. function getNextDescendantID(ancestorID, destinationID) {
  10538. ("production" !== "development" ? invariant(
  10539. isValidID(ancestorID) && isValidID(destinationID),
  10540. 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
  10541. ancestorID,
  10542. destinationID
  10543. ) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
  10544. ("production" !== "development" ? invariant(
  10545. isAncestorIDOf(ancestorID, destinationID),
  10546. 'getNextDescendantID(...): React has made an invalid assumption about ' +
  10547. 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
  10548. ancestorID,
  10549. destinationID
  10550. ) : invariant(isAncestorIDOf(ancestorID, destinationID)));
  10551. if (ancestorID === destinationID) {
  10552. return ancestorID;
  10553. }
  10554. // Skip over the ancestor and the immediate separator. Traverse until we hit
  10555. // another separator or we reach the end of `destinationID`.
  10556. var start = ancestorID.length + SEPARATOR_LENGTH;
  10557. var i;
  10558. for (i = start; i < destinationID.length; i++) {
  10559. if (isBoundary(destinationID, i)) {
  10560. break;
  10561. }
  10562. }
  10563. return destinationID.substr(0, i);
  10564. }
  10565. /**
  10566. * Gets the nearest common ancestor ID of two IDs.
  10567. *
  10568. * Using this ID scheme, the nearest common ancestor ID is the longest common
  10569. * prefix of the two IDs that immediately preceded a "marker" in both strings.
  10570. *
  10571. * @param {string} oneID
  10572. * @param {string} twoID
  10573. * @return {string} Nearest common ancestor ID, or the empty string if none.
  10574. * @private
  10575. */
  10576. function getFirstCommonAncestorID(oneID, twoID) {
  10577. var minLength = Math.min(oneID.length, twoID.length);
  10578. if (minLength === 0) {
  10579. return '';
  10580. }
  10581. var lastCommonMarkerIndex = 0;
  10582. // Use `<=` to traverse until the "EOL" of the shorter string.
  10583. for (var i = 0; i <= minLength; i++) {
  10584. if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
  10585. lastCommonMarkerIndex = i;
  10586. } else if (oneID.charAt(i) !== twoID.charAt(i)) {
  10587. break;
  10588. }
  10589. }
  10590. var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
  10591. ("production" !== "development" ? invariant(
  10592. isValidID(longestCommonID),
  10593. 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
  10594. oneID,
  10595. twoID,
  10596. longestCommonID
  10597. ) : invariant(isValidID(longestCommonID)));
  10598. return longestCommonID;
  10599. }
  10600. /**
  10601. * Traverses the parent path between two IDs (either up or down). The IDs must
  10602. * not be the same, and there must exist a parent path between them. If the
  10603. * callback returns `false`, traversal is stopped.
  10604. *
  10605. * @param {?string} start ID at which to start traversal.
  10606. * @param {?string} stop ID at which to end traversal.
  10607. * @param {function} cb Callback to invoke each ID with.
  10608. * @param {?boolean} skipFirst Whether or not to skip the first node.
  10609. * @param {?boolean} skipLast Whether or not to skip the last node.
  10610. * @private
  10611. */
  10612. function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
  10613. start = start || '';
  10614. stop = stop || '';
  10615. ("production" !== "development" ? invariant(
  10616. start !== stop,
  10617. 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
  10618. start
  10619. ) : invariant(start !== stop));
  10620. var traverseUp = isAncestorIDOf(stop, start);
  10621. ("production" !== "development" ? invariant(
  10622. traverseUp || isAncestorIDOf(start, stop),
  10623. 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
  10624. 'not have a parent path.',
  10625. start,
  10626. stop
  10627. ) : invariant(traverseUp || isAncestorIDOf(start, stop)));
  10628. // Traverse from `start` to `stop` one depth at a time.
  10629. var depth = 0;
  10630. var traverse = traverseUp ? getParentID : getNextDescendantID;
  10631. for (var id = start; /* until break */; id = traverse(id, stop)) {
  10632. var ret;
  10633. if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
  10634. ret = cb(id, traverseUp, arg);
  10635. }
  10636. if (ret === false || id === stop) {
  10637. // Only break //after// visiting `stop`.
  10638. break;
  10639. }
  10640. ("production" !== "development" ? invariant(
  10641. depth++ < MAX_TREE_DEPTH,
  10642. 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
  10643. 'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
  10644. start, stop
  10645. ) : invariant(depth++ < MAX_TREE_DEPTH));
  10646. }
  10647. }
  10648. /**
  10649. * Manages the IDs assigned to DOM representations of React components. This
  10650. * uses a specific scheme in order to traverse the DOM efficiently (e.g. in
  10651. * order to simulate events).
  10652. *
  10653. * @internal
  10654. */
  10655. var ReactInstanceHandles = {
  10656. /**
  10657. * Constructs a React root ID
  10658. * @return {string} A React root ID.
  10659. */
  10660. createReactRootID: function() {
  10661. return getReactRootIDString(ReactRootIndex.createReactRootIndex());
  10662. },
  10663. /**
  10664. * Constructs a React ID by joining a root ID with a name.
  10665. *
  10666. * @param {string} rootID Root ID of a parent component.
  10667. * @param {string} name A component's name (as flattened children).
  10668. * @return {string} A React ID.
  10669. * @internal
  10670. */
  10671. createReactID: function(rootID, name) {
  10672. return rootID + name;
  10673. },
  10674. /**
  10675. * Gets the DOM ID of the React component that is the root of the tree that
  10676. * contains the React component with the supplied DOM ID.
  10677. *
  10678. * @param {string} id DOM ID of a React component.
  10679. * @return {?string} DOM ID of the React component that is the root.
  10680. * @internal
  10681. */
  10682. getReactRootIDFromNodeID: function(id) {
  10683. if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
  10684. var index = id.indexOf(SEPARATOR, 1);
  10685. return index > -1 ? id.substr(0, index) : id;
  10686. }
  10687. return null;
  10688. },
  10689. /**
  10690. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  10691. * should would receive a `mouseEnter` or `mouseLeave` event.
  10692. *
  10693. * NOTE: Does not invoke the callback on the nearest common ancestor because
  10694. * nothing "entered" or "left" that element.
  10695. *
  10696. * @param {string} leaveID ID being left.
  10697. * @param {string} enterID ID being entered.
  10698. * @param {function} cb Callback to invoke on each entered/left ID.
  10699. * @param {*} upArg Argument to invoke the callback with on left IDs.
  10700. * @param {*} downArg Argument to invoke the callback with on entered IDs.
  10701. * @internal
  10702. */
  10703. traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
  10704. var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
  10705. if (ancestorID !== leaveID) {
  10706. traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
  10707. }
  10708. if (ancestorID !== enterID) {
  10709. traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
  10710. }
  10711. },
  10712. /**
  10713. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  10714. *
  10715. * NOTE: This traversal happens on IDs without touching the DOM.
  10716. *
  10717. * @param {string} targetID ID of the target node.
  10718. * @param {function} cb Callback to invoke.
  10719. * @param {*} arg Argument to invoke the callback with.
  10720. * @internal
  10721. */
  10722. traverseTwoPhase: function(targetID, cb, arg) {
  10723. if (targetID) {
  10724. traverseParentPath('', targetID, cb, arg, true, false);
  10725. traverseParentPath(targetID, '', cb, arg, false, true);
  10726. }
  10727. },
  10728. /**
  10729. * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
  10730. * example, passing `.0.$row-0.1` would result in `cb` getting called
  10731. * with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
  10732. *
  10733. * NOTE: This traversal happens on IDs without touching the DOM.
  10734. *
  10735. * @param {string} targetID ID of the target node.
  10736. * @param {function} cb Callback to invoke.
  10737. * @param {*} arg Argument to invoke the callback with.
  10738. * @internal
  10739. */
  10740. traverseAncestors: function(targetID, cb, arg) {
  10741. traverseParentPath('', targetID, cb, arg, true, false);
  10742. },
  10743. /**
  10744. * Exposed for unit testing.
  10745. * @private
  10746. */
  10747. _getFirstCommonAncestorID: getFirstCommonAncestorID,
  10748. /**
  10749. * Exposed for unit testing.
  10750. * @private
  10751. */
  10752. _getNextDescendantID: getNextDescendantID,
  10753. isAncestorIDOf: isAncestorIDOf,
  10754. SEPARATOR: SEPARATOR
  10755. };
  10756. module.exports = ReactInstanceHandles;
  10757. },{"150":150,"91":91}],73:[function(_dereq_,module,exports){
  10758. /**
  10759. * Copyright 2013-2015, Facebook, Inc.
  10760. * All rights reserved.
  10761. *
  10762. * This source code is licensed under the BSD-style license found in the
  10763. * LICENSE file in the root directory of this source tree. An additional grant
  10764. * of patent rights can be found in the PATENTS file in the same directory.
  10765. *
  10766. * @providesModule ReactInstanceMap
  10767. */
  10768. 'use strict';
  10769. /**
  10770. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  10771. * instance (key) and the internal representation (value). This allows public
  10772. * methods to accept the user facing instance as an argument and map them back
  10773. * to internal methods.
  10774. */
  10775. // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
  10776. var ReactInstanceMap = {
  10777. /**
  10778. * This API should be called `delete` but we'd have to make sure to always
  10779. * transform these to strings for IE support. When this transform is fully
  10780. * supported we can rename it.
  10781. */
  10782. remove: function(key) {
  10783. key._reactInternalInstance = undefined;
  10784. },
  10785. get: function(key) {
  10786. return key._reactInternalInstance;
  10787. },
  10788. has: function(key) {
  10789. return key._reactInternalInstance !== undefined;
  10790. },
  10791. set: function(key, value) {
  10792. key._reactInternalInstance = value;
  10793. }
  10794. };
  10795. module.exports = ReactInstanceMap;
  10796. },{}],74:[function(_dereq_,module,exports){
  10797. /**
  10798. * Copyright 2015, Facebook, Inc.
  10799. * All rights reserved.
  10800. *
  10801. * This source code is licensed under the BSD-style license found in the
  10802. * LICENSE file in the root directory of this source tree. An additional grant
  10803. * of patent rights can be found in the PATENTS file in the same directory.
  10804. *
  10805. * @providesModule ReactLifeCycle
  10806. */
  10807. 'use strict';
  10808. /**
  10809. * This module manages the bookkeeping when a component is in the process
  10810. * of being mounted or being unmounted. This is used as a way to enforce
  10811. * invariants (or warnings) when it is not recommended to call
  10812. * setState/forceUpdate.
  10813. *
  10814. * currentlyMountingInstance: During the construction phase, it is not possible
  10815. * to trigger an update since the instance is not fully mounted yet. However, we
  10816. * currently allow this as a convenience for mutating the initial state.
  10817. *
  10818. * currentlyUnmountingInstance: During the unmounting phase, the instance is
  10819. * still mounted and can therefore schedule an update. However, this is not
  10820. * recommended and probably an error since it's about to be unmounted.
  10821. * Therefore we still want to trigger in an error for that case.
  10822. */
  10823. var ReactLifeCycle = {
  10824. currentlyMountingInstance: null,
  10825. currentlyUnmountingInstance: null
  10826. };
  10827. module.exports = ReactLifeCycle;
  10828. },{}],75:[function(_dereq_,module,exports){
  10829. /**
  10830. * Copyright 2013-2015, Facebook, Inc.
  10831. * All rights reserved.
  10832. *
  10833. * This source code is licensed under the BSD-style license found in the
  10834. * LICENSE file in the root directory of this source tree. An additional grant
  10835. * of patent rights can be found in the PATENTS file in the same directory.
  10836. *
  10837. * @providesModule ReactLink
  10838. * @typechecks static-only
  10839. */
  10840. 'use strict';
  10841. /**
  10842. * ReactLink encapsulates a common pattern in which a component wants to modify
  10843. * a prop received from its parent. ReactLink allows the parent to pass down a
  10844. * value coupled with a callback that, when invoked, expresses an intent to
  10845. * modify that value. For example:
  10846. *
  10847. * React.createClass({
  10848. * getInitialState: function() {
  10849. * return {value: ''};
  10850. * },
  10851. * render: function() {
  10852. * var valueLink = new ReactLink(this.state.value, this._handleValueChange);
  10853. * return <input valueLink={valueLink} />;
  10854. * },
  10855. * this._handleValueChange: function(newValue) {
  10856. * this.setState({value: newValue});
  10857. * }
  10858. * });
  10859. *
  10860. * We have provided some sugary mixins to make the creation and
  10861. * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
  10862. */
  10863. var React = _dereq_(31);
  10864. /**
  10865. * @param {*} value current value of the link
  10866. * @param {function} requestChange callback to request a change
  10867. */
  10868. function ReactLink(value, requestChange) {
  10869. this.value = value;
  10870. this.requestChange = requestChange;
  10871. }
  10872. /**
  10873. * Creates a PropType that enforces the ReactLink API and optionally checks the
  10874. * type of the value being passed inside the link. Example:
  10875. *
  10876. * MyComponent.propTypes = {
  10877. * tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number)
  10878. * }
  10879. */
  10880. function createLinkTypeChecker(linkType) {
  10881. var shapes = {
  10882. value: typeof linkType === 'undefined' ?
  10883. React.PropTypes.any.isRequired :
  10884. linkType.isRequired,
  10885. requestChange: React.PropTypes.func.isRequired
  10886. };
  10887. return React.PropTypes.shape(shapes);
  10888. }
  10889. ReactLink.PropTypes = {
  10890. link: createLinkTypeChecker
  10891. };
  10892. module.exports = ReactLink;
  10893. },{"31":31}],76:[function(_dereq_,module,exports){
  10894. /**
  10895. * Copyright 2013-2015, Facebook, Inc.
  10896. * All rights reserved.
  10897. *
  10898. * This source code is licensed under the BSD-style license found in the
  10899. * LICENSE file in the root directory of this source tree. An additional grant
  10900. * of patent rights can be found in the PATENTS file in the same directory.
  10901. *
  10902. * @providesModule ReactMarkupChecksum
  10903. */
  10904. 'use strict';
  10905. var adler32 = _dereq_(119);
  10906. var ReactMarkupChecksum = {
  10907. CHECKSUM_ATTR_NAME: 'data-react-checksum',
  10908. /**
  10909. * @param {string} markup Markup string
  10910. * @return {string} Markup string with checksum attribute attached
  10911. */
  10912. addChecksumToMarkup: function(markup) {
  10913. var checksum = adler32(markup);
  10914. return markup.replace(
  10915. '>',
  10916. ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
  10917. );
  10918. },
  10919. /**
  10920. * @param {string} markup to use
  10921. * @param {DOMElement} element root React element
  10922. * @returns {boolean} whether or not the markup is the same
  10923. */
  10924. canReuseMarkup: function(markup, element) {
  10925. var existingChecksum = element.getAttribute(
  10926. ReactMarkupChecksum.CHECKSUM_ATTR_NAME
  10927. );
  10928. existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
  10929. var markupChecksum = adler32(markup);
  10930. return markupChecksum === existingChecksum;
  10931. }
  10932. };
  10933. module.exports = ReactMarkupChecksum;
  10934. },{"119":119}],77:[function(_dereq_,module,exports){
  10935. /**
  10936. * Copyright 2013-2015, Facebook, Inc.
  10937. * All rights reserved.
  10938. *
  10939. * This source code is licensed under the BSD-style license found in the
  10940. * LICENSE file in the root directory of this source tree. An additional grant
  10941. * of patent rights can be found in the PATENTS file in the same directory.
  10942. *
  10943. * @providesModule ReactMount
  10944. */
  10945. 'use strict';
  10946. var DOMProperty = _dereq_(11);
  10947. var ReactBrowserEventEmitter = _dereq_(33);
  10948. var ReactCurrentOwner = _dereq_(45);
  10949. var ReactElement = _dereq_(63);
  10950. var ReactElementValidator = _dereq_(64);
  10951. var ReactEmptyComponent = _dereq_(65);
  10952. var ReactInstanceHandles = _dereq_(72);
  10953. var ReactInstanceMap = _dereq_(73);
  10954. var ReactMarkupChecksum = _dereq_(76);
  10955. var ReactPerf = _dereq_(82);
  10956. var ReactReconciler = _dereq_(89);
  10957. var ReactUpdateQueue = _dereq_(99);
  10958. var ReactUpdates = _dereq_(100);
  10959. var emptyObject = _dereq_(130);
  10960. var containsNode = _dereq_(123);
  10961. var getReactRootElementInContainer = _dereq_(144);
  10962. var instantiateReactComponent = _dereq_(149);
  10963. var invariant = _dereq_(150);
  10964. var setInnerHTML = _dereq_(164);
  10965. var shouldUpdateReactComponent = _dereq_(167);
  10966. var warning = _dereq_(171);
  10967. var SEPARATOR = ReactInstanceHandles.SEPARATOR;
  10968. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  10969. var nodeCache = {};
  10970. var ELEMENT_NODE_TYPE = 1;
  10971. var DOC_NODE_TYPE = 9;
  10972. /** Mapping from reactRootID to React component instance. */
  10973. var instancesByReactRootID = {};
  10974. /** Mapping from reactRootID to `container` nodes. */
  10975. var containersByReactRootID = {};
  10976. if ("production" !== "development") {
  10977. /** __DEV__-only mapping from reactRootID to root elements. */
  10978. var rootElementsByReactRootID = {};
  10979. }
  10980. // Used to store breadth-first search state in findComponentRoot.
  10981. var findComponentRootReusableArray = [];
  10982. /**
  10983. * Finds the index of the first character
  10984. * that's not common between the two given strings.
  10985. *
  10986. * @return {number} the index of the character where the strings diverge
  10987. */
  10988. function firstDifferenceIndex(string1, string2) {
  10989. var minLen = Math.min(string1.length, string2.length);
  10990. for (var i = 0; i < minLen; i++) {
  10991. if (string1.charAt(i) !== string2.charAt(i)) {
  10992. return i;
  10993. }
  10994. }
  10995. return string1.length === string2.length ? -1 : minLen;
  10996. }
  10997. /**
  10998. * @param {DOMElement} container DOM element that may contain a React component.
  10999. * @return {?string} A "reactRoot" ID, if a React component is rendered.
  11000. */
  11001. function getReactRootID(container) {
  11002. var rootElement = getReactRootElementInContainer(container);
  11003. return rootElement && ReactMount.getID(rootElement);
  11004. }
  11005. /**
  11006. * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
  11007. * element can return its control whose name or ID equals ATTR_NAME. All
  11008. * DOM nodes support `getAttributeNode` but this can also get called on
  11009. * other objects so just return '' if we're given something other than a
  11010. * DOM node (such as window).
  11011. *
  11012. * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
  11013. * @return {string} ID of the supplied `domNode`.
  11014. */
  11015. function getID(node) {
  11016. var id = internalGetID(node);
  11017. if (id) {
  11018. if (nodeCache.hasOwnProperty(id)) {
  11019. var cached = nodeCache[id];
  11020. if (cached !== node) {
  11021. ("production" !== "development" ? invariant(
  11022. !isValid(cached, id),
  11023. 'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
  11024. ATTR_NAME, id
  11025. ) : invariant(!isValid(cached, id)));
  11026. nodeCache[id] = node;
  11027. }
  11028. } else {
  11029. nodeCache[id] = node;
  11030. }
  11031. }
  11032. return id;
  11033. }
  11034. function internalGetID(node) {
  11035. // If node is something like a window, document, or text node, none of
  11036. // which support attributes or a .getAttribute method, gracefully return
  11037. // the empty string, as if the attribute were missing.
  11038. return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
  11039. }
  11040. /**
  11041. * Sets the React-specific ID of the given node.
  11042. *
  11043. * @param {DOMElement} node The DOM node whose ID will be set.
  11044. * @param {string} id The value of the ID attribute.
  11045. */
  11046. function setID(node, id) {
  11047. var oldID = internalGetID(node);
  11048. if (oldID !== id) {
  11049. delete nodeCache[oldID];
  11050. }
  11051. node.setAttribute(ATTR_NAME, id);
  11052. nodeCache[id] = node;
  11053. }
  11054. /**
  11055. * Finds the node with the supplied React-generated DOM ID.
  11056. *
  11057. * @param {string} id A React-generated DOM ID.
  11058. * @return {DOMElement} DOM node with the suppled `id`.
  11059. * @internal
  11060. */
  11061. function getNode(id) {
  11062. if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
  11063. nodeCache[id] = ReactMount.findReactNodeByID(id);
  11064. }
  11065. return nodeCache[id];
  11066. }
  11067. /**
  11068. * Finds the node with the supplied public React instance.
  11069. *
  11070. * @param {*} instance A public React instance.
  11071. * @return {?DOMElement} DOM node with the suppled `id`.
  11072. * @internal
  11073. */
  11074. function getNodeFromInstance(instance) {
  11075. var id = ReactInstanceMap.get(instance)._rootNodeID;
  11076. if (ReactEmptyComponent.isNullComponentID(id)) {
  11077. return null;
  11078. }
  11079. if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
  11080. nodeCache[id] = ReactMount.findReactNodeByID(id);
  11081. }
  11082. return nodeCache[id];
  11083. }
  11084. /**
  11085. * A node is "valid" if it is contained by a currently mounted container.
  11086. *
  11087. * This means that the node does not have to be contained by a document in
  11088. * order to be considered valid.
  11089. *
  11090. * @param {?DOMElement} node The candidate DOM node.
  11091. * @param {string} id The expected ID of the node.
  11092. * @return {boolean} Whether the node is contained by a mounted container.
  11093. */
  11094. function isValid(node, id) {
  11095. if (node) {
  11096. ("production" !== "development" ? invariant(
  11097. internalGetID(node) === id,
  11098. 'ReactMount: Unexpected modification of `%s`',
  11099. ATTR_NAME
  11100. ) : invariant(internalGetID(node) === id));
  11101. var container = ReactMount.findReactContainerForID(id);
  11102. if (container && containsNode(container, node)) {
  11103. return true;
  11104. }
  11105. }
  11106. return false;
  11107. }
  11108. /**
  11109. * Causes the cache to forget about one React-specific ID.
  11110. *
  11111. * @param {string} id The ID to forget.
  11112. */
  11113. function purgeID(id) {
  11114. delete nodeCache[id];
  11115. }
  11116. var deepestNodeSoFar = null;
  11117. function findDeepestCachedAncestorImpl(ancestorID) {
  11118. var ancestor = nodeCache[ancestorID];
  11119. if (ancestor && isValid(ancestor, ancestorID)) {
  11120. deepestNodeSoFar = ancestor;
  11121. } else {
  11122. // This node isn't populated in the cache, so presumably none of its
  11123. // descendants are. Break out of the loop.
  11124. return false;
  11125. }
  11126. }
  11127. /**
  11128. * Return the deepest cached node whose ID is a prefix of `targetID`.
  11129. */
  11130. function findDeepestCachedAncestor(targetID) {
  11131. deepestNodeSoFar = null;
  11132. ReactInstanceHandles.traverseAncestors(
  11133. targetID,
  11134. findDeepestCachedAncestorImpl
  11135. );
  11136. var foundNode = deepestNodeSoFar;
  11137. deepestNodeSoFar = null;
  11138. return foundNode;
  11139. }
  11140. /**
  11141. * Mounts this component and inserts it into the DOM.
  11142. *
  11143. * @param {ReactComponent} componentInstance The instance to mount.
  11144. * @param {string} rootID DOM ID of the root node.
  11145. * @param {DOMElement} container DOM element to mount into.
  11146. * @param {ReactReconcileTransaction} transaction
  11147. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  11148. */
  11149. function mountComponentIntoNode(
  11150. componentInstance,
  11151. rootID,
  11152. container,
  11153. transaction,
  11154. shouldReuseMarkup) {
  11155. var markup = ReactReconciler.mountComponent(
  11156. componentInstance, rootID, transaction, emptyObject
  11157. );
  11158. componentInstance._isTopLevel = true;
  11159. ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
  11160. }
  11161. /**
  11162. * Batched mount.
  11163. *
  11164. * @param {ReactComponent} componentInstance The instance to mount.
  11165. * @param {string} rootID DOM ID of the root node.
  11166. * @param {DOMElement} container DOM element to mount into.
  11167. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  11168. */
  11169. function batchedMountComponentIntoNode(
  11170. componentInstance,
  11171. rootID,
  11172. container,
  11173. shouldReuseMarkup) {
  11174. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
  11175. transaction.perform(
  11176. mountComponentIntoNode,
  11177. null,
  11178. componentInstance,
  11179. rootID,
  11180. container,
  11181. transaction,
  11182. shouldReuseMarkup
  11183. );
  11184. ReactUpdates.ReactReconcileTransaction.release(transaction);
  11185. }
  11186. /**
  11187. * Mounting is the process of initializing a React component by creating its
  11188. * representative DOM elements and inserting them into a supplied `container`.
  11189. * Any prior content inside `container` is destroyed in the process.
  11190. *
  11191. * ReactMount.render(
  11192. * component,
  11193. * document.getElementById('container')
  11194. * );
  11195. *
  11196. * <div id="container"> <-- Supplied `container`.
  11197. * <div data-reactid=".3"> <-- Rendered reactRoot of React
  11198. * // ... component.
  11199. * </div>
  11200. * </div>
  11201. *
  11202. * Inside of `container`, the first element rendered is the "reactRoot".
  11203. */
  11204. var ReactMount = {
  11205. /** Exposed for debugging purposes **/
  11206. _instancesByReactRootID: instancesByReactRootID,
  11207. /**
  11208. * This is a hook provided to support rendering React components while
  11209. * ensuring that the apparent scroll position of its `container` does not
  11210. * change.
  11211. *
  11212. * @param {DOMElement} container The `container` being rendered into.
  11213. * @param {function} renderCallback This must be called once to do the render.
  11214. */
  11215. scrollMonitor: function(container, renderCallback) {
  11216. renderCallback();
  11217. },
  11218. /**
  11219. * Take a component that's already mounted into the DOM and replace its props
  11220. * @param {ReactComponent} prevComponent component instance already in the DOM
  11221. * @param {ReactElement} nextElement component instance to render
  11222. * @param {DOMElement} container container to render into
  11223. * @param {?function} callback function triggered on completion
  11224. */
  11225. _updateRootComponent: function(
  11226. prevComponent,
  11227. nextElement,
  11228. container,
  11229. callback) {
  11230. if ("production" !== "development") {
  11231. ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
  11232. }
  11233. ReactMount.scrollMonitor(container, function() {
  11234. ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
  11235. if (callback) {
  11236. ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
  11237. }
  11238. });
  11239. if ("production" !== "development") {
  11240. // Record the root element in case it later gets transplanted.
  11241. rootElementsByReactRootID[getReactRootID(container)] =
  11242. getReactRootElementInContainer(container);
  11243. }
  11244. return prevComponent;
  11245. },
  11246. /**
  11247. * Register a component into the instance map and starts scroll value
  11248. * monitoring
  11249. * @param {ReactComponent} nextComponent component instance to render
  11250. * @param {DOMElement} container container to render into
  11251. * @return {string} reactRoot ID prefix
  11252. */
  11253. _registerComponent: function(nextComponent, container) {
  11254. ("production" !== "development" ? invariant(
  11255. container && (
  11256. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11257. ),
  11258. '_registerComponent(...): Target container is not a DOM element.'
  11259. ) : invariant(container && (
  11260. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11261. )));
  11262. ReactBrowserEventEmitter.ensureScrollValueMonitoring();
  11263. var reactRootID = ReactMount.registerContainer(container);
  11264. instancesByReactRootID[reactRootID] = nextComponent;
  11265. return reactRootID;
  11266. },
  11267. /**
  11268. * Render a new component into the DOM.
  11269. * @param {ReactElement} nextElement element to render
  11270. * @param {DOMElement} container container to render into
  11271. * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
  11272. * @return {ReactComponent} nextComponent
  11273. */
  11274. _renderNewRootComponent: function(
  11275. nextElement,
  11276. container,
  11277. shouldReuseMarkup
  11278. ) {
  11279. // Various parts of our code (such as ReactCompositeComponent's
  11280. // _renderValidatedComponent) assume that calls to render aren't nested;
  11281. // verify that that's the case.
  11282. ("production" !== "development" ? warning(
  11283. ReactCurrentOwner.current == null,
  11284. '_renderNewRootComponent(): Render methods should be a pure function ' +
  11285. 'of props and state; triggering nested component updates from ' +
  11286. 'render is not allowed. If necessary, trigger nested updates in ' +
  11287. 'componentDidUpdate.'
  11288. ) : null);
  11289. var componentInstance = instantiateReactComponent(nextElement, null);
  11290. var reactRootID = ReactMount._registerComponent(
  11291. componentInstance,
  11292. container
  11293. );
  11294. // The initial render is synchronous but any updates that happen during
  11295. // rendering, in componentWillMount or componentDidMount, will be batched
  11296. // according to the current batching strategy.
  11297. ReactUpdates.batchedUpdates(
  11298. batchedMountComponentIntoNode,
  11299. componentInstance,
  11300. reactRootID,
  11301. container,
  11302. shouldReuseMarkup
  11303. );
  11304. if ("production" !== "development") {
  11305. // Record the root element in case it later gets transplanted.
  11306. rootElementsByReactRootID[reactRootID] =
  11307. getReactRootElementInContainer(container);
  11308. }
  11309. return componentInstance;
  11310. },
  11311. /**
  11312. * Renders a React component into the DOM in the supplied `container`.
  11313. *
  11314. * If the React component was previously rendered into `container`, this will
  11315. * perform an update on it and only mutate the DOM as necessary to reflect the
  11316. * latest React component.
  11317. *
  11318. * @param {ReactElement} nextElement Component element to render.
  11319. * @param {DOMElement} container DOM element to render into.
  11320. * @param {?function} callback function triggered on completion
  11321. * @return {ReactComponent} Component instance rendered in `container`.
  11322. */
  11323. render: function(nextElement, container, callback) {
  11324. ("production" !== "development" ? invariant(
  11325. ReactElement.isValidElement(nextElement),
  11326. 'React.render(): Invalid component element.%s',
  11327. (
  11328. typeof nextElement === 'string' ?
  11329. ' Instead of passing an element string, make sure to instantiate ' +
  11330. 'it by passing it to React.createElement.' :
  11331. typeof nextElement === 'function' ?
  11332. ' Instead of passing a component class, make sure to instantiate ' +
  11333. 'it by passing it to React.createElement.' :
  11334. // Check if it quacks like an element
  11335. nextElement != null && nextElement.props !== undefined ?
  11336. ' This may be caused by unintentionally loading two independent ' +
  11337. 'copies of React.' :
  11338. ''
  11339. )
  11340. ) : invariant(ReactElement.isValidElement(nextElement)));
  11341. var prevComponent = instancesByReactRootID[getReactRootID(container)];
  11342. if (prevComponent) {
  11343. var prevElement = prevComponent._currentElement;
  11344. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  11345. return ReactMount._updateRootComponent(
  11346. prevComponent,
  11347. nextElement,
  11348. container,
  11349. callback
  11350. ).getPublicInstance();
  11351. } else {
  11352. ReactMount.unmountComponentAtNode(container);
  11353. }
  11354. }
  11355. var reactRootElement = getReactRootElementInContainer(container);
  11356. var containerHasReactMarkup =
  11357. reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
  11358. if ("production" !== "development") {
  11359. if (!containerHasReactMarkup || reactRootElement.nextSibling) {
  11360. var rootElementSibling = reactRootElement;
  11361. while (rootElementSibling) {
  11362. if (ReactMount.isRenderedByReact(rootElementSibling)) {
  11363. ("production" !== "development" ? warning(
  11364. false,
  11365. 'render(): Target node has markup rendered by React, but there ' +
  11366. 'are unrelated nodes as well. This is most commonly caused by ' +
  11367. 'white-space inserted around server-rendered markup.'
  11368. ) : null);
  11369. break;
  11370. }
  11371. rootElementSibling = rootElementSibling.nextSibling;
  11372. }
  11373. }
  11374. }
  11375. var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
  11376. var component = ReactMount._renderNewRootComponent(
  11377. nextElement,
  11378. container,
  11379. shouldReuseMarkup
  11380. ).getPublicInstance();
  11381. if (callback) {
  11382. callback.call(component);
  11383. }
  11384. return component;
  11385. },
  11386. /**
  11387. * Constructs a component instance of `constructor` with `initialProps` and
  11388. * renders it into the supplied `container`.
  11389. *
  11390. * @param {function} constructor React component constructor.
  11391. * @param {?object} props Initial props of the component instance.
  11392. * @param {DOMElement} container DOM element to render into.
  11393. * @return {ReactComponent} Component instance rendered in `container`.
  11394. */
  11395. constructAndRenderComponent: function(constructor, props, container) {
  11396. var element = ReactElement.createElement(constructor, props);
  11397. return ReactMount.render(element, container);
  11398. },
  11399. /**
  11400. * Constructs a component instance of `constructor` with `initialProps` and
  11401. * renders it into a container node identified by supplied `id`.
  11402. *
  11403. * @param {function} componentConstructor React component constructor
  11404. * @param {?object} props Initial props of the component instance.
  11405. * @param {string} id ID of the DOM element to render into.
  11406. * @return {ReactComponent} Component instance rendered in the container node.
  11407. */
  11408. constructAndRenderComponentByID: function(constructor, props, id) {
  11409. var domNode = document.getElementById(id);
  11410. ("production" !== "development" ? invariant(
  11411. domNode,
  11412. 'Tried to get element with id of "%s" but it is not present on the page.',
  11413. id
  11414. ) : invariant(domNode));
  11415. return ReactMount.constructAndRenderComponent(constructor, props, domNode);
  11416. },
  11417. /**
  11418. * Registers a container node into which React components will be rendered.
  11419. * This also creates the "reactRoot" ID that will be assigned to the element
  11420. * rendered within.
  11421. *
  11422. * @param {DOMElement} container DOM element to register as a container.
  11423. * @return {string} The "reactRoot" ID of elements rendered within.
  11424. */
  11425. registerContainer: function(container) {
  11426. var reactRootID = getReactRootID(container);
  11427. if (reactRootID) {
  11428. // If one exists, make sure it is a valid "reactRoot" ID.
  11429. reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
  11430. }
  11431. if (!reactRootID) {
  11432. // No valid "reactRoot" ID found, create one.
  11433. reactRootID = ReactInstanceHandles.createReactRootID();
  11434. }
  11435. containersByReactRootID[reactRootID] = container;
  11436. return reactRootID;
  11437. },
  11438. /**
  11439. * Unmounts and destroys the React component rendered in the `container`.
  11440. *
  11441. * @param {DOMElement} container DOM element containing a React component.
  11442. * @return {boolean} True if a component was found in and unmounted from
  11443. * `container`
  11444. */
  11445. unmountComponentAtNode: function(container) {
  11446. // Various parts of our code (such as ReactCompositeComponent's
  11447. // _renderValidatedComponent) assume that calls to render aren't nested;
  11448. // verify that that's the case. (Strictly speaking, unmounting won't cause a
  11449. // render but we still don't expect to be in a render call here.)
  11450. ("production" !== "development" ? warning(
  11451. ReactCurrentOwner.current == null,
  11452. 'unmountComponentAtNode(): Render methods should be a pure function of ' +
  11453. 'props and state; triggering nested component updates from render is ' +
  11454. 'not allowed. If necessary, trigger nested updates in ' +
  11455. 'componentDidUpdate.'
  11456. ) : null);
  11457. ("production" !== "development" ? invariant(
  11458. container && (
  11459. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11460. ),
  11461. 'unmountComponentAtNode(...): Target container is not a DOM element.'
  11462. ) : invariant(container && (
  11463. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11464. )));
  11465. var reactRootID = getReactRootID(container);
  11466. var component = instancesByReactRootID[reactRootID];
  11467. if (!component) {
  11468. return false;
  11469. }
  11470. ReactMount.unmountComponentFromNode(component, container);
  11471. delete instancesByReactRootID[reactRootID];
  11472. delete containersByReactRootID[reactRootID];
  11473. if ("production" !== "development") {
  11474. delete rootElementsByReactRootID[reactRootID];
  11475. }
  11476. return true;
  11477. },
  11478. /**
  11479. * Unmounts a component and removes it from the DOM.
  11480. *
  11481. * @param {ReactComponent} instance React component instance.
  11482. * @param {DOMElement} container DOM element to unmount from.
  11483. * @final
  11484. * @internal
  11485. * @see {ReactMount.unmountComponentAtNode}
  11486. */
  11487. unmountComponentFromNode: function(instance, container) {
  11488. ReactReconciler.unmountComponent(instance);
  11489. if (container.nodeType === DOC_NODE_TYPE) {
  11490. container = container.documentElement;
  11491. }
  11492. // http://jsperf.com/emptying-a-node
  11493. while (container.lastChild) {
  11494. container.removeChild(container.lastChild);
  11495. }
  11496. },
  11497. /**
  11498. * Finds the container DOM element that contains React component to which the
  11499. * supplied DOM `id` belongs.
  11500. *
  11501. * @param {string} id The ID of an element rendered by a React component.
  11502. * @return {?DOMElement} DOM element that contains the `id`.
  11503. */
  11504. findReactContainerForID: function(id) {
  11505. var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
  11506. var container = containersByReactRootID[reactRootID];
  11507. if ("production" !== "development") {
  11508. var rootElement = rootElementsByReactRootID[reactRootID];
  11509. if (rootElement && rootElement.parentNode !== container) {
  11510. ("production" !== "development" ? invariant(
  11511. // Call internalGetID here because getID calls isValid which calls
  11512. // findReactContainerForID (this function).
  11513. internalGetID(rootElement) === reactRootID,
  11514. 'ReactMount: Root element ID differed from reactRootID.'
  11515. ) : invariant(// Call internalGetID here because getID calls isValid which calls
  11516. // findReactContainerForID (this function).
  11517. internalGetID(rootElement) === reactRootID));
  11518. var containerChild = container.firstChild;
  11519. if (containerChild &&
  11520. reactRootID === internalGetID(containerChild)) {
  11521. // If the container has a new child with the same ID as the old
  11522. // root element, then rootElementsByReactRootID[reactRootID] is
  11523. // just stale and needs to be updated. The case that deserves a
  11524. // warning is when the container is empty.
  11525. rootElementsByReactRootID[reactRootID] = containerChild;
  11526. } else {
  11527. ("production" !== "development" ? warning(
  11528. false,
  11529. 'ReactMount: Root element has been removed from its original ' +
  11530. 'container. New container:', rootElement.parentNode
  11531. ) : null);
  11532. }
  11533. }
  11534. }
  11535. return container;
  11536. },
  11537. /**
  11538. * Finds an element rendered by React with the supplied ID.
  11539. *
  11540. * @param {string} id ID of a DOM node in the React component.
  11541. * @return {DOMElement} Root DOM node of the React component.
  11542. */
  11543. findReactNodeByID: function(id) {
  11544. var reactRoot = ReactMount.findReactContainerForID(id);
  11545. return ReactMount.findComponentRoot(reactRoot, id);
  11546. },
  11547. /**
  11548. * True if the supplied `node` is rendered by React.
  11549. *
  11550. * @param {*} node DOM Element to check.
  11551. * @return {boolean} True if the DOM Element appears to be rendered by React.
  11552. * @internal
  11553. */
  11554. isRenderedByReact: function(node) {
  11555. if (node.nodeType !== 1) {
  11556. // Not a DOMElement, therefore not a React component
  11557. return false;
  11558. }
  11559. var id = ReactMount.getID(node);
  11560. return id ? id.charAt(0) === SEPARATOR : false;
  11561. },
  11562. /**
  11563. * Traverses up the ancestors of the supplied node to find a node that is a
  11564. * DOM representation of a React component.
  11565. *
  11566. * @param {*} node
  11567. * @return {?DOMEventTarget}
  11568. * @internal
  11569. */
  11570. getFirstReactDOM: function(node) {
  11571. var current = node;
  11572. while (current && current.parentNode !== current) {
  11573. if (ReactMount.isRenderedByReact(current)) {
  11574. return current;
  11575. }
  11576. current = current.parentNode;
  11577. }
  11578. return null;
  11579. },
  11580. /**
  11581. * Finds a node with the supplied `targetID` inside of the supplied
  11582. * `ancestorNode`. Exploits the ID naming scheme to perform the search
  11583. * quickly.
  11584. *
  11585. * @param {DOMEventTarget} ancestorNode Search from this root.
  11586. * @pararm {string} targetID ID of the DOM representation of the component.
  11587. * @return {DOMEventTarget} DOM node with the supplied `targetID`.
  11588. * @internal
  11589. */
  11590. findComponentRoot: function(ancestorNode, targetID) {
  11591. var firstChildren = findComponentRootReusableArray;
  11592. var childIndex = 0;
  11593. var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
  11594. firstChildren[0] = deepestAncestor.firstChild;
  11595. firstChildren.length = 1;
  11596. while (childIndex < firstChildren.length) {
  11597. var child = firstChildren[childIndex++];
  11598. var targetChild;
  11599. while (child) {
  11600. var childID = ReactMount.getID(child);
  11601. if (childID) {
  11602. // Even if we find the node we're looking for, we finish looping
  11603. // through its siblings to ensure they're cached so that we don't have
  11604. // to revisit this node again. Otherwise, we make n^2 calls to getID
  11605. // when visiting the many children of a single node in order.
  11606. if (targetID === childID) {
  11607. targetChild = child;
  11608. } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
  11609. // If we find a child whose ID is an ancestor of the given ID,
  11610. // then we can be sure that we only want to search the subtree
  11611. // rooted at this child, so we can throw out the rest of the
  11612. // search state.
  11613. firstChildren.length = childIndex = 0;
  11614. firstChildren.push(child.firstChild);
  11615. }
  11616. } else {
  11617. // If this child had no ID, then there's a chance that it was
  11618. // injected automatically by the browser, as when a `<table>`
  11619. // element sprouts an extra `<tbody>` child as a side effect of
  11620. // `.innerHTML` parsing. Optimistically continue down this
  11621. // branch, but not before examining the other siblings.
  11622. firstChildren.push(child.firstChild);
  11623. }
  11624. child = child.nextSibling;
  11625. }
  11626. if (targetChild) {
  11627. // Emptying firstChildren/findComponentRootReusableArray is
  11628. // not necessary for correctness, but it helps the GC reclaim
  11629. // any nodes that were left at the end of the search.
  11630. firstChildren.length = 0;
  11631. return targetChild;
  11632. }
  11633. }
  11634. firstChildren.length = 0;
  11635. ("production" !== "development" ? invariant(
  11636. false,
  11637. 'findComponentRoot(..., %s): Unable to find element. This probably ' +
  11638. 'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
  11639. 'usually due to forgetting a <tbody> when using tables, nesting tags ' +
  11640. 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
  11641. 'parent. ' +
  11642. 'Try inspecting the child nodes of the element with React ID `%s`.',
  11643. targetID,
  11644. ReactMount.getID(ancestorNode)
  11645. ) : invariant(false));
  11646. },
  11647. _mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
  11648. ("production" !== "development" ? invariant(
  11649. container && (
  11650. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11651. ),
  11652. 'mountComponentIntoNode(...): Target container is not valid.'
  11653. ) : invariant(container && (
  11654. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11655. )));
  11656. if (shouldReuseMarkup) {
  11657. var rootElement = getReactRootElementInContainer(container);
  11658. if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
  11659. return;
  11660. } else {
  11661. var checksum = rootElement.getAttribute(
  11662. ReactMarkupChecksum.CHECKSUM_ATTR_NAME
  11663. );
  11664. rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  11665. var rootMarkup = rootElement.outerHTML;
  11666. rootElement.setAttribute(
  11667. ReactMarkupChecksum.CHECKSUM_ATTR_NAME,
  11668. checksum
  11669. );
  11670. var diffIndex = firstDifferenceIndex(markup, rootMarkup);
  11671. var difference = ' (client) ' +
  11672. markup.substring(diffIndex - 20, diffIndex + 20) +
  11673. '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
  11674. ("production" !== "development" ? invariant(
  11675. container.nodeType !== DOC_NODE_TYPE,
  11676. 'You\'re trying to render a component to the document using ' +
  11677. 'server rendering but the checksum was invalid. This usually ' +
  11678. 'means you rendered a different component type or props on ' +
  11679. 'the client from the one on the server, or your render() ' +
  11680. 'methods are impure. React cannot handle this case due to ' +
  11681. 'cross-browser quirks by rendering at the document root. You ' +
  11682. 'should look for environment dependent code in your components ' +
  11683. 'and ensure the props are the same client and server side:\n%s',
  11684. difference
  11685. ) : invariant(container.nodeType !== DOC_NODE_TYPE));
  11686. if ("production" !== "development") {
  11687. ("production" !== "development" ? warning(
  11688. false,
  11689. 'React attempted to reuse markup in a container but the ' +
  11690. 'checksum was invalid. This generally means that you are ' +
  11691. 'using server rendering and the markup generated on the ' +
  11692. 'server was not what the client was expecting. React injected ' +
  11693. 'new markup to compensate which works but you have lost many ' +
  11694. 'of the benefits of server rendering. Instead, figure out ' +
  11695. 'why the markup being generated is different on the client ' +
  11696. 'or server:\n%s',
  11697. difference
  11698. ) : null);
  11699. }
  11700. }
  11701. }
  11702. ("production" !== "development" ? invariant(
  11703. container.nodeType !== DOC_NODE_TYPE,
  11704. 'You\'re trying to render a component to the document but ' +
  11705. 'you didn\'t use server rendering. We can\'t do this ' +
  11706. 'without using server rendering due to cross-browser quirks. ' +
  11707. 'See React.renderToString() for server rendering.'
  11708. ) : invariant(container.nodeType !== DOC_NODE_TYPE));
  11709. setInnerHTML(container, markup);
  11710. },
  11711. /**
  11712. * React ID utilities.
  11713. */
  11714. getReactRootID: getReactRootID,
  11715. getID: getID,
  11716. setID: setID,
  11717. getNode: getNode,
  11718. getNodeFromInstance: getNodeFromInstance,
  11719. purgeID: purgeID
  11720. };
  11721. ReactPerf.measureMethods(ReactMount, 'ReactMount', {
  11722. _renderNewRootComponent: '_renderNewRootComponent',
  11723. _mountImageIntoNode: '_mountImageIntoNode'
  11724. });
  11725. module.exports = ReactMount;
  11726. },{"100":100,"11":11,"123":123,"130":130,"144":144,"149":149,"150":150,"164":164,"167":167,"171":171,"33":33,"45":45,"63":63,"64":64,"65":65,"72":72,"73":73,"76":76,"82":82,"89":89,"99":99}],78:[function(_dereq_,module,exports){
  11727. /**
  11728. * Copyright 2013-2015, Facebook, Inc.
  11729. * All rights reserved.
  11730. *
  11731. * This source code is licensed under the BSD-style license found in the
  11732. * LICENSE file in the root directory of this source tree. An additional grant
  11733. * of patent rights can be found in the PATENTS file in the same directory.
  11734. *
  11735. * @providesModule ReactMultiChild
  11736. * @typechecks static-only
  11737. */
  11738. 'use strict';
  11739. var ReactComponentEnvironment = _dereq_(41);
  11740. var ReactMultiChildUpdateTypes = _dereq_(79);
  11741. var ReactReconciler = _dereq_(89);
  11742. var ReactChildReconciler = _dereq_(36);
  11743. /**
  11744. * Updating children of a component may trigger recursive updates. The depth is
  11745. * used to batch recursive updates to render markup more efficiently.
  11746. *
  11747. * @type {number}
  11748. * @private
  11749. */
  11750. var updateDepth = 0;
  11751. /**
  11752. * Queue of update configuration objects.
  11753. *
  11754. * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
  11755. *
  11756. * @type {array<object>}
  11757. * @private
  11758. */
  11759. var updateQueue = [];
  11760. /**
  11761. * Queue of markup to be rendered.
  11762. *
  11763. * @type {array<string>}
  11764. * @private
  11765. */
  11766. var markupQueue = [];
  11767. /**
  11768. * Enqueues markup to be rendered and inserted at a supplied index.
  11769. *
  11770. * @param {string} parentID ID of the parent component.
  11771. * @param {string} markup Markup that renders into an element.
  11772. * @param {number} toIndex Destination index.
  11773. * @private
  11774. */
  11775. function enqueueMarkup(parentID, markup, toIndex) {
  11776. // NOTE: Null values reduce hidden classes.
  11777. updateQueue.push({
  11778. parentID: parentID,
  11779. parentNode: null,
  11780. type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
  11781. markupIndex: markupQueue.push(markup) - 1,
  11782. textContent: null,
  11783. fromIndex: null,
  11784. toIndex: toIndex
  11785. });
  11786. }
  11787. /**
  11788. * Enqueues moving an existing element to another index.
  11789. *
  11790. * @param {string} parentID ID of the parent component.
  11791. * @param {number} fromIndex Source index of the existing element.
  11792. * @param {number} toIndex Destination index of the element.
  11793. * @private
  11794. */
  11795. function enqueueMove(parentID, fromIndex, toIndex) {
  11796. // NOTE: Null values reduce hidden classes.
  11797. updateQueue.push({
  11798. parentID: parentID,
  11799. parentNode: null,
  11800. type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
  11801. markupIndex: null,
  11802. textContent: null,
  11803. fromIndex: fromIndex,
  11804. toIndex: toIndex
  11805. });
  11806. }
  11807. /**
  11808. * Enqueues removing an element at an index.
  11809. *
  11810. * @param {string} parentID ID of the parent component.
  11811. * @param {number} fromIndex Index of the element to remove.
  11812. * @private
  11813. */
  11814. function enqueueRemove(parentID, fromIndex) {
  11815. // NOTE: Null values reduce hidden classes.
  11816. updateQueue.push({
  11817. parentID: parentID,
  11818. parentNode: null,
  11819. type: ReactMultiChildUpdateTypes.REMOVE_NODE,
  11820. markupIndex: null,
  11821. textContent: null,
  11822. fromIndex: fromIndex,
  11823. toIndex: null
  11824. });
  11825. }
  11826. /**
  11827. * Enqueues setting the text content.
  11828. *
  11829. * @param {string} parentID ID of the parent component.
  11830. * @param {string} textContent Text content to set.
  11831. * @private
  11832. */
  11833. function enqueueTextContent(parentID, textContent) {
  11834. // NOTE: Null values reduce hidden classes.
  11835. updateQueue.push({
  11836. parentID: parentID,
  11837. parentNode: null,
  11838. type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
  11839. markupIndex: null,
  11840. textContent: textContent,
  11841. fromIndex: null,
  11842. toIndex: null
  11843. });
  11844. }
  11845. /**
  11846. * Processes any enqueued updates.
  11847. *
  11848. * @private
  11849. */
  11850. function processQueue() {
  11851. if (updateQueue.length) {
  11852. ReactComponentEnvironment.processChildrenUpdates(
  11853. updateQueue,
  11854. markupQueue
  11855. );
  11856. clearQueue();
  11857. }
  11858. }
  11859. /**
  11860. * Clears any enqueued updates.
  11861. *
  11862. * @private
  11863. */
  11864. function clearQueue() {
  11865. updateQueue.length = 0;
  11866. markupQueue.length = 0;
  11867. }
  11868. /**
  11869. * ReactMultiChild are capable of reconciling multiple children.
  11870. *
  11871. * @class ReactMultiChild
  11872. * @internal
  11873. */
  11874. var ReactMultiChild = {
  11875. /**
  11876. * Provides common functionality for components that must reconcile multiple
  11877. * children. This is used by `ReactDOMComponent` to mount, update, and
  11878. * unmount child components.
  11879. *
  11880. * @lends {ReactMultiChild.prototype}
  11881. */
  11882. Mixin: {
  11883. /**
  11884. * Generates a "mount image" for each of the supplied children. In the case
  11885. * of `ReactDOMComponent`, a mount image is a string of markup.
  11886. *
  11887. * @param {?object} nestedChildren Nested child maps.
  11888. * @return {array} An array of mounted representations.
  11889. * @internal
  11890. */
  11891. mountChildren: function(nestedChildren, transaction, context) {
  11892. var children = ReactChildReconciler.instantiateChildren(
  11893. nestedChildren, transaction, context
  11894. );
  11895. this._renderedChildren = children;
  11896. var mountImages = [];
  11897. var index = 0;
  11898. for (var name in children) {
  11899. if (children.hasOwnProperty(name)) {
  11900. var child = children[name];
  11901. // Inlined for performance, see `ReactInstanceHandles.createReactID`.
  11902. var rootID = this._rootNodeID + name;
  11903. var mountImage = ReactReconciler.mountComponent(
  11904. child,
  11905. rootID,
  11906. transaction,
  11907. context
  11908. );
  11909. child._mountIndex = index;
  11910. mountImages.push(mountImage);
  11911. index++;
  11912. }
  11913. }
  11914. return mountImages;
  11915. },
  11916. /**
  11917. * Replaces any rendered children with a text content string.
  11918. *
  11919. * @param {string} nextContent String of content.
  11920. * @internal
  11921. */
  11922. updateTextContent: function(nextContent) {
  11923. updateDepth++;
  11924. var errorThrown = true;
  11925. try {
  11926. var prevChildren = this._renderedChildren;
  11927. // Remove any rendered children.
  11928. ReactChildReconciler.unmountChildren(prevChildren);
  11929. // TODO: The setTextContent operation should be enough
  11930. for (var name in prevChildren) {
  11931. if (prevChildren.hasOwnProperty(name)) {
  11932. this._unmountChildByName(prevChildren[name], name);
  11933. }
  11934. }
  11935. // Set new text content.
  11936. this.setTextContent(nextContent);
  11937. errorThrown = false;
  11938. } finally {
  11939. updateDepth--;
  11940. if (!updateDepth) {
  11941. if (errorThrown) {
  11942. clearQueue();
  11943. } else {
  11944. processQueue();
  11945. }
  11946. }
  11947. }
  11948. },
  11949. /**
  11950. * Updates the rendered children with new children.
  11951. *
  11952. * @param {?object} nextNestedChildren Nested child maps.
  11953. * @param {ReactReconcileTransaction} transaction
  11954. * @internal
  11955. */
  11956. updateChildren: function(nextNestedChildren, transaction, context) {
  11957. updateDepth++;
  11958. var errorThrown = true;
  11959. try {
  11960. this._updateChildren(nextNestedChildren, transaction, context);
  11961. errorThrown = false;
  11962. } finally {
  11963. updateDepth--;
  11964. if (!updateDepth) {
  11965. if (errorThrown) {
  11966. clearQueue();
  11967. } else {
  11968. processQueue();
  11969. }
  11970. }
  11971. }
  11972. },
  11973. /**
  11974. * Improve performance by isolating this hot code path from the try/catch
  11975. * block in `updateChildren`.
  11976. *
  11977. * @param {?object} nextNestedChildren Nested child maps.
  11978. * @param {ReactReconcileTransaction} transaction
  11979. * @final
  11980. * @protected
  11981. */
  11982. _updateChildren: function(nextNestedChildren, transaction, context) {
  11983. var prevChildren = this._renderedChildren;
  11984. var nextChildren = ReactChildReconciler.updateChildren(
  11985. prevChildren, nextNestedChildren, transaction, context
  11986. );
  11987. this._renderedChildren = nextChildren;
  11988. if (!nextChildren && !prevChildren) {
  11989. return;
  11990. }
  11991. var name;
  11992. // `nextIndex` will increment for each child in `nextChildren`, but
  11993. // `lastIndex` will be the last index visited in `prevChildren`.
  11994. var lastIndex = 0;
  11995. var nextIndex = 0;
  11996. for (name in nextChildren) {
  11997. if (!nextChildren.hasOwnProperty(name)) {
  11998. continue;
  11999. }
  12000. var prevChild = prevChildren && prevChildren[name];
  12001. var nextChild = nextChildren[name];
  12002. if (prevChild === nextChild) {
  12003. this.moveChild(prevChild, nextIndex, lastIndex);
  12004. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  12005. prevChild._mountIndex = nextIndex;
  12006. } else {
  12007. if (prevChild) {
  12008. // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
  12009. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  12010. this._unmountChildByName(prevChild, name);
  12011. }
  12012. // The child must be instantiated before it's mounted.
  12013. this._mountChildByNameAtIndex(
  12014. nextChild, name, nextIndex, transaction, context
  12015. );
  12016. }
  12017. nextIndex++;
  12018. }
  12019. // Remove children that are no longer present.
  12020. for (name in prevChildren) {
  12021. if (prevChildren.hasOwnProperty(name) &&
  12022. !(nextChildren && nextChildren.hasOwnProperty(name))) {
  12023. this._unmountChildByName(prevChildren[name], name);
  12024. }
  12025. }
  12026. },
  12027. /**
  12028. * Unmounts all rendered children. This should be used to clean up children
  12029. * when this component is unmounted.
  12030. *
  12031. * @internal
  12032. */
  12033. unmountChildren: function() {
  12034. var renderedChildren = this._renderedChildren;
  12035. ReactChildReconciler.unmountChildren(renderedChildren);
  12036. this._renderedChildren = null;
  12037. },
  12038. /**
  12039. * Moves a child component to the supplied index.
  12040. *
  12041. * @param {ReactComponent} child Component to move.
  12042. * @param {number} toIndex Destination index of the element.
  12043. * @param {number} lastIndex Last index visited of the siblings of `child`.
  12044. * @protected
  12045. */
  12046. moveChild: function(child, toIndex, lastIndex) {
  12047. // If the index of `child` is less than `lastIndex`, then it needs to
  12048. // be moved. Otherwise, we do not need to move it because a child will be
  12049. // inserted or moved before `child`.
  12050. if (child._mountIndex < lastIndex) {
  12051. enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
  12052. }
  12053. },
  12054. /**
  12055. * Creates a child component.
  12056. *
  12057. * @param {ReactComponent} child Component to create.
  12058. * @param {string} mountImage Markup to insert.
  12059. * @protected
  12060. */
  12061. createChild: function(child, mountImage) {
  12062. enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
  12063. },
  12064. /**
  12065. * Removes a child component.
  12066. *
  12067. * @param {ReactComponent} child Child to remove.
  12068. * @protected
  12069. */
  12070. removeChild: function(child) {
  12071. enqueueRemove(this._rootNodeID, child._mountIndex);
  12072. },
  12073. /**
  12074. * Sets this text content string.
  12075. *
  12076. * @param {string} textContent Text content to set.
  12077. * @protected
  12078. */
  12079. setTextContent: function(textContent) {
  12080. enqueueTextContent(this._rootNodeID, textContent);
  12081. },
  12082. /**
  12083. * Mounts a child with the supplied name.
  12084. *
  12085. * NOTE: This is part of `updateChildren` and is here for readability.
  12086. *
  12087. * @param {ReactComponent} child Component to mount.
  12088. * @param {string} name Name of the child.
  12089. * @param {number} index Index at which to insert the child.
  12090. * @param {ReactReconcileTransaction} transaction
  12091. * @private
  12092. */
  12093. _mountChildByNameAtIndex: function(
  12094. child,
  12095. name,
  12096. index,
  12097. transaction,
  12098. context) {
  12099. // Inlined for performance, see `ReactInstanceHandles.createReactID`.
  12100. var rootID = this._rootNodeID + name;
  12101. var mountImage = ReactReconciler.mountComponent(
  12102. child,
  12103. rootID,
  12104. transaction,
  12105. context
  12106. );
  12107. child._mountIndex = index;
  12108. this.createChild(child, mountImage);
  12109. },
  12110. /**
  12111. * Unmounts a rendered child by name.
  12112. *
  12113. * NOTE: This is part of `updateChildren` and is here for readability.
  12114. *
  12115. * @param {ReactComponent} child Component to unmount.
  12116. * @param {string} name Name of the child in `this._renderedChildren`.
  12117. * @private
  12118. */
  12119. _unmountChildByName: function(child, name) {
  12120. this.removeChild(child);
  12121. child._mountIndex = null;
  12122. }
  12123. }
  12124. };
  12125. module.exports = ReactMultiChild;
  12126. },{"36":36,"41":41,"79":79,"89":89}],79:[function(_dereq_,module,exports){
  12127. /**
  12128. * Copyright 2013-2015, Facebook, Inc.
  12129. * All rights reserved.
  12130. *
  12131. * This source code is licensed under the BSD-style license found in the
  12132. * LICENSE file in the root directory of this source tree. An additional grant
  12133. * of patent rights can be found in the PATENTS file in the same directory.
  12134. *
  12135. * @providesModule ReactMultiChildUpdateTypes
  12136. */
  12137. 'use strict';
  12138. var keyMirror = _dereq_(156);
  12139. /**
  12140. * When a component's children are updated, a series of update configuration
  12141. * objects are created in order to batch and serialize the required changes.
  12142. *
  12143. * Enumerates all the possible types of update configurations.
  12144. *
  12145. * @internal
  12146. */
  12147. var ReactMultiChildUpdateTypes = keyMirror({
  12148. INSERT_MARKUP: null,
  12149. MOVE_EXISTING: null,
  12150. REMOVE_NODE: null,
  12151. TEXT_CONTENT: null
  12152. });
  12153. module.exports = ReactMultiChildUpdateTypes;
  12154. },{"156":156}],80:[function(_dereq_,module,exports){
  12155. /**
  12156. * Copyright 2014-2015, Facebook, Inc.
  12157. * All rights reserved.
  12158. *
  12159. * This source code is licensed under the BSD-style license found in the
  12160. * LICENSE file in the root directory of this source tree. An additional grant
  12161. * of patent rights can be found in the PATENTS file in the same directory.
  12162. *
  12163. * @providesModule ReactNativeComponent
  12164. */
  12165. 'use strict';
  12166. var assign = _dereq_(29);
  12167. var invariant = _dereq_(150);
  12168. var autoGenerateWrapperClass = null;
  12169. var genericComponentClass = null;
  12170. // This registry keeps track of wrapper classes around native tags
  12171. var tagToComponentClass = {};
  12172. var textComponentClass = null;
  12173. var ReactNativeComponentInjection = {
  12174. // This accepts a class that receives the tag string. This is a catch all
  12175. // that can render any kind of tag.
  12176. injectGenericComponentClass: function(componentClass) {
  12177. genericComponentClass = componentClass;
  12178. },
  12179. // This accepts a text component class that takes the text string to be
  12180. // rendered as props.
  12181. injectTextComponentClass: function(componentClass) {
  12182. textComponentClass = componentClass;
  12183. },
  12184. // This accepts a keyed object with classes as values. Each key represents a
  12185. // tag. That particular tag will use this class instead of the generic one.
  12186. injectComponentClasses: function(componentClasses) {
  12187. assign(tagToComponentClass, componentClasses);
  12188. },
  12189. // Temporary hack since we expect DOM refs to behave like composites,
  12190. // for this release.
  12191. injectAutoWrapper: function(wrapperFactory) {
  12192. autoGenerateWrapperClass = wrapperFactory;
  12193. }
  12194. };
  12195. /**
  12196. * Get a composite component wrapper class for a specific tag.
  12197. *
  12198. * @param {ReactElement} element The tag for which to get the class.
  12199. * @return {function} The React class constructor function.
  12200. */
  12201. function getComponentClassForElement(element) {
  12202. if (typeof element.type === 'function') {
  12203. return element.type;
  12204. }
  12205. var tag = element.type;
  12206. var componentClass = tagToComponentClass[tag];
  12207. if (componentClass == null) {
  12208. tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
  12209. }
  12210. return componentClass;
  12211. }
  12212. /**
  12213. * Get a native internal component class for a specific tag.
  12214. *
  12215. * @param {ReactElement} element The element to create.
  12216. * @return {function} The internal class constructor function.
  12217. */
  12218. function createInternalComponent(element) {
  12219. ("production" !== "development" ? invariant(
  12220. genericComponentClass,
  12221. 'There is no registered component for the tag %s',
  12222. element.type
  12223. ) : invariant(genericComponentClass));
  12224. return new genericComponentClass(element.type, element.props);
  12225. }
  12226. /**
  12227. * @param {ReactText} text
  12228. * @return {ReactComponent}
  12229. */
  12230. function createInstanceForText(text) {
  12231. return new textComponentClass(text);
  12232. }
  12233. /**
  12234. * @param {ReactComponent} component
  12235. * @return {boolean}
  12236. */
  12237. function isTextComponent(component) {
  12238. return component instanceof textComponentClass;
  12239. }
  12240. var ReactNativeComponent = {
  12241. getComponentClassForElement: getComponentClassForElement,
  12242. createInternalComponent: createInternalComponent,
  12243. createInstanceForText: createInstanceForText,
  12244. isTextComponent: isTextComponent,
  12245. injection: ReactNativeComponentInjection
  12246. };
  12247. module.exports = ReactNativeComponent;
  12248. },{"150":150,"29":29}],81:[function(_dereq_,module,exports){
  12249. /**
  12250. * Copyright 2013-2015, Facebook, Inc.
  12251. * All rights reserved.
  12252. *
  12253. * This source code is licensed under the BSD-style license found in the
  12254. * LICENSE file in the root directory of this source tree. An additional grant
  12255. * of patent rights can be found in the PATENTS file in the same directory.
  12256. *
  12257. * @providesModule ReactOwner
  12258. */
  12259. 'use strict';
  12260. var invariant = _dereq_(150);
  12261. /**
  12262. * ReactOwners are capable of storing references to owned components.
  12263. *
  12264. * All components are capable of //being// referenced by owner components, but
  12265. * only ReactOwner components are capable of //referencing// owned components.
  12266. * The named reference is known as a "ref".
  12267. *
  12268. * Refs are available when mounted and updated during reconciliation.
  12269. *
  12270. * var MyComponent = React.createClass({
  12271. * render: function() {
  12272. * return (
  12273. * <div onClick={this.handleClick}>
  12274. * <CustomComponent ref="custom" />
  12275. * </div>
  12276. * );
  12277. * },
  12278. * handleClick: function() {
  12279. * this.refs.custom.handleClick();
  12280. * },
  12281. * componentDidMount: function() {
  12282. * this.refs.custom.initialize();
  12283. * }
  12284. * });
  12285. *
  12286. * Refs should rarely be used. When refs are used, they should only be done to
  12287. * control data that is not handled by React's data flow.
  12288. *
  12289. * @class ReactOwner
  12290. */
  12291. var ReactOwner = {
  12292. /**
  12293. * @param {?object} object
  12294. * @return {boolean} True if `object` is a valid owner.
  12295. * @final
  12296. */
  12297. isValidOwner: function(object) {
  12298. return !!(
  12299. (object &&
  12300. typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
  12301. );
  12302. },
  12303. /**
  12304. * Adds a component by ref to an owner component.
  12305. *
  12306. * @param {ReactComponent} component Component to reference.
  12307. * @param {string} ref Name by which to refer to the component.
  12308. * @param {ReactOwner} owner Component on which to record the ref.
  12309. * @final
  12310. * @internal
  12311. */
  12312. addComponentAsRefTo: function(component, ref, owner) {
  12313. ("production" !== "development" ? invariant(
  12314. ReactOwner.isValidOwner(owner),
  12315. 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
  12316. 'usually means that you\'re trying to add a ref to a component that ' +
  12317. 'doesn\'t have an owner (that is, was not created inside of another ' +
  12318. 'component\'s `render` method). Try rendering this component inside of ' +
  12319. 'a new top-level component which will hold the ref.'
  12320. ) : invariant(ReactOwner.isValidOwner(owner)));
  12321. owner.attachRef(ref, component);
  12322. },
  12323. /**
  12324. * Removes a component by ref from an owner component.
  12325. *
  12326. * @param {ReactComponent} component Component to dereference.
  12327. * @param {string} ref Name of the ref to remove.
  12328. * @param {ReactOwner} owner Component on which the ref is recorded.
  12329. * @final
  12330. * @internal
  12331. */
  12332. removeComponentAsRefFrom: function(component, ref, owner) {
  12333. ("production" !== "development" ? invariant(
  12334. ReactOwner.isValidOwner(owner),
  12335. 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
  12336. 'usually means that you\'re trying to remove a ref to a component that ' +
  12337. 'doesn\'t have an owner (that is, was not created inside of another ' +
  12338. 'component\'s `render` method). Try rendering this component inside of ' +
  12339. 'a new top-level component which will hold the ref.'
  12340. ) : invariant(ReactOwner.isValidOwner(owner)));
  12341. // Check that `component` is still the current ref because we do not want to
  12342. // detach the ref if another component stole it.
  12343. if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
  12344. owner.detachRef(ref);
  12345. }
  12346. }
  12347. };
  12348. module.exports = ReactOwner;
  12349. },{"150":150}],82:[function(_dereq_,module,exports){
  12350. /**
  12351. * Copyright 2013-2015, Facebook, Inc.
  12352. * All rights reserved.
  12353. *
  12354. * This source code is licensed under the BSD-style license found in the
  12355. * LICENSE file in the root directory of this source tree. An additional grant
  12356. * of patent rights can be found in the PATENTS file in the same directory.
  12357. *
  12358. * @providesModule ReactPerf
  12359. * @typechecks static-only
  12360. */
  12361. 'use strict';
  12362. /**
  12363. * ReactPerf is a general AOP system designed to measure performance. This
  12364. * module only has the hooks: see ReactDefaultPerf for the analysis tool.
  12365. */
  12366. var ReactPerf = {
  12367. /**
  12368. * Boolean to enable/disable measurement. Set to false by default to prevent
  12369. * accidental logging and perf loss.
  12370. */
  12371. enableMeasure: false,
  12372. /**
  12373. * Holds onto the measure function in use. By default, don't measure
  12374. * anything, but we'll override this if we inject a measure function.
  12375. */
  12376. storedMeasure: _noMeasure,
  12377. /**
  12378. * @param {object} object
  12379. * @param {string} objectName
  12380. * @param {object<string>} methodNames
  12381. */
  12382. measureMethods: function(object, objectName, methodNames) {
  12383. if ("production" !== "development") {
  12384. for (var key in methodNames) {
  12385. if (!methodNames.hasOwnProperty(key)) {
  12386. continue;
  12387. }
  12388. object[key] = ReactPerf.measure(
  12389. objectName,
  12390. methodNames[key],
  12391. object[key]
  12392. );
  12393. }
  12394. }
  12395. },
  12396. /**
  12397. * Use this to wrap methods you want to measure. Zero overhead in production.
  12398. *
  12399. * @param {string} objName
  12400. * @param {string} fnName
  12401. * @param {function} func
  12402. * @return {function}
  12403. */
  12404. measure: function(objName, fnName, func) {
  12405. if ("production" !== "development") {
  12406. var measuredFunc = null;
  12407. var wrapper = function() {
  12408. if (ReactPerf.enableMeasure) {
  12409. if (!measuredFunc) {
  12410. measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
  12411. }
  12412. return measuredFunc.apply(this, arguments);
  12413. }
  12414. return func.apply(this, arguments);
  12415. };
  12416. wrapper.displayName = objName + '_' + fnName;
  12417. return wrapper;
  12418. }
  12419. return func;
  12420. },
  12421. injection: {
  12422. /**
  12423. * @param {function} measure
  12424. */
  12425. injectMeasure: function(measure) {
  12426. ReactPerf.storedMeasure = measure;
  12427. }
  12428. }
  12429. };
  12430. /**
  12431. * Simply passes through the measured function, without measuring it.
  12432. *
  12433. * @param {string} objName
  12434. * @param {string} fnName
  12435. * @param {function} func
  12436. * @return {function}
  12437. */
  12438. function _noMeasure(objName, fnName, func) {
  12439. return func;
  12440. }
  12441. module.exports = ReactPerf;
  12442. },{}],83:[function(_dereq_,module,exports){
  12443. /**
  12444. * Copyright 2013-2015, Facebook, Inc.
  12445. * All rights reserved.
  12446. *
  12447. * This source code is licensed under the BSD-style license found in the
  12448. * LICENSE file in the root directory of this source tree. An additional grant
  12449. * of patent rights can be found in the PATENTS file in the same directory.
  12450. *
  12451. * @providesModule ReactPropTransferer
  12452. */
  12453. 'use strict';
  12454. var assign = _dereq_(29);
  12455. var emptyFunction = _dereq_(129);
  12456. var joinClasses = _dereq_(155);
  12457. /**
  12458. * Creates a transfer strategy that will merge prop values using the supplied
  12459. * `mergeStrategy`. If a prop was previously unset, this just sets it.
  12460. *
  12461. * @param {function} mergeStrategy
  12462. * @return {function}
  12463. */
  12464. function createTransferStrategy(mergeStrategy) {
  12465. return function(props, key, value) {
  12466. if (!props.hasOwnProperty(key)) {
  12467. props[key] = value;
  12468. } else {
  12469. props[key] = mergeStrategy(props[key], value);
  12470. }
  12471. };
  12472. }
  12473. var transferStrategyMerge = createTransferStrategy(function(a, b) {
  12474. // `merge` overrides the first object's (`props[key]` above) keys using the
  12475. // second object's (`value`) keys. An object's style's existing `propA` would
  12476. // get overridden. Flip the order here.
  12477. return assign({}, b, a);
  12478. });
  12479. /**
  12480. * Transfer strategies dictate how props are transferred by `transferPropsTo`.
  12481. * NOTE: if you add any more exceptions to this list you should be sure to
  12482. * update `cloneWithProps()` accordingly.
  12483. */
  12484. var TransferStrategies = {
  12485. /**
  12486. * Never transfer `children`.
  12487. */
  12488. children: emptyFunction,
  12489. /**
  12490. * Transfer the `className` prop by merging them.
  12491. */
  12492. className: createTransferStrategy(joinClasses),
  12493. /**
  12494. * Transfer the `style` prop (which is an object) by merging them.
  12495. */
  12496. style: transferStrategyMerge
  12497. };
  12498. /**
  12499. * Mutates the first argument by transferring the properties from the second
  12500. * argument.
  12501. *
  12502. * @param {object} props
  12503. * @param {object} newProps
  12504. * @return {object}
  12505. */
  12506. function transferInto(props, newProps) {
  12507. for (var thisKey in newProps) {
  12508. if (!newProps.hasOwnProperty(thisKey)) {
  12509. continue;
  12510. }
  12511. var transferStrategy = TransferStrategies[thisKey];
  12512. if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) {
  12513. transferStrategy(props, thisKey, newProps[thisKey]);
  12514. } else if (!props.hasOwnProperty(thisKey)) {
  12515. props[thisKey] = newProps[thisKey];
  12516. }
  12517. }
  12518. return props;
  12519. }
  12520. /**
  12521. * ReactPropTransferer are capable of transferring props to another component
  12522. * using a `transferPropsTo` method.
  12523. *
  12524. * @class ReactPropTransferer
  12525. */
  12526. var ReactPropTransferer = {
  12527. /**
  12528. * Merge two props objects using TransferStrategies.
  12529. *
  12530. * @param {object} oldProps original props (they take precedence)
  12531. * @param {object} newProps new props to merge in
  12532. * @return {object} a new object containing both sets of props merged.
  12533. */
  12534. mergeProps: function(oldProps, newProps) {
  12535. return transferInto(assign({}, oldProps), newProps);
  12536. }
  12537. };
  12538. module.exports = ReactPropTransferer;
  12539. },{"129":129,"155":155,"29":29}],84:[function(_dereq_,module,exports){
  12540. /**
  12541. * Copyright 2013-2015, Facebook, Inc.
  12542. * All rights reserved.
  12543. *
  12544. * This source code is licensed under the BSD-style license found in the
  12545. * LICENSE file in the root directory of this source tree. An additional grant
  12546. * of patent rights can be found in the PATENTS file in the same directory.
  12547. *
  12548. * @providesModule ReactPropTypeLocationNames
  12549. */
  12550. 'use strict';
  12551. var ReactPropTypeLocationNames = {};
  12552. if ("production" !== "development") {
  12553. ReactPropTypeLocationNames = {
  12554. prop: 'prop',
  12555. context: 'context',
  12556. childContext: 'child context'
  12557. };
  12558. }
  12559. module.exports = ReactPropTypeLocationNames;
  12560. },{}],85:[function(_dereq_,module,exports){
  12561. /**
  12562. * Copyright 2013-2015, Facebook, Inc.
  12563. * All rights reserved.
  12564. *
  12565. * This source code is licensed under the BSD-style license found in the
  12566. * LICENSE file in the root directory of this source tree. An additional grant
  12567. * of patent rights can be found in the PATENTS file in the same directory.
  12568. *
  12569. * @providesModule ReactPropTypeLocations
  12570. */
  12571. 'use strict';
  12572. var keyMirror = _dereq_(156);
  12573. var ReactPropTypeLocations = keyMirror({
  12574. prop: null,
  12575. context: null,
  12576. childContext: null
  12577. });
  12578. module.exports = ReactPropTypeLocations;
  12579. },{"156":156}],86:[function(_dereq_,module,exports){
  12580. /**
  12581. * Copyright 2013-2015, Facebook, Inc.
  12582. * All rights reserved.
  12583. *
  12584. * This source code is licensed under the BSD-style license found in the
  12585. * LICENSE file in the root directory of this source tree. An additional grant
  12586. * of patent rights can be found in the PATENTS file in the same directory.
  12587. *
  12588. * @providesModule ReactPropTypes
  12589. */
  12590. 'use strict';
  12591. var ReactElement = _dereq_(63);
  12592. var ReactFragment = _dereq_(69);
  12593. var ReactPropTypeLocationNames = _dereq_(84);
  12594. var emptyFunction = _dereq_(129);
  12595. /**
  12596. * Collection of methods that allow declaration and validation of props that are
  12597. * supplied to React components. Example usage:
  12598. *
  12599. * var Props = require('ReactPropTypes');
  12600. * var MyArticle = React.createClass({
  12601. * propTypes: {
  12602. * // An optional string prop named "description".
  12603. * description: Props.string,
  12604. *
  12605. * // A required enum prop named "category".
  12606. * category: Props.oneOf(['News','Photos']).isRequired,
  12607. *
  12608. * // A prop named "dialog" that requires an instance of Dialog.
  12609. * dialog: Props.instanceOf(Dialog).isRequired
  12610. * },
  12611. * render: function() { ... }
  12612. * });
  12613. *
  12614. * A more formal specification of how these methods are used:
  12615. *
  12616. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  12617. * decl := ReactPropTypes.{type}(.isRequired)?
  12618. *
  12619. * Each and every declaration produces a function with the same signature. This
  12620. * allows the creation of custom validation functions. For example:
  12621. *
  12622. * var MyLink = React.createClass({
  12623. * propTypes: {
  12624. * // An optional string or URI prop named "href".
  12625. * href: function(props, propName, componentName) {
  12626. * var propValue = props[propName];
  12627. * if (propValue != null && typeof propValue !== 'string' &&
  12628. * !(propValue instanceof URI)) {
  12629. * return new Error(
  12630. * 'Expected a string or an URI for ' + propName + ' in ' +
  12631. * componentName
  12632. * );
  12633. * }
  12634. * }
  12635. * },
  12636. * render: function() {...}
  12637. * });
  12638. *
  12639. * @internal
  12640. */
  12641. var ANONYMOUS = '<<anonymous>>';
  12642. var elementTypeChecker = createElementTypeChecker();
  12643. var nodeTypeChecker = createNodeChecker();
  12644. var ReactPropTypes = {
  12645. array: createPrimitiveTypeChecker('array'),
  12646. bool: createPrimitiveTypeChecker('boolean'),
  12647. func: createPrimitiveTypeChecker('function'),
  12648. number: createPrimitiveTypeChecker('number'),
  12649. object: createPrimitiveTypeChecker('object'),
  12650. string: createPrimitiveTypeChecker('string'),
  12651. any: createAnyTypeChecker(),
  12652. arrayOf: createArrayOfTypeChecker,
  12653. element: elementTypeChecker,
  12654. instanceOf: createInstanceTypeChecker,
  12655. node: nodeTypeChecker,
  12656. objectOf: createObjectOfTypeChecker,
  12657. oneOf: createEnumTypeChecker,
  12658. oneOfType: createUnionTypeChecker,
  12659. shape: createShapeTypeChecker
  12660. };
  12661. function createChainableTypeChecker(validate) {
  12662. function checkType(isRequired, props, propName, componentName, location) {
  12663. componentName = componentName || ANONYMOUS;
  12664. if (props[propName] == null) {
  12665. var locationName = ReactPropTypeLocationNames[location];
  12666. if (isRequired) {
  12667. return new Error(
  12668. ("Required " + locationName + " `" + propName + "` was not specified in ") +
  12669. ("`" + componentName + "`.")
  12670. );
  12671. }
  12672. return null;
  12673. } else {
  12674. return validate(props, propName, componentName, location);
  12675. }
  12676. }
  12677. var chainedCheckType = checkType.bind(null, false);
  12678. chainedCheckType.isRequired = checkType.bind(null, true);
  12679. return chainedCheckType;
  12680. }
  12681. function createPrimitiveTypeChecker(expectedType) {
  12682. function validate(props, propName, componentName, location) {
  12683. var propValue = props[propName];
  12684. var propType = getPropType(propValue);
  12685. if (propType !== expectedType) {
  12686. var locationName = ReactPropTypeLocationNames[location];
  12687. // `propValue` being instance of, say, date/regexp, pass the 'object'
  12688. // check, but we can offer a more precise error message here rather than
  12689. // 'of type `object`'.
  12690. var preciseType = getPreciseType(propValue);
  12691. return new Error(
  12692. ("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") +
  12693. ("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
  12694. );
  12695. }
  12696. return null;
  12697. }
  12698. return createChainableTypeChecker(validate);
  12699. }
  12700. function createAnyTypeChecker() {
  12701. return createChainableTypeChecker(emptyFunction.thatReturns(null));
  12702. }
  12703. function createArrayOfTypeChecker(typeChecker) {
  12704. function validate(props, propName, componentName, location) {
  12705. var propValue = props[propName];
  12706. if (!Array.isArray(propValue)) {
  12707. var locationName = ReactPropTypeLocationNames[location];
  12708. var propType = getPropType(propValue);
  12709. return new Error(
  12710. ("Invalid " + locationName + " `" + propName + "` of type ") +
  12711. ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")
  12712. );
  12713. }
  12714. for (var i = 0; i < propValue.length; i++) {
  12715. var error = typeChecker(propValue, i, componentName, location);
  12716. if (error instanceof Error) {
  12717. return error;
  12718. }
  12719. }
  12720. return null;
  12721. }
  12722. return createChainableTypeChecker(validate);
  12723. }
  12724. function createElementTypeChecker() {
  12725. function validate(props, propName, componentName, location) {
  12726. if (!ReactElement.isValidElement(props[propName])) {
  12727. var locationName = ReactPropTypeLocationNames[location];
  12728. return new Error(
  12729. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12730. ("`" + componentName + "`, expected a ReactElement.")
  12731. );
  12732. }
  12733. return null;
  12734. }
  12735. return createChainableTypeChecker(validate);
  12736. }
  12737. function createInstanceTypeChecker(expectedClass) {
  12738. function validate(props, propName, componentName, location) {
  12739. if (!(props[propName] instanceof expectedClass)) {
  12740. var locationName = ReactPropTypeLocationNames[location];
  12741. var expectedClassName = expectedClass.name || ANONYMOUS;
  12742. return new Error(
  12743. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12744. ("`" + componentName + "`, expected instance of `" + expectedClassName + "`.")
  12745. );
  12746. }
  12747. return null;
  12748. }
  12749. return createChainableTypeChecker(validate);
  12750. }
  12751. function createEnumTypeChecker(expectedValues) {
  12752. function validate(props, propName, componentName, location) {
  12753. var propValue = props[propName];
  12754. for (var i = 0; i < expectedValues.length; i++) {
  12755. if (propValue === expectedValues[i]) {
  12756. return null;
  12757. }
  12758. }
  12759. var locationName = ReactPropTypeLocationNames[location];
  12760. var valuesString = JSON.stringify(expectedValues);
  12761. return new Error(
  12762. ("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") +
  12763. ("supplied to `" + componentName + "`, expected one of " + valuesString + ".")
  12764. );
  12765. }
  12766. return createChainableTypeChecker(validate);
  12767. }
  12768. function createObjectOfTypeChecker(typeChecker) {
  12769. function validate(props, propName, componentName, location) {
  12770. var propValue = props[propName];
  12771. var propType = getPropType(propValue);
  12772. if (propType !== 'object') {
  12773. var locationName = ReactPropTypeLocationNames[location];
  12774. return new Error(
  12775. ("Invalid " + locationName + " `" + propName + "` of type ") +
  12776. ("`" + propType + "` supplied to `" + componentName + "`, expected an object.")
  12777. );
  12778. }
  12779. for (var key in propValue) {
  12780. if (propValue.hasOwnProperty(key)) {
  12781. var error = typeChecker(propValue, key, componentName, location);
  12782. if (error instanceof Error) {
  12783. return error;
  12784. }
  12785. }
  12786. }
  12787. return null;
  12788. }
  12789. return createChainableTypeChecker(validate);
  12790. }
  12791. function createUnionTypeChecker(arrayOfTypeCheckers) {
  12792. function validate(props, propName, componentName, location) {
  12793. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  12794. var checker = arrayOfTypeCheckers[i];
  12795. if (checker(props, propName, componentName, location) == null) {
  12796. return null;
  12797. }
  12798. }
  12799. var locationName = ReactPropTypeLocationNames[location];
  12800. return new Error(
  12801. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12802. ("`" + componentName + "`.")
  12803. );
  12804. }
  12805. return createChainableTypeChecker(validate);
  12806. }
  12807. function createNodeChecker() {
  12808. function validate(props, propName, componentName, location) {
  12809. if (!isNode(props[propName])) {
  12810. var locationName = ReactPropTypeLocationNames[location];
  12811. return new Error(
  12812. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12813. ("`" + componentName + "`, expected a ReactNode.")
  12814. );
  12815. }
  12816. return null;
  12817. }
  12818. return createChainableTypeChecker(validate);
  12819. }
  12820. function createShapeTypeChecker(shapeTypes) {
  12821. function validate(props, propName, componentName, location) {
  12822. var propValue = props[propName];
  12823. var propType = getPropType(propValue);
  12824. if (propType !== 'object') {
  12825. var locationName = ReactPropTypeLocationNames[location];
  12826. return new Error(
  12827. ("Invalid " + locationName + " `" + propName + "` of type `" + propType + "` ") +
  12828. ("supplied to `" + componentName + "`, expected `object`.")
  12829. );
  12830. }
  12831. for (var key in shapeTypes) {
  12832. var checker = shapeTypes[key];
  12833. if (!checker) {
  12834. continue;
  12835. }
  12836. var error = checker(propValue, key, componentName, location);
  12837. if (error) {
  12838. return error;
  12839. }
  12840. }
  12841. return null;
  12842. }
  12843. return createChainableTypeChecker(validate);
  12844. }
  12845. function isNode(propValue) {
  12846. switch (typeof propValue) {
  12847. case 'number':
  12848. case 'string':
  12849. case 'undefined':
  12850. return true;
  12851. case 'boolean':
  12852. return !propValue;
  12853. case 'object':
  12854. if (Array.isArray(propValue)) {
  12855. return propValue.every(isNode);
  12856. }
  12857. if (propValue === null || ReactElement.isValidElement(propValue)) {
  12858. return true;
  12859. }
  12860. propValue = ReactFragment.extractIfFragment(propValue);
  12861. for (var k in propValue) {
  12862. if (!isNode(propValue[k])) {
  12863. return false;
  12864. }
  12865. }
  12866. return true;
  12867. default:
  12868. return false;
  12869. }
  12870. }
  12871. // Equivalent of `typeof` but with special handling for array and regexp.
  12872. function getPropType(propValue) {
  12873. var propType = typeof propValue;
  12874. if (Array.isArray(propValue)) {
  12875. return 'array';
  12876. }
  12877. if (propValue instanceof RegExp) {
  12878. // Old webkits (at least until Android 4.0) return 'function' rather than
  12879. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  12880. // passes PropTypes.object.
  12881. return 'object';
  12882. }
  12883. return propType;
  12884. }
  12885. // This handles more types than `getPropType`. Only used for error messages.
  12886. // See `createPrimitiveTypeChecker`.
  12887. function getPreciseType(propValue) {
  12888. var propType = getPropType(propValue);
  12889. if (propType === 'object') {
  12890. if (propValue instanceof Date) {
  12891. return 'date';
  12892. } else if (propValue instanceof RegExp) {
  12893. return 'regexp';
  12894. }
  12895. }
  12896. return propType;
  12897. }
  12898. module.exports = ReactPropTypes;
  12899. },{"129":129,"63":63,"69":69,"84":84}],87:[function(_dereq_,module,exports){
  12900. /**
  12901. * Copyright 2013-2015, Facebook, Inc.
  12902. * All rights reserved.
  12903. *
  12904. * This source code is licensed under the BSD-style license found in the
  12905. * LICENSE file in the root directory of this source tree. An additional grant
  12906. * of patent rights can be found in the PATENTS file in the same directory.
  12907. *
  12908. * @providesModule ReactPutListenerQueue
  12909. */
  12910. 'use strict';
  12911. var PooledClass = _dereq_(30);
  12912. var ReactBrowserEventEmitter = _dereq_(33);
  12913. var assign = _dereq_(29);
  12914. function ReactPutListenerQueue() {
  12915. this.listenersToPut = [];
  12916. }
  12917. assign(ReactPutListenerQueue.prototype, {
  12918. enqueuePutListener: function(rootNodeID, propKey, propValue) {
  12919. this.listenersToPut.push({
  12920. rootNodeID: rootNodeID,
  12921. propKey: propKey,
  12922. propValue: propValue
  12923. });
  12924. },
  12925. putListeners: function() {
  12926. for (var i = 0; i < this.listenersToPut.length; i++) {
  12927. var listenerToPut = this.listenersToPut[i];
  12928. ReactBrowserEventEmitter.putListener(
  12929. listenerToPut.rootNodeID,
  12930. listenerToPut.propKey,
  12931. listenerToPut.propValue
  12932. );
  12933. }
  12934. },
  12935. reset: function() {
  12936. this.listenersToPut.length = 0;
  12937. },
  12938. destructor: function() {
  12939. this.reset();
  12940. }
  12941. });
  12942. PooledClass.addPoolingTo(ReactPutListenerQueue);
  12943. module.exports = ReactPutListenerQueue;
  12944. },{"29":29,"30":30,"33":33}],88:[function(_dereq_,module,exports){
  12945. /**
  12946. * Copyright 2013-2015, Facebook, Inc.
  12947. * All rights reserved.
  12948. *
  12949. * This source code is licensed under the BSD-style license found in the
  12950. * LICENSE file in the root directory of this source tree. An additional grant
  12951. * of patent rights can be found in the PATENTS file in the same directory.
  12952. *
  12953. * @providesModule ReactReconcileTransaction
  12954. * @typechecks static-only
  12955. */
  12956. 'use strict';
  12957. var CallbackQueue = _dereq_(7);
  12958. var PooledClass = _dereq_(30);
  12959. var ReactBrowserEventEmitter = _dereq_(33);
  12960. var ReactInputSelection = _dereq_(71);
  12961. var ReactPutListenerQueue = _dereq_(87);
  12962. var Transaction = _dereq_(116);
  12963. var assign = _dereq_(29);
  12964. /**
  12965. * Ensures that, when possible, the selection range (currently selected text
  12966. * input) is not disturbed by performing the transaction.
  12967. */
  12968. var SELECTION_RESTORATION = {
  12969. /**
  12970. * @return {Selection} Selection information.
  12971. */
  12972. initialize: ReactInputSelection.getSelectionInformation,
  12973. /**
  12974. * @param {Selection} sel Selection information returned from `initialize`.
  12975. */
  12976. close: ReactInputSelection.restoreSelection
  12977. };
  12978. /**
  12979. * Suppresses events (blur/focus) that could be inadvertently dispatched due to
  12980. * high level DOM manipulations (like temporarily removing a text input from the
  12981. * DOM).
  12982. */
  12983. var EVENT_SUPPRESSION = {
  12984. /**
  12985. * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
  12986. * the reconciliation.
  12987. */
  12988. initialize: function() {
  12989. var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
  12990. ReactBrowserEventEmitter.setEnabled(false);
  12991. return currentlyEnabled;
  12992. },
  12993. /**
  12994. * @param {boolean} previouslyEnabled Enabled status of
  12995. * `ReactBrowserEventEmitter` before the reconciliation occured. `close`
  12996. * restores the previous value.
  12997. */
  12998. close: function(previouslyEnabled) {
  12999. ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
  13000. }
  13001. };
  13002. /**
  13003. * Provides a queue for collecting `componentDidMount` and
  13004. * `componentDidUpdate` callbacks during the the transaction.
  13005. */
  13006. var ON_DOM_READY_QUEUEING = {
  13007. /**
  13008. * Initializes the internal `onDOMReady` queue.
  13009. */
  13010. initialize: function() {
  13011. this.reactMountReady.reset();
  13012. },
  13013. /**
  13014. * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
  13015. */
  13016. close: function() {
  13017. this.reactMountReady.notifyAll();
  13018. }
  13019. };
  13020. var PUT_LISTENER_QUEUEING = {
  13021. initialize: function() {
  13022. this.putListenerQueue.reset();
  13023. },
  13024. close: function() {
  13025. this.putListenerQueue.putListeners();
  13026. }
  13027. };
  13028. /**
  13029. * Executed within the scope of the `Transaction` instance. Consider these as
  13030. * being member methods, but with an implied ordering while being isolated from
  13031. * each other.
  13032. */
  13033. var TRANSACTION_WRAPPERS = [
  13034. PUT_LISTENER_QUEUEING,
  13035. SELECTION_RESTORATION,
  13036. EVENT_SUPPRESSION,
  13037. ON_DOM_READY_QUEUEING
  13038. ];
  13039. /**
  13040. * Currently:
  13041. * - The order that these are listed in the transaction is critical:
  13042. * - Suppresses events.
  13043. * - Restores selection range.
  13044. *
  13045. * Future:
  13046. * - Restore document/overflow scroll positions that were unintentionally
  13047. * modified via DOM insertions above the top viewport boundary.
  13048. * - Implement/integrate with customized constraint based layout system and keep
  13049. * track of which dimensions must be remeasured.
  13050. *
  13051. * @class ReactReconcileTransaction
  13052. */
  13053. function ReactReconcileTransaction() {
  13054. this.reinitializeTransaction();
  13055. // Only server-side rendering really needs this option (see
  13056. // `ReactServerRendering`), but server-side uses
  13057. // `ReactServerRenderingTransaction` instead. This option is here so that it's
  13058. // accessible and defaults to false when `ReactDOMComponent` and
  13059. // `ReactTextComponent` checks it in `mountComponent`.`
  13060. this.renderToStaticMarkup = false;
  13061. this.reactMountReady = CallbackQueue.getPooled(null);
  13062. this.putListenerQueue = ReactPutListenerQueue.getPooled();
  13063. }
  13064. var Mixin = {
  13065. /**
  13066. * @see Transaction
  13067. * @abstract
  13068. * @final
  13069. * @return {array<object>} List of operation wrap proceedures.
  13070. * TODO: convert to array<TransactionWrapper>
  13071. */
  13072. getTransactionWrappers: function() {
  13073. return TRANSACTION_WRAPPERS;
  13074. },
  13075. /**
  13076. * @return {object} The queue to collect `onDOMReady` callbacks with.
  13077. */
  13078. getReactMountReady: function() {
  13079. return this.reactMountReady;
  13080. },
  13081. getPutListenerQueue: function() {
  13082. return this.putListenerQueue;
  13083. },
  13084. /**
  13085. * `PooledClass` looks for this, and will invoke this before allowing this
  13086. * instance to be resused.
  13087. */
  13088. destructor: function() {
  13089. CallbackQueue.release(this.reactMountReady);
  13090. this.reactMountReady = null;
  13091. ReactPutListenerQueue.release(this.putListenerQueue);
  13092. this.putListenerQueue = null;
  13093. }
  13094. };
  13095. assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
  13096. PooledClass.addPoolingTo(ReactReconcileTransaction);
  13097. module.exports = ReactReconcileTransaction;
  13098. },{"116":116,"29":29,"30":30,"33":33,"7":7,"71":71,"87":87}],89:[function(_dereq_,module,exports){
  13099. /**
  13100. * Copyright 2013-2015, Facebook, Inc.
  13101. * All rights reserved.
  13102. *
  13103. * This source code is licensed under the BSD-style license found in the
  13104. * LICENSE file in the root directory of this source tree. An additional grant
  13105. * of patent rights can be found in the PATENTS file in the same directory.
  13106. *
  13107. * @providesModule ReactReconciler
  13108. */
  13109. 'use strict';
  13110. var ReactRef = _dereq_(90);
  13111. var ReactElementValidator = _dereq_(64);
  13112. /**
  13113. * Helper to call ReactRef.attachRefs with this composite component, split out
  13114. * to avoid allocations in the transaction mount-ready queue.
  13115. */
  13116. function attachRefs() {
  13117. ReactRef.attachRefs(this, this._currentElement);
  13118. }
  13119. var ReactReconciler = {
  13120. /**
  13121. * Initializes the component, renders markup, and registers event listeners.
  13122. *
  13123. * @param {ReactComponent} internalInstance
  13124. * @param {string} rootID DOM ID of the root node.
  13125. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  13126. * @return {?string} Rendered markup to be inserted into the DOM.
  13127. * @final
  13128. * @internal
  13129. */
  13130. mountComponent: function(internalInstance, rootID, transaction, context) {
  13131. var markup = internalInstance.mountComponent(rootID, transaction, context);
  13132. if ("production" !== "development") {
  13133. ReactElementValidator.checkAndWarnForMutatedProps(
  13134. internalInstance._currentElement
  13135. );
  13136. }
  13137. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  13138. return markup;
  13139. },
  13140. /**
  13141. * Releases any resources allocated by `mountComponent`.
  13142. *
  13143. * @final
  13144. * @internal
  13145. */
  13146. unmountComponent: function(internalInstance) {
  13147. ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
  13148. internalInstance.unmountComponent();
  13149. },
  13150. /**
  13151. * Update a component using a new element.
  13152. *
  13153. * @param {ReactComponent} internalInstance
  13154. * @param {ReactElement} nextElement
  13155. * @param {ReactReconcileTransaction} transaction
  13156. * @param {object} context
  13157. * @internal
  13158. */
  13159. receiveComponent: function(
  13160. internalInstance, nextElement, transaction, context
  13161. ) {
  13162. var prevElement = internalInstance._currentElement;
  13163. if (nextElement === prevElement && nextElement._owner != null) {
  13164. // Since elements are immutable after the owner is rendered,
  13165. // we can do a cheap identity compare here to determine if this is a
  13166. // superfluous reconcile. It's possible for state to be mutable but such
  13167. // change should trigger an update of the owner which would recreate
  13168. // the element. We explicitly check for the existence of an owner since
  13169. // it's possible for an element created outside a composite to be
  13170. // deeply mutated and reused.
  13171. return;
  13172. }
  13173. if ("production" !== "development") {
  13174. ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
  13175. }
  13176. var refsChanged = ReactRef.shouldUpdateRefs(
  13177. prevElement,
  13178. nextElement
  13179. );
  13180. if (refsChanged) {
  13181. ReactRef.detachRefs(internalInstance, prevElement);
  13182. }
  13183. internalInstance.receiveComponent(nextElement, transaction, context);
  13184. if (refsChanged) {
  13185. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  13186. }
  13187. },
  13188. /**
  13189. * Flush any dirty changes in a component.
  13190. *
  13191. * @param {ReactComponent} internalInstance
  13192. * @param {ReactReconcileTransaction} transaction
  13193. * @internal
  13194. */
  13195. performUpdateIfNecessary: function(
  13196. internalInstance,
  13197. transaction
  13198. ) {
  13199. internalInstance.performUpdateIfNecessary(transaction);
  13200. }
  13201. };
  13202. module.exports = ReactReconciler;
  13203. },{"64":64,"90":90}],90:[function(_dereq_,module,exports){
  13204. /**
  13205. * Copyright 2013-2015, Facebook, Inc.
  13206. * All rights reserved.
  13207. *
  13208. * This source code is licensed under the BSD-style license found in the
  13209. * LICENSE file in the root directory of this source tree. An additional grant
  13210. * of patent rights can be found in the PATENTS file in the same directory.
  13211. *
  13212. * @providesModule ReactRef
  13213. */
  13214. 'use strict';
  13215. var ReactOwner = _dereq_(81);
  13216. var ReactRef = {};
  13217. function attachRef(ref, component, owner) {
  13218. if (typeof ref === 'function') {
  13219. ref(component.getPublicInstance());
  13220. } else {
  13221. // Legacy ref
  13222. ReactOwner.addComponentAsRefTo(component, ref, owner);
  13223. }
  13224. }
  13225. function detachRef(ref, component, owner) {
  13226. if (typeof ref === 'function') {
  13227. ref(null);
  13228. } else {
  13229. // Legacy ref
  13230. ReactOwner.removeComponentAsRefFrom(component, ref, owner);
  13231. }
  13232. }
  13233. ReactRef.attachRefs = function(instance, element) {
  13234. var ref = element.ref;
  13235. if (ref != null) {
  13236. attachRef(ref, instance, element._owner);
  13237. }
  13238. };
  13239. ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
  13240. // If either the owner or a `ref` has changed, make sure the newest owner
  13241. // has stored a reference to `this`, and the previous owner (if different)
  13242. // has forgotten the reference to `this`. We use the element instead
  13243. // of the public this.props because the post processing cannot determine
  13244. // a ref. The ref conceptually lives on the element.
  13245. // TODO: Should this even be possible? The owner cannot change because
  13246. // it's forbidden by shouldUpdateReactComponent. The ref can change
  13247. // if you swap the keys of but not the refs. Reconsider where this check
  13248. // is made. It probably belongs where the key checking and
  13249. // instantiateReactComponent is done.
  13250. return (
  13251. nextElement._owner !== prevElement._owner ||
  13252. nextElement.ref !== prevElement.ref
  13253. );
  13254. };
  13255. ReactRef.detachRefs = function(instance, element) {
  13256. var ref = element.ref;
  13257. if (ref != null) {
  13258. detachRef(ref, instance, element._owner);
  13259. }
  13260. };
  13261. module.exports = ReactRef;
  13262. },{"81":81}],91:[function(_dereq_,module,exports){
  13263. /**
  13264. * Copyright 2013-2015, Facebook, Inc.
  13265. * All rights reserved.
  13266. *
  13267. * This source code is licensed under the BSD-style license found in the
  13268. * LICENSE file in the root directory of this source tree. An additional grant
  13269. * of patent rights can be found in the PATENTS file in the same directory.
  13270. *
  13271. * @providesModule ReactRootIndex
  13272. * @typechecks
  13273. */
  13274. 'use strict';
  13275. var ReactRootIndexInjection = {
  13276. /**
  13277. * @param {function} _createReactRootIndex
  13278. */
  13279. injectCreateReactRootIndex: function(_createReactRootIndex) {
  13280. ReactRootIndex.createReactRootIndex = _createReactRootIndex;
  13281. }
  13282. };
  13283. var ReactRootIndex = {
  13284. createReactRootIndex: null,
  13285. injection: ReactRootIndexInjection
  13286. };
  13287. module.exports = ReactRootIndex;
  13288. },{}],92:[function(_dereq_,module,exports){
  13289. /**
  13290. * Copyright 2013-2015, Facebook, Inc.
  13291. * All rights reserved.
  13292. *
  13293. * This source code is licensed under the BSD-style license found in the
  13294. * LICENSE file in the root directory of this source tree. An additional grant
  13295. * of patent rights can be found in the PATENTS file in the same directory.
  13296. *
  13297. * @typechecks static-only
  13298. * @providesModule ReactServerRendering
  13299. */
  13300. 'use strict';
  13301. var ReactElement = _dereq_(63);
  13302. var ReactInstanceHandles = _dereq_(72);
  13303. var ReactMarkupChecksum = _dereq_(76);
  13304. var ReactServerRenderingTransaction =
  13305. _dereq_(93);
  13306. var emptyObject = _dereq_(130);
  13307. var instantiateReactComponent = _dereq_(149);
  13308. var invariant = _dereq_(150);
  13309. /**
  13310. * @param {ReactElement} element
  13311. * @return {string} the HTML markup
  13312. */
  13313. function renderToString(element) {
  13314. ("production" !== "development" ? invariant(
  13315. ReactElement.isValidElement(element),
  13316. 'renderToString(): You must pass a valid ReactElement.'
  13317. ) : invariant(ReactElement.isValidElement(element)));
  13318. var transaction;
  13319. try {
  13320. var id = ReactInstanceHandles.createReactRootID();
  13321. transaction = ReactServerRenderingTransaction.getPooled(false);
  13322. return transaction.perform(function() {
  13323. var componentInstance = instantiateReactComponent(element, null);
  13324. var markup =
  13325. componentInstance.mountComponent(id, transaction, emptyObject);
  13326. return ReactMarkupChecksum.addChecksumToMarkup(markup);
  13327. }, null);
  13328. } finally {
  13329. ReactServerRenderingTransaction.release(transaction);
  13330. }
  13331. }
  13332. /**
  13333. * @param {ReactElement} element
  13334. * @return {string} the HTML markup, without the extra React ID and checksum
  13335. * (for generating static pages)
  13336. */
  13337. function renderToStaticMarkup(element) {
  13338. ("production" !== "development" ? invariant(
  13339. ReactElement.isValidElement(element),
  13340. 'renderToStaticMarkup(): You must pass a valid ReactElement.'
  13341. ) : invariant(ReactElement.isValidElement(element)));
  13342. var transaction;
  13343. try {
  13344. var id = ReactInstanceHandles.createReactRootID();
  13345. transaction = ReactServerRenderingTransaction.getPooled(true);
  13346. return transaction.perform(function() {
  13347. var componentInstance = instantiateReactComponent(element, null);
  13348. return componentInstance.mountComponent(id, transaction, emptyObject);
  13349. }, null);
  13350. } finally {
  13351. ReactServerRenderingTransaction.release(transaction);
  13352. }
  13353. }
  13354. module.exports = {
  13355. renderToString: renderToString,
  13356. renderToStaticMarkup: renderToStaticMarkup
  13357. };
  13358. },{"130":130,"149":149,"150":150,"63":63,"72":72,"76":76,"93":93}],93:[function(_dereq_,module,exports){
  13359. /**
  13360. * Copyright 2014-2015, Facebook, Inc.
  13361. * All rights reserved.
  13362. *
  13363. * This source code is licensed under the BSD-style license found in the
  13364. * LICENSE file in the root directory of this source tree. An additional grant
  13365. * of patent rights can be found in the PATENTS file in the same directory.
  13366. *
  13367. * @providesModule ReactServerRenderingTransaction
  13368. * @typechecks
  13369. */
  13370. 'use strict';
  13371. var PooledClass = _dereq_(30);
  13372. var CallbackQueue = _dereq_(7);
  13373. var ReactPutListenerQueue = _dereq_(87);
  13374. var Transaction = _dereq_(116);
  13375. var assign = _dereq_(29);
  13376. var emptyFunction = _dereq_(129);
  13377. /**
  13378. * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
  13379. * during the performing of the transaction.
  13380. */
  13381. var ON_DOM_READY_QUEUEING = {
  13382. /**
  13383. * Initializes the internal `onDOMReady` queue.
  13384. */
  13385. initialize: function() {
  13386. this.reactMountReady.reset();
  13387. },
  13388. close: emptyFunction
  13389. };
  13390. var PUT_LISTENER_QUEUEING = {
  13391. initialize: function() {
  13392. this.putListenerQueue.reset();
  13393. },
  13394. close: emptyFunction
  13395. };
  13396. /**
  13397. * Executed within the scope of the `Transaction` instance. Consider these as
  13398. * being member methods, but with an implied ordering while being isolated from
  13399. * each other.
  13400. */
  13401. var TRANSACTION_WRAPPERS = [
  13402. PUT_LISTENER_QUEUEING,
  13403. ON_DOM_READY_QUEUEING
  13404. ];
  13405. /**
  13406. * @class ReactServerRenderingTransaction
  13407. * @param {boolean} renderToStaticMarkup
  13408. */
  13409. function ReactServerRenderingTransaction(renderToStaticMarkup) {
  13410. this.reinitializeTransaction();
  13411. this.renderToStaticMarkup = renderToStaticMarkup;
  13412. this.reactMountReady = CallbackQueue.getPooled(null);
  13413. this.putListenerQueue = ReactPutListenerQueue.getPooled();
  13414. }
  13415. var Mixin = {
  13416. /**
  13417. * @see Transaction
  13418. * @abstract
  13419. * @final
  13420. * @return {array} Empty list of operation wrap proceedures.
  13421. */
  13422. getTransactionWrappers: function() {
  13423. return TRANSACTION_WRAPPERS;
  13424. },
  13425. /**
  13426. * @return {object} The queue to collect `onDOMReady` callbacks with.
  13427. */
  13428. getReactMountReady: function() {
  13429. return this.reactMountReady;
  13430. },
  13431. getPutListenerQueue: function() {
  13432. return this.putListenerQueue;
  13433. },
  13434. /**
  13435. * `PooledClass` looks for this, and will invoke this before allowing this
  13436. * instance to be resused.
  13437. */
  13438. destructor: function() {
  13439. CallbackQueue.release(this.reactMountReady);
  13440. this.reactMountReady = null;
  13441. ReactPutListenerQueue.release(this.putListenerQueue);
  13442. this.putListenerQueue = null;
  13443. }
  13444. };
  13445. assign(
  13446. ReactServerRenderingTransaction.prototype,
  13447. Transaction.Mixin,
  13448. Mixin
  13449. );
  13450. PooledClass.addPoolingTo(ReactServerRenderingTransaction);
  13451. module.exports = ReactServerRenderingTransaction;
  13452. },{"116":116,"129":129,"29":29,"30":30,"7":7,"87":87}],94:[function(_dereq_,module,exports){
  13453. /**
  13454. * Copyright 2013-2015, Facebook, Inc.
  13455. * All rights reserved.
  13456. *
  13457. * This source code is licensed under the BSD-style license found in the
  13458. * LICENSE file in the root directory of this source tree. An additional grant
  13459. * of patent rights can be found in the PATENTS file in the same directory.
  13460. *
  13461. * @providesModule ReactStateSetters
  13462. */
  13463. 'use strict';
  13464. var ReactStateSetters = {
  13465. /**
  13466. * Returns a function that calls the provided function, and uses the result
  13467. * of that to set the component's state.
  13468. *
  13469. * @param {ReactCompositeComponent} component
  13470. * @param {function} funcReturningState Returned callback uses this to
  13471. * determine how to update state.
  13472. * @return {function} callback that when invoked uses funcReturningState to
  13473. * determined the object literal to setState.
  13474. */
  13475. createStateSetter: function(component, funcReturningState) {
  13476. return function(a, b, c, d, e, f) {
  13477. var partialState = funcReturningState.call(component, a, b, c, d, e, f);
  13478. if (partialState) {
  13479. component.setState(partialState);
  13480. }
  13481. };
  13482. },
  13483. /**
  13484. * Returns a single-argument callback that can be used to update a single
  13485. * key in the component's state.
  13486. *
  13487. * Note: this is memoized function, which makes it inexpensive to call.
  13488. *
  13489. * @param {ReactCompositeComponent} component
  13490. * @param {string} key The key in the state that you should update.
  13491. * @return {function} callback of 1 argument which calls setState() with
  13492. * the provided keyName and callback argument.
  13493. */
  13494. createStateKeySetter: function(component, key) {
  13495. // Memoize the setters.
  13496. var cache = component.__keySetters || (component.__keySetters = {});
  13497. return cache[key] || (cache[key] = createStateKeySetter(component, key));
  13498. }
  13499. };
  13500. function createStateKeySetter(component, key) {
  13501. // Partial state is allocated outside of the function closure so it can be
  13502. // reused with every call, avoiding memory allocation when this function
  13503. // is called.
  13504. var partialState = {};
  13505. return function stateKeySetter(value) {
  13506. partialState[key] = value;
  13507. component.setState(partialState);
  13508. };
  13509. }
  13510. ReactStateSetters.Mixin = {
  13511. /**
  13512. * Returns a function that calls the provided function, and uses the result
  13513. * of that to set the component's state.
  13514. *
  13515. * For example, these statements are equivalent:
  13516. *
  13517. * this.setState({x: 1});
  13518. * this.createStateSetter(function(xValue) {
  13519. * return {x: xValue};
  13520. * })(1);
  13521. *
  13522. * @param {function} funcReturningState Returned callback uses this to
  13523. * determine how to update state.
  13524. * @return {function} callback that when invoked uses funcReturningState to
  13525. * determined the object literal to setState.
  13526. */
  13527. createStateSetter: function(funcReturningState) {
  13528. return ReactStateSetters.createStateSetter(this, funcReturningState);
  13529. },
  13530. /**
  13531. * Returns a single-argument callback that can be used to update a single
  13532. * key in the component's state.
  13533. *
  13534. * For example, these statements are equivalent:
  13535. *
  13536. * this.setState({x: 1});
  13537. * this.createStateKeySetter('x')(1);
  13538. *
  13539. * Note: this is memoized function, which makes it inexpensive to call.
  13540. *
  13541. * @param {string} key The key in the state that you should update.
  13542. * @return {function} callback of 1 argument which calls setState() with
  13543. * the provided keyName and callback argument.
  13544. */
  13545. createStateKeySetter: function(key) {
  13546. return ReactStateSetters.createStateKeySetter(this, key);
  13547. }
  13548. };
  13549. module.exports = ReactStateSetters;
  13550. },{}],95:[function(_dereq_,module,exports){
  13551. /**
  13552. * Copyright 2013-2015, Facebook, Inc.
  13553. * All rights reserved.
  13554. *
  13555. * This source code is licensed under the BSD-style license found in the
  13556. * LICENSE file in the root directory of this source tree. An additional grant
  13557. * of patent rights can be found in the PATENTS file in the same directory.
  13558. *
  13559. * @providesModule ReactTestUtils
  13560. */
  13561. 'use strict';
  13562. var EventConstants = _dereq_(16);
  13563. var EventPluginHub = _dereq_(18);
  13564. var EventPropagators = _dereq_(21);
  13565. var React = _dereq_(31);
  13566. var ReactElement = _dereq_(63);
  13567. var ReactEmptyComponent = _dereq_(65);
  13568. var ReactBrowserEventEmitter = _dereq_(33);
  13569. var ReactCompositeComponent = _dereq_(43);
  13570. var ReactInstanceHandles = _dereq_(72);
  13571. var ReactInstanceMap = _dereq_(73);
  13572. var ReactMount = _dereq_(77);
  13573. var ReactUpdates = _dereq_(100);
  13574. var SyntheticEvent = _dereq_(108);
  13575. var assign = _dereq_(29);
  13576. var emptyObject = _dereq_(130);
  13577. var topLevelTypes = EventConstants.topLevelTypes;
  13578. function Event(suffix) {}
  13579. /**
  13580. * @class ReactTestUtils
  13581. */
  13582. /**
  13583. * Todo: Support the entire DOM.scry query syntax. For now, these simple
  13584. * utilities will suffice for testing purposes.
  13585. * @lends ReactTestUtils
  13586. */
  13587. var ReactTestUtils = {
  13588. renderIntoDocument: function(instance) {
  13589. var div = document.createElement('div');
  13590. // None of our tests actually require attaching the container to the
  13591. // DOM, and doing so creates a mess that we rely on test isolation to
  13592. // clean up, so we're going to stop honoring the name of this method
  13593. // (and probably rename it eventually) if no problems arise.
  13594. // document.documentElement.appendChild(div);
  13595. return React.render(instance, div);
  13596. },
  13597. isElement: function(element) {
  13598. return ReactElement.isValidElement(element);
  13599. },
  13600. isElementOfType: function(inst, convenienceConstructor) {
  13601. return (
  13602. ReactElement.isValidElement(inst) &&
  13603. inst.type === convenienceConstructor
  13604. );
  13605. },
  13606. isDOMComponent: function(inst) {
  13607. // TODO: Fix this heuristic. It's just here because composites can currently
  13608. // pretend to be DOM components.
  13609. return !!(inst && inst.tagName && inst.getDOMNode);
  13610. },
  13611. isDOMComponentElement: function(inst) {
  13612. return !!(inst &&
  13613. ReactElement.isValidElement(inst) &&
  13614. !!inst.tagName);
  13615. },
  13616. isCompositeComponent: function(inst) {
  13617. return typeof inst.render === 'function' &&
  13618. typeof inst.setState === 'function';
  13619. },
  13620. isCompositeComponentWithType: function(inst, type) {
  13621. return !!(ReactTestUtils.isCompositeComponent(inst) &&
  13622. (inst.constructor === type));
  13623. },
  13624. isCompositeComponentElement: function(inst) {
  13625. if (!ReactElement.isValidElement(inst)) {
  13626. return false;
  13627. }
  13628. // We check the prototype of the type that will get mounted, not the
  13629. // instance itself. This is a future proof way of duck typing.
  13630. var prototype = inst.type.prototype;
  13631. return (
  13632. typeof prototype.render === 'function' &&
  13633. typeof prototype.setState === 'function'
  13634. );
  13635. },
  13636. isCompositeComponentElementWithType: function(inst, type) {
  13637. return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
  13638. (inst.constructor === type));
  13639. },
  13640. getRenderedChildOfCompositeComponent: function(inst) {
  13641. if (!ReactTestUtils.isCompositeComponent(inst)) {
  13642. return null;
  13643. }
  13644. var internalInstance = ReactInstanceMap.get(inst);
  13645. return internalInstance._renderedComponent.getPublicInstance();
  13646. },
  13647. findAllInRenderedTree: function(inst, test) {
  13648. if (!inst) {
  13649. return [];
  13650. }
  13651. var ret = test(inst) ? [inst] : [];
  13652. if (ReactTestUtils.isDOMComponent(inst)) {
  13653. var internalInstance = ReactInstanceMap.get(inst);
  13654. var renderedChildren = internalInstance
  13655. ._renderedComponent
  13656. ._renderedChildren;
  13657. var key;
  13658. for (key in renderedChildren) {
  13659. if (!renderedChildren.hasOwnProperty(key)) {
  13660. continue;
  13661. }
  13662. if (!renderedChildren[key].getPublicInstance) {
  13663. continue;
  13664. }
  13665. ret = ret.concat(
  13666. ReactTestUtils.findAllInRenderedTree(
  13667. renderedChildren[key].getPublicInstance(),
  13668. test
  13669. )
  13670. );
  13671. }
  13672. } else if (ReactTestUtils.isCompositeComponent(inst)) {
  13673. ret = ret.concat(
  13674. ReactTestUtils.findAllInRenderedTree(
  13675. ReactTestUtils.getRenderedChildOfCompositeComponent(inst),
  13676. test
  13677. )
  13678. );
  13679. }
  13680. return ret;
  13681. },
  13682. /**
  13683. * Finds all instance of components in the rendered tree that are DOM
  13684. * components with the class name matching `className`.
  13685. * @return an array of all the matches.
  13686. */
  13687. scryRenderedDOMComponentsWithClass: function(root, className) {
  13688. return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
  13689. var instClassName = inst.props.className;
  13690. return ReactTestUtils.isDOMComponent(inst) && (
  13691. (instClassName && (' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1)
  13692. );
  13693. });
  13694. },
  13695. /**
  13696. * Like scryRenderedDOMComponentsWithClass but expects there to be one result,
  13697. * and returns that one result, or throws exception if there is any other
  13698. * number of matches besides one.
  13699. * @return {!ReactDOMComponent} The one match.
  13700. */
  13701. findRenderedDOMComponentWithClass: function(root, className) {
  13702. var all =
  13703. ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
  13704. if (all.length !== 1) {
  13705. throw new Error('Did not find exactly one match ' +
  13706. '(found: ' + all.length + ') for class:' + className
  13707. );
  13708. }
  13709. return all[0];
  13710. },
  13711. /**
  13712. * Finds all instance of components in the rendered tree that are DOM
  13713. * components with the tag name matching `tagName`.
  13714. * @return an array of all the matches.
  13715. */
  13716. scryRenderedDOMComponentsWithTag: function(root, tagName) {
  13717. return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
  13718. return ReactTestUtils.isDOMComponent(inst) &&
  13719. inst.tagName === tagName.toUpperCase();
  13720. });
  13721. },
  13722. /**
  13723. * Like scryRenderedDOMComponentsWithTag but expects there to be one result,
  13724. * and returns that one result, or throws exception if there is any other
  13725. * number of matches besides one.
  13726. * @return {!ReactDOMComponent} The one match.
  13727. */
  13728. findRenderedDOMComponentWithTag: function(root, tagName) {
  13729. var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
  13730. if (all.length !== 1) {
  13731. throw new Error('Did not find exactly one match for tag:' + tagName);
  13732. }
  13733. return all[0];
  13734. },
  13735. /**
  13736. * Finds all instances of components with type equal to `componentType`.
  13737. * @return an array of all the matches.
  13738. */
  13739. scryRenderedComponentsWithType: function(root, componentType) {
  13740. return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
  13741. return ReactTestUtils.isCompositeComponentWithType(
  13742. inst,
  13743. componentType
  13744. );
  13745. });
  13746. },
  13747. /**
  13748. * Same as `scryRenderedComponentsWithType` but expects there to be one result
  13749. * and returns that one result, or throws exception if there is any other
  13750. * number of matches besides one.
  13751. * @return {!ReactComponent} The one match.
  13752. */
  13753. findRenderedComponentWithType: function(root, componentType) {
  13754. var all = ReactTestUtils.scryRenderedComponentsWithType(
  13755. root,
  13756. componentType
  13757. );
  13758. if (all.length !== 1) {
  13759. throw new Error(
  13760. 'Did not find exactly one match for componentType:' + componentType
  13761. );
  13762. }
  13763. return all[0];
  13764. },
  13765. /**
  13766. * Pass a mocked component module to this method to augment it with
  13767. * useful methods that allow it to be used as a dummy React component.
  13768. * Instead of rendering as usual, the component will become a simple
  13769. * <div> containing any provided children.
  13770. *
  13771. * @param {object} module the mock function object exported from a
  13772. * module that defines the component to be mocked
  13773. * @param {?string} mockTagName optional dummy root tag name to return
  13774. * from render method (overrides
  13775. * module.mockTagName if provided)
  13776. * @return {object} the ReactTestUtils object (for chaining)
  13777. */
  13778. mockComponent: function(module, mockTagName) {
  13779. mockTagName = mockTagName || module.mockTagName || "div";
  13780. module.prototype.render.mockImplementation(function() {
  13781. return React.createElement(
  13782. mockTagName,
  13783. null,
  13784. this.props.children
  13785. );
  13786. });
  13787. return this;
  13788. },
  13789. /**
  13790. * Simulates a top level event being dispatched from a raw event that occured
  13791. * on an `Element` node.
  13792. * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`
  13793. * @param {!Element} node The dom to simulate an event occurring on.
  13794. * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
  13795. */
  13796. simulateNativeEventOnNode: function(topLevelType, node, fakeNativeEvent) {
  13797. fakeNativeEvent.target = node;
  13798. ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(
  13799. topLevelType,
  13800. fakeNativeEvent
  13801. );
  13802. },
  13803. /**
  13804. * Simulates a top level event being dispatched from a raw event that occured
  13805. * on the `ReactDOMComponent` `comp`.
  13806. * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.
  13807. * @param comp {!ReactDOMComponent}
  13808. * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
  13809. */
  13810. simulateNativeEventOnDOMComponent: function(
  13811. topLevelType,
  13812. comp,
  13813. fakeNativeEvent) {
  13814. ReactTestUtils.simulateNativeEventOnNode(
  13815. topLevelType,
  13816. comp.getDOMNode(),
  13817. fakeNativeEvent
  13818. );
  13819. },
  13820. nativeTouchData: function(x, y) {
  13821. return {
  13822. touches: [
  13823. {pageX: x, pageY: y}
  13824. ]
  13825. };
  13826. },
  13827. createRenderer: function() {
  13828. return new ReactShallowRenderer();
  13829. },
  13830. Simulate: null,
  13831. SimulateNative: {}
  13832. };
  13833. /**
  13834. * @class ReactShallowRenderer
  13835. */
  13836. var ReactShallowRenderer = function() {
  13837. this._instance = null;
  13838. };
  13839. ReactShallowRenderer.prototype.getRenderOutput = function() {
  13840. return (
  13841. (this._instance && this._instance._renderedComponent &&
  13842. this._instance._renderedComponent._renderedOutput)
  13843. || null
  13844. );
  13845. };
  13846. var NoopInternalComponent = function(element) {
  13847. this._renderedOutput = element;
  13848. this._currentElement = element === null || element === false ?
  13849. ReactEmptyComponent.emptyElement :
  13850. element;
  13851. };
  13852. NoopInternalComponent.prototype = {
  13853. mountComponent: function() {
  13854. },
  13855. receiveComponent: function(element) {
  13856. this._renderedOutput = element;
  13857. this._currentElement = element === null || element === false ?
  13858. ReactEmptyComponent.emptyElement :
  13859. element;
  13860. },
  13861. unmountComponent: function() {
  13862. }
  13863. };
  13864. var ShallowComponentWrapper = function() { };
  13865. assign(
  13866. ShallowComponentWrapper.prototype,
  13867. ReactCompositeComponent.Mixin, {
  13868. _instantiateReactComponent: function(element) {
  13869. return new NoopInternalComponent(element);
  13870. },
  13871. _replaceNodeWithMarkupByID: function() {},
  13872. _renderValidatedComponent:
  13873. ReactCompositeComponent.Mixin.
  13874. _renderValidatedComponentWithoutOwnerOrContext
  13875. }
  13876. );
  13877. ReactShallowRenderer.prototype.render = function(element, context) {
  13878. if (!context) {
  13879. context = emptyObject;
  13880. }
  13881. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
  13882. this._render(element, transaction, context);
  13883. ReactUpdates.ReactReconcileTransaction.release(transaction);
  13884. };
  13885. ReactShallowRenderer.prototype.unmount = function() {
  13886. if (this._instance) {
  13887. this._instance.unmountComponent();
  13888. }
  13889. };
  13890. ReactShallowRenderer.prototype._render = function(element, transaction, context) {
  13891. if (!this._instance) {
  13892. var rootID = ReactInstanceHandles.createReactRootID();
  13893. var instance = new ShallowComponentWrapper(element.type);
  13894. instance.construct(element);
  13895. instance.mountComponent(rootID, transaction, context);
  13896. this._instance = instance;
  13897. } else {
  13898. this._instance.receiveComponent(element, transaction, context);
  13899. }
  13900. };
  13901. /**
  13902. * Exports:
  13903. *
  13904. * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
  13905. * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
  13906. * - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)`
  13907. * - ... (All keys from event plugin `eventTypes` objects)
  13908. */
  13909. function makeSimulator(eventType) {
  13910. return function(domComponentOrNode, eventData) {
  13911. var node;
  13912. if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
  13913. node = domComponentOrNode.getDOMNode();
  13914. } else if (domComponentOrNode.tagName) {
  13915. node = domComponentOrNode;
  13916. }
  13917. var fakeNativeEvent = new Event();
  13918. fakeNativeEvent.target = node;
  13919. // We don't use SyntheticEvent.getPooled in order to not have to worry about
  13920. // properly destroying any properties assigned from `eventData` upon release
  13921. var event = new SyntheticEvent(
  13922. ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType],
  13923. ReactMount.getID(node),
  13924. fakeNativeEvent
  13925. );
  13926. assign(event, eventData);
  13927. EventPropagators.accumulateTwoPhaseDispatches(event);
  13928. ReactUpdates.batchedUpdates(function() {
  13929. EventPluginHub.enqueueEvents(event);
  13930. EventPluginHub.processEventQueue();
  13931. });
  13932. };
  13933. }
  13934. function buildSimulators() {
  13935. ReactTestUtils.Simulate = {};
  13936. var eventType;
  13937. for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
  13938. /**
  13939. * @param {!Element || ReactDOMComponent} domComponentOrNode
  13940. * @param {?object} eventData Fake event data to use in SyntheticEvent.
  13941. */
  13942. ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
  13943. }
  13944. }
  13945. // Rebuild ReactTestUtils.Simulate whenever event plugins are injected
  13946. var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
  13947. EventPluginHub.injection.injectEventPluginOrder = function() {
  13948. oldInjectEventPluginOrder.apply(this, arguments);
  13949. buildSimulators();
  13950. };
  13951. var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
  13952. EventPluginHub.injection.injectEventPluginsByName = function() {
  13953. oldInjectEventPlugins.apply(this, arguments);
  13954. buildSimulators();
  13955. };
  13956. buildSimulators();
  13957. /**
  13958. * Exports:
  13959. *
  13960. * - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
  13961. * - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
  13962. * - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
  13963. * - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
  13964. * - ... (All keys from `EventConstants.topLevelTypes`)
  13965. *
  13966. * Note: Top level event types are a subset of the entire set of handler types
  13967. * (which include a broader set of "synthetic" events). For example, onDragDone
  13968. * is a synthetic event. Except when testing an event plugin or React's event
  13969. * handling code specifically, you probably want to use ReactTestUtils.Simulate
  13970. * to dispatch synthetic events.
  13971. */
  13972. function makeNativeSimulator(eventType) {
  13973. return function(domComponentOrNode, nativeEventData) {
  13974. var fakeNativeEvent = new Event(eventType);
  13975. assign(fakeNativeEvent, nativeEventData);
  13976. if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
  13977. ReactTestUtils.simulateNativeEventOnDOMComponent(
  13978. eventType,
  13979. domComponentOrNode,
  13980. fakeNativeEvent
  13981. );
  13982. } else if (!!domComponentOrNode.tagName) {
  13983. // Will allow on actual dom nodes.
  13984. ReactTestUtils.simulateNativeEventOnNode(
  13985. eventType,
  13986. domComponentOrNode,
  13987. fakeNativeEvent
  13988. );
  13989. }
  13990. };
  13991. }
  13992. var eventType;
  13993. for (eventType in topLevelTypes) {
  13994. // Event type is stored as 'topClick' - we transform that to 'click'
  13995. var convenienceName = eventType.indexOf('top') === 0 ?
  13996. eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
  13997. /**
  13998. * @param {!Element || ReactDOMComponent} domComponentOrNode
  13999. * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
  14000. */
  14001. ReactTestUtils.SimulateNative[convenienceName] =
  14002. makeNativeSimulator(eventType);
  14003. }
  14004. module.exports = ReactTestUtils;
  14005. },{"100":100,"108":108,"130":130,"16":16,"18":18,"21":21,"29":29,"31":31,"33":33,"43":43,"63":63,"65":65,"72":72,"73":73,"77":77}],96:[function(_dereq_,module,exports){
  14006. /**
  14007. * Copyright 2013-2015, Facebook, Inc.
  14008. * All rights reserved.
  14009. *
  14010. * This source code is licensed under the BSD-style license found in the
  14011. * LICENSE file in the root directory of this source tree. An additional grant
  14012. * of patent rights can be found in the PATENTS file in the same directory.
  14013. *
  14014. * @typechecks static-only
  14015. * @providesModule ReactTransitionChildMapping
  14016. */
  14017. 'use strict';
  14018. var ReactChildren = _dereq_(37);
  14019. var ReactFragment = _dereq_(69);
  14020. var ReactTransitionChildMapping = {
  14021. /**
  14022. * Given `this.props.children`, return an object mapping key to child. Just
  14023. * simple syntactic sugar around ReactChildren.map().
  14024. *
  14025. * @param {*} children `this.props.children`
  14026. * @return {object} Mapping of key to child
  14027. */
  14028. getChildMapping: function(children) {
  14029. if (!children) {
  14030. return children;
  14031. }
  14032. return ReactFragment.extract(ReactChildren.map(children, function(child) {
  14033. return child;
  14034. }));
  14035. },
  14036. /**
  14037. * When you're adding or removing children some may be added or removed in the
  14038. * same render pass. We want to show *both* since we want to simultaneously
  14039. * animate elements in and out. This function takes a previous set of keys
  14040. * and a new set of keys and merges them with its best guess of the correct
  14041. * ordering. In the future we may expose some of the utilities in
  14042. * ReactMultiChild to make this easy, but for now React itself does not
  14043. * directly have this concept of the union of prevChildren and nextChildren
  14044. * so we implement it here.
  14045. *
  14046. * @param {object} prev prev children as returned from
  14047. * `ReactTransitionChildMapping.getChildMapping()`.
  14048. * @param {object} next next children as returned from
  14049. * `ReactTransitionChildMapping.getChildMapping()`.
  14050. * @return {object} a key set that contains all keys in `prev` and all keys
  14051. * in `next` in a reasonable order.
  14052. */
  14053. mergeChildMappings: function(prev, next) {
  14054. prev = prev || {};
  14055. next = next || {};
  14056. function getValueForKey(key) {
  14057. if (next.hasOwnProperty(key)) {
  14058. return next[key];
  14059. } else {
  14060. return prev[key];
  14061. }
  14062. }
  14063. // For each key of `next`, the list of keys to insert before that key in
  14064. // the combined list
  14065. var nextKeysPending = {};
  14066. var pendingKeys = [];
  14067. for (var prevKey in prev) {
  14068. if (next.hasOwnProperty(prevKey)) {
  14069. if (pendingKeys.length) {
  14070. nextKeysPending[prevKey] = pendingKeys;
  14071. pendingKeys = [];
  14072. }
  14073. } else {
  14074. pendingKeys.push(prevKey);
  14075. }
  14076. }
  14077. var i;
  14078. var childMapping = {};
  14079. for (var nextKey in next) {
  14080. if (nextKeysPending.hasOwnProperty(nextKey)) {
  14081. for (i = 0; i < nextKeysPending[nextKey].length; i++) {
  14082. var pendingNextKey = nextKeysPending[nextKey][i];
  14083. childMapping[nextKeysPending[nextKey][i]] = getValueForKey(
  14084. pendingNextKey
  14085. );
  14086. }
  14087. }
  14088. childMapping[nextKey] = getValueForKey(nextKey);
  14089. }
  14090. // Finally, add the keys which didn't appear before any key in `next`
  14091. for (i = 0; i < pendingKeys.length; i++) {
  14092. childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
  14093. }
  14094. return childMapping;
  14095. }
  14096. };
  14097. module.exports = ReactTransitionChildMapping;
  14098. },{"37":37,"69":69}],97:[function(_dereq_,module,exports){
  14099. /**
  14100. * Copyright 2013-2015, Facebook, Inc.
  14101. * All rights reserved.
  14102. *
  14103. * This source code is licensed under the BSD-style license found in the
  14104. * LICENSE file in the root directory of this source tree. An additional grant
  14105. * of patent rights can be found in the PATENTS file in the same directory.
  14106. *
  14107. * @providesModule ReactTransitionEvents
  14108. */
  14109. 'use strict';
  14110. var ExecutionEnvironment = _dereq_(22);
  14111. /**
  14112. * EVENT_NAME_MAP is used to determine which event fired when a
  14113. * transition/animation ends, based on the style property used to
  14114. * define that event.
  14115. */
  14116. var EVENT_NAME_MAP = {
  14117. transitionend: {
  14118. 'transition': 'transitionend',
  14119. 'WebkitTransition': 'webkitTransitionEnd',
  14120. 'MozTransition': 'mozTransitionEnd',
  14121. 'OTransition': 'oTransitionEnd',
  14122. 'msTransition': 'MSTransitionEnd'
  14123. },
  14124. animationend: {
  14125. 'animation': 'animationend',
  14126. 'WebkitAnimation': 'webkitAnimationEnd',
  14127. 'MozAnimation': 'mozAnimationEnd',
  14128. 'OAnimation': 'oAnimationEnd',
  14129. 'msAnimation': 'MSAnimationEnd'
  14130. }
  14131. };
  14132. var endEvents = [];
  14133. function detectEvents() {
  14134. var testEl = document.createElement('div');
  14135. var style = testEl.style;
  14136. // On some platforms, in particular some releases of Android 4.x,
  14137. // the un-prefixed "animation" and "transition" properties are defined on the
  14138. // style object but the events that fire will still be prefixed, so we need
  14139. // to check if the un-prefixed events are useable, and if not remove them
  14140. // from the map
  14141. if (!('AnimationEvent' in window)) {
  14142. delete EVENT_NAME_MAP.animationend.animation;
  14143. }
  14144. if (!('TransitionEvent' in window)) {
  14145. delete EVENT_NAME_MAP.transitionend.transition;
  14146. }
  14147. for (var baseEventName in EVENT_NAME_MAP) {
  14148. var baseEvents = EVENT_NAME_MAP[baseEventName];
  14149. for (var styleName in baseEvents) {
  14150. if (styleName in style) {
  14151. endEvents.push(baseEvents[styleName]);
  14152. break;
  14153. }
  14154. }
  14155. }
  14156. }
  14157. if (ExecutionEnvironment.canUseDOM) {
  14158. detectEvents();
  14159. }
  14160. // We use the raw {add|remove}EventListener() call because EventListener
  14161. // does not know how to remove event listeners and we really should
  14162. // clean up. Also, these events are not triggered in older browsers
  14163. // so we should be A-OK here.
  14164. function addEventListener(node, eventName, eventListener) {
  14165. node.addEventListener(eventName, eventListener, false);
  14166. }
  14167. function removeEventListener(node, eventName, eventListener) {
  14168. node.removeEventListener(eventName, eventListener, false);
  14169. }
  14170. var ReactTransitionEvents = {
  14171. addEndEventListener: function(node, eventListener) {
  14172. if (endEvents.length === 0) {
  14173. // If CSS transitions are not supported, trigger an "end animation"
  14174. // event immediately.
  14175. window.setTimeout(eventListener, 0);
  14176. return;
  14177. }
  14178. endEvents.forEach(function(endEvent) {
  14179. addEventListener(node, endEvent, eventListener);
  14180. });
  14181. },
  14182. removeEndEventListener: function(node, eventListener) {
  14183. if (endEvents.length === 0) {
  14184. return;
  14185. }
  14186. endEvents.forEach(function(endEvent) {
  14187. removeEventListener(node, endEvent, eventListener);
  14188. });
  14189. }
  14190. };
  14191. module.exports = ReactTransitionEvents;
  14192. },{"22":22}],98:[function(_dereq_,module,exports){
  14193. /**
  14194. * Copyright 2013-2015, Facebook, Inc.
  14195. * All rights reserved.
  14196. *
  14197. * This source code is licensed under the BSD-style license found in the
  14198. * LICENSE file in the root directory of this source tree. An additional grant
  14199. * of patent rights can be found in the PATENTS file in the same directory.
  14200. *
  14201. * @providesModule ReactTransitionGroup
  14202. */
  14203. 'use strict';
  14204. var React = _dereq_(31);
  14205. var ReactTransitionChildMapping = _dereq_(96);
  14206. var assign = _dereq_(29);
  14207. var cloneWithProps = _dereq_(122);
  14208. var emptyFunction = _dereq_(129);
  14209. var ReactTransitionGroup = React.createClass({
  14210. displayName: 'ReactTransitionGroup',
  14211. propTypes: {
  14212. component: React.PropTypes.any,
  14213. childFactory: React.PropTypes.func
  14214. },
  14215. getDefaultProps: function() {
  14216. return {
  14217. component: 'span',
  14218. childFactory: emptyFunction.thatReturnsArgument
  14219. };
  14220. },
  14221. getInitialState: function() {
  14222. return {
  14223. children: ReactTransitionChildMapping.getChildMapping(this.props.children)
  14224. };
  14225. },
  14226. componentWillMount: function() {
  14227. this.currentlyTransitioningKeys = {};
  14228. this.keysToEnter = [];
  14229. this.keysToLeave = [];
  14230. },
  14231. componentDidMount: function() {
  14232. var initialChildMapping = this.state.children;
  14233. for (var key in initialChildMapping) {
  14234. if (initialChildMapping[key]) {
  14235. this.performAppear(key);
  14236. }
  14237. }
  14238. },
  14239. componentWillReceiveProps: function(nextProps) {
  14240. var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
  14241. nextProps.children
  14242. );
  14243. var prevChildMapping = this.state.children;
  14244. this.setState({
  14245. children: ReactTransitionChildMapping.mergeChildMappings(
  14246. prevChildMapping,
  14247. nextChildMapping
  14248. )
  14249. });
  14250. var key;
  14251. for (key in nextChildMapping) {
  14252. var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
  14253. if (nextChildMapping[key] && !hasPrev &&
  14254. !this.currentlyTransitioningKeys[key]) {
  14255. this.keysToEnter.push(key);
  14256. }
  14257. }
  14258. for (key in prevChildMapping) {
  14259. var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
  14260. if (prevChildMapping[key] && !hasNext &&
  14261. !this.currentlyTransitioningKeys[key]) {
  14262. this.keysToLeave.push(key);
  14263. }
  14264. }
  14265. // If we want to someday check for reordering, we could do it here.
  14266. },
  14267. componentDidUpdate: function() {
  14268. var keysToEnter = this.keysToEnter;
  14269. this.keysToEnter = [];
  14270. keysToEnter.forEach(this.performEnter);
  14271. var keysToLeave = this.keysToLeave;
  14272. this.keysToLeave = [];
  14273. keysToLeave.forEach(this.performLeave);
  14274. },
  14275. performAppear: function(key) {
  14276. this.currentlyTransitioningKeys[key] = true;
  14277. var component = this.refs[key];
  14278. if (component.componentWillAppear) {
  14279. component.componentWillAppear(
  14280. this._handleDoneAppearing.bind(this, key)
  14281. );
  14282. } else {
  14283. this._handleDoneAppearing(key);
  14284. }
  14285. },
  14286. _handleDoneAppearing: function(key) {
  14287. var component = this.refs[key];
  14288. if (component.componentDidAppear) {
  14289. component.componentDidAppear();
  14290. }
  14291. delete this.currentlyTransitioningKeys[key];
  14292. var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
  14293. this.props.children
  14294. );
  14295. if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
  14296. // This was removed before it had fully appeared. Remove it.
  14297. this.performLeave(key);
  14298. }
  14299. },
  14300. performEnter: function(key) {
  14301. this.currentlyTransitioningKeys[key] = true;
  14302. var component = this.refs[key];
  14303. if (component.componentWillEnter) {
  14304. component.componentWillEnter(
  14305. this._handleDoneEntering.bind(this, key)
  14306. );
  14307. } else {
  14308. this._handleDoneEntering(key);
  14309. }
  14310. },
  14311. _handleDoneEntering: function(key) {
  14312. var component = this.refs[key];
  14313. if (component.componentDidEnter) {
  14314. component.componentDidEnter();
  14315. }
  14316. delete this.currentlyTransitioningKeys[key];
  14317. var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
  14318. this.props.children
  14319. );
  14320. if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
  14321. // This was removed before it had fully entered. Remove it.
  14322. this.performLeave(key);
  14323. }
  14324. },
  14325. performLeave: function(key) {
  14326. this.currentlyTransitioningKeys[key] = true;
  14327. var component = this.refs[key];
  14328. if (component.componentWillLeave) {
  14329. component.componentWillLeave(this._handleDoneLeaving.bind(this, key));
  14330. } else {
  14331. // Note that this is somewhat dangerous b/c it calls setState()
  14332. // again, effectively mutating the component before all the work
  14333. // is done.
  14334. this._handleDoneLeaving(key);
  14335. }
  14336. },
  14337. _handleDoneLeaving: function(key) {
  14338. var component = this.refs[key];
  14339. if (component.componentDidLeave) {
  14340. component.componentDidLeave();
  14341. }
  14342. delete this.currentlyTransitioningKeys[key];
  14343. var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
  14344. this.props.children
  14345. );
  14346. if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
  14347. // This entered again before it fully left. Add it again.
  14348. this.performEnter(key);
  14349. } else {
  14350. var newChildren = assign({}, this.state.children);
  14351. delete newChildren[key];
  14352. this.setState({children: newChildren});
  14353. }
  14354. },
  14355. render: function() {
  14356. // TODO: we could get rid of the need for the wrapper node
  14357. // by cloning a single child
  14358. var childrenToRender = [];
  14359. for (var key in this.state.children) {
  14360. var child = this.state.children[key];
  14361. if (child) {
  14362. // You may need to apply reactive updates to a child as it is leaving.
  14363. // The normal React way to do it won't work since the child will have
  14364. // already been removed. In case you need this behavior you can provide
  14365. // a childFactory function to wrap every child, even the ones that are
  14366. // leaving.
  14367. childrenToRender.push(cloneWithProps(
  14368. this.props.childFactory(child),
  14369. {ref: key, key: key}
  14370. ));
  14371. }
  14372. }
  14373. return React.createElement(
  14374. this.props.component,
  14375. this.props,
  14376. childrenToRender
  14377. );
  14378. }
  14379. });
  14380. module.exports = ReactTransitionGroup;
  14381. },{"122":122,"129":129,"29":29,"31":31,"96":96}],99:[function(_dereq_,module,exports){
  14382. /**
  14383. * Copyright 2015, Facebook, Inc.
  14384. * All rights reserved.
  14385. *
  14386. * This source code is licensed under the BSD-style license found in the
  14387. * LICENSE file in the root directory of this source tree. An additional grant
  14388. * of patent rights can be found in the PATENTS file in the same directory.
  14389. *
  14390. * @providesModule ReactUpdateQueue
  14391. */
  14392. 'use strict';
  14393. var ReactLifeCycle = _dereq_(74);
  14394. var ReactCurrentOwner = _dereq_(45);
  14395. var ReactElement = _dereq_(63);
  14396. var ReactInstanceMap = _dereq_(73);
  14397. var ReactUpdates = _dereq_(100);
  14398. var assign = _dereq_(29);
  14399. var invariant = _dereq_(150);
  14400. var warning = _dereq_(171);
  14401. function enqueueUpdate(internalInstance) {
  14402. if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {
  14403. // If we're in a componentWillMount handler, don't enqueue a rerender
  14404. // because ReactUpdates assumes we're in a browser context (which is
  14405. // wrong for server rendering) and we're about to do a render anyway.
  14406. // See bug in #1740.
  14407. ReactUpdates.enqueueUpdate(internalInstance);
  14408. }
  14409. }
  14410. function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  14411. ("production" !== "development" ? invariant(
  14412. ReactCurrentOwner.current == null,
  14413. '%s(...): Cannot update during an existing state transition ' +
  14414. '(such as within `render`). Render methods should be a pure function ' +
  14415. 'of props and state.',
  14416. callerName
  14417. ) : invariant(ReactCurrentOwner.current == null));
  14418. var internalInstance = ReactInstanceMap.get(publicInstance);
  14419. if (!internalInstance) {
  14420. if ("production" !== "development") {
  14421. // Only warn when we have a callerName. Otherwise we should be silent.
  14422. // We're probably calling from enqueueCallback. We don't want to warn
  14423. // there because we already warned for the corresponding lifecycle method.
  14424. ("production" !== "development" ? warning(
  14425. !callerName,
  14426. '%s(...): Can only update a mounted or mounting component. ' +
  14427. 'This usually means you called %s() on an unmounted ' +
  14428. 'component. This is a no-op.',
  14429. callerName,
  14430. callerName
  14431. ) : null);
  14432. }
  14433. return null;
  14434. }
  14435. if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {
  14436. return null;
  14437. }
  14438. return internalInstance;
  14439. }
  14440. /**
  14441. * ReactUpdateQueue allows for state updates to be scheduled into a later
  14442. * reconciliation step.
  14443. */
  14444. var ReactUpdateQueue = {
  14445. /**
  14446. * Enqueue a callback that will be executed after all the pending updates
  14447. * have processed.
  14448. *
  14449. * @param {ReactClass} publicInstance The instance to use as `this` context.
  14450. * @param {?function} callback Called after state is updated.
  14451. * @internal
  14452. */
  14453. enqueueCallback: function(publicInstance, callback) {
  14454. ("production" !== "development" ? invariant(
  14455. typeof callback === 'function',
  14456. 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
  14457. '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
  14458. 'isn\'t callable.'
  14459. ) : invariant(typeof callback === 'function'));
  14460. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
  14461. // Previously we would throw an error if we didn't have an internal
  14462. // instance. Since we want to make it a no-op instead, we mirror the same
  14463. // behavior we have in other enqueue* methods.
  14464. // We also need to ignore callbacks in componentWillMount. See
  14465. // enqueueUpdates.
  14466. if (!internalInstance ||
  14467. internalInstance === ReactLifeCycle.currentlyMountingInstance) {
  14468. return null;
  14469. }
  14470. if (internalInstance._pendingCallbacks) {
  14471. internalInstance._pendingCallbacks.push(callback);
  14472. } else {
  14473. internalInstance._pendingCallbacks = [callback];
  14474. }
  14475. // TODO: The callback here is ignored when setState is called from
  14476. // componentWillMount. Either fix it or disallow doing so completely in
  14477. // favor of getInitialState. Alternatively, we can disallow
  14478. // componentWillMount during server-side rendering.
  14479. enqueueUpdate(internalInstance);
  14480. },
  14481. enqueueCallbackInternal: function(internalInstance, callback) {
  14482. ("production" !== "development" ? invariant(
  14483. typeof callback === 'function',
  14484. 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
  14485. '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
  14486. 'isn\'t callable.'
  14487. ) : invariant(typeof callback === 'function'));
  14488. if (internalInstance._pendingCallbacks) {
  14489. internalInstance._pendingCallbacks.push(callback);
  14490. } else {
  14491. internalInstance._pendingCallbacks = [callback];
  14492. }
  14493. enqueueUpdate(internalInstance);
  14494. },
  14495. /**
  14496. * Forces an update. This should only be invoked when it is known with
  14497. * certainty that we are **not** in a DOM transaction.
  14498. *
  14499. * You may want to call this when you know that some deeper aspect of the
  14500. * component's state has changed but `setState` was not called.
  14501. *
  14502. * This will not invoke `shouldUpdateComponent`, but it will invoke
  14503. * `componentWillUpdate` and `componentDidUpdate`.
  14504. *
  14505. * @param {ReactClass} publicInstance The instance that should rerender.
  14506. * @internal
  14507. */
  14508. enqueueForceUpdate: function(publicInstance) {
  14509. var internalInstance = getInternalInstanceReadyForUpdate(
  14510. publicInstance,
  14511. 'forceUpdate'
  14512. );
  14513. if (!internalInstance) {
  14514. return;
  14515. }
  14516. internalInstance._pendingForceUpdate = true;
  14517. enqueueUpdate(internalInstance);
  14518. },
  14519. /**
  14520. * Replaces all of the state. Always use this or `setState` to mutate state.
  14521. * You should treat `this.state` as immutable.
  14522. *
  14523. * There is no guarantee that `this.state` will be immediately updated, so
  14524. * accessing `this.state` after calling this method may return the old value.
  14525. *
  14526. * @param {ReactClass} publicInstance The instance that should rerender.
  14527. * @param {object} completeState Next state.
  14528. * @internal
  14529. */
  14530. enqueueReplaceState: function(publicInstance, completeState) {
  14531. var internalInstance = getInternalInstanceReadyForUpdate(
  14532. publicInstance,
  14533. 'replaceState'
  14534. );
  14535. if (!internalInstance) {
  14536. return;
  14537. }
  14538. internalInstance._pendingStateQueue = [completeState];
  14539. internalInstance._pendingReplaceState = true;
  14540. enqueueUpdate(internalInstance);
  14541. },
  14542. /**
  14543. * Sets a subset of the state. This only exists because _pendingState is
  14544. * internal. This provides a merging strategy that is not available to deep
  14545. * properties which is confusing. TODO: Expose pendingState or don't use it
  14546. * during the merge.
  14547. *
  14548. * @param {ReactClass} publicInstance The instance that should rerender.
  14549. * @param {object} partialState Next partial state to be merged with state.
  14550. * @internal
  14551. */
  14552. enqueueSetState: function(publicInstance, partialState) {
  14553. var internalInstance = getInternalInstanceReadyForUpdate(
  14554. publicInstance,
  14555. 'setState'
  14556. );
  14557. if (!internalInstance) {
  14558. return;
  14559. }
  14560. var queue =
  14561. internalInstance._pendingStateQueue ||
  14562. (internalInstance._pendingStateQueue = []);
  14563. queue.push(partialState);
  14564. enqueueUpdate(internalInstance);
  14565. },
  14566. /**
  14567. * Sets a subset of the props.
  14568. *
  14569. * @param {ReactClass} publicInstance The instance that should rerender.
  14570. * @param {object} partialProps Subset of the next props.
  14571. * @internal
  14572. */
  14573. enqueueSetProps: function(publicInstance, partialProps) {
  14574. var internalInstance = getInternalInstanceReadyForUpdate(
  14575. publicInstance,
  14576. 'setProps'
  14577. );
  14578. if (!internalInstance) {
  14579. return;
  14580. }
  14581. ("production" !== "development" ? invariant(
  14582. internalInstance._isTopLevel,
  14583. 'setProps(...): You called `setProps` on a ' +
  14584. 'component with a parent. This is an anti-pattern since props will ' +
  14585. 'get reactively updated when rendered. Instead, change the owner\'s ' +
  14586. '`render` method to pass the correct value as props to the component ' +
  14587. 'where it is created.'
  14588. ) : invariant(internalInstance._isTopLevel));
  14589. // Merge with the pending element if it exists, otherwise with existing
  14590. // element props.
  14591. var element = internalInstance._pendingElement ||
  14592. internalInstance._currentElement;
  14593. var props = assign({}, element.props, partialProps);
  14594. internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
  14595. element,
  14596. props
  14597. );
  14598. enqueueUpdate(internalInstance);
  14599. },
  14600. /**
  14601. * Replaces all of the props.
  14602. *
  14603. * @param {ReactClass} publicInstance The instance that should rerender.
  14604. * @param {object} props New props.
  14605. * @internal
  14606. */
  14607. enqueueReplaceProps: function(publicInstance, props) {
  14608. var internalInstance = getInternalInstanceReadyForUpdate(
  14609. publicInstance,
  14610. 'replaceProps'
  14611. );
  14612. if (!internalInstance) {
  14613. return;
  14614. }
  14615. ("production" !== "development" ? invariant(
  14616. internalInstance._isTopLevel,
  14617. 'replaceProps(...): You called `replaceProps` on a ' +
  14618. 'component with a parent. This is an anti-pattern since props will ' +
  14619. 'get reactively updated when rendered. Instead, change the owner\'s ' +
  14620. '`render` method to pass the correct value as props to the component ' +
  14621. 'where it is created.'
  14622. ) : invariant(internalInstance._isTopLevel));
  14623. // Merge with the pending element if it exists, otherwise with existing
  14624. // element props.
  14625. var element = internalInstance._pendingElement ||
  14626. internalInstance._currentElement;
  14627. internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
  14628. element,
  14629. props
  14630. );
  14631. enqueueUpdate(internalInstance);
  14632. },
  14633. enqueueElementInternal: function(internalInstance, newElement) {
  14634. internalInstance._pendingElement = newElement;
  14635. enqueueUpdate(internalInstance);
  14636. }
  14637. };
  14638. module.exports = ReactUpdateQueue;
  14639. },{"100":100,"150":150,"171":171,"29":29,"45":45,"63":63,"73":73,"74":74}],100:[function(_dereq_,module,exports){
  14640. /**
  14641. * Copyright 2013-2015, Facebook, Inc.
  14642. * All rights reserved.
  14643. *
  14644. * This source code is licensed under the BSD-style license found in the
  14645. * LICENSE file in the root directory of this source tree. An additional grant
  14646. * of patent rights can be found in the PATENTS file in the same directory.
  14647. *
  14648. * @providesModule ReactUpdates
  14649. */
  14650. 'use strict';
  14651. var CallbackQueue = _dereq_(7);
  14652. var PooledClass = _dereq_(30);
  14653. var ReactCurrentOwner = _dereq_(45);
  14654. var ReactPerf = _dereq_(82);
  14655. var ReactReconciler = _dereq_(89);
  14656. var Transaction = _dereq_(116);
  14657. var assign = _dereq_(29);
  14658. var invariant = _dereq_(150);
  14659. var warning = _dereq_(171);
  14660. var dirtyComponents = [];
  14661. var asapCallbackQueue = CallbackQueue.getPooled();
  14662. var asapEnqueued = false;
  14663. var batchingStrategy = null;
  14664. function ensureInjected() {
  14665. ("production" !== "development" ? invariant(
  14666. ReactUpdates.ReactReconcileTransaction && batchingStrategy,
  14667. 'ReactUpdates: must inject a reconcile transaction class and batching ' +
  14668. 'strategy'
  14669. ) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
  14670. }
  14671. var NESTED_UPDATES = {
  14672. initialize: function() {
  14673. this.dirtyComponentsLength = dirtyComponents.length;
  14674. },
  14675. close: function() {
  14676. if (this.dirtyComponentsLength !== dirtyComponents.length) {
  14677. // Additional updates were enqueued by componentDidUpdate handlers or
  14678. // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
  14679. // these new updates so that if A's componentDidUpdate calls setState on
  14680. // B, B will update before the callback A's updater provided when calling
  14681. // setState.
  14682. dirtyComponents.splice(0, this.dirtyComponentsLength);
  14683. flushBatchedUpdates();
  14684. } else {
  14685. dirtyComponents.length = 0;
  14686. }
  14687. }
  14688. };
  14689. var UPDATE_QUEUEING = {
  14690. initialize: function() {
  14691. this.callbackQueue.reset();
  14692. },
  14693. close: function() {
  14694. this.callbackQueue.notifyAll();
  14695. }
  14696. };
  14697. var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
  14698. function ReactUpdatesFlushTransaction() {
  14699. this.reinitializeTransaction();
  14700. this.dirtyComponentsLength = null;
  14701. this.callbackQueue = CallbackQueue.getPooled();
  14702. this.reconcileTransaction =
  14703. ReactUpdates.ReactReconcileTransaction.getPooled();
  14704. }
  14705. assign(
  14706. ReactUpdatesFlushTransaction.prototype,
  14707. Transaction.Mixin, {
  14708. getTransactionWrappers: function() {
  14709. return TRANSACTION_WRAPPERS;
  14710. },
  14711. destructor: function() {
  14712. this.dirtyComponentsLength = null;
  14713. CallbackQueue.release(this.callbackQueue);
  14714. this.callbackQueue = null;
  14715. ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
  14716. this.reconcileTransaction = null;
  14717. },
  14718. perform: function(method, scope, a) {
  14719. // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
  14720. // with this transaction's wrappers around it.
  14721. return Transaction.Mixin.perform.call(
  14722. this,
  14723. this.reconcileTransaction.perform,
  14724. this.reconcileTransaction,
  14725. method,
  14726. scope,
  14727. a
  14728. );
  14729. }
  14730. });
  14731. PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
  14732. function batchedUpdates(callback, a, b, c, d) {
  14733. ensureInjected();
  14734. batchingStrategy.batchedUpdates(callback, a, b, c, d);
  14735. }
  14736. /**
  14737. * Array comparator for ReactComponents by mount ordering.
  14738. *
  14739. * @param {ReactComponent} c1 first component you're comparing
  14740. * @param {ReactComponent} c2 second component you're comparing
  14741. * @return {number} Return value usable by Array.prototype.sort().
  14742. */
  14743. function mountOrderComparator(c1, c2) {
  14744. return c1._mountOrder - c2._mountOrder;
  14745. }
  14746. function runBatchedUpdates(transaction) {
  14747. var len = transaction.dirtyComponentsLength;
  14748. ("production" !== "development" ? invariant(
  14749. len === dirtyComponents.length,
  14750. 'Expected flush transaction\'s stored dirty-components length (%s) to ' +
  14751. 'match dirty-components array length (%s).',
  14752. len,
  14753. dirtyComponents.length
  14754. ) : invariant(len === dirtyComponents.length));
  14755. // Since reconciling a component higher in the owner hierarchy usually (not
  14756. // always -- see shouldComponentUpdate()) will reconcile children, reconcile
  14757. // them before their children by sorting the array.
  14758. dirtyComponents.sort(mountOrderComparator);
  14759. for (var i = 0; i < len; i++) {
  14760. // If a component is unmounted before pending changes apply, it will still
  14761. // be here, but we assume that it has cleared its _pendingCallbacks and
  14762. // that performUpdateIfNecessary is a noop.
  14763. var component = dirtyComponents[i];
  14764. // If performUpdateIfNecessary happens to enqueue any new updates, we
  14765. // shouldn't execute the callbacks until the next render happens, so
  14766. // stash the callbacks first
  14767. var callbacks = component._pendingCallbacks;
  14768. component._pendingCallbacks = null;
  14769. ReactReconciler.performUpdateIfNecessary(
  14770. component,
  14771. transaction.reconcileTransaction
  14772. );
  14773. if (callbacks) {
  14774. for (var j = 0; j < callbacks.length; j++) {
  14775. transaction.callbackQueue.enqueue(
  14776. callbacks[j],
  14777. component.getPublicInstance()
  14778. );
  14779. }
  14780. }
  14781. }
  14782. }
  14783. var flushBatchedUpdates = function() {
  14784. // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
  14785. // array and perform any updates enqueued by mount-ready handlers (i.e.,
  14786. // componentDidUpdate) but we need to check here too in order to catch
  14787. // updates enqueued by setState callbacks and asap calls.
  14788. while (dirtyComponents.length || asapEnqueued) {
  14789. if (dirtyComponents.length) {
  14790. var transaction = ReactUpdatesFlushTransaction.getPooled();
  14791. transaction.perform(runBatchedUpdates, null, transaction);
  14792. ReactUpdatesFlushTransaction.release(transaction);
  14793. }
  14794. if (asapEnqueued) {
  14795. asapEnqueued = false;
  14796. var queue = asapCallbackQueue;
  14797. asapCallbackQueue = CallbackQueue.getPooled();
  14798. queue.notifyAll();
  14799. CallbackQueue.release(queue);
  14800. }
  14801. }
  14802. };
  14803. flushBatchedUpdates = ReactPerf.measure(
  14804. 'ReactUpdates',
  14805. 'flushBatchedUpdates',
  14806. flushBatchedUpdates
  14807. );
  14808. /**
  14809. * Mark a component as needing a rerender, adding an optional callback to a
  14810. * list of functions which will be executed once the rerender occurs.
  14811. */
  14812. function enqueueUpdate(component) {
  14813. ensureInjected();
  14814. // Various parts of our code (such as ReactCompositeComponent's
  14815. // _renderValidatedComponent) assume that calls to render aren't nested;
  14816. // verify that that's the case. (This is called by each top-level update
  14817. // function, like setProps, setState, forceUpdate, etc.; creation and
  14818. // destruction of top-level components is guarded in ReactMount.)
  14819. ("production" !== "development" ? warning(
  14820. ReactCurrentOwner.current == null,
  14821. 'enqueueUpdate(): Render methods should be a pure function of props ' +
  14822. 'and state; triggering nested component updates from render is not ' +
  14823. 'allowed. If necessary, trigger nested updates in ' +
  14824. 'componentDidUpdate.'
  14825. ) : null);
  14826. if (!batchingStrategy.isBatchingUpdates) {
  14827. batchingStrategy.batchedUpdates(enqueueUpdate, component);
  14828. return;
  14829. }
  14830. dirtyComponents.push(component);
  14831. }
  14832. /**
  14833. * Enqueue a callback to be run at the end of the current batching cycle. Throws
  14834. * if no updates are currently being performed.
  14835. */
  14836. function asap(callback, context) {
  14837. ("production" !== "development" ? invariant(
  14838. batchingStrategy.isBatchingUpdates,
  14839. 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
  14840. 'updates are not being batched.'
  14841. ) : invariant(batchingStrategy.isBatchingUpdates));
  14842. asapCallbackQueue.enqueue(callback, context);
  14843. asapEnqueued = true;
  14844. }
  14845. var ReactUpdatesInjection = {
  14846. injectReconcileTransaction: function(ReconcileTransaction) {
  14847. ("production" !== "development" ? invariant(
  14848. ReconcileTransaction,
  14849. 'ReactUpdates: must provide a reconcile transaction class'
  14850. ) : invariant(ReconcileTransaction));
  14851. ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
  14852. },
  14853. injectBatchingStrategy: function(_batchingStrategy) {
  14854. ("production" !== "development" ? invariant(
  14855. _batchingStrategy,
  14856. 'ReactUpdates: must provide a batching strategy'
  14857. ) : invariant(_batchingStrategy));
  14858. ("production" !== "development" ? invariant(
  14859. typeof _batchingStrategy.batchedUpdates === 'function',
  14860. 'ReactUpdates: must provide a batchedUpdates() function'
  14861. ) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
  14862. ("production" !== "development" ? invariant(
  14863. typeof _batchingStrategy.isBatchingUpdates === 'boolean',
  14864. 'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
  14865. ) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
  14866. batchingStrategy = _batchingStrategy;
  14867. }
  14868. };
  14869. var ReactUpdates = {
  14870. /**
  14871. * React references `ReactReconcileTransaction` using this property in order
  14872. * to allow dependency injection.
  14873. *
  14874. * @internal
  14875. */
  14876. ReactReconcileTransaction: null,
  14877. batchedUpdates: batchedUpdates,
  14878. enqueueUpdate: enqueueUpdate,
  14879. flushBatchedUpdates: flushBatchedUpdates,
  14880. injection: ReactUpdatesInjection,
  14881. asap: asap
  14882. };
  14883. module.exports = ReactUpdates;
  14884. },{"116":116,"150":150,"171":171,"29":29,"30":30,"45":45,"7":7,"82":82,"89":89}],101:[function(_dereq_,module,exports){
  14885. /**
  14886. * Copyright 2013-2015, Facebook, Inc.
  14887. * All rights reserved.
  14888. *
  14889. * This source code is licensed under the BSD-style license found in the
  14890. * LICENSE file in the root directory of this source tree. An additional grant
  14891. * of patent rights can be found in the PATENTS file in the same directory.
  14892. *
  14893. * @providesModule SVGDOMPropertyConfig
  14894. */
  14895. /*jslint bitwise: true*/
  14896. 'use strict';
  14897. var DOMProperty = _dereq_(11);
  14898. var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
  14899. var SVGDOMPropertyConfig = {
  14900. Properties: {
  14901. clipPath: MUST_USE_ATTRIBUTE,
  14902. cx: MUST_USE_ATTRIBUTE,
  14903. cy: MUST_USE_ATTRIBUTE,
  14904. d: MUST_USE_ATTRIBUTE,
  14905. dx: MUST_USE_ATTRIBUTE,
  14906. dy: MUST_USE_ATTRIBUTE,
  14907. fill: MUST_USE_ATTRIBUTE,
  14908. fillOpacity: MUST_USE_ATTRIBUTE,
  14909. fontFamily: MUST_USE_ATTRIBUTE,
  14910. fontSize: MUST_USE_ATTRIBUTE,
  14911. fx: MUST_USE_ATTRIBUTE,
  14912. fy: MUST_USE_ATTRIBUTE,
  14913. gradientTransform: MUST_USE_ATTRIBUTE,
  14914. gradientUnits: MUST_USE_ATTRIBUTE,
  14915. markerEnd: MUST_USE_ATTRIBUTE,
  14916. markerMid: MUST_USE_ATTRIBUTE,
  14917. markerStart: MUST_USE_ATTRIBUTE,
  14918. offset: MUST_USE_ATTRIBUTE,
  14919. opacity: MUST_USE_ATTRIBUTE,
  14920. patternContentUnits: MUST_USE_ATTRIBUTE,
  14921. patternUnits: MUST_USE_ATTRIBUTE,
  14922. points: MUST_USE_ATTRIBUTE,
  14923. preserveAspectRatio: MUST_USE_ATTRIBUTE,
  14924. r: MUST_USE_ATTRIBUTE,
  14925. rx: MUST_USE_ATTRIBUTE,
  14926. ry: MUST_USE_ATTRIBUTE,
  14927. spreadMethod: MUST_USE_ATTRIBUTE,
  14928. stopColor: MUST_USE_ATTRIBUTE,
  14929. stopOpacity: MUST_USE_ATTRIBUTE,
  14930. stroke: MUST_USE_ATTRIBUTE,
  14931. strokeDasharray: MUST_USE_ATTRIBUTE,
  14932. strokeLinecap: MUST_USE_ATTRIBUTE,
  14933. strokeOpacity: MUST_USE_ATTRIBUTE,
  14934. strokeWidth: MUST_USE_ATTRIBUTE,
  14935. textAnchor: MUST_USE_ATTRIBUTE,
  14936. transform: MUST_USE_ATTRIBUTE,
  14937. version: MUST_USE_ATTRIBUTE,
  14938. viewBox: MUST_USE_ATTRIBUTE,
  14939. x1: MUST_USE_ATTRIBUTE,
  14940. x2: MUST_USE_ATTRIBUTE,
  14941. x: MUST_USE_ATTRIBUTE,
  14942. y1: MUST_USE_ATTRIBUTE,
  14943. y2: MUST_USE_ATTRIBUTE,
  14944. y: MUST_USE_ATTRIBUTE
  14945. },
  14946. DOMAttributeNames: {
  14947. clipPath: 'clip-path',
  14948. fillOpacity: 'fill-opacity',
  14949. fontFamily: 'font-family',
  14950. fontSize: 'font-size',
  14951. gradientTransform: 'gradientTransform',
  14952. gradientUnits: 'gradientUnits',
  14953. markerEnd: 'marker-end',
  14954. markerMid: 'marker-mid',
  14955. markerStart: 'marker-start',
  14956. patternContentUnits: 'patternContentUnits',
  14957. patternUnits: 'patternUnits',
  14958. preserveAspectRatio: 'preserveAspectRatio',
  14959. spreadMethod: 'spreadMethod',
  14960. stopColor: 'stop-color',
  14961. stopOpacity: 'stop-opacity',
  14962. strokeDasharray: 'stroke-dasharray',
  14963. strokeLinecap: 'stroke-linecap',
  14964. strokeOpacity: 'stroke-opacity',
  14965. strokeWidth: 'stroke-width',
  14966. textAnchor: 'text-anchor',
  14967. viewBox: 'viewBox'
  14968. }
  14969. };
  14970. module.exports = SVGDOMPropertyConfig;
  14971. },{"11":11}],102:[function(_dereq_,module,exports){
  14972. /**
  14973. * Copyright 2013-2015, Facebook, Inc.
  14974. * All rights reserved.
  14975. *
  14976. * This source code is licensed under the BSD-style license found in the
  14977. * LICENSE file in the root directory of this source tree. An additional grant
  14978. * of patent rights can be found in the PATENTS file in the same directory.
  14979. *
  14980. * @providesModule SelectEventPlugin
  14981. */
  14982. 'use strict';
  14983. var EventConstants = _dereq_(16);
  14984. var EventPropagators = _dereq_(21);
  14985. var ReactInputSelection = _dereq_(71);
  14986. var SyntheticEvent = _dereq_(108);
  14987. var getActiveElement = _dereq_(136);
  14988. var isTextInputElement = _dereq_(153);
  14989. var keyOf = _dereq_(157);
  14990. var shallowEqual = _dereq_(166);
  14991. var topLevelTypes = EventConstants.topLevelTypes;
  14992. var eventTypes = {
  14993. select: {
  14994. phasedRegistrationNames: {
  14995. bubbled: keyOf({onSelect: null}),
  14996. captured: keyOf({onSelectCapture: null})
  14997. },
  14998. dependencies: [
  14999. topLevelTypes.topBlur,
  15000. topLevelTypes.topContextMenu,
  15001. topLevelTypes.topFocus,
  15002. topLevelTypes.topKeyDown,
  15003. topLevelTypes.topMouseDown,
  15004. topLevelTypes.topMouseUp,
  15005. topLevelTypes.topSelectionChange
  15006. ]
  15007. }
  15008. };
  15009. var activeElement = null;
  15010. var activeElementID = null;
  15011. var lastSelection = null;
  15012. var mouseDown = false;
  15013. /**
  15014. * Get an object which is a unique representation of the current selection.
  15015. *
  15016. * The return value will not be consistent across nodes or browsers, but
  15017. * two identical selections on the same node will return identical objects.
  15018. *
  15019. * @param {DOMElement} node
  15020. * @param {object}
  15021. */
  15022. function getSelection(node) {
  15023. if ('selectionStart' in node &&
  15024. ReactInputSelection.hasSelectionCapabilities(node)) {
  15025. return {
  15026. start: node.selectionStart,
  15027. end: node.selectionEnd
  15028. };
  15029. } else if (window.getSelection) {
  15030. var selection = window.getSelection();
  15031. return {
  15032. anchorNode: selection.anchorNode,
  15033. anchorOffset: selection.anchorOffset,
  15034. focusNode: selection.focusNode,
  15035. focusOffset: selection.focusOffset
  15036. };
  15037. } else if (document.selection) {
  15038. var range = document.selection.createRange();
  15039. return {
  15040. parentElement: range.parentElement(),
  15041. text: range.text,
  15042. top: range.boundingTop,
  15043. left: range.boundingLeft
  15044. };
  15045. }
  15046. }
  15047. /**
  15048. * Poll selection to see whether it's changed.
  15049. *
  15050. * @param {object} nativeEvent
  15051. * @return {?SyntheticEvent}
  15052. */
  15053. function constructSelectEvent(nativeEvent) {
  15054. // Ensure we have the right element, and that the user is not dragging a
  15055. // selection (this matches native `select` event behavior). In HTML5, select
  15056. // fires only on input and textarea thus if there's no focused element we
  15057. // won't dispatch.
  15058. if (mouseDown ||
  15059. activeElement == null ||
  15060. activeElement !== getActiveElement()) {
  15061. return null;
  15062. }
  15063. // Only fire when selection has actually changed.
  15064. var currentSelection = getSelection(activeElement);
  15065. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  15066. lastSelection = currentSelection;
  15067. var syntheticEvent = SyntheticEvent.getPooled(
  15068. eventTypes.select,
  15069. activeElementID,
  15070. nativeEvent
  15071. );
  15072. syntheticEvent.type = 'select';
  15073. syntheticEvent.target = activeElement;
  15074. EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
  15075. return syntheticEvent;
  15076. }
  15077. }
  15078. /**
  15079. * This plugin creates an `onSelect` event that normalizes select events
  15080. * across form elements.
  15081. *
  15082. * Supported elements are:
  15083. * - input (see `isTextInputElement`)
  15084. * - textarea
  15085. * - contentEditable
  15086. *
  15087. * This differs from native browser implementations in the following ways:
  15088. * - Fires on contentEditable fields as well as inputs.
  15089. * - Fires for collapsed selection.
  15090. * - Fires after user input.
  15091. */
  15092. var SelectEventPlugin = {
  15093. eventTypes: eventTypes,
  15094. /**
  15095. * @param {string} topLevelType Record from `EventConstants`.
  15096. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  15097. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  15098. * @param {object} nativeEvent Native browser event.
  15099. * @return {*} An accumulation of synthetic events.
  15100. * @see {EventPluginHub.extractEvents}
  15101. */
  15102. extractEvents: function(
  15103. topLevelType,
  15104. topLevelTarget,
  15105. topLevelTargetID,
  15106. nativeEvent) {
  15107. switch (topLevelType) {
  15108. // Track the input node that has focus.
  15109. case topLevelTypes.topFocus:
  15110. if (isTextInputElement(topLevelTarget) ||
  15111. topLevelTarget.contentEditable === 'true') {
  15112. activeElement = topLevelTarget;
  15113. activeElementID = topLevelTargetID;
  15114. lastSelection = null;
  15115. }
  15116. break;
  15117. case topLevelTypes.topBlur:
  15118. activeElement = null;
  15119. activeElementID = null;
  15120. lastSelection = null;
  15121. break;
  15122. // Don't fire the event while the user is dragging. This matches the
  15123. // semantics of the native select event.
  15124. case topLevelTypes.topMouseDown:
  15125. mouseDown = true;
  15126. break;
  15127. case topLevelTypes.topContextMenu:
  15128. case topLevelTypes.topMouseUp:
  15129. mouseDown = false;
  15130. return constructSelectEvent(nativeEvent);
  15131. // Chrome and IE fire non-standard event when selection is changed (and
  15132. // sometimes when it hasn't).
  15133. // Firefox doesn't support selectionchange, so check selection status
  15134. // after each key entry. The selection changes after keydown and before
  15135. // keyup, but we check on keydown as well in the case of holding down a
  15136. // key, when multiple keydown events are fired but only one keyup is.
  15137. case topLevelTypes.topSelectionChange:
  15138. case topLevelTypes.topKeyDown:
  15139. case topLevelTypes.topKeyUp:
  15140. return constructSelectEvent(nativeEvent);
  15141. }
  15142. }
  15143. };
  15144. module.exports = SelectEventPlugin;
  15145. },{"108":108,"136":136,"153":153,"157":157,"16":16,"166":166,"21":21,"71":71}],103:[function(_dereq_,module,exports){
  15146. /**
  15147. * Copyright 2013-2015, Facebook, Inc.
  15148. * All rights reserved.
  15149. *
  15150. * This source code is licensed under the BSD-style license found in the
  15151. * LICENSE file in the root directory of this source tree. An additional grant
  15152. * of patent rights can be found in the PATENTS file in the same directory.
  15153. *
  15154. * @providesModule ServerReactRootIndex
  15155. * @typechecks
  15156. */
  15157. 'use strict';
  15158. /**
  15159. * Size of the reactRoot ID space. We generate random numbers for React root
  15160. * IDs and if there's a collision the events and DOM update system will
  15161. * get confused. In the future we need a way to generate GUIDs but for
  15162. * now this will work on a smaller scale.
  15163. */
  15164. var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
  15165. var ServerReactRootIndex = {
  15166. createReactRootIndex: function() {
  15167. return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
  15168. }
  15169. };
  15170. module.exports = ServerReactRootIndex;
  15171. },{}],104:[function(_dereq_,module,exports){
  15172. /**
  15173. * Copyright 2013-2015, Facebook, Inc.
  15174. * All rights reserved.
  15175. *
  15176. * This source code is licensed under the BSD-style license found in the
  15177. * LICENSE file in the root directory of this source tree. An additional grant
  15178. * of patent rights can be found in the PATENTS file in the same directory.
  15179. *
  15180. * @providesModule SimpleEventPlugin
  15181. */
  15182. 'use strict';
  15183. var EventConstants = _dereq_(16);
  15184. var EventPluginUtils = _dereq_(20);
  15185. var EventPropagators = _dereq_(21);
  15186. var SyntheticClipboardEvent = _dereq_(105);
  15187. var SyntheticEvent = _dereq_(108);
  15188. var SyntheticFocusEvent = _dereq_(109);
  15189. var SyntheticKeyboardEvent = _dereq_(111);
  15190. var SyntheticMouseEvent = _dereq_(112);
  15191. var SyntheticDragEvent = _dereq_(107);
  15192. var SyntheticTouchEvent = _dereq_(113);
  15193. var SyntheticUIEvent = _dereq_(114);
  15194. var SyntheticWheelEvent = _dereq_(115);
  15195. var getEventCharCode = _dereq_(137);
  15196. var invariant = _dereq_(150);
  15197. var keyOf = _dereq_(157);
  15198. var warning = _dereq_(171);
  15199. var topLevelTypes = EventConstants.topLevelTypes;
  15200. var eventTypes = {
  15201. blur: {
  15202. phasedRegistrationNames: {
  15203. bubbled: keyOf({onBlur: true}),
  15204. captured: keyOf({onBlurCapture: true})
  15205. }
  15206. },
  15207. click: {
  15208. phasedRegistrationNames: {
  15209. bubbled: keyOf({onClick: true}),
  15210. captured: keyOf({onClickCapture: true})
  15211. }
  15212. },
  15213. contextMenu: {
  15214. phasedRegistrationNames: {
  15215. bubbled: keyOf({onContextMenu: true}),
  15216. captured: keyOf({onContextMenuCapture: true})
  15217. }
  15218. },
  15219. copy: {
  15220. phasedRegistrationNames: {
  15221. bubbled: keyOf({onCopy: true}),
  15222. captured: keyOf({onCopyCapture: true})
  15223. }
  15224. },
  15225. cut: {
  15226. phasedRegistrationNames: {
  15227. bubbled: keyOf({onCut: true}),
  15228. captured: keyOf({onCutCapture: true})
  15229. }
  15230. },
  15231. doubleClick: {
  15232. phasedRegistrationNames: {
  15233. bubbled: keyOf({onDoubleClick: true}),
  15234. captured: keyOf({onDoubleClickCapture: true})
  15235. }
  15236. },
  15237. drag: {
  15238. phasedRegistrationNames: {
  15239. bubbled: keyOf({onDrag: true}),
  15240. captured: keyOf({onDragCapture: true})
  15241. }
  15242. },
  15243. dragEnd: {
  15244. phasedRegistrationNames: {
  15245. bubbled: keyOf({onDragEnd: true}),
  15246. captured: keyOf({onDragEndCapture: true})
  15247. }
  15248. },
  15249. dragEnter: {
  15250. phasedRegistrationNames: {
  15251. bubbled: keyOf({onDragEnter: true}),
  15252. captured: keyOf({onDragEnterCapture: true})
  15253. }
  15254. },
  15255. dragExit: {
  15256. phasedRegistrationNames: {
  15257. bubbled: keyOf({onDragExit: true}),
  15258. captured: keyOf({onDragExitCapture: true})
  15259. }
  15260. },
  15261. dragLeave: {
  15262. phasedRegistrationNames: {
  15263. bubbled: keyOf({onDragLeave: true}),
  15264. captured: keyOf({onDragLeaveCapture: true})
  15265. }
  15266. },
  15267. dragOver: {
  15268. phasedRegistrationNames: {
  15269. bubbled: keyOf({onDragOver: true}),
  15270. captured: keyOf({onDragOverCapture: true})
  15271. }
  15272. },
  15273. dragStart: {
  15274. phasedRegistrationNames: {
  15275. bubbled: keyOf({onDragStart: true}),
  15276. captured: keyOf({onDragStartCapture: true})
  15277. }
  15278. },
  15279. drop: {
  15280. phasedRegistrationNames: {
  15281. bubbled: keyOf({onDrop: true}),
  15282. captured: keyOf({onDropCapture: true})
  15283. }
  15284. },
  15285. focus: {
  15286. phasedRegistrationNames: {
  15287. bubbled: keyOf({onFocus: true}),
  15288. captured: keyOf({onFocusCapture: true})
  15289. }
  15290. },
  15291. input: {
  15292. phasedRegistrationNames: {
  15293. bubbled: keyOf({onInput: true}),
  15294. captured: keyOf({onInputCapture: true})
  15295. }
  15296. },
  15297. keyDown: {
  15298. phasedRegistrationNames: {
  15299. bubbled: keyOf({onKeyDown: true}),
  15300. captured: keyOf({onKeyDownCapture: true})
  15301. }
  15302. },
  15303. keyPress: {
  15304. phasedRegistrationNames: {
  15305. bubbled: keyOf({onKeyPress: true}),
  15306. captured: keyOf({onKeyPressCapture: true})
  15307. }
  15308. },
  15309. keyUp: {
  15310. phasedRegistrationNames: {
  15311. bubbled: keyOf({onKeyUp: true}),
  15312. captured: keyOf({onKeyUpCapture: true})
  15313. }
  15314. },
  15315. load: {
  15316. phasedRegistrationNames: {
  15317. bubbled: keyOf({onLoad: true}),
  15318. captured: keyOf({onLoadCapture: true})
  15319. }
  15320. },
  15321. error: {
  15322. phasedRegistrationNames: {
  15323. bubbled: keyOf({onError: true}),
  15324. captured: keyOf({onErrorCapture: true})
  15325. }
  15326. },
  15327. // Note: We do not allow listening to mouseOver events. Instead, use the
  15328. // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
  15329. mouseDown: {
  15330. phasedRegistrationNames: {
  15331. bubbled: keyOf({onMouseDown: true}),
  15332. captured: keyOf({onMouseDownCapture: true})
  15333. }
  15334. },
  15335. mouseMove: {
  15336. phasedRegistrationNames: {
  15337. bubbled: keyOf({onMouseMove: true}),
  15338. captured: keyOf({onMouseMoveCapture: true})
  15339. }
  15340. },
  15341. mouseOut: {
  15342. phasedRegistrationNames: {
  15343. bubbled: keyOf({onMouseOut: true}),
  15344. captured: keyOf({onMouseOutCapture: true})
  15345. }
  15346. },
  15347. mouseOver: {
  15348. phasedRegistrationNames: {
  15349. bubbled: keyOf({onMouseOver: true}),
  15350. captured: keyOf({onMouseOverCapture: true})
  15351. }
  15352. },
  15353. mouseUp: {
  15354. phasedRegistrationNames: {
  15355. bubbled: keyOf({onMouseUp: true}),
  15356. captured: keyOf({onMouseUpCapture: true})
  15357. }
  15358. },
  15359. paste: {
  15360. phasedRegistrationNames: {
  15361. bubbled: keyOf({onPaste: true}),
  15362. captured: keyOf({onPasteCapture: true})
  15363. }
  15364. },
  15365. reset: {
  15366. phasedRegistrationNames: {
  15367. bubbled: keyOf({onReset: true}),
  15368. captured: keyOf({onResetCapture: true})
  15369. }
  15370. },
  15371. scroll: {
  15372. phasedRegistrationNames: {
  15373. bubbled: keyOf({onScroll: true}),
  15374. captured: keyOf({onScrollCapture: true})
  15375. }
  15376. },
  15377. submit: {
  15378. phasedRegistrationNames: {
  15379. bubbled: keyOf({onSubmit: true}),
  15380. captured: keyOf({onSubmitCapture: true})
  15381. }
  15382. },
  15383. touchCancel: {
  15384. phasedRegistrationNames: {
  15385. bubbled: keyOf({onTouchCancel: true}),
  15386. captured: keyOf({onTouchCancelCapture: true})
  15387. }
  15388. },
  15389. touchEnd: {
  15390. phasedRegistrationNames: {
  15391. bubbled: keyOf({onTouchEnd: true}),
  15392. captured: keyOf({onTouchEndCapture: true})
  15393. }
  15394. },
  15395. touchMove: {
  15396. phasedRegistrationNames: {
  15397. bubbled: keyOf({onTouchMove: true}),
  15398. captured: keyOf({onTouchMoveCapture: true})
  15399. }
  15400. },
  15401. touchStart: {
  15402. phasedRegistrationNames: {
  15403. bubbled: keyOf({onTouchStart: true}),
  15404. captured: keyOf({onTouchStartCapture: true})
  15405. }
  15406. },
  15407. wheel: {
  15408. phasedRegistrationNames: {
  15409. bubbled: keyOf({onWheel: true}),
  15410. captured: keyOf({onWheelCapture: true})
  15411. }
  15412. }
  15413. };
  15414. var topLevelEventsToDispatchConfig = {
  15415. topBlur: eventTypes.blur,
  15416. topClick: eventTypes.click,
  15417. topContextMenu: eventTypes.contextMenu,
  15418. topCopy: eventTypes.copy,
  15419. topCut: eventTypes.cut,
  15420. topDoubleClick: eventTypes.doubleClick,
  15421. topDrag: eventTypes.drag,
  15422. topDragEnd: eventTypes.dragEnd,
  15423. topDragEnter: eventTypes.dragEnter,
  15424. topDragExit: eventTypes.dragExit,
  15425. topDragLeave: eventTypes.dragLeave,
  15426. topDragOver: eventTypes.dragOver,
  15427. topDragStart: eventTypes.dragStart,
  15428. topDrop: eventTypes.drop,
  15429. topError: eventTypes.error,
  15430. topFocus: eventTypes.focus,
  15431. topInput: eventTypes.input,
  15432. topKeyDown: eventTypes.keyDown,
  15433. topKeyPress: eventTypes.keyPress,
  15434. topKeyUp: eventTypes.keyUp,
  15435. topLoad: eventTypes.load,
  15436. topMouseDown: eventTypes.mouseDown,
  15437. topMouseMove: eventTypes.mouseMove,
  15438. topMouseOut: eventTypes.mouseOut,
  15439. topMouseOver: eventTypes.mouseOver,
  15440. topMouseUp: eventTypes.mouseUp,
  15441. topPaste: eventTypes.paste,
  15442. topReset: eventTypes.reset,
  15443. topScroll: eventTypes.scroll,
  15444. topSubmit: eventTypes.submit,
  15445. topTouchCancel: eventTypes.touchCancel,
  15446. topTouchEnd: eventTypes.touchEnd,
  15447. topTouchMove: eventTypes.touchMove,
  15448. topTouchStart: eventTypes.touchStart,
  15449. topWheel: eventTypes.wheel
  15450. };
  15451. for (var type in topLevelEventsToDispatchConfig) {
  15452. topLevelEventsToDispatchConfig[type].dependencies = [type];
  15453. }
  15454. var SimpleEventPlugin = {
  15455. eventTypes: eventTypes,
  15456. /**
  15457. * Same as the default implementation, except cancels the event when return
  15458. * value is false. This behavior will be disabled in a future release.
  15459. *
  15460. * @param {object} Event to be dispatched.
  15461. * @param {function} Application-level callback.
  15462. * @param {string} domID DOM ID to pass to the callback.
  15463. */
  15464. executeDispatch: function(event, listener, domID) {
  15465. var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
  15466. ("production" !== "development" ? warning(
  15467. typeof returnValue !== 'boolean',
  15468. 'Returning `false` from an event handler is deprecated and will be ' +
  15469. 'ignored in a future release. Instead, manually call ' +
  15470. 'e.stopPropagation() or e.preventDefault(), as appropriate.'
  15471. ) : null);
  15472. if (returnValue === false) {
  15473. event.stopPropagation();
  15474. event.preventDefault();
  15475. }
  15476. },
  15477. /**
  15478. * @param {string} topLevelType Record from `EventConstants`.
  15479. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  15480. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  15481. * @param {object} nativeEvent Native browser event.
  15482. * @return {*} An accumulation of synthetic events.
  15483. * @see {EventPluginHub.extractEvents}
  15484. */
  15485. extractEvents: function(
  15486. topLevelType,
  15487. topLevelTarget,
  15488. topLevelTargetID,
  15489. nativeEvent) {
  15490. var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  15491. if (!dispatchConfig) {
  15492. return null;
  15493. }
  15494. var EventConstructor;
  15495. switch (topLevelType) {
  15496. case topLevelTypes.topInput:
  15497. case topLevelTypes.topLoad:
  15498. case topLevelTypes.topError:
  15499. case topLevelTypes.topReset:
  15500. case topLevelTypes.topSubmit:
  15501. // HTML Events
  15502. // @see http://www.w3.org/TR/html5/index.html#events-0
  15503. EventConstructor = SyntheticEvent;
  15504. break;
  15505. case topLevelTypes.topKeyPress:
  15506. // FireFox creates a keypress event for function keys too. This removes
  15507. // the unwanted keypress events. Enter is however both printable and
  15508. // non-printable. One would expect Tab to be as well (but it isn't).
  15509. if (getEventCharCode(nativeEvent) === 0) {
  15510. return null;
  15511. }
  15512. /* falls through */
  15513. case topLevelTypes.topKeyDown:
  15514. case topLevelTypes.topKeyUp:
  15515. EventConstructor = SyntheticKeyboardEvent;
  15516. break;
  15517. case topLevelTypes.topBlur:
  15518. case topLevelTypes.topFocus:
  15519. EventConstructor = SyntheticFocusEvent;
  15520. break;
  15521. case topLevelTypes.topClick:
  15522. // Firefox creates a click event on right mouse clicks. This removes the
  15523. // unwanted click events.
  15524. if (nativeEvent.button === 2) {
  15525. return null;
  15526. }
  15527. /* falls through */
  15528. case topLevelTypes.topContextMenu:
  15529. case topLevelTypes.topDoubleClick:
  15530. case topLevelTypes.topMouseDown:
  15531. case topLevelTypes.topMouseMove:
  15532. case topLevelTypes.topMouseOut:
  15533. case topLevelTypes.topMouseOver:
  15534. case topLevelTypes.topMouseUp:
  15535. EventConstructor = SyntheticMouseEvent;
  15536. break;
  15537. case topLevelTypes.topDrag:
  15538. case topLevelTypes.topDragEnd:
  15539. case topLevelTypes.topDragEnter:
  15540. case topLevelTypes.topDragExit:
  15541. case topLevelTypes.topDragLeave:
  15542. case topLevelTypes.topDragOver:
  15543. case topLevelTypes.topDragStart:
  15544. case topLevelTypes.topDrop:
  15545. EventConstructor = SyntheticDragEvent;
  15546. break;
  15547. case topLevelTypes.topTouchCancel:
  15548. case topLevelTypes.topTouchEnd:
  15549. case topLevelTypes.topTouchMove:
  15550. case topLevelTypes.topTouchStart:
  15551. EventConstructor = SyntheticTouchEvent;
  15552. break;
  15553. case topLevelTypes.topScroll:
  15554. EventConstructor = SyntheticUIEvent;
  15555. break;
  15556. case topLevelTypes.topWheel:
  15557. EventConstructor = SyntheticWheelEvent;
  15558. break;
  15559. case topLevelTypes.topCopy:
  15560. case topLevelTypes.topCut:
  15561. case topLevelTypes.topPaste:
  15562. EventConstructor = SyntheticClipboardEvent;
  15563. break;
  15564. }
  15565. ("production" !== "development" ? invariant(
  15566. EventConstructor,
  15567. 'SimpleEventPlugin: Unhandled event type, `%s`.',
  15568. topLevelType
  15569. ) : invariant(EventConstructor));
  15570. var event = EventConstructor.getPooled(
  15571. dispatchConfig,
  15572. topLevelTargetID,
  15573. nativeEvent
  15574. );
  15575. EventPropagators.accumulateTwoPhaseDispatches(event);
  15576. return event;
  15577. }
  15578. };
  15579. module.exports = SimpleEventPlugin;
  15580. },{"105":105,"107":107,"108":108,"109":109,"111":111,"112":112,"113":113,"114":114,"115":115,"137":137,"150":150,"157":157,"16":16,"171":171,"20":20,"21":21}],105:[function(_dereq_,module,exports){
  15581. /**
  15582. * Copyright 2013-2015, Facebook, Inc.
  15583. * All rights reserved.
  15584. *
  15585. * This source code is licensed under the BSD-style license found in the
  15586. * LICENSE file in the root directory of this source tree. An additional grant
  15587. * of patent rights can be found in the PATENTS file in the same directory.
  15588. *
  15589. * @providesModule SyntheticClipboardEvent
  15590. * @typechecks static-only
  15591. */
  15592. 'use strict';
  15593. var SyntheticEvent = _dereq_(108);
  15594. /**
  15595. * @interface Event
  15596. * @see http://www.w3.org/TR/clipboard-apis/
  15597. */
  15598. var ClipboardEventInterface = {
  15599. clipboardData: function(event) {
  15600. return (
  15601. 'clipboardData' in event ?
  15602. event.clipboardData :
  15603. window.clipboardData
  15604. );
  15605. }
  15606. };
  15607. /**
  15608. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15609. * @param {string} dispatchMarker Marker identifying the event target.
  15610. * @param {object} nativeEvent Native browser event.
  15611. * @extends {SyntheticUIEvent}
  15612. */
  15613. function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  15614. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15615. }
  15616. SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
  15617. module.exports = SyntheticClipboardEvent;
  15618. },{"108":108}],106:[function(_dereq_,module,exports){
  15619. /**
  15620. * Copyright 2013-2015, Facebook, Inc.
  15621. * All rights reserved.
  15622. *
  15623. * This source code is licensed under the BSD-style license found in the
  15624. * LICENSE file in the root directory of this source tree. An additional grant
  15625. * of patent rights can be found in the PATENTS file in the same directory.
  15626. *
  15627. * @providesModule SyntheticCompositionEvent
  15628. * @typechecks static-only
  15629. */
  15630. 'use strict';
  15631. var SyntheticEvent = _dereq_(108);
  15632. /**
  15633. * @interface Event
  15634. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  15635. */
  15636. var CompositionEventInterface = {
  15637. data: null
  15638. };
  15639. /**
  15640. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15641. * @param {string} dispatchMarker Marker identifying the event target.
  15642. * @param {object} nativeEvent Native browser event.
  15643. * @extends {SyntheticUIEvent}
  15644. */
  15645. function SyntheticCompositionEvent(
  15646. dispatchConfig,
  15647. dispatchMarker,
  15648. nativeEvent) {
  15649. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15650. }
  15651. SyntheticEvent.augmentClass(
  15652. SyntheticCompositionEvent,
  15653. CompositionEventInterface
  15654. );
  15655. module.exports = SyntheticCompositionEvent;
  15656. },{"108":108}],107:[function(_dereq_,module,exports){
  15657. /**
  15658. * Copyright 2013-2015, Facebook, Inc.
  15659. * All rights reserved.
  15660. *
  15661. * This source code is licensed under the BSD-style license found in the
  15662. * LICENSE file in the root directory of this source tree. An additional grant
  15663. * of patent rights can be found in the PATENTS file in the same directory.
  15664. *
  15665. * @providesModule SyntheticDragEvent
  15666. * @typechecks static-only
  15667. */
  15668. 'use strict';
  15669. var SyntheticMouseEvent = _dereq_(112);
  15670. /**
  15671. * @interface DragEvent
  15672. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15673. */
  15674. var DragEventInterface = {
  15675. dataTransfer: null
  15676. };
  15677. /**
  15678. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15679. * @param {string} dispatchMarker Marker identifying the event target.
  15680. * @param {object} nativeEvent Native browser event.
  15681. * @extends {SyntheticUIEvent}
  15682. */
  15683. function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  15684. SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15685. }
  15686. SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
  15687. module.exports = SyntheticDragEvent;
  15688. },{"112":112}],108:[function(_dereq_,module,exports){
  15689. /**
  15690. * Copyright 2013-2015, Facebook, Inc.
  15691. * All rights reserved.
  15692. *
  15693. * This source code is licensed under the BSD-style license found in the
  15694. * LICENSE file in the root directory of this source tree. An additional grant
  15695. * of patent rights can be found in the PATENTS file in the same directory.
  15696. *
  15697. * @providesModule SyntheticEvent
  15698. * @typechecks static-only
  15699. */
  15700. 'use strict';
  15701. var PooledClass = _dereq_(30);
  15702. var assign = _dereq_(29);
  15703. var emptyFunction = _dereq_(129);
  15704. var getEventTarget = _dereq_(140);
  15705. /**
  15706. * @interface Event
  15707. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15708. */
  15709. var EventInterface = {
  15710. type: null,
  15711. target: getEventTarget,
  15712. // currentTarget is set when dispatching; no use in copying it here
  15713. currentTarget: emptyFunction.thatReturnsNull,
  15714. eventPhase: null,
  15715. bubbles: null,
  15716. cancelable: null,
  15717. timeStamp: function(event) {
  15718. return event.timeStamp || Date.now();
  15719. },
  15720. defaultPrevented: null,
  15721. isTrusted: null
  15722. };
  15723. /**
  15724. * Synthetic events are dispatched by event plugins, typically in response to a
  15725. * top-level event delegation handler.
  15726. *
  15727. * These systems should generally use pooling to reduce the frequency of garbage
  15728. * collection. The system should check `isPersistent` to determine whether the
  15729. * event should be released into the pool after being dispatched. Users that
  15730. * need a persisted event should invoke `persist`.
  15731. *
  15732. * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
  15733. * normalizing browser quirks. Subclasses do not necessarily have to implement a
  15734. * DOM interface; custom application-specific events can also subclass this.
  15735. *
  15736. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15737. * @param {string} dispatchMarker Marker identifying the event target.
  15738. * @param {object} nativeEvent Native browser event.
  15739. */
  15740. function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  15741. this.dispatchConfig = dispatchConfig;
  15742. this.dispatchMarker = dispatchMarker;
  15743. this.nativeEvent = nativeEvent;
  15744. var Interface = this.constructor.Interface;
  15745. for (var propName in Interface) {
  15746. if (!Interface.hasOwnProperty(propName)) {
  15747. continue;
  15748. }
  15749. var normalize = Interface[propName];
  15750. if (normalize) {
  15751. this[propName] = normalize(nativeEvent);
  15752. } else {
  15753. this[propName] = nativeEvent[propName];
  15754. }
  15755. }
  15756. var defaultPrevented = nativeEvent.defaultPrevented != null ?
  15757. nativeEvent.defaultPrevented :
  15758. nativeEvent.returnValue === false;
  15759. if (defaultPrevented) {
  15760. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  15761. } else {
  15762. this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
  15763. }
  15764. this.isPropagationStopped = emptyFunction.thatReturnsFalse;
  15765. }
  15766. assign(SyntheticEvent.prototype, {
  15767. preventDefault: function() {
  15768. this.defaultPrevented = true;
  15769. var event = this.nativeEvent;
  15770. if (event.preventDefault) {
  15771. event.preventDefault();
  15772. } else {
  15773. event.returnValue = false;
  15774. }
  15775. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  15776. },
  15777. stopPropagation: function() {
  15778. var event = this.nativeEvent;
  15779. if (event.stopPropagation) {
  15780. event.stopPropagation();
  15781. } else {
  15782. event.cancelBubble = true;
  15783. }
  15784. this.isPropagationStopped = emptyFunction.thatReturnsTrue;
  15785. },
  15786. /**
  15787. * We release all dispatched `SyntheticEvent`s after each event loop, adding
  15788. * them back into the pool. This allows a way to hold onto a reference that
  15789. * won't be added back into the pool.
  15790. */
  15791. persist: function() {
  15792. this.isPersistent = emptyFunction.thatReturnsTrue;
  15793. },
  15794. /**
  15795. * Checks if this event should be released back into the pool.
  15796. *
  15797. * @return {boolean} True if this should not be released, false otherwise.
  15798. */
  15799. isPersistent: emptyFunction.thatReturnsFalse,
  15800. /**
  15801. * `PooledClass` looks for `destructor` on each instance it releases.
  15802. */
  15803. destructor: function() {
  15804. var Interface = this.constructor.Interface;
  15805. for (var propName in Interface) {
  15806. this[propName] = null;
  15807. }
  15808. this.dispatchConfig = null;
  15809. this.dispatchMarker = null;
  15810. this.nativeEvent = null;
  15811. }
  15812. });
  15813. SyntheticEvent.Interface = EventInterface;
  15814. /**
  15815. * Helper to reduce boilerplate when creating subclasses.
  15816. *
  15817. * @param {function} Class
  15818. * @param {?object} Interface
  15819. */
  15820. SyntheticEvent.augmentClass = function(Class, Interface) {
  15821. var Super = this;
  15822. var prototype = Object.create(Super.prototype);
  15823. assign(prototype, Class.prototype);
  15824. Class.prototype = prototype;
  15825. Class.prototype.constructor = Class;
  15826. Class.Interface = assign({}, Super.Interface, Interface);
  15827. Class.augmentClass = Super.augmentClass;
  15828. PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
  15829. };
  15830. PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
  15831. module.exports = SyntheticEvent;
  15832. },{"129":129,"140":140,"29":29,"30":30}],109:[function(_dereq_,module,exports){
  15833. /**
  15834. * Copyright 2013-2015, Facebook, Inc.
  15835. * All rights reserved.
  15836. *
  15837. * This source code is licensed under the BSD-style license found in the
  15838. * LICENSE file in the root directory of this source tree. An additional grant
  15839. * of patent rights can be found in the PATENTS file in the same directory.
  15840. *
  15841. * @providesModule SyntheticFocusEvent
  15842. * @typechecks static-only
  15843. */
  15844. 'use strict';
  15845. var SyntheticUIEvent = _dereq_(114);
  15846. /**
  15847. * @interface FocusEvent
  15848. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15849. */
  15850. var FocusEventInterface = {
  15851. relatedTarget: null
  15852. };
  15853. /**
  15854. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15855. * @param {string} dispatchMarker Marker identifying the event target.
  15856. * @param {object} nativeEvent Native browser event.
  15857. * @extends {SyntheticUIEvent}
  15858. */
  15859. function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  15860. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15861. }
  15862. SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
  15863. module.exports = SyntheticFocusEvent;
  15864. },{"114":114}],110:[function(_dereq_,module,exports){
  15865. /**
  15866. * Copyright 2013-2015, Facebook, Inc.
  15867. * All rights reserved.
  15868. *
  15869. * This source code is licensed under the BSD-style license found in the
  15870. * LICENSE file in the root directory of this source tree. An additional grant
  15871. * of patent rights can be found in the PATENTS file in the same directory.
  15872. *
  15873. * @providesModule SyntheticInputEvent
  15874. * @typechecks static-only
  15875. */
  15876. 'use strict';
  15877. var SyntheticEvent = _dereq_(108);
  15878. /**
  15879. * @interface Event
  15880. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  15881. * /#events-inputevents
  15882. */
  15883. var InputEventInterface = {
  15884. data: null
  15885. };
  15886. /**
  15887. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15888. * @param {string} dispatchMarker Marker identifying the event target.
  15889. * @param {object} nativeEvent Native browser event.
  15890. * @extends {SyntheticUIEvent}
  15891. */
  15892. function SyntheticInputEvent(
  15893. dispatchConfig,
  15894. dispatchMarker,
  15895. nativeEvent) {
  15896. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15897. }
  15898. SyntheticEvent.augmentClass(
  15899. SyntheticInputEvent,
  15900. InputEventInterface
  15901. );
  15902. module.exports = SyntheticInputEvent;
  15903. },{"108":108}],111:[function(_dereq_,module,exports){
  15904. /**
  15905. * Copyright 2013-2015, Facebook, Inc.
  15906. * All rights reserved.
  15907. *
  15908. * This source code is licensed under the BSD-style license found in the
  15909. * LICENSE file in the root directory of this source tree. An additional grant
  15910. * of patent rights can be found in the PATENTS file in the same directory.
  15911. *
  15912. * @providesModule SyntheticKeyboardEvent
  15913. * @typechecks static-only
  15914. */
  15915. 'use strict';
  15916. var SyntheticUIEvent = _dereq_(114);
  15917. var getEventCharCode = _dereq_(137);
  15918. var getEventKey = _dereq_(138);
  15919. var getEventModifierState = _dereq_(139);
  15920. /**
  15921. * @interface KeyboardEvent
  15922. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15923. */
  15924. var KeyboardEventInterface = {
  15925. key: getEventKey,
  15926. location: null,
  15927. ctrlKey: null,
  15928. shiftKey: null,
  15929. altKey: null,
  15930. metaKey: null,
  15931. repeat: null,
  15932. locale: null,
  15933. getModifierState: getEventModifierState,
  15934. // Legacy Interface
  15935. charCode: function(event) {
  15936. // `charCode` is the result of a KeyPress event and represents the value of
  15937. // the actual printable character.
  15938. // KeyPress is deprecated, but its replacement is not yet final and not
  15939. // implemented in any major browser. Only KeyPress has charCode.
  15940. if (event.type === 'keypress') {
  15941. return getEventCharCode(event);
  15942. }
  15943. return 0;
  15944. },
  15945. keyCode: function(event) {
  15946. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  15947. // physical keyboard key.
  15948. // The actual meaning of the value depends on the users' keyboard layout
  15949. // which cannot be detected. Assuming that it is a US keyboard layout
  15950. // provides a surprisingly accurate mapping for US and European users.
  15951. // Due to this, it is left to the user to implement at this time.
  15952. if (event.type === 'keydown' || event.type === 'keyup') {
  15953. return event.keyCode;
  15954. }
  15955. return 0;
  15956. },
  15957. which: function(event) {
  15958. // `which` is an alias for either `keyCode` or `charCode` depending on the
  15959. // type of the event.
  15960. if (event.type === 'keypress') {
  15961. return getEventCharCode(event);
  15962. }
  15963. if (event.type === 'keydown' || event.type === 'keyup') {
  15964. return event.keyCode;
  15965. }
  15966. return 0;
  15967. }
  15968. };
  15969. /**
  15970. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15971. * @param {string} dispatchMarker Marker identifying the event target.
  15972. * @param {object} nativeEvent Native browser event.
  15973. * @extends {SyntheticUIEvent}
  15974. */
  15975. function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  15976. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15977. }
  15978. SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
  15979. module.exports = SyntheticKeyboardEvent;
  15980. },{"114":114,"137":137,"138":138,"139":139}],112:[function(_dereq_,module,exports){
  15981. /**
  15982. * Copyright 2013-2015, Facebook, Inc.
  15983. * All rights reserved.
  15984. *
  15985. * This source code is licensed under the BSD-style license found in the
  15986. * LICENSE file in the root directory of this source tree. An additional grant
  15987. * of patent rights can be found in the PATENTS file in the same directory.
  15988. *
  15989. * @providesModule SyntheticMouseEvent
  15990. * @typechecks static-only
  15991. */
  15992. 'use strict';
  15993. var SyntheticUIEvent = _dereq_(114);
  15994. var ViewportMetrics = _dereq_(117);
  15995. var getEventModifierState = _dereq_(139);
  15996. /**
  15997. * @interface MouseEvent
  15998. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15999. */
  16000. var MouseEventInterface = {
  16001. screenX: null,
  16002. screenY: null,
  16003. clientX: null,
  16004. clientY: null,
  16005. ctrlKey: null,
  16006. shiftKey: null,
  16007. altKey: null,
  16008. metaKey: null,
  16009. getModifierState: getEventModifierState,
  16010. button: function(event) {
  16011. // Webkit, Firefox, IE9+
  16012. // which: 1 2 3
  16013. // button: 0 1 2 (standard)
  16014. var button = event.button;
  16015. if ('which' in event) {
  16016. return button;
  16017. }
  16018. // IE<9
  16019. // which: undefined
  16020. // button: 0 0 0
  16021. // button: 1 4 2 (onmouseup)
  16022. return button === 2 ? 2 : button === 4 ? 1 : 0;
  16023. },
  16024. buttons: null,
  16025. relatedTarget: function(event) {
  16026. return event.relatedTarget || (
  16027. ((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
  16028. );
  16029. },
  16030. // "Proprietary" Interface.
  16031. pageX: function(event) {
  16032. return 'pageX' in event ?
  16033. event.pageX :
  16034. event.clientX + ViewportMetrics.currentScrollLeft;
  16035. },
  16036. pageY: function(event) {
  16037. return 'pageY' in event ?
  16038. event.pageY :
  16039. event.clientY + ViewportMetrics.currentScrollTop;
  16040. }
  16041. };
  16042. /**
  16043. * @param {object} dispatchConfig Configuration used to dispatch this event.
  16044. * @param {string} dispatchMarker Marker identifying the event target.
  16045. * @param {object} nativeEvent Native browser event.
  16046. * @extends {SyntheticUIEvent}
  16047. */
  16048. function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  16049. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  16050. }
  16051. SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
  16052. module.exports = SyntheticMouseEvent;
  16053. },{"114":114,"117":117,"139":139}],113:[function(_dereq_,module,exports){
  16054. /**
  16055. * Copyright 2013-2015, Facebook, Inc.
  16056. * All rights reserved.
  16057. *
  16058. * This source code is licensed under the BSD-style license found in the
  16059. * LICENSE file in the root directory of this source tree. An additional grant
  16060. * of patent rights can be found in the PATENTS file in the same directory.
  16061. *
  16062. * @providesModule SyntheticTouchEvent
  16063. * @typechecks static-only
  16064. */
  16065. 'use strict';
  16066. var SyntheticUIEvent = _dereq_(114);
  16067. var getEventModifierState = _dereq_(139);
  16068. /**
  16069. * @interface TouchEvent
  16070. * @see http://www.w3.org/TR/touch-events/
  16071. */
  16072. var TouchEventInterface = {
  16073. touches: null,
  16074. targetTouches: null,
  16075. changedTouches: null,
  16076. altKey: null,
  16077. metaKey: null,
  16078. ctrlKey: null,
  16079. shiftKey: null,
  16080. getModifierState: getEventModifierState
  16081. };
  16082. /**
  16083. * @param {object} dispatchConfig Configuration used to dispatch this event.
  16084. * @param {string} dispatchMarker Marker identifying the event target.
  16085. * @param {object} nativeEvent Native browser event.
  16086. * @extends {SyntheticUIEvent}
  16087. */
  16088. function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  16089. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  16090. }
  16091. SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
  16092. module.exports = SyntheticTouchEvent;
  16093. },{"114":114,"139":139}],114:[function(_dereq_,module,exports){
  16094. /**
  16095. * Copyright 2013-2015, Facebook, Inc.
  16096. * All rights reserved.
  16097. *
  16098. * This source code is licensed under the BSD-style license found in the
  16099. * LICENSE file in the root directory of this source tree. An additional grant
  16100. * of patent rights can be found in the PATENTS file in the same directory.
  16101. *
  16102. * @providesModule SyntheticUIEvent
  16103. * @typechecks static-only
  16104. */
  16105. 'use strict';
  16106. var SyntheticEvent = _dereq_(108);
  16107. var getEventTarget = _dereq_(140);
  16108. /**
  16109. * @interface UIEvent
  16110. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  16111. */
  16112. var UIEventInterface = {
  16113. view: function(event) {
  16114. if (event.view) {
  16115. return event.view;
  16116. }
  16117. var target = getEventTarget(event);
  16118. if (target != null && target.window === target) {
  16119. // target is a window object
  16120. return target;
  16121. }
  16122. var doc = target.ownerDocument;
  16123. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  16124. if (doc) {
  16125. return doc.defaultView || doc.parentWindow;
  16126. } else {
  16127. return window;
  16128. }
  16129. },
  16130. detail: function(event) {
  16131. return event.detail || 0;
  16132. }
  16133. };
  16134. /**
  16135. * @param {object} dispatchConfig Configuration used to dispatch this event.
  16136. * @param {string} dispatchMarker Marker identifying the event target.
  16137. * @param {object} nativeEvent Native browser event.
  16138. * @extends {SyntheticEvent}
  16139. */
  16140. function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  16141. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  16142. }
  16143. SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
  16144. module.exports = SyntheticUIEvent;
  16145. },{"108":108,"140":140}],115:[function(_dereq_,module,exports){
  16146. /**
  16147. * Copyright 2013-2015, Facebook, Inc.
  16148. * All rights reserved.
  16149. *
  16150. * This source code is licensed under the BSD-style license found in the
  16151. * LICENSE file in the root directory of this source tree. An additional grant
  16152. * of patent rights can be found in the PATENTS file in the same directory.
  16153. *
  16154. * @providesModule SyntheticWheelEvent
  16155. * @typechecks static-only
  16156. */
  16157. 'use strict';
  16158. var SyntheticMouseEvent = _dereq_(112);
  16159. /**
  16160. * @interface WheelEvent
  16161. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  16162. */
  16163. var WheelEventInterface = {
  16164. deltaX: function(event) {
  16165. return (
  16166. 'deltaX' in event ? event.deltaX :
  16167. // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  16168. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0
  16169. );
  16170. },
  16171. deltaY: function(event) {
  16172. return (
  16173. 'deltaY' in event ? event.deltaY :
  16174. // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  16175. 'wheelDeltaY' in event ? -event.wheelDeltaY :
  16176. // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  16177. 'wheelDelta' in event ? -event.wheelDelta : 0
  16178. );
  16179. },
  16180. deltaZ: null,
  16181. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  16182. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  16183. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  16184. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  16185. deltaMode: null
  16186. };
  16187. /**
  16188. * @param {object} dispatchConfig Configuration used to dispatch this event.
  16189. * @param {string} dispatchMarker Marker identifying the event target.
  16190. * @param {object} nativeEvent Native browser event.
  16191. * @extends {SyntheticMouseEvent}
  16192. */
  16193. function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  16194. SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  16195. }
  16196. SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
  16197. module.exports = SyntheticWheelEvent;
  16198. },{"112":112}],116:[function(_dereq_,module,exports){
  16199. /**
  16200. * Copyright 2013-2015, Facebook, Inc.
  16201. * All rights reserved.
  16202. *
  16203. * This source code is licensed under the BSD-style license found in the
  16204. * LICENSE file in the root directory of this source tree. An additional grant
  16205. * of patent rights can be found in the PATENTS file in the same directory.
  16206. *
  16207. * @providesModule Transaction
  16208. */
  16209. 'use strict';
  16210. var invariant = _dereq_(150);
  16211. /**
  16212. * `Transaction` creates a black box that is able to wrap any method such that
  16213. * certain invariants are maintained before and after the method is invoked
  16214. * (Even if an exception is thrown while invoking the wrapped method). Whoever
  16215. * instantiates a transaction can provide enforcers of the invariants at
  16216. * creation time. The `Transaction` class itself will supply one additional
  16217. * automatic invariant for you - the invariant that any transaction instance
  16218. * should not be run while it is already being run. You would typically create a
  16219. * single instance of a `Transaction` for reuse multiple times, that potentially
  16220. * is used to wrap several different methods. Wrappers are extremely simple -
  16221. * they only require implementing two methods.
  16222. *
  16223. * <pre>
  16224. * wrappers (injected at creation time)
  16225. * + +
  16226. * | |
  16227. * +-----------------|--------|--------------+
  16228. * | v | |
  16229. * | +---------------+ | |
  16230. * | +--| wrapper1 |---|----+ |
  16231. * | | +---------------+ v | |
  16232. * | | +-------------+ | |
  16233. * | | +----| wrapper2 |--------+ |
  16234. * | | | +-------------+ | | |
  16235. * | | | | | |
  16236. * | v v v v | wrapper
  16237. * | +---+ +---+ +---------+ +---+ +---+ | invariants
  16238. * perform(anyMethod) | | | | | | | | | | | | maintained
  16239. * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
  16240. * | | | | | | | | | | | |
  16241. * | | | | | | | | | | | |
  16242. * | | | | | | | | | | | |
  16243. * | +---+ +---+ +---------+ +---+ +---+ |
  16244. * | initialize close |
  16245. * +-----------------------------------------+
  16246. * </pre>
  16247. *
  16248. * Use cases:
  16249. * - Preserving the input selection ranges before/after reconciliation.
  16250. * Restoring selection even in the event of an unexpected error.
  16251. * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
  16252. * while guaranteeing that afterwards, the event system is reactivated.
  16253. * - Flushing a queue of collected DOM mutations to the main UI thread after a
  16254. * reconciliation takes place in a worker thread.
  16255. * - Invoking any collected `componentDidUpdate` callbacks after rendering new
  16256. * content.
  16257. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
  16258. * to preserve the `scrollTop` (an automatic scroll aware DOM).
  16259. * - (Future use case): Layout calculations before and after DOM updates.
  16260. *
  16261. * Transactional plugin API:
  16262. * - A module that has an `initialize` method that returns any precomputation.
  16263. * - and a `close` method that accepts the precomputation. `close` is invoked
  16264. * when the wrapped process is completed, or has failed.
  16265. *
  16266. * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
  16267. * that implement `initialize` and `close`.
  16268. * @return {Transaction} Single transaction for reuse in thread.
  16269. *
  16270. * @class Transaction
  16271. */
  16272. var Mixin = {
  16273. /**
  16274. * Sets up this instance so that it is prepared for collecting metrics. Does
  16275. * so such that this setup method may be used on an instance that is already
  16276. * initialized, in a way that does not consume additional memory upon reuse.
  16277. * That can be useful if you decide to make your subclass of this mixin a
  16278. * "PooledClass".
  16279. */
  16280. reinitializeTransaction: function() {
  16281. this.transactionWrappers = this.getTransactionWrappers();
  16282. if (!this.wrapperInitData) {
  16283. this.wrapperInitData = [];
  16284. } else {
  16285. this.wrapperInitData.length = 0;
  16286. }
  16287. this._isInTransaction = false;
  16288. },
  16289. _isInTransaction: false,
  16290. /**
  16291. * @abstract
  16292. * @return {Array<TransactionWrapper>} Array of transaction wrappers.
  16293. */
  16294. getTransactionWrappers: null,
  16295. isInTransaction: function() {
  16296. return !!this._isInTransaction;
  16297. },
  16298. /**
  16299. * Executes the function within a safety window. Use this for the top level
  16300. * methods that result in large amounts of computation/mutations that would
  16301. * need to be safety checked.
  16302. *
  16303. * @param {function} method Member of scope to call.
  16304. * @param {Object} scope Scope to invoke from.
  16305. * @param {Object?=} args... Arguments to pass to the method (optional).
  16306. * Helps prevent need to bind in many cases.
  16307. * @return Return value from `method`.
  16308. */
  16309. perform: function(method, scope, a, b, c, d, e, f) {
  16310. ("production" !== "development" ? invariant(
  16311. !this.isInTransaction(),
  16312. 'Transaction.perform(...): Cannot initialize a transaction when there ' +
  16313. 'is already an outstanding transaction.'
  16314. ) : invariant(!this.isInTransaction()));
  16315. var errorThrown;
  16316. var ret;
  16317. try {
  16318. this._isInTransaction = true;
  16319. // Catching errors makes debugging more difficult, so we start with
  16320. // errorThrown set to true before setting it to false after calling
  16321. // close -- if it's still set to true in the finally block, it means
  16322. // one of these calls threw.
  16323. errorThrown = true;
  16324. this.initializeAll(0);
  16325. ret = method.call(scope, a, b, c, d, e, f);
  16326. errorThrown = false;
  16327. } finally {
  16328. try {
  16329. if (errorThrown) {
  16330. // If `method` throws, prefer to show that stack trace over any thrown
  16331. // by invoking `closeAll`.
  16332. try {
  16333. this.closeAll(0);
  16334. } catch (err) {
  16335. }
  16336. } else {
  16337. // Since `method` didn't throw, we don't want to silence the exception
  16338. // here.
  16339. this.closeAll(0);
  16340. }
  16341. } finally {
  16342. this._isInTransaction = false;
  16343. }
  16344. }
  16345. return ret;
  16346. },
  16347. initializeAll: function(startIndex) {
  16348. var transactionWrappers = this.transactionWrappers;
  16349. for (var i = startIndex; i < transactionWrappers.length; i++) {
  16350. var wrapper = transactionWrappers[i];
  16351. try {
  16352. // Catching errors makes debugging more difficult, so we start with the
  16353. // OBSERVED_ERROR state before overwriting it with the real return value
  16354. // of initialize -- if it's still set to OBSERVED_ERROR in the finally
  16355. // block, it means wrapper.initialize threw.
  16356. this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
  16357. this.wrapperInitData[i] = wrapper.initialize ?
  16358. wrapper.initialize.call(this) :
  16359. null;
  16360. } finally {
  16361. if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
  16362. // The initializer for wrapper i threw an error; initialize the
  16363. // remaining wrappers but silence any exceptions from them to ensure
  16364. // that the first error is the one to bubble up.
  16365. try {
  16366. this.initializeAll(i + 1);
  16367. } catch (err) {
  16368. }
  16369. }
  16370. }
  16371. }
  16372. },
  16373. /**
  16374. * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
  16375. * them the respective return values of `this.transactionWrappers.init[i]`
  16376. * (`close`rs that correspond to initializers that failed will not be
  16377. * invoked).
  16378. */
  16379. closeAll: function(startIndex) {
  16380. ("production" !== "development" ? invariant(
  16381. this.isInTransaction(),
  16382. 'Transaction.closeAll(): Cannot close transaction when none are open.'
  16383. ) : invariant(this.isInTransaction()));
  16384. var transactionWrappers = this.transactionWrappers;
  16385. for (var i = startIndex; i < transactionWrappers.length; i++) {
  16386. var wrapper = transactionWrappers[i];
  16387. var initData = this.wrapperInitData[i];
  16388. var errorThrown;
  16389. try {
  16390. // Catching errors makes debugging more difficult, so we start with
  16391. // errorThrown set to true before setting it to false after calling
  16392. // close -- if it's still set to true in the finally block, it means
  16393. // wrapper.close threw.
  16394. errorThrown = true;
  16395. if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
  16396. wrapper.close.call(this, initData);
  16397. }
  16398. errorThrown = false;
  16399. } finally {
  16400. if (errorThrown) {
  16401. // The closer for wrapper i threw an error; close the remaining
  16402. // wrappers but silence any exceptions from them to ensure that the
  16403. // first error is the one to bubble up.
  16404. try {
  16405. this.closeAll(i + 1);
  16406. } catch (e) {
  16407. }
  16408. }
  16409. }
  16410. }
  16411. this.wrapperInitData.length = 0;
  16412. }
  16413. };
  16414. var Transaction = {
  16415. Mixin: Mixin,
  16416. /**
  16417. * Token to look for to determine if an error occured.
  16418. */
  16419. OBSERVED_ERROR: {}
  16420. };
  16421. module.exports = Transaction;
  16422. },{"150":150}],117:[function(_dereq_,module,exports){
  16423. /**
  16424. * Copyright 2013-2015, Facebook, Inc.
  16425. * All rights reserved.
  16426. *
  16427. * This source code is licensed under the BSD-style license found in the
  16428. * LICENSE file in the root directory of this source tree. An additional grant
  16429. * of patent rights can be found in the PATENTS file in the same directory.
  16430. *
  16431. * @providesModule ViewportMetrics
  16432. */
  16433. 'use strict';
  16434. var ViewportMetrics = {
  16435. currentScrollLeft: 0,
  16436. currentScrollTop: 0,
  16437. refreshScrollValues: function(scrollPosition) {
  16438. ViewportMetrics.currentScrollLeft = scrollPosition.x;
  16439. ViewportMetrics.currentScrollTop = scrollPosition.y;
  16440. }
  16441. };
  16442. module.exports = ViewportMetrics;
  16443. },{}],118:[function(_dereq_,module,exports){
  16444. /**
  16445. * Copyright 2014-2015, Facebook, Inc.
  16446. * All rights reserved.
  16447. *
  16448. * This source code is licensed under the BSD-style license found in the
  16449. * LICENSE file in the root directory of this source tree. An additional grant
  16450. * of patent rights can be found in the PATENTS file in the same directory.
  16451. *
  16452. * @providesModule accumulateInto
  16453. */
  16454. 'use strict';
  16455. var invariant = _dereq_(150);
  16456. /**
  16457. *
  16458. * Accumulates items that must not be null or undefined into the first one. This
  16459. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  16460. * API cleanness. Since `current` can be null before being passed in and not
  16461. * null after this function, make sure to assign it back to `current`:
  16462. *
  16463. * `a = accumulateInto(a, b);`
  16464. *
  16465. * This API should be sparingly used. Try `accumulate` for something cleaner.
  16466. *
  16467. * @return {*|array<*>} An accumulation of items.
  16468. */
  16469. function accumulateInto(current, next) {
  16470. ("production" !== "development" ? invariant(
  16471. next != null,
  16472. 'accumulateInto(...): Accumulated items must not be null or undefined.'
  16473. ) : invariant(next != null));
  16474. if (current == null) {
  16475. return next;
  16476. }
  16477. // Both are not empty. Warning: Never call x.concat(y) when you are not
  16478. // certain that x is an Array (x could be a string with concat method).
  16479. var currentIsArray = Array.isArray(current);
  16480. var nextIsArray = Array.isArray(next);
  16481. if (currentIsArray && nextIsArray) {
  16482. current.push.apply(current, next);
  16483. return current;
  16484. }
  16485. if (currentIsArray) {
  16486. current.push(next);
  16487. return current;
  16488. }
  16489. if (nextIsArray) {
  16490. // A bit too dangerous to mutate `next`.
  16491. return [current].concat(next);
  16492. }
  16493. return [current, next];
  16494. }
  16495. module.exports = accumulateInto;
  16496. },{"150":150}],119:[function(_dereq_,module,exports){
  16497. /**
  16498. * Copyright 2013-2015, Facebook, Inc.
  16499. * All rights reserved.
  16500. *
  16501. * This source code is licensed under the BSD-style license found in the
  16502. * LICENSE file in the root directory of this source tree. An additional grant
  16503. * of patent rights can be found in the PATENTS file in the same directory.
  16504. *
  16505. * @providesModule adler32
  16506. */
  16507. /* jslint bitwise:true */
  16508. 'use strict';
  16509. var MOD = 65521;
  16510. // This is a clean-room implementation of adler32 designed for detecting
  16511. // if markup is not what we expect it to be. It does not need to be
  16512. // cryptographically strong, only reasonably good at detecting if markup
  16513. // generated on the server is different than that on the client.
  16514. function adler32(data) {
  16515. var a = 1;
  16516. var b = 0;
  16517. for (var i = 0; i < data.length; i++) {
  16518. a = (a + data.charCodeAt(i)) % MOD;
  16519. b = (b + a) % MOD;
  16520. }
  16521. return a | (b << 16);
  16522. }
  16523. module.exports = adler32;
  16524. },{}],120:[function(_dereq_,module,exports){
  16525. /**
  16526. * Copyright 2013-2015, Facebook, Inc.
  16527. * All rights reserved.
  16528. *
  16529. * This source code is licensed under the BSD-style license found in the
  16530. * LICENSE file in the root directory of this source tree. An additional grant
  16531. * of patent rights can be found in the PATENTS file in the same directory.
  16532. *
  16533. * @providesModule camelize
  16534. * @typechecks
  16535. */
  16536. var _hyphenPattern = /-(.)/g;
  16537. /**
  16538. * Camelcases a hyphenated string, for example:
  16539. *
  16540. * > camelize('background-color')
  16541. * < "backgroundColor"
  16542. *
  16543. * @param {string} string
  16544. * @return {string}
  16545. */
  16546. function camelize(string) {
  16547. return string.replace(_hyphenPattern, function(_, character) {
  16548. return character.toUpperCase();
  16549. });
  16550. }
  16551. module.exports = camelize;
  16552. },{}],121:[function(_dereq_,module,exports){
  16553. /**
  16554. * Copyright 2014-2015, Facebook, Inc.
  16555. * All rights reserved.
  16556. *
  16557. * This source code is licensed under the BSD-style license found in the
  16558. * LICENSE file in the root directory of this source tree. An additional grant
  16559. * of patent rights can be found in the PATENTS file in the same directory.
  16560. *
  16561. * @providesModule camelizeStyleName
  16562. * @typechecks
  16563. */
  16564. "use strict";
  16565. var camelize = _dereq_(120);
  16566. var msPattern = /^-ms-/;
  16567. /**
  16568. * Camelcases a hyphenated CSS property name, for example:
  16569. *
  16570. * > camelizeStyleName('background-color')
  16571. * < "backgroundColor"
  16572. * > camelizeStyleName('-moz-transition')
  16573. * < "MozTransition"
  16574. * > camelizeStyleName('-ms-transition')
  16575. * < "msTransition"
  16576. *
  16577. * As Andi Smith suggests
  16578. * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  16579. * is converted to lowercase `ms`.
  16580. *
  16581. * @param {string} string
  16582. * @return {string}
  16583. */
  16584. function camelizeStyleName(string) {
  16585. return camelize(string.replace(msPattern, 'ms-'));
  16586. }
  16587. module.exports = camelizeStyleName;
  16588. },{"120":120}],122:[function(_dereq_,module,exports){
  16589. /**
  16590. * Copyright 2013-2015, Facebook, Inc.
  16591. * All rights reserved.
  16592. *
  16593. * This source code is licensed under the BSD-style license found in the
  16594. * LICENSE file in the root directory of this source tree. An additional grant
  16595. * of patent rights can be found in the PATENTS file in the same directory.
  16596. *
  16597. * @typechecks static-only
  16598. * @providesModule cloneWithProps
  16599. */
  16600. 'use strict';
  16601. var ReactElement = _dereq_(63);
  16602. var ReactPropTransferer = _dereq_(83);
  16603. var keyOf = _dereq_(157);
  16604. var warning = _dereq_(171);
  16605. var CHILDREN_PROP = keyOf({children: null});
  16606. /**
  16607. * Sometimes you want to change the props of a child passed to you. Usually
  16608. * this is to add a CSS class.
  16609. *
  16610. * @param {ReactElement} child child element you'd like to clone
  16611. * @param {object} props props you'd like to modify. className and style will be
  16612. * merged automatically.
  16613. * @return {ReactElement} a clone of child with props merged in.
  16614. */
  16615. function cloneWithProps(child, props) {
  16616. if ("production" !== "development") {
  16617. ("production" !== "development" ? warning(
  16618. !child.ref,
  16619. 'You are calling cloneWithProps() on a child with a ref. This is ' +
  16620. 'dangerous because you\'re creating a new child which will not be ' +
  16621. 'added as a ref to its parent.'
  16622. ) : null);
  16623. }
  16624. var newProps = ReactPropTransferer.mergeProps(props, child.props);
  16625. // Use `child.props.children` if it is provided.
  16626. if (!newProps.hasOwnProperty(CHILDREN_PROP) &&
  16627. child.props.hasOwnProperty(CHILDREN_PROP)) {
  16628. newProps.children = child.props.children;
  16629. }
  16630. // The current API doesn't retain _owner and _context, which is why this
  16631. // doesn't use ReactElement.cloneAndReplaceProps.
  16632. return ReactElement.createElement(child.type, newProps);
  16633. }
  16634. module.exports = cloneWithProps;
  16635. },{"157":157,"171":171,"63":63,"83":83}],123:[function(_dereq_,module,exports){
  16636. /**
  16637. * Copyright 2013-2015, Facebook, Inc.
  16638. * All rights reserved.
  16639. *
  16640. * This source code is licensed under the BSD-style license found in the
  16641. * LICENSE file in the root directory of this source tree. An additional grant
  16642. * of patent rights can be found in the PATENTS file in the same directory.
  16643. *
  16644. * @providesModule containsNode
  16645. * @typechecks
  16646. */
  16647. var isTextNode = _dereq_(154);
  16648. /*jslint bitwise:true */
  16649. /**
  16650. * Checks if a given DOM node contains or is another DOM node.
  16651. *
  16652. * @param {?DOMNode} outerNode Outer DOM node.
  16653. * @param {?DOMNode} innerNode Inner DOM node.
  16654. * @return {boolean} True if `outerNode` contains or is `innerNode`.
  16655. */
  16656. function containsNode(outerNode, innerNode) {
  16657. if (!outerNode || !innerNode) {
  16658. return false;
  16659. } else if (outerNode === innerNode) {
  16660. return true;
  16661. } else if (isTextNode(outerNode)) {
  16662. return false;
  16663. } else if (isTextNode(innerNode)) {
  16664. return containsNode(outerNode, innerNode.parentNode);
  16665. } else if (outerNode.contains) {
  16666. return outerNode.contains(innerNode);
  16667. } else if (outerNode.compareDocumentPosition) {
  16668. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  16669. } else {
  16670. return false;
  16671. }
  16672. }
  16673. module.exports = containsNode;
  16674. },{"154":154}],124:[function(_dereq_,module,exports){
  16675. /**
  16676. * Copyright 2013-2015, Facebook, Inc.
  16677. * All rights reserved.
  16678. *
  16679. * This source code is licensed under the BSD-style license found in the
  16680. * LICENSE file in the root directory of this source tree. An additional grant
  16681. * of patent rights can be found in the PATENTS file in the same directory.
  16682. *
  16683. * @providesModule createArrayFromMixed
  16684. * @typechecks
  16685. */
  16686. var toArray = _dereq_(168);
  16687. /**
  16688. * Perform a heuristic test to determine if an object is "array-like".
  16689. *
  16690. * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
  16691. * Joshu replied: "Mu."
  16692. *
  16693. * This function determines if its argument has "array nature": it returns
  16694. * true if the argument is an actual array, an `arguments' object, or an
  16695. * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
  16696. *
  16697. * It will return false for other array-like objects like Filelist.
  16698. *
  16699. * @param {*} obj
  16700. * @return {boolean}
  16701. */
  16702. function hasArrayNature(obj) {
  16703. return (
  16704. // not null/false
  16705. !!obj &&
  16706. // arrays are objects, NodeLists are functions in Safari
  16707. (typeof obj == 'object' || typeof obj == 'function') &&
  16708. // quacks like an array
  16709. ('length' in obj) &&
  16710. // not window
  16711. !('setInterval' in obj) &&
  16712. // no DOM node should be considered an array-like
  16713. // a 'select' element has 'length' and 'item' properties on IE8
  16714. (typeof obj.nodeType != 'number') &&
  16715. (
  16716. // a real array
  16717. (// HTMLCollection/NodeList
  16718. (Array.isArray(obj) ||
  16719. // arguments
  16720. ('callee' in obj) || 'item' in obj))
  16721. )
  16722. );
  16723. }
  16724. /**
  16725. * Ensure that the argument is an array by wrapping it in an array if it is not.
  16726. * Creates a copy of the argument if it is already an array.
  16727. *
  16728. * This is mostly useful idiomatically:
  16729. *
  16730. * var createArrayFromMixed = require('createArrayFromMixed');
  16731. *
  16732. * function takesOneOrMoreThings(things) {
  16733. * things = createArrayFromMixed(things);
  16734. * ...
  16735. * }
  16736. *
  16737. * This allows you to treat `things' as an array, but accept scalars in the API.
  16738. *
  16739. * If you need to convert an array-like object, like `arguments`, into an array
  16740. * use toArray instead.
  16741. *
  16742. * @param {*} obj
  16743. * @return {array}
  16744. */
  16745. function createArrayFromMixed(obj) {
  16746. if (!hasArrayNature(obj)) {
  16747. return [obj];
  16748. } else if (Array.isArray(obj)) {
  16749. return obj.slice();
  16750. } else {
  16751. return toArray(obj);
  16752. }
  16753. }
  16754. module.exports = createArrayFromMixed;
  16755. },{"168":168}],125:[function(_dereq_,module,exports){
  16756. /**
  16757. * Copyright 2013-2015, Facebook, Inc.
  16758. * All rights reserved.
  16759. *
  16760. * This source code is licensed under the BSD-style license found in the
  16761. * LICENSE file in the root directory of this source tree. An additional grant
  16762. * of patent rights can be found in the PATENTS file in the same directory.
  16763. *
  16764. * @providesModule createFullPageComponent
  16765. * @typechecks
  16766. */
  16767. 'use strict';
  16768. // Defeat circular references by requiring this directly.
  16769. var ReactClass = _dereq_(38);
  16770. var ReactElement = _dereq_(63);
  16771. var invariant = _dereq_(150);
  16772. /**
  16773. * Create a component that will throw an exception when unmounted.
  16774. *
  16775. * Components like <html> <head> and <body> can't be removed or added
  16776. * easily in a cross-browser way, however it's valuable to be able to
  16777. * take advantage of React's reconciliation for styling and <title>
  16778. * management. So we just document it and throw in dangerous cases.
  16779. *
  16780. * @param {string} tag The tag to wrap
  16781. * @return {function} convenience constructor of new component
  16782. */
  16783. function createFullPageComponent(tag) {
  16784. var elementFactory = ReactElement.createFactory(tag);
  16785. var FullPageComponent = ReactClass.createClass({
  16786. tagName: tag.toUpperCase(),
  16787. displayName: 'ReactFullPageComponent' + tag,
  16788. componentWillUnmount: function() {
  16789. ("production" !== "development" ? invariant(
  16790. false,
  16791. '%s tried to unmount. Because of cross-browser quirks it is ' +
  16792. 'impossible to unmount some top-level components (eg <html>, <head>, ' +
  16793. 'and <body>) reliably and efficiently. To fix this, have a single ' +
  16794. 'top-level component that never unmounts render these elements.',
  16795. this.constructor.displayName
  16796. ) : invariant(false));
  16797. },
  16798. render: function() {
  16799. return elementFactory(this.props);
  16800. }
  16801. });
  16802. return FullPageComponent;
  16803. }
  16804. module.exports = createFullPageComponent;
  16805. },{"150":150,"38":38,"63":63}],126:[function(_dereq_,module,exports){
  16806. /**
  16807. * Copyright 2013-2015, Facebook, Inc.
  16808. * All rights reserved.
  16809. *
  16810. * This source code is licensed under the BSD-style license found in the
  16811. * LICENSE file in the root directory of this source tree. An additional grant
  16812. * of patent rights can be found in the PATENTS file in the same directory.
  16813. *
  16814. * @providesModule createNodesFromMarkup
  16815. * @typechecks
  16816. */
  16817. /*jslint evil: true, sub: true */
  16818. var ExecutionEnvironment = _dereq_(22);
  16819. var createArrayFromMixed = _dereq_(124);
  16820. var getMarkupWrap = _dereq_(142);
  16821. var invariant = _dereq_(150);
  16822. /**
  16823. * Dummy container used to render all markup.
  16824. */
  16825. var dummyNode =
  16826. ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  16827. /**
  16828. * Pattern used by `getNodeName`.
  16829. */
  16830. var nodeNamePattern = /^\s*<(\w+)/;
  16831. /**
  16832. * Extracts the `nodeName` of the first element in a string of markup.
  16833. *
  16834. * @param {string} markup String of markup.
  16835. * @return {?string} Node name of the supplied markup.
  16836. */
  16837. function getNodeName(markup) {
  16838. var nodeNameMatch = markup.match(nodeNamePattern);
  16839. return nodeNameMatch && nodeNameMatch[1].toLowerCase();
  16840. }
  16841. /**
  16842. * Creates an array containing the nodes rendered from the supplied markup. The
  16843. * optionally supplied `handleScript` function will be invoked once for each
  16844. * <script> element that is rendered. If no `handleScript` function is supplied,
  16845. * an exception is thrown if any <script> elements are rendered.
  16846. *
  16847. * @param {string} markup A string of valid HTML markup.
  16848. * @param {?function} handleScript Invoked once for each rendered <script>.
  16849. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
  16850. */
  16851. function createNodesFromMarkup(markup, handleScript) {
  16852. var node = dummyNode;
  16853. ("production" !== "development" ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));
  16854. var nodeName = getNodeName(markup);
  16855. var wrap = nodeName && getMarkupWrap(nodeName);
  16856. if (wrap) {
  16857. node.innerHTML = wrap[1] + markup + wrap[2];
  16858. var wrapDepth = wrap[0];
  16859. while (wrapDepth--) {
  16860. node = node.lastChild;
  16861. }
  16862. } else {
  16863. node.innerHTML = markup;
  16864. }
  16865. var scripts = node.getElementsByTagName('script');
  16866. if (scripts.length) {
  16867. ("production" !== "development" ? invariant(
  16868. handleScript,
  16869. 'createNodesFromMarkup(...): Unexpected <script> element rendered.'
  16870. ) : invariant(handleScript));
  16871. createArrayFromMixed(scripts).forEach(handleScript);
  16872. }
  16873. var nodes = createArrayFromMixed(node.childNodes);
  16874. while (node.lastChild) {
  16875. node.removeChild(node.lastChild);
  16876. }
  16877. return nodes;
  16878. }
  16879. module.exports = createNodesFromMarkup;
  16880. },{"124":124,"142":142,"150":150,"22":22}],127:[function(_dereq_,module,exports){
  16881. /**
  16882. * Copyright 2013-2015, Facebook, Inc.
  16883. * All rights reserved.
  16884. *
  16885. * This source code is licensed under the BSD-style license found in the
  16886. * LICENSE file in the root directory of this source tree. An additional grant
  16887. * of patent rights can be found in the PATENTS file in the same directory.
  16888. *
  16889. * @providesModule cx
  16890. */
  16891. /**
  16892. * This function is used to mark string literals representing CSS class names
  16893. * so that they can be transformed statically. This allows for modularization
  16894. * and minification of CSS class names.
  16895. *
  16896. * In static_upstream, this function is actually implemented, but it should
  16897. * eventually be replaced with something more descriptive, and the transform
  16898. * that is used in the main stack should be ported for use elsewhere.
  16899. *
  16900. * @param string|object className to modularize, or an object of key/values.
  16901. * In the object case, the values are conditions that
  16902. * determine if the className keys should be included.
  16903. * @param [string ...] Variable list of classNames in the string case.
  16904. * @return string Renderable space-separated CSS className.
  16905. */
  16906. 'use strict';
  16907. var warning = _dereq_(171);
  16908. var warned = false;
  16909. function cx(classNames) {
  16910. if ("production" !== "development") {
  16911. ("production" !== "development" ? warning(
  16912. warned,
  16913. 'React.addons.classSet will be deprecated in a future version. See ' +
  16914. 'http://fb.me/react-addons-classset'
  16915. ) : null);
  16916. warned = true;
  16917. }
  16918. if (typeof classNames == 'object') {
  16919. return Object.keys(classNames).filter(function(className) {
  16920. return classNames[className];
  16921. }).join(' ');
  16922. } else {
  16923. return Array.prototype.join.call(arguments, ' ');
  16924. }
  16925. }
  16926. module.exports = cx;
  16927. },{"171":171}],128:[function(_dereq_,module,exports){
  16928. /**
  16929. * Copyright 2013-2015, Facebook, Inc.
  16930. * All rights reserved.
  16931. *
  16932. * This source code is licensed under the BSD-style license found in the
  16933. * LICENSE file in the root directory of this source tree. An additional grant
  16934. * of patent rights can be found in the PATENTS file in the same directory.
  16935. *
  16936. * @providesModule dangerousStyleValue
  16937. * @typechecks static-only
  16938. */
  16939. 'use strict';
  16940. var CSSProperty = _dereq_(5);
  16941. var isUnitlessNumber = CSSProperty.isUnitlessNumber;
  16942. /**
  16943. * Convert a value into the proper css writable value. The style name `name`
  16944. * should be logical (no hyphens), as specified
  16945. * in `CSSProperty.isUnitlessNumber`.
  16946. *
  16947. * @param {string} name CSS property name such as `topMargin`.
  16948. * @param {*} value CSS property value such as `10px`.
  16949. * @return {string} Normalized style value with dimensions applied.
  16950. */
  16951. function dangerousStyleValue(name, value) {
  16952. // Note that we've removed escapeTextForBrowser() calls here since the
  16953. // whole string will be escaped when the attribute is injected into
  16954. // the markup. If you provide unsafe user data here they can inject
  16955. // arbitrary CSS which may be problematic (I couldn't repro this):
  16956. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  16957. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  16958. // This is not an XSS hole but instead a potential CSS injection issue
  16959. // which has lead to a greater discussion about how we're going to
  16960. // trust URLs moving forward. See #2115901
  16961. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  16962. if (isEmpty) {
  16963. return '';
  16964. }
  16965. var isNonNumeric = isNaN(value);
  16966. if (isNonNumeric || value === 0 ||
  16967. isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
  16968. return '' + value; // cast to string
  16969. }
  16970. if (typeof value === 'string') {
  16971. value = value.trim();
  16972. }
  16973. return value + 'px';
  16974. }
  16975. module.exports = dangerousStyleValue;
  16976. },{"5":5}],129:[function(_dereq_,module,exports){
  16977. /**
  16978. * Copyright 2013-2015, Facebook, Inc.
  16979. * All rights reserved.
  16980. *
  16981. * This source code is licensed under the BSD-style license found in the
  16982. * LICENSE file in the root directory of this source tree. An additional grant
  16983. * of patent rights can be found in the PATENTS file in the same directory.
  16984. *
  16985. * @providesModule emptyFunction
  16986. */
  16987. function makeEmptyFunction(arg) {
  16988. return function() {
  16989. return arg;
  16990. };
  16991. }
  16992. /**
  16993. * This function accepts and discards inputs; it has no side effects. This is
  16994. * primarily useful idiomatically for overridable function endpoints which
  16995. * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
  16996. */
  16997. function emptyFunction() {}
  16998. emptyFunction.thatReturns = makeEmptyFunction;
  16999. emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
  17000. emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
  17001. emptyFunction.thatReturnsNull = makeEmptyFunction(null);
  17002. emptyFunction.thatReturnsThis = function() { return this; };
  17003. emptyFunction.thatReturnsArgument = function(arg) { return arg; };
  17004. module.exports = emptyFunction;
  17005. },{}],130:[function(_dereq_,module,exports){
  17006. /**
  17007. * Copyright 2013-2015, Facebook, Inc.
  17008. * All rights reserved.
  17009. *
  17010. * This source code is licensed under the BSD-style license found in the
  17011. * LICENSE file in the root directory of this source tree. An additional grant
  17012. * of patent rights can be found in the PATENTS file in the same directory.
  17013. *
  17014. * @providesModule emptyObject
  17015. */
  17016. "use strict";
  17017. var emptyObject = {};
  17018. if ("production" !== "development") {
  17019. Object.freeze(emptyObject);
  17020. }
  17021. module.exports = emptyObject;
  17022. },{}],131:[function(_dereq_,module,exports){
  17023. /**
  17024. * Copyright 2013-2015, Facebook, Inc.
  17025. * All rights reserved.
  17026. *
  17027. * This source code is licensed under the BSD-style license found in the
  17028. * LICENSE file in the root directory of this source tree. An additional grant
  17029. * of patent rights can be found in the PATENTS file in the same directory.
  17030. *
  17031. * @providesModule escapeTextContentForBrowser
  17032. */
  17033. 'use strict';
  17034. var ESCAPE_LOOKUP = {
  17035. '&': '&amp;',
  17036. '>': '&gt;',
  17037. '<': '&lt;',
  17038. '"': '&quot;',
  17039. '\'': '&#x27;'
  17040. };
  17041. var ESCAPE_REGEX = /[&><"']/g;
  17042. function escaper(match) {
  17043. return ESCAPE_LOOKUP[match];
  17044. }
  17045. /**
  17046. * Escapes text to prevent scripting attacks.
  17047. *
  17048. * @param {*} text Text value to escape.
  17049. * @return {string} An escaped string.
  17050. */
  17051. function escapeTextContentForBrowser(text) {
  17052. return ('' + text).replace(ESCAPE_REGEX, escaper);
  17053. }
  17054. module.exports = escapeTextContentForBrowser;
  17055. },{}],132:[function(_dereq_,module,exports){
  17056. /**
  17057. * Copyright 2013-2015, Facebook, Inc.
  17058. * All rights reserved.
  17059. *
  17060. * This source code is licensed under the BSD-style license found in the
  17061. * LICENSE file in the root directory of this source tree. An additional grant
  17062. * of patent rights can be found in the PATENTS file in the same directory.
  17063. *
  17064. * @providesModule findDOMNode
  17065. * @typechecks static-only
  17066. */
  17067. 'use strict';
  17068. var ReactCurrentOwner = _dereq_(45);
  17069. var ReactInstanceMap = _dereq_(73);
  17070. var ReactMount = _dereq_(77);
  17071. var invariant = _dereq_(150);
  17072. var isNode = _dereq_(152);
  17073. var warning = _dereq_(171);
  17074. /**
  17075. * Returns the DOM node rendered by this element.
  17076. *
  17077. * @param {ReactComponent|DOMElement} componentOrElement
  17078. * @return {DOMElement} The root node of this element.
  17079. */
  17080. function findDOMNode(componentOrElement) {
  17081. if ("production" !== "development") {
  17082. var owner = ReactCurrentOwner.current;
  17083. if (owner !== null) {
  17084. ("production" !== "development" ? warning(
  17085. owner._warnedAboutRefsInRender,
  17086. '%s is accessing getDOMNode or findDOMNode inside its render(). ' +
  17087. 'render() should be a pure function of props and state. It should ' +
  17088. 'never access something that requires stale data from the previous ' +
  17089. 'render, such as refs. Move this logic to componentDidMount and ' +
  17090. 'componentDidUpdate instead.',
  17091. owner.getName() || 'A component'
  17092. ) : null);
  17093. owner._warnedAboutRefsInRender = true;
  17094. }
  17095. }
  17096. if (componentOrElement == null) {
  17097. return null;
  17098. }
  17099. if (isNode(componentOrElement)) {
  17100. return componentOrElement;
  17101. }
  17102. if (ReactInstanceMap.has(componentOrElement)) {
  17103. return ReactMount.getNodeFromInstance(componentOrElement);
  17104. }
  17105. ("production" !== "development" ? invariant(
  17106. componentOrElement.render == null ||
  17107. typeof componentOrElement.render !== 'function',
  17108. 'Component (with keys: %s) contains `render` method ' +
  17109. 'but is not mounted in the DOM',
  17110. Object.keys(componentOrElement)
  17111. ) : invariant(componentOrElement.render == null ||
  17112. typeof componentOrElement.render !== 'function'));
  17113. ("production" !== "development" ? invariant(
  17114. false,
  17115. 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
  17116. Object.keys(componentOrElement)
  17117. ) : invariant(false));
  17118. }
  17119. module.exports = findDOMNode;
  17120. },{"150":150,"152":152,"171":171,"45":45,"73":73,"77":77}],133:[function(_dereq_,module,exports){
  17121. /**
  17122. * Copyright 2013-2015, Facebook, Inc.
  17123. * All rights reserved.
  17124. *
  17125. * This source code is licensed under the BSD-style license found in the
  17126. * LICENSE file in the root directory of this source tree. An additional grant
  17127. * of patent rights can be found in the PATENTS file in the same directory.
  17128. *
  17129. * @providesModule flattenChildren
  17130. */
  17131. 'use strict';
  17132. var traverseAllChildren = _dereq_(169);
  17133. var warning = _dereq_(171);
  17134. /**
  17135. * @param {function} traverseContext Context passed through traversal.
  17136. * @param {?ReactComponent} child React child component.
  17137. * @param {!string} name String name of key path to child.
  17138. */
  17139. function flattenSingleChildIntoContext(traverseContext, child, name) {
  17140. // We found a component instance.
  17141. var result = traverseContext;
  17142. var keyUnique = !result.hasOwnProperty(name);
  17143. if ("production" !== "development") {
  17144. ("production" !== "development" ? warning(
  17145. keyUnique,
  17146. 'flattenChildren(...): Encountered two children with the same key, ' +
  17147. '`%s`. Child keys must be unique; when two children share a key, only ' +
  17148. 'the first child will be used.',
  17149. name
  17150. ) : null);
  17151. }
  17152. if (keyUnique && child != null) {
  17153. result[name] = child;
  17154. }
  17155. }
  17156. /**
  17157. * Flattens children that are typically specified as `props.children`. Any null
  17158. * children will not be included in the resulting object.
  17159. * @return {!object} flattened children keyed by name.
  17160. */
  17161. function flattenChildren(children) {
  17162. if (children == null) {
  17163. return children;
  17164. }
  17165. var result = {};
  17166. traverseAllChildren(children, flattenSingleChildIntoContext, result);
  17167. return result;
  17168. }
  17169. module.exports = flattenChildren;
  17170. },{"169":169,"171":171}],134:[function(_dereq_,module,exports){
  17171. /**
  17172. * Copyright 2014-2015, Facebook, Inc.
  17173. * All rights reserved.
  17174. *
  17175. * This source code is licensed under the BSD-style license found in the
  17176. * LICENSE file in the root directory of this source tree. An additional grant
  17177. * of patent rights can be found in the PATENTS file in the same directory.
  17178. *
  17179. * @providesModule focusNode
  17180. */
  17181. "use strict";
  17182. /**
  17183. * @param {DOMElement} node input/textarea to focus
  17184. */
  17185. function focusNode(node) {
  17186. // IE8 can throw "Can't move focus to the control because it is invisible,
  17187. // not enabled, or of a type that does not accept the focus." for all kinds of
  17188. // reasons that are too expensive and fragile to test.
  17189. try {
  17190. node.focus();
  17191. } catch(e) {
  17192. }
  17193. }
  17194. module.exports = focusNode;
  17195. },{}],135:[function(_dereq_,module,exports){
  17196. /**
  17197. * Copyright 2013-2015, Facebook, Inc.
  17198. * All rights reserved.
  17199. *
  17200. * This source code is licensed under the BSD-style license found in the
  17201. * LICENSE file in the root directory of this source tree. An additional grant
  17202. * of patent rights can be found in the PATENTS file in the same directory.
  17203. *
  17204. * @providesModule forEachAccumulated
  17205. */
  17206. 'use strict';
  17207. /**
  17208. * @param {array} an "accumulation" of items which is either an Array or
  17209. * a single item. Useful when paired with the `accumulate` module. This is a
  17210. * simple utility that allows us to reason about a collection of items, but
  17211. * handling the case when there is exactly one item (and we do not need to
  17212. * allocate an array).
  17213. */
  17214. var forEachAccumulated = function(arr, cb, scope) {
  17215. if (Array.isArray(arr)) {
  17216. arr.forEach(cb, scope);
  17217. } else if (arr) {
  17218. cb.call(scope, arr);
  17219. }
  17220. };
  17221. module.exports = forEachAccumulated;
  17222. },{}],136:[function(_dereq_,module,exports){
  17223. /**
  17224. * Copyright 2013-2015, Facebook, Inc.
  17225. * All rights reserved.
  17226. *
  17227. * This source code is licensed under the BSD-style license found in the
  17228. * LICENSE file in the root directory of this source tree. An additional grant
  17229. * of patent rights can be found in the PATENTS file in the same directory.
  17230. *
  17231. * @providesModule getActiveElement
  17232. * @typechecks
  17233. */
  17234. /**
  17235. * Same as document.activeElement but wraps in a try-catch block. In IE it is
  17236. * not safe to call document.activeElement if there is nothing focused.
  17237. *
  17238. * The activeElement will be null only if the document body is not yet defined.
  17239. */
  17240. function getActiveElement() /*?DOMElement*/ {
  17241. try {
  17242. return document.activeElement || document.body;
  17243. } catch (e) {
  17244. return document.body;
  17245. }
  17246. }
  17247. module.exports = getActiveElement;
  17248. },{}],137:[function(_dereq_,module,exports){
  17249. /**
  17250. * Copyright 2013-2015, Facebook, Inc.
  17251. * All rights reserved.
  17252. *
  17253. * This source code is licensed under the BSD-style license found in the
  17254. * LICENSE file in the root directory of this source tree. An additional grant
  17255. * of patent rights can be found in the PATENTS file in the same directory.
  17256. *
  17257. * @providesModule getEventCharCode
  17258. * @typechecks static-only
  17259. */
  17260. 'use strict';
  17261. /**
  17262. * `charCode` represents the actual "character code" and is safe to use with
  17263. * `String.fromCharCode`. As such, only keys that correspond to printable
  17264. * characters produce a valid `charCode`, the only exception to this is Enter.
  17265. * The Tab-key is considered non-printable and does not have a `charCode`,
  17266. * presumably because it does not produce a tab-character in browsers.
  17267. *
  17268. * @param {object} nativeEvent Native browser event.
  17269. * @return {string} Normalized `charCode` property.
  17270. */
  17271. function getEventCharCode(nativeEvent) {
  17272. var charCode;
  17273. var keyCode = nativeEvent.keyCode;
  17274. if ('charCode' in nativeEvent) {
  17275. charCode = nativeEvent.charCode;
  17276. // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  17277. if (charCode === 0 && keyCode === 13) {
  17278. charCode = 13;
  17279. }
  17280. } else {
  17281. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  17282. charCode = keyCode;
  17283. }
  17284. // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  17285. // Must not discard the (non-)printable Enter-key.
  17286. if (charCode >= 32 || charCode === 13) {
  17287. return charCode;
  17288. }
  17289. return 0;
  17290. }
  17291. module.exports = getEventCharCode;
  17292. },{}],138:[function(_dereq_,module,exports){
  17293. /**
  17294. * Copyright 2013-2015, Facebook, Inc.
  17295. * All rights reserved.
  17296. *
  17297. * This source code is licensed under the BSD-style license found in the
  17298. * LICENSE file in the root directory of this source tree. An additional grant
  17299. * of patent rights can be found in the PATENTS file in the same directory.
  17300. *
  17301. * @providesModule getEventKey
  17302. * @typechecks static-only
  17303. */
  17304. 'use strict';
  17305. var getEventCharCode = _dereq_(137);
  17306. /**
  17307. * Normalization of deprecated HTML5 `key` values
  17308. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  17309. */
  17310. var normalizeKey = {
  17311. 'Esc': 'Escape',
  17312. 'Spacebar': ' ',
  17313. 'Left': 'ArrowLeft',
  17314. 'Up': 'ArrowUp',
  17315. 'Right': 'ArrowRight',
  17316. 'Down': 'ArrowDown',
  17317. 'Del': 'Delete',
  17318. 'Win': 'OS',
  17319. 'Menu': 'ContextMenu',
  17320. 'Apps': 'ContextMenu',
  17321. 'Scroll': 'ScrollLock',
  17322. 'MozPrintableKey': 'Unidentified'
  17323. };
  17324. /**
  17325. * Translation from legacy `keyCode` to HTML5 `key`
  17326. * Only special keys supported, all others depend on keyboard layout or browser
  17327. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  17328. */
  17329. var translateToKey = {
  17330. 8: 'Backspace',
  17331. 9: 'Tab',
  17332. 12: 'Clear',
  17333. 13: 'Enter',
  17334. 16: 'Shift',
  17335. 17: 'Control',
  17336. 18: 'Alt',
  17337. 19: 'Pause',
  17338. 20: 'CapsLock',
  17339. 27: 'Escape',
  17340. 32: ' ',
  17341. 33: 'PageUp',
  17342. 34: 'PageDown',
  17343. 35: 'End',
  17344. 36: 'Home',
  17345. 37: 'ArrowLeft',
  17346. 38: 'ArrowUp',
  17347. 39: 'ArrowRight',
  17348. 40: 'ArrowDown',
  17349. 45: 'Insert',
  17350. 46: 'Delete',
  17351. 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
  17352. 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
  17353. 144: 'NumLock',
  17354. 145: 'ScrollLock',
  17355. 224: 'Meta'
  17356. };
  17357. /**
  17358. * @param {object} nativeEvent Native browser event.
  17359. * @return {string} Normalized `key` property.
  17360. */
  17361. function getEventKey(nativeEvent) {
  17362. if (nativeEvent.key) {
  17363. // Normalize inconsistent values reported by browsers due to
  17364. // implementations of a working draft specification.
  17365. // FireFox implements `key` but returns `MozPrintableKey` for all
  17366. // printable characters (normalized to `Unidentified`), ignore it.
  17367. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  17368. if (key !== 'Unidentified') {
  17369. return key;
  17370. }
  17371. }
  17372. // Browser does not implement `key`, polyfill as much of it as we can.
  17373. if (nativeEvent.type === 'keypress') {
  17374. var charCode = getEventCharCode(nativeEvent);
  17375. // The enter-key is technically both printable and non-printable and can
  17376. // thus be captured by `keypress`, no other non-printable key should.
  17377. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  17378. }
  17379. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  17380. // While user keyboard layout determines the actual meaning of each
  17381. // `keyCode` value, almost all function keys have a universal value.
  17382. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  17383. }
  17384. return '';
  17385. }
  17386. module.exports = getEventKey;
  17387. },{"137":137}],139:[function(_dereq_,module,exports){
  17388. /**
  17389. * Copyright 2013-2015, Facebook, Inc.
  17390. * All rights reserved.
  17391. *
  17392. * This source code is licensed under the BSD-style license found in the
  17393. * LICENSE file in the root directory of this source tree. An additional grant
  17394. * of patent rights can be found in the PATENTS file in the same directory.
  17395. *
  17396. * @providesModule getEventModifierState
  17397. * @typechecks static-only
  17398. */
  17399. 'use strict';
  17400. /**
  17401. * Translation from modifier key to the associated property in the event.
  17402. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  17403. */
  17404. var modifierKeyToProp = {
  17405. 'Alt': 'altKey',
  17406. 'Control': 'ctrlKey',
  17407. 'Meta': 'metaKey',
  17408. 'Shift': 'shiftKey'
  17409. };
  17410. // IE8 does not implement getModifierState so we simply map it to the only
  17411. // modifier keys exposed by the event itself, does not support Lock-keys.
  17412. // Currently, all major browsers except Chrome seems to support Lock-keys.
  17413. function modifierStateGetter(keyArg) {
  17414. /*jshint validthis:true */
  17415. var syntheticEvent = this;
  17416. var nativeEvent = syntheticEvent.nativeEvent;
  17417. if (nativeEvent.getModifierState) {
  17418. return nativeEvent.getModifierState(keyArg);
  17419. }
  17420. var keyProp = modifierKeyToProp[keyArg];
  17421. return keyProp ? !!nativeEvent[keyProp] : false;
  17422. }
  17423. function getEventModifierState(nativeEvent) {
  17424. return modifierStateGetter;
  17425. }
  17426. module.exports = getEventModifierState;
  17427. },{}],140:[function(_dereq_,module,exports){
  17428. /**
  17429. * Copyright 2013-2015, Facebook, Inc.
  17430. * All rights reserved.
  17431. *
  17432. * This source code is licensed under the BSD-style license found in the
  17433. * LICENSE file in the root directory of this source tree. An additional grant
  17434. * of patent rights can be found in the PATENTS file in the same directory.
  17435. *
  17436. * @providesModule getEventTarget
  17437. * @typechecks static-only
  17438. */
  17439. 'use strict';
  17440. /**
  17441. * Gets the target node from a native browser event by accounting for
  17442. * inconsistencies in browser DOM APIs.
  17443. *
  17444. * @param {object} nativeEvent Native browser event.
  17445. * @return {DOMEventTarget} Target node.
  17446. */
  17447. function getEventTarget(nativeEvent) {
  17448. var target = nativeEvent.target || nativeEvent.srcElement || window;
  17449. // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  17450. // @see http://www.quirksmode.org/js/events_properties.html
  17451. return target.nodeType === 3 ? target.parentNode : target;
  17452. }
  17453. module.exports = getEventTarget;
  17454. },{}],141:[function(_dereq_,module,exports){
  17455. /**
  17456. * Copyright 2013-2015, Facebook, Inc.
  17457. * All rights reserved.
  17458. *
  17459. * This source code is licensed under the BSD-style license found in the
  17460. * LICENSE file in the root directory of this source tree. An additional grant
  17461. * of patent rights can be found in the PATENTS file in the same directory.
  17462. *
  17463. * @providesModule getIteratorFn
  17464. * @typechecks static-only
  17465. */
  17466. 'use strict';
  17467. /* global Symbol */
  17468. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  17469. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  17470. /**
  17471. * Returns the iterator method function contained on the iterable object.
  17472. *
  17473. * Be sure to invoke the function with the iterable as context:
  17474. *
  17475. * var iteratorFn = getIteratorFn(myIterable);
  17476. * if (iteratorFn) {
  17477. * var iterator = iteratorFn.call(myIterable);
  17478. * ...
  17479. * }
  17480. *
  17481. * @param {?object} maybeIterable
  17482. * @return {?function}
  17483. */
  17484. function getIteratorFn(maybeIterable) {
  17485. var iteratorFn = maybeIterable && (
  17486. (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL])
  17487. );
  17488. if (typeof iteratorFn === 'function') {
  17489. return iteratorFn;
  17490. }
  17491. }
  17492. module.exports = getIteratorFn;
  17493. },{}],142:[function(_dereq_,module,exports){
  17494. /**
  17495. * Copyright 2013-2015, Facebook, Inc.
  17496. * All rights reserved.
  17497. *
  17498. * This source code is licensed under the BSD-style license found in the
  17499. * LICENSE file in the root directory of this source tree. An additional grant
  17500. * of patent rights can be found in the PATENTS file in the same directory.
  17501. *
  17502. * @providesModule getMarkupWrap
  17503. */
  17504. var ExecutionEnvironment = _dereq_(22);
  17505. var invariant = _dereq_(150);
  17506. /**
  17507. * Dummy container used to detect which wraps are necessary.
  17508. */
  17509. var dummyNode =
  17510. ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  17511. /**
  17512. * Some browsers cannot use `innerHTML` to render certain elements standalone,
  17513. * so we wrap them, render the wrapped nodes, then extract the desired node.
  17514. *
  17515. * In IE8, certain elements cannot render alone, so wrap all elements ('*').
  17516. */
  17517. var shouldWrap = {
  17518. // Force wrapping for SVG elements because if they get created inside a <div>,
  17519. // they will be initialized in the wrong namespace (and will not display).
  17520. 'circle': true,
  17521. 'clipPath': true,
  17522. 'defs': true,
  17523. 'ellipse': true,
  17524. 'g': true,
  17525. 'line': true,
  17526. 'linearGradient': true,
  17527. 'path': true,
  17528. 'polygon': true,
  17529. 'polyline': true,
  17530. 'radialGradient': true,
  17531. 'rect': true,
  17532. 'stop': true,
  17533. 'text': true
  17534. };
  17535. var selectWrap = [1, '<select multiple="true">', '</select>'];
  17536. var tableWrap = [1, '<table>', '</table>'];
  17537. var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  17538. var svgWrap = [1, '<svg>', '</svg>'];
  17539. var markupWrap = {
  17540. '*': [1, '?<div>', '</div>'],
  17541. 'area': [1, '<map>', '</map>'],
  17542. 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
  17543. 'legend': [1, '<fieldset>', '</fieldset>'],
  17544. 'param': [1, '<object>', '</object>'],
  17545. 'tr': [2, '<table><tbody>', '</tbody></table>'],
  17546. 'optgroup': selectWrap,
  17547. 'option': selectWrap,
  17548. 'caption': tableWrap,
  17549. 'colgroup': tableWrap,
  17550. 'tbody': tableWrap,
  17551. 'tfoot': tableWrap,
  17552. 'thead': tableWrap,
  17553. 'td': trWrap,
  17554. 'th': trWrap,
  17555. 'circle': svgWrap,
  17556. 'clipPath': svgWrap,
  17557. 'defs': svgWrap,
  17558. 'ellipse': svgWrap,
  17559. 'g': svgWrap,
  17560. 'line': svgWrap,
  17561. 'linearGradient': svgWrap,
  17562. 'path': svgWrap,
  17563. 'polygon': svgWrap,
  17564. 'polyline': svgWrap,
  17565. 'radialGradient': svgWrap,
  17566. 'rect': svgWrap,
  17567. 'stop': svgWrap,
  17568. 'text': svgWrap
  17569. };
  17570. /**
  17571. * Gets the markup wrap configuration for the supplied `nodeName`.
  17572. *
  17573. * NOTE: This lazily detects which wraps are necessary for the current browser.
  17574. *
  17575. * @param {string} nodeName Lowercase `nodeName`.
  17576. * @return {?array} Markup wrap configuration, if applicable.
  17577. */
  17578. function getMarkupWrap(nodeName) {
  17579. ("production" !== "development" ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));
  17580. if (!markupWrap.hasOwnProperty(nodeName)) {
  17581. nodeName = '*';
  17582. }
  17583. if (!shouldWrap.hasOwnProperty(nodeName)) {
  17584. if (nodeName === '*') {
  17585. dummyNode.innerHTML = '<link />';
  17586. } else {
  17587. dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
  17588. }
  17589. shouldWrap[nodeName] = !dummyNode.firstChild;
  17590. }
  17591. return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
  17592. }
  17593. module.exports = getMarkupWrap;
  17594. },{"150":150,"22":22}],143:[function(_dereq_,module,exports){
  17595. /**
  17596. * Copyright 2013-2015, Facebook, Inc.
  17597. * All rights reserved.
  17598. *
  17599. * This source code is licensed under the BSD-style license found in the
  17600. * LICENSE file in the root directory of this source tree. An additional grant
  17601. * of patent rights can be found in the PATENTS file in the same directory.
  17602. *
  17603. * @providesModule getNodeForCharacterOffset
  17604. */
  17605. 'use strict';
  17606. /**
  17607. * Given any node return the first leaf node without children.
  17608. *
  17609. * @param {DOMElement|DOMTextNode} node
  17610. * @return {DOMElement|DOMTextNode}
  17611. */
  17612. function getLeafNode(node) {
  17613. while (node && node.firstChild) {
  17614. node = node.firstChild;
  17615. }
  17616. return node;
  17617. }
  17618. /**
  17619. * Get the next sibling within a container. This will walk up the
  17620. * DOM if a node's siblings have been exhausted.
  17621. *
  17622. * @param {DOMElement|DOMTextNode} node
  17623. * @return {?DOMElement|DOMTextNode}
  17624. */
  17625. function getSiblingNode(node) {
  17626. while (node) {
  17627. if (node.nextSibling) {
  17628. return node.nextSibling;
  17629. }
  17630. node = node.parentNode;
  17631. }
  17632. }
  17633. /**
  17634. * Get object describing the nodes which contain characters at offset.
  17635. *
  17636. * @param {DOMElement|DOMTextNode} root
  17637. * @param {number} offset
  17638. * @return {?object}
  17639. */
  17640. function getNodeForCharacterOffset(root, offset) {
  17641. var node = getLeafNode(root);
  17642. var nodeStart = 0;
  17643. var nodeEnd = 0;
  17644. while (node) {
  17645. if (node.nodeType === 3) {
  17646. nodeEnd = nodeStart + node.textContent.length;
  17647. if (nodeStart <= offset && nodeEnd >= offset) {
  17648. return {
  17649. node: node,
  17650. offset: offset - nodeStart
  17651. };
  17652. }
  17653. nodeStart = nodeEnd;
  17654. }
  17655. node = getLeafNode(getSiblingNode(node));
  17656. }
  17657. }
  17658. module.exports = getNodeForCharacterOffset;
  17659. },{}],144:[function(_dereq_,module,exports){
  17660. /**
  17661. * Copyright 2013-2015, Facebook, Inc.
  17662. * All rights reserved.
  17663. *
  17664. * This source code is licensed under the BSD-style license found in the
  17665. * LICENSE file in the root directory of this source tree. An additional grant
  17666. * of patent rights can be found in the PATENTS file in the same directory.
  17667. *
  17668. * @providesModule getReactRootElementInContainer
  17669. */
  17670. 'use strict';
  17671. var DOC_NODE_TYPE = 9;
  17672. /**
  17673. * @param {DOMElement|DOMDocument} container DOM element that may contain
  17674. * a React component
  17675. * @return {?*} DOM element that may have the reactRoot ID, or null.
  17676. */
  17677. function getReactRootElementInContainer(container) {
  17678. if (!container) {
  17679. return null;
  17680. }
  17681. if (container.nodeType === DOC_NODE_TYPE) {
  17682. return container.documentElement;
  17683. } else {
  17684. return container.firstChild;
  17685. }
  17686. }
  17687. module.exports = getReactRootElementInContainer;
  17688. },{}],145:[function(_dereq_,module,exports){
  17689. /**
  17690. * Copyright 2013-2015, Facebook, Inc.
  17691. * All rights reserved.
  17692. *
  17693. * This source code is licensed under the BSD-style license found in the
  17694. * LICENSE file in the root directory of this source tree. An additional grant
  17695. * of patent rights can be found in the PATENTS file in the same directory.
  17696. *
  17697. * @providesModule getTextContentAccessor
  17698. */
  17699. 'use strict';
  17700. var ExecutionEnvironment = _dereq_(22);
  17701. var contentKey = null;
  17702. /**
  17703. * Gets the key used to access text content on a DOM node.
  17704. *
  17705. * @return {?string} Key used to access text content.
  17706. * @internal
  17707. */
  17708. function getTextContentAccessor() {
  17709. if (!contentKey && ExecutionEnvironment.canUseDOM) {
  17710. // Prefer textContent to innerText because many browsers support both but
  17711. // SVG <text> elements don't support innerText even when <div> does.
  17712. contentKey = 'textContent' in document.documentElement ?
  17713. 'textContent' :
  17714. 'innerText';
  17715. }
  17716. return contentKey;
  17717. }
  17718. module.exports = getTextContentAccessor;
  17719. },{"22":22}],146:[function(_dereq_,module,exports){
  17720. /**
  17721. * Copyright 2013-2015, Facebook, Inc.
  17722. * All rights reserved.
  17723. *
  17724. * This source code is licensed under the BSD-style license found in the
  17725. * LICENSE file in the root directory of this source tree. An additional grant
  17726. * of patent rights can be found in the PATENTS file in the same directory.
  17727. *
  17728. * @providesModule getUnboundedScrollPosition
  17729. * @typechecks
  17730. */
  17731. "use strict";
  17732. /**
  17733. * Gets the scroll position of the supplied element or window.
  17734. *
  17735. * The return values are unbounded, unlike `getScrollPosition`. This means they
  17736. * may be negative or exceed the element boundaries (which is possible using
  17737. * inertial scrolling).
  17738. *
  17739. * @param {DOMWindow|DOMElement} scrollable
  17740. * @return {object} Map with `x` and `y` keys.
  17741. */
  17742. function getUnboundedScrollPosition(scrollable) {
  17743. if (scrollable === window) {
  17744. return {
  17745. x: window.pageXOffset || document.documentElement.scrollLeft,
  17746. y: window.pageYOffset || document.documentElement.scrollTop
  17747. };
  17748. }
  17749. return {
  17750. x: scrollable.scrollLeft,
  17751. y: scrollable.scrollTop
  17752. };
  17753. }
  17754. module.exports = getUnboundedScrollPosition;
  17755. },{}],147:[function(_dereq_,module,exports){
  17756. /**
  17757. * Copyright 2013-2015, Facebook, Inc.
  17758. * All rights reserved.
  17759. *
  17760. * This source code is licensed under the BSD-style license found in the
  17761. * LICENSE file in the root directory of this source tree. An additional grant
  17762. * of patent rights can be found in the PATENTS file in the same directory.
  17763. *
  17764. * @providesModule hyphenate
  17765. * @typechecks
  17766. */
  17767. var _uppercasePattern = /([A-Z])/g;
  17768. /**
  17769. * Hyphenates a camelcased string, for example:
  17770. *
  17771. * > hyphenate('backgroundColor')
  17772. * < "background-color"
  17773. *
  17774. * For CSS style names, use `hyphenateStyleName` instead which works properly
  17775. * with all vendor prefixes, including `ms`.
  17776. *
  17777. * @param {string} string
  17778. * @return {string}
  17779. */
  17780. function hyphenate(string) {
  17781. return string.replace(_uppercasePattern, '-$1').toLowerCase();
  17782. }
  17783. module.exports = hyphenate;
  17784. },{}],148:[function(_dereq_,module,exports){
  17785. /**
  17786. * Copyright 2013-2015, Facebook, Inc.
  17787. * All rights reserved.
  17788. *
  17789. * This source code is licensed under the BSD-style license found in the
  17790. * LICENSE file in the root directory of this source tree. An additional grant
  17791. * of patent rights can be found in the PATENTS file in the same directory.
  17792. *
  17793. * @providesModule hyphenateStyleName
  17794. * @typechecks
  17795. */
  17796. "use strict";
  17797. var hyphenate = _dereq_(147);
  17798. var msPattern = /^ms-/;
  17799. /**
  17800. * Hyphenates a camelcased CSS property name, for example:
  17801. *
  17802. * > hyphenateStyleName('backgroundColor')
  17803. * < "background-color"
  17804. * > hyphenateStyleName('MozTransition')
  17805. * < "-moz-transition"
  17806. * > hyphenateStyleName('msTransition')
  17807. * < "-ms-transition"
  17808. *
  17809. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  17810. * is converted to `-ms-`.
  17811. *
  17812. * @param {string} string
  17813. * @return {string}
  17814. */
  17815. function hyphenateStyleName(string) {
  17816. return hyphenate(string).replace(msPattern, '-ms-');
  17817. }
  17818. module.exports = hyphenateStyleName;
  17819. },{"147":147}],149:[function(_dereq_,module,exports){
  17820. /**
  17821. * Copyright 2013-2015, Facebook, Inc.
  17822. * All rights reserved.
  17823. *
  17824. * This source code is licensed under the BSD-style license found in the
  17825. * LICENSE file in the root directory of this source tree. An additional grant
  17826. * of patent rights can be found in the PATENTS file in the same directory.
  17827. *
  17828. * @providesModule instantiateReactComponent
  17829. * @typechecks static-only
  17830. */
  17831. 'use strict';
  17832. var ReactCompositeComponent = _dereq_(43);
  17833. var ReactEmptyComponent = _dereq_(65);
  17834. var ReactNativeComponent = _dereq_(80);
  17835. var assign = _dereq_(29);
  17836. var invariant = _dereq_(150);
  17837. var warning = _dereq_(171);
  17838. // To avoid a cyclic dependency, we create the final class in this module
  17839. var ReactCompositeComponentWrapper = function() { };
  17840. assign(
  17841. ReactCompositeComponentWrapper.prototype,
  17842. ReactCompositeComponent.Mixin,
  17843. {
  17844. _instantiateReactComponent: instantiateReactComponent
  17845. }
  17846. );
  17847. /**
  17848. * Check if the type reference is a known internal type. I.e. not a user
  17849. * provided composite type.
  17850. *
  17851. * @param {function} type
  17852. * @return {boolean} Returns true if this is a valid internal type.
  17853. */
  17854. function isInternalComponentType(type) {
  17855. return (
  17856. typeof type === 'function' &&
  17857. typeof type.prototype !== 'undefined' &&
  17858. typeof type.prototype.mountComponent === 'function' &&
  17859. typeof type.prototype.receiveComponent === 'function'
  17860. );
  17861. }
  17862. /**
  17863. * Given a ReactNode, create an instance that will actually be mounted.
  17864. *
  17865. * @param {ReactNode} node
  17866. * @param {*} parentCompositeType The composite type that resolved this.
  17867. * @return {object} A new instance of the element's constructor.
  17868. * @protected
  17869. */
  17870. function instantiateReactComponent(node, parentCompositeType) {
  17871. var instance;
  17872. if (node === null || node === false) {
  17873. node = ReactEmptyComponent.emptyElement;
  17874. }
  17875. if (typeof node === 'object') {
  17876. var element = node;
  17877. if ("production" !== "development") {
  17878. ("production" !== "development" ? warning(
  17879. element && (typeof element.type === 'function' ||
  17880. typeof element.type === 'string'),
  17881. 'Only functions or strings can be mounted as React components.'
  17882. ) : null);
  17883. }
  17884. // Special case string values
  17885. if (parentCompositeType === element.type &&
  17886. typeof element.type === 'string') {
  17887. // Avoid recursion if the wrapper renders itself.
  17888. instance = ReactNativeComponent.createInternalComponent(element);
  17889. // All native components are currently wrapped in a composite so we're
  17890. // safe to assume that this is what we should instantiate.
  17891. } else if (isInternalComponentType(element.type)) {
  17892. // This is temporarily available for custom components that are not string
  17893. // represenations. I.e. ART. Once those are updated to use the string
  17894. // representation, we can drop this code path.
  17895. instance = new element.type(element);
  17896. } else {
  17897. instance = new ReactCompositeComponentWrapper();
  17898. }
  17899. } else if (typeof node === 'string' || typeof node === 'number') {
  17900. instance = ReactNativeComponent.createInstanceForText(node);
  17901. } else {
  17902. ("production" !== "development" ? invariant(
  17903. false,
  17904. 'Encountered invalid React node of type %s',
  17905. typeof node
  17906. ) : invariant(false));
  17907. }
  17908. if ("production" !== "development") {
  17909. ("production" !== "development" ? warning(
  17910. typeof instance.construct === 'function' &&
  17911. typeof instance.mountComponent === 'function' &&
  17912. typeof instance.receiveComponent === 'function' &&
  17913. typeof instance.unmountComponent === 'function',
  17914. 'Only React Components can be mounted.'
  17915. ) : null);
  17916. }
  17917. // Sets up the instance. This can probably just move into the constructor now.
  17918. instance.construct(node);
  17919. // These two fields are used by the DOM and ART diffing algorithms
  17920. // respectively. Instead of using expandos on components, we should be
  17921. // storing the state needed by the diffing algorithms elsewhere.
  17922. instance._mountIndex = 0;
  17923. instance._mountImage = null;
  17924. if ("production" !== "development") {
  17925. instance._isOwnerNecessary = false;
  17926. instance._warnedAboutRefsInRender = false;
  17927. }
  17928. // Internal instances should fully constructed at this point, so they should
  17929. // not get any new fields added to them at this point.
  17930. if ("production" !== "development") {
  17931. if (Object.preventExtensions) {
  17932. Object.preventExtensions(instance);
  17933. }
  17934. }
  17935. return instance;
  17936. }
  17937. module.exports = instantiateReactComponent;
  17938. },{"150":150,"171":171,"29":29,"43":43,"65":65,"80":80}],150:[function(_dereq_,module,exports){
  17939. /**
  17940. * Copyright 2013-2015, Facebook, Inc.
  17941. * All rights reserved.
  17942. *
  17943. * This source code is licensed under the BSD-style license found in the
  17944. * LICENSE file in the root directory of this source tree. An additional grant
  17945. * of patent rights can be found in the PATENTS file in the same directory.
  17946. *
  17947. * @providesModule invariant
  17948. */
  17949. "use strict";
  17950. /**
  17951. * Use invariant() to assert state which your program assumes to be true.
  17952. *
  17953. * Provide sprintf-style format (only %s is supported) and arguments
  17954. * to provide information about what broke and what you were
  17955. * expecting.
  17956. *
  17957. * The invariant message will be stripped in production, but the invariant
  17958. * will remain to ensure logic does not differ in production.
  17959. */
  17960. var invariant = function(condition, format, a, b, c, d, e, f) {
  17961. if ("production" !== "development") {
  17962. if (format === undefined) {
  17963. throw new Error('invariant requires an error message argument');
  17964. }
  17965. }
  17966. if (!condition) {
  17967. var error;
  17968. if (format === undefined) {
  17969. error = new Error(
  17970. 'Minified exception occurred; use the non-minified dev environment ' +
  17971. 'for the full error message and additional helpful warnings.'
  17972. );
  17973. } else {
  17974. var args = [a, b, c, d, e, f];
  17975. var argIndex = 0;
  17976. error = new Error(
  17977. 'Invariant Violation: ' +
  17978. format.replace(/%s/g, function() { return args[argIndex++]; })
  17979. );
  17980. }
  17981. error.framesToPop = 1; // we don't care about invariant's own frame
  17982. throw error;
  17983. }
  17984. };
  17985. module.exports = invariant;
  17986. },{}],151:[function(_dereq_,module,exports){
  17987. /**
  17988. * Copyright 2013-2015, Facebook, Inc.
  17989. * All rights reserved.
  17990. *
  17991. * This source code is licensed under the BSD-style license found in the
  17992. * LICENSE file in the root directory of this source tree. An additional grant
  17993. * of patent rights can be found in the PATENTS file in the same directory.
  17994. *
  17995. * @providesModule isEventSupported
  17996. */
  17997. 'use strict';
  17998. var ExecutionEnvironment = _dereq_(22);
  17999. var useHasFeature;
  18000. if (ExecutionEnvironment.canUseDOM) {
  18001. useHasFeature =
  18002. document.implementation &&
  18003. document.implementation.hasFeature &&
  18004. // always returns true in newer browsers as per the standard.
  18005. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  18006. document.implementation.hasFeature('', '') !== true;
  18007. }
  18008. /**
  18009. * Checks if an event is supported in the current execution environment.
  18010. *
  18011. * NOTE: This will not work correctly for non-generic events such as `change`,
  18012. * `reset`, `load`, `error`, and `select`.
  18013. *
  18014. * Borrows from Modernizr.
  18015. *
  18016. * @param {string} eventNameSuffix Event name, e.g. "click".
  18017. * @param {?boolean} capture Check if the capture phase is supported.
  18018. * @return {boolean} True if the event is supported.
  18019. * @internal
  18020. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  18021. */
  18022. function isEventSupported(eventNameSuffix, capture) {
  18023. if (!ExecutionEnvironment.canUseDOM ||
  18024. capture && !('addEventListener' in document)) {
  18025. return false;
  18026. }
  18027. var eventName = 'on' + eventNameSuffix;
  18028. var isSupported = eventName in document;
  18029. if (!isSupported) {
  18030. var element = document.createElement('div');
  18031. element.setAttribute(eventName, 'return;');
  18032. isSupported = typeof element[eventName] === 'function';
  18033. }
  18034. if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
  18035. // This is the only way to test support for the `wheel` event in IE9+.
  18036. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  18037. }
  18038. return isSupported;
  18039. }
  18040. module.exports = isEventSupported;
  18041. },{"22":22}],152:[function(_dereq_,module,exports){
  18042. /**
  18043. * Copyright 2013-2015, Facebook, Inc.
  18044. * All rights reserved.
  18045. *
  18046. * This source code is licensed under the BSD-style license found in the
  18047. * LICENSE file in the root directory of this source tree. An additional grant
  18048. * of patent rights can be found in the PATENTS file in the same directory.
  18049. *
  18050. * @providesModule isNode
  18051. * @typechecks
  18052. */
  18053. /**
  18054. * @param {*} object The object to check.
  18055. * @return {boolean} Whether or not the object is a DOM node.
  18056. */
  18057. function isNode(object) {
  18058. return !!(object && (
  18059. ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
  18060. typeof object.nodeType === 'number' &&
  18061. typeof object.nodeName === 'string'))
  18062. ));
  18063. }
  18064. module.exports = isNode;
  18065. },{}],153:[function(_dereq_,module,exports){
  18066. /**
  18067. * Copyright 2013-2015, Facebook, Inc.
  18068. * All rights reserved.
  18069. *
  18070. * This source code is licensed under the BSD-style license found in the
  18071. * LICENSE file in the root directory of this source tree. An additional grant
  18072. * of patent rights can be found in the PATENTS file in the same directory.
  18073. *
  18074. * @providesModule isTextInputElement
  18075. */
  18076. 'use strict';
  18077. /**
  18078. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  18079. */
  18080. var supportedInputTypes = {
  18081. 'color': true,
  18082. 'date': true,
  18083. 'datetime': true,
  18084. 'datetime-local': true,
  18085. 'email': true,
  18086. 'month': true,
  18087. 'number': true,
  18088. 'password': true,
  18089. 'range': true,
  18090. 'search': true,
  18091. 'tel': true,
  18092. 'text': true,
  18093. 'time': true,
  18094. 'url': true,
  18095. 'week': true
  18096. };
  18097. function isTextInputElement(elem) {
  18098. return elem && (
  18099. (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')
  18100. );
  18101. }
  18102. module.exports = isTextInputElement;
  18103. },{}],154:[function(_dereq_,module,exports){
  18104. /**
  18105. * Copyright 2013-2015, Facebook, Inc.
  18106. * All rights reserved.
  18107. *
  18108. * This source code is licensed under the BSD-style license found in the
  18109. * LICENSE file in the root directory of this source tree. An additional grant
  18110. * of patent rights can be found in the PATENTS file in the same directory.
  18111. *
  18112. * @providesModule isTextNode
  18113. * @typechecks
  18114. */
  18115. var isNode = _dereq_(152);
  18116. /**
  18117. * @param {*} object The object to check.
  18118. * @return {boolean} Whether or not the object is a DOM text node.
  18119. */
  18120. function isTextNode(object) {
  18121. return isNode(object) && object.nodeType == 3;
  18122. }
  18123. module.exports = isTextNode;
  18124. },{"152":152}],155:[function(_dereq_,module,exports){
  18125. /**
  18126. * Copyright 2013-2015, Facebook, Inc.
  18127. * All rights reserved.
  18128. *
  18129. * This source code is licensed under the BSD-style license found in the
  18130. * LICENSE file in the root directory of this source tree. An additional grant
  18131. * of patent rights can be found in the PATENTS file in the same directory.
  18132. *
  18133. * @providesModule joinClasses
  18134. * @typechecks static-only
  18135. */
  18136. 'use strict';
  18137. /**
  18138. * Combines multiple className strings into one.
  18139. * http://jsperf.com/joinclasses-args-vs-array
  18140. *
  18141. * @param {...?string} classes
  18142. * @return {string}
  18143. */
  18144. function joinClasses(className/*, ... */) {
  18145. if (!className) {
  18146. className = '';
  18147. }
  18148. var nextClass;
  18149. var argLength = arguments.length;
  18150. if (argLength > 1) {
  18151. for (var ii = 1; ii < argLength; ii++) {
  18152. nextClass = arguments[ii];
  18153. if (nextClass) {
  18154. className = (className ? className + ' ' : '') + nextClass;
  18155. }
  18156. }
  18157. }
  18158. return className;
  18159. }
  18160. module.exports = joinClasses;
  18161. },{}],156:[function(_dereq_,module,exports){
  18162. /**
  18163. * Copyright 2013-2015, Facebook, Inc.
  18164. * All rights reserved.
  18165. *
  18166. * This source code is licensed under the BSD-style license found in the
  18167. * LICENSE file in the root directory of this source tree. An additional grant
  18168. * of patent rights can be found in the PATENTS file in the same directory.
  18169. *
  18170. * @providesModule keyMirror
  18171. * @typechecks static-only
  18172. */
  18173. 'use strict';
  18174. var invariant = _dereq_(150);
  18175. /**
  18176. * Constructs an enumeration with keys equal to their value.
  18177. *
  18178. * For example:
  18179. *
  18180. * var COLORS = keyMirror({blue: null, red: null});
  18181. * var myColor = COLORS.blue;
  18182. * var isColorValid = !!COLORS[myColor];
  18183. *
  18184. * The last line could not be performed if the values of the generated enum were
  18185. * not equal to their keys.
  18186. *
  18187. * Input: {key1: val1, key2: val2}
  18188. * Output: {key1: key1, key2: key2}
  18189. *
  18190. * @param {object} obj
  18191. * @return {object}
  18192. */
  18193. var keyMirror = function(obj) {
  18194. var ret = {};
  18195. var key;
  18196. ("production" !== "development" ? invariant(
  18197. obj instanceof Object && !Array.isArray(obj),
  18198. 'keyMirror(...): Argument must be an object.'
  18199. ) : invariant(obj instanceof Object && !Array.isArray(obj)));
  18200. for (key in obj) {
  18201. if (!obj.hasOwnProperty(key)) {
  18202. continue;
  18203. }
  18204. ret[key] = key;
  18205. }
  18206. return ret;
  18207. };
  18208. module.exports = keyMirror;
  18209. },{"150":150}],157:[function(_dereq_,module,exports){
  18210. /**
  18211. * Copyright 2013-2015, Facebook, Inc.
  18212. * All rights reserved.
  18213. *
  18214. * This source code is licensed under the BSD-style license found in the
  18215. * LICENSE file in the root directory of this source tree. An additional grant
  18216. * of patent rights can be found in the PATENTS file in the same directory.
  18217. *
  18218. * @providesModule keyOf
  18219. */
  18220. /**
  18221. * Allows extraction of a minified key. Let's the build system minify keys
  18222. * without loosing the ability to dynamically use key strings as values
  18223. * themselves. Pass in an object with a single key/val pair and it will return
  18224. * you the string key of that single record. Suppose you want to grab the
  18225. * value for a key 'className' inside of an object. Key/val minification may
  18226. * have aliased that key to be 'xa12'. keyOf({className: null}) will return
  18227. * 'xa12' in that case. Resolve keys you want to use once at startup time, then
  18228. * reuse those resolutions.
  18229. */
  18230. var keyOf = function(oneKeyObj) {
  18231. var key;
  18232. for (key in oneKeyObj) {
  18233. if (!oneKeyObj.hasOwnProperty(key)) {
  18234. continue;
  18235. }
  18236. return key;
  18237. }
  18238. return null;
  18239. };
  18240. module.exports = keyOf;
  18241. },{}],158:[function(_dereq_,module,exports){
  18242. /**
  18243. * Copyright 2013-2015, Facebook, Inc.
  18244. * All rights reserved.
  18245. *
  18246. * This source code is licensed under the BSD-style license found in the
  18247. * LICENSE file in the root directory of this source tree. An additional grant
  18248. * of patent rights can be found in the PATENTS file in the same directory.
  18249. *
  18250. * @providesModule mapObject
  18251. */
  18252. 'use strict';
  18253. var hasOwnProperty = Object.prototype.hasOwnProperty;
  18254. /**
  18255. * Executes the provided `callback` once for each enumerable own property in the
  18256. * object and constructs a new object from the results. The `callback` is
  18257. * invoked with three arguments:
  18258. *
  18259. * - the property value
  18260. * - the property name
  18261. * - the object being traversed
  18262. *
  18263. * Properties that are added after the call to `mapObject` will not be visited
  18264. * by `callback`. If the values of existing properties are changed, the value
  18265. * passed to `callback` will be the value at the time `mapObject` visits them.
  18266. * Properties that are deleted before being visited are not visited.
  18267. *
  18268. * @grep function objectMap()
  18269. * @grep function objMap()
  18270. *
  18271. * @param {?object} object
  18272. * @param {function} callback
  18273. * @param {*} context
  18274. * @return {?object}
  18275. */
  18276. function mapObject(object, callback, context) {
  18277. if (!object) {
  18278. return null;
  18279. }
  18280. var result = {};
  18281. for (var name in object) {
  18282. if (hasOwnProperty.call(object, name)) {
  18283. result[name] = callback.call(context, object[name], name, object);
  18284. }
  18285. }
  18286. return result;
  18287. }
  18288. module.exports = mapObject;
  18289. },{}],159:[function(_dereq_,module,exports){
  18290. /**
  18291. * Copyright 2013-2015, Facebook, Inc.
  18292. * All rights reserved.
  18293. *
  18294. * This source code is licensed under the BSD-style license found in the
  18295. * LICENSE file in the root directory of this source tree. An additional grant
  18296. * of patent rights can be found in the PATENTS file in the same directory.
  18297. *
  18298. * @providesModule memoizeStringOnly
  18299. * @typechecks static-only
  18300. */
  18301. 'use strict';
  18302. /**
  18303. * Memoizes the return value of a function that accepts one string argument.
  18304. *
  18305. * @param {function} callback
  18306. * @return {function}
  18307. */
  18308. function memoizeStringOnly(callback) {
  18309. var cache = {};
  18310. return function(string) {
  18311. if (!cache.hasOwnProperty(string)) {
  18312. cache[string] = callback.call(this, string);
  18313. }
  18314. return cache[string];
  18315. };
  18316. }
  18317. module.exports = memoizeStringOnly;
  18318. },{}],160:[function(_dereq_,module,exports){
  18319. /**
  18320. * Copyright 2013-2015, Facebook, Inc.
  18321. * All rights reserved.
  18322. *
  18323. * This source code is licensed under the BSD-style license found in the
  18324. * LICENSE file in the root directory of this source tree. An additional grant
  18325. * of patent rights can be found in the PATENTS file in the same directory.
  18326. *
  18327. * @providesModule onlyChild
  18328. */
  18329. 'use strict';
  18330. var ReactElement = _dereq_(63);
  18331. var invariant = _dereq_(150);
  18332. /**
  18333. * Returns the first child in a collection of children and verifies that there
  18334. * is only one child in the collection. The current implementation of this
  18335. * function assumes that a single child gets passed without a wrapper, but the
  18336. * purpose of this helper function is to abstract away the particular structure
  18337. * of children.
  18338. *
  18339. * @param {?object} children Child collection structure.
  18340. * @return {ReactComponent} The first and only `ReactComponent` contained in the
  18341. * structure.
  18342. */
  18343. function onlyChild(children) {
  18344. ("production" !== "development" ? invariant(
  18345. ReactElement.isValidElement(children),
  18346. 'onlyChild must be passed a children with exactly one child.'
  18347. ) : invariant(ReactElement.isValidElement(children)));
  18348. return children;
  18349. }
  18350. module.exports = onlyChild;
  18351. },{"150":150,"63":63}],161:[function(_dereq_,module,exports){
  18352. /**
  18353. * Copyright 2013-2015, Facebook, Inc.
  18354. * All rights reserved.
  18355. *
  18356. * This source code is licensed under the BSD-style license found in the
  18357. * LICENSE file in the root directory of this source tree. An additional grant
  18358. * of patent rights can be found in the PATENTS file in the same directory.
  18359. *
  18360. * @providesModule performance
  18361. * @typechecks
  18362. */
  18363. "use strict";
  18364. var ExecutionEnvironment = _dereq_(22);
  18365. var performance;
  18366. if (ExecutionEnvironment.canUseDOM) {
  18367. performance =
  18368. window.performance ||
  18369. window.msPerformance ||
  18370. window.webkitPerformance;
  18371. }
  18372. module.exports = performance || {};
  18373. },{"22":22}],162:[function(_dereq_,module,exports){
  18374. /**
  18375. * Copyright 2013-2015, Facebook, Inc.
  18376. * All rights reserved.
  18377. *
  18378. * This source code is licensed under the BSD-style license found in the
  18379. * LICENSE file in the root directory of this source tree. An additional grant
  18380. * of patent rights can be found in the PATENTS file in the same directory.
  18381. *
  18382. * @providesModule performanceNow
  18383. * @typechecks
  18384. */
  18385. var performance = _dereq_(161);
  18386. /**
  18387. * Detect if we can use `window.performance.now()` and gracefully fallback to
  18388. * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
  18389. * because of Facebook's testing infrastructure.
  18390. */
  18391. if (!performance || !performance.now) {
  18392. performance = Date;
  18393. }
  18394. var performanceNow = performance.now.bind(performance);
  18395. module.exports = performanceNow;
  18396. },{"161":161}],163:[function(_dereq_,module,exports){
  18397. /**
  18398. * Copyright 2013-2015, Facebook, Inc.
  18399. * All rights reserved.
  18400. *
  18401. * This source code is licensed under the BSD-style license found in the
  18402. * LICENSE file in the root directory of this source tree. An additional grant
  18403. * of patent rights can be found in the PATENTS file in the same directory.
  18404. *
  18405. * @providesModule quoteAttributeValueForBrowser
  18406. */
  18407. 'use strict';
  18408. var escapeTextContentForBrowser = _dereq_(131);
  18409. /**
  18410. * Escapes attribute value to prevent scripting attacks.
  18411. *
  18412. * @param {*} value Value to escape.
  18413. * @return {string} An escaped string.
  18414. */
  18415. function quoteAttributeValueForBrowser(value) {
  18416. return '"' + escapeTextContentForBrowser(value) + '"';
  18417. }
  18418. module.exports = quoteAttributeValueForBrowser;
  18419. },{"131":131}],164:[function(_dereq_,module,exports){
  18420. /**
  18421. * Copyright 2013-2015, Facebook, Inc.
  18422. * All rights reserved.
  18423. *
  18424. * This source code is licensed under the BSD-style license found in the
  18425. * LICENSE file in the root directory of this source tree. An additional grant
  18426. * of patent rights can be found in the PATENTS file in the same directory.
  18427. *
  18428. * @providesModule setInnerHTML
  18429. */
  18430. /* globals MSApp */
  18431. 'use strict';
  18432. var ExecutionEnvironment = _dereq_(22);
  18433. var WHITESPACE_TEST = /^[ \r\n\t\f]/;
  18434. var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
  18435. /**
  18436. * Set the innerHTML property of a node, ensuring that whitespace is preserved
  18437. * even in IE8.
  18438. *
  18439. * @param {DOMElement} node
  18440. * @param {string} html
  18441. * @internal
  18442. */
  18443. var setInnerHTML = function(node, html) {
  18444. node.innerHTML = html;
  18445. };
  18446. // Win8 apps: Allow all html to be inserted
  18447. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  18448. setInnerHTML = function(node, html) {
  18449. MSApp.execUnsafeLocalFunction(function() {
  18450. node.innerHTML = html;
  18451. });
  18452. };
  18453. }
  18454. if (ExecutionEnvironment.canUseDOM) {
  18455. // IE8: When updating a just created node with innerHTML only leading
  18456. // whitespace is removed. When updating an existing node with innerHTML
  18457. // whitespace in root TextNodes is also collapsed.
  18458. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
  18459. // Feature detection; only IE8 is known to behave improperly like this.
  18460. var testElement = document.createElement('div');
  18461. testElement.innerHTML = ' ';
  18462. if (testElement.innerHTML === '') {
  18463. setInnerHTML = function(node, html) {
  18464. // Magic theory: IE8 supposedly differentiates between added and updated
  18465. // nodes when processing innerHTML, innerHTML on updated nodes suffers
  18466. // from worse whitespace behavior. Re-adding a node like this triggers
  18467. // the initial and more favorable whitespace behavior.
  18468. // TODO: What to do on a detached node?
  18469. if (node.parentNode) {
  18470. node.parentNode.replaceChild(node, node);
  18471. }
  18472. // We also implement a workaround for non-visible tags disappearing into
  18473. // thin air on IE8, this only happens if there is no visible text
  18474. // in-front of the non-visible tags. Piggyback on the whitespace fix
  18475. // and simply check if any non-visible tags appear in the source.
  18476. if (WHITESPACE_TEST.test(html) ||
  18477. html[0] === '<' && NONVISIBLE_TEST.test(html)) {
  18478. // Recover leading whitespace by temporarily prepending any character.
  18479. // \uFEFF has the potential advantage of being zero-width/invisible.
  18480. node.innerHTML = '\uFEFF' + html;
  18481. // deleteData leaves an empty `TextNode` which offsets the index of all
  18482. // children. Definitely want to avoid this.
  18483. var textNode = node.firstChild;
  18484. if (textNode.data.length === 1) {
  18485. node.removeChild(textNode);
  18486. } else {
  18487. textNode.deleteData(0, 1);
  18488. }
  18489. } else {
  18490. node.innerHTML = html;
  18491. }
  18492. };
  18493. }
  18494. }
  18495. module.exports = setInnerHTML;
  18496. },{"22":22}],165:[function(_dereq_,module,exports){
  18497. /**
  18498. * Copyright 2013-2015, Facebook, Inc.
  18499. * All rights reserved.
  18500. *
  18501. * This source code is licensed under the BSD-style license found in the
  18502. * LICENSE file in the root directory of this source tree. An additional grant
  18503. * of patent rights can be found in the PATENTS file in the same directory.
  18504. *
  18505. * @providesModule setTextContent
  18506. */
  18507. 'use strict';
  18508. var ExecutionEnvironment = _dereq_(22);
  18509. var escapeTextContentForBrowser = _dereq_(131);
  18510. var setInnerHTML = _dereq_(164);
  18511. /**
  18512. * Set the textContent property of a node, ensuring that whitespace is preserved
  18513. * even in IE8. innerText is a poor substitute for textContent and, among many
  18514. * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
  18515. * as it should.
  18516. *
  18517. * @param {DOMElement} node
  18518. * @param {string} text
  18519. * @internal
  18520. */
  18521. var setTextContent = function(node, text) {
  18522. node.textContent = text;
  18523. };
  18524. if (ExecutionEnvironment.canUseDOM) {
  18525. if (!('textContent' in document.documentElement)) {
  18526. setTextContent = function(node, text) {
  18527. setInnerHTML(node, escapeTextContentForBrowser(text));
  18528. };
  18529. }
  18530. }
  18531. module.exports = setTextContent;
  18532. },{"131":131,"164":164,"22":22}],166:[function(_dereq_,module,exports){
  18533. /**
  18534. * Copyright 2013-2015, Facebook, Inc.
  18535. * All rights reserved.
  18536. *
  18537. * This source code is licensed under the BSD-style license found in the
  18538. * LICENSE file in the root directory of this source tree. An additional grant
  18539. * of patent rights can be found in the PATENTS file in the same directory.
  18540. *
  18541. * @providesModule shallowEqual
  18542. */
  18543. 'use strict';
  18544. /**
  18545. * Performs equality by iterating through keys on an object and returning
  18546. * false when any key has values which are not strictly equal between
  18547. * objA and objB. Returns true when the values of all keys are strictly equal.
  18548. *
  18549. * @return {boolean}
  18550. */
  18551. function shallowEqual(objA, objB) {
  18552. if (objA === objB) {
  18553. return true;
  18554. }
  18555. var key;
  18556. // Test for A's keys different from B.
  18557. for (key in objA) {
  18558. if (objA.hasOwnProperty(key) &&
  18559. (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
  18560. return false;
  18561. }
  18562. }
  18563. // Test for B's keys missing from A.
  18564. for (key in objB) {
  18565. if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
  18566. return false;
  18567. }
  18568. }
  18569. return true;
  18570. }
  18571. module.exports = shallowEqual;
  18572. },{}],167:[function(_dereq_,module,exports){
  18573. /**
  18574. * Copyright 2013-2015, Facebook, Inc.
  18575. * All rights reserved.
  18576. *
  18577. * This source code is licensed under the BSD-style license found in the
  18578. * LICENSE file in the root directory of this source tree. An additional grant
  18579. * of patent rights can be found in the PATENTS file in the same directory.
  18580. *
  18581. * @providesModule shouldUpdateReactComponent
  18582. * @typechecks static-only
  18583. */
  18584. 'use strict';
  18585. var warning = _dereq_(171);
  18586. /**
  18587. * Given a `prevElement` and `nextElement`, determines if the existing
  18588. * instance should be updated as opposed to being destroyed or replaced by a new
  18589. * instance. Both arguments are elements. This ensures that this logic can
  18590. * operate on stateless trees without any backing instance.
  18591. *
  18592. * @param {?object} prevElement
  18593. * @param {?object} nextElement
  18594. * @return {boolean} True if the existing instance should be updated.
  18595. * @protected
  18596. */
  18597. function shouldUpdateReactComponent(prevElement, nextElement) {
  18598. if (prevElement != null && nextElement != null) {
  18599. var prevType = typeof prevElement;
  18600. var nextType = typeof nextElement;
  18601. if (prevType === 'string' || prevType === 'number') {
  18602. return (nextType === 'string' || nextType === 'number');
  18603. } else {
  18604. if (nextType === 'object' &&
  18605. prevElement.type === nextElement.type &&
  18606. prevElement.key === nextElement.key) {
  18607. var ownersMatch = prevElement._owner === nextElement._owner;
  18608. var prevName = null;
  18609. var nextName = null;
  18610. var nextDisplayName = null;
  18611. if ("production" !== "development") {
  18612. if (!ownersMatch) {
  18613. if (prevElement._owner != null &&
  18614. prevElement._owner.getPublicInstance() != null &&
  18615. prevElement._owner.getPublicInstance().constructor != null) {
  18616. prevName =
  18617. prevElement._owner.getPublicInstance().constructor.displayName;
  18618. }
  18619. if (nextElement._owner != null &&
  18620. nextElement._owner.getPublicInstance() != null &&
  18621. nextElement._owner.getPublicInstance().constructor != null) {
  18622. nextName =
  18623. nextElement._owner.getPublicInstance().constructor.displayName;
  18624. }
  18625. if (nextElement.type != null &&
  18626. nextElement.type.displayName != null) {
  18627. nextDisplayName = nextElement.type.displayName;
  18628. }
  18629. if (nextElement.type != null && typeof nextElement.type === 'string') {
  18630. nextDisplayName = nextElement.type;
  18631. }
  18632. if (typeof nextElement.type !== 'string' ||
  18633. nextElement.type === 'input' ||
  18634. nextElement.type === 'textarea') {
  18635. if ((prevElement._owner != null &&
  18636. prevElement._owner._isOwnerNecessary === false) ||
  18637. (nextElement._owner != null &&
  18638. nextElement._owner._isOwnerNecessary === false)) {
  18639. if (prevElement._owner != null) {
  18640. prevElement._owner._isOwnerNecessary = true;
  18641. }
  18642. if (nextElement._owner != null) {
  18643. nextElement._owner._isOwnerNecessary = true;
  18644. }
  18645. ("production" !== "development" ? warning(
  18646. false,
  18647. '<%s /> is being rendered by both %s and %s using the same ' +
  18648. 'key (%s) in the same place. Currently, this means that ' +
  18649. 'they don\'t preserve state. This behavior should be very ' +
  18650. 'rare so we\'re considering deprecating it. Please contact ' +
  18651. 'the React team and explain your use case so that we can ' +
  18652. 'take that into consideration.',
  18653. nextDisplayName || 'Unknown Component',
  18654. prevName || '[Unknown]',
  18655. nextName || '[Unknown]',
  18656. prevElement.key
  18657. ) : null);
  18658. }
  18659. }
  18660. }
  18661. }
  18662. return ownersMatch;
  18663. }
  18664. }
  18665. }
  18666. return false;
  18667. }
  18668. module.exports = shouldUpdateReactComponent;
  18669. },{"171":171}],168:[function(_dereq_,module,exports){
  18670. /**
  18671. * Copyright 2014-2015, Facebook, Inc.
  18672. * All rights reserved.
  18673. *
  18674. * This source code is licensed under the BSD-style license found in the
  18675. * LICENSE file in the root directory of this source tree. An additional grant
  18676. * of patent rights can be found in the PATENTS file in the same directory.
  18677. *
  18678. * @providesModule toArray
  18679. * @typechecks
  18680. */
  18681. var invariant = _dereq_(150);
  18682. /**
  18683. * Convert array-like objects to arrays.
  18684. *
  18685. * This API assumes the caller knows the contents of the data type. For less
  18686. * well defined inputs use createArrayFromMixed.
  18687. *
  18688. * @param {object|function|filelist} obj
  18689. * @return {array}
  18690. */
  18691. function toArray(obj) {
  18692. var length = obj.length;
  18693. // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
  18694. // old versions of Safari).
  18695. ("production" !== "development" ? invariant(
  18696. !Array.isArray(obj) &&
  18697. (typeof obj === 'object' || typeof obj === 'function'),
  18698. 'toArray: Array-like object expected'
  18699. ) : invariant(!Array.isArray(obj) &&
  18700. (typeof obj === 'object' || typeof obj === 'function')));
  18701. ("production" !== "development" ? invariant(
  18702. typeof length === 'number',
  18703. 'toArray: Object needs a length property'
  18704. ) : invariant(typeof length === 'number'));
  18705. ("production" !== "development" ? invariant(
  18706. length === 0 ||
  18707. (length - 1) in obj,
  18708. 'toArray: Object should have keys for indices'
  18709. ) : invariant(length === 0 ||
  18710. (length - 1) in obj));
  18711. // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
  18712. // without method will throw during the slice call and skip straight to the
  18713. // fallback.
  18714. if (obj.hasOwnProperty) {
  18715. try {
  18716. return Array.prototype.slice.call(obj);
  18717. } catch (e) {
  18718. // IE < 9 does not support Array#slice on collections objects
  18719. }
  18720. }
  18721. // Fall back to copying key by key. This assumes all keys have a value,
  18722. // so will not preserve sparsely populated inputs.
  18723. var ret = Array(length);
  18724. for (var ii = 0; ii < length; ii++) {
  18725. ret[ii] = obj[ii];
  18726. }
  18727. return ret;
  18728. }
  18729. module.exports = toArray;
  18730. },{"150":150}],169:[function(_dereq_,module,exports){
  18731. /**
  18732. * Copyright 2013-2015, Facebook, Inc.
  18733. * All rights reserved.
  18734. *
  18735. * This source code is licensed under the BSD-style license found in the
  18736. * LICENSE file in the root directory of this source tree. An additional grant
  18737. * of patent rights can be found in the PATENTS file in the same directory.
  18738. *
  18739. * @providesModule traverseAllChildren
  18740. */
  18741. 'use strict';
  18742. var ReactElement = _dereq_(63);
  18743. var ReactFragment = _dereq_(69);
  18744. var ReactInstanceHandles = _dereq_(72);
  18745. var getIteratorFn = _dereq_(141);
  18746. var invariant = _dereq_(150);
  18747. var warning = _dereq_(171);
  18748. var SEPARATOR = ReactInstanceHandles.SEPARATOR;
  18749. var SUBSEPARATOR = ':';
  18750. /**
  18751. * TODO: Test that a single child and an array with one item have the same key
  18752. * pattern.
  18753. */
  18754. var userProvidedKeyEscaperLookup = {
  18755. '=': '=0',
  18756. '.': '=1',
  18757. ':': '=2'
  18758. };
  18759. var userProvidedKeyEscapeRegex = /[=.:]/g;
  18760. var didWarnAboutMaps = false;
  18761. function userProvidedKeyEscaper(match) {
  18762. return userProvidedKeyEscaperLookup[match];
  18763. }
  18764. /**
  18765. * Generate a key string that identifies a component within a set.
  18766. *
  18767. * @param {*} component A component that could contain a manual key.
  18768. * @param {number} index Index that is used if a manual key is not provided.
  18769. * @return {string}
  18770. */
  18771. function getComponentKey(component, index) {
  18772. if (component && component.key != null) {
  18773. // Explicit key
  18774. return wrapUserProvidedKey(component.key);
  18775. }
  18776. // Implicit key determined by the index in the set
  18777. return index.toString(36);
  18778. }
  18779. /**
  18780. * Escape a component key so that it is safe to use in a reactid.
  18781. *
  18782. * @param {*} key Component key to be escaped.
  18783. * @return {string} An escaped string.
  18784. */
  18785. function escapeUserProvidedKey(text) {
  18786. return ('' + text).replace(
  18787. userProvidedKeyEscapeRegex,
  18788. userProvidedKeyEscaper
  18789. );
  18790. }
  18791. /**
  18792. * Wrap a `key` value explicitly provided by the user to distinguish it from
  18793. * implicitly-generated keys generated by a component's index in its parent.
  18794. *
  18795. * @param {string} key Value of a user-provided `key` attribute
  18796. * @return {string}
  18797. */
  18798. function wrapUserProvidedKey(key) {
  18799. return '$' + escapeUserProvidedKey(key);
  18800. }
  18801. /**
  18802. * @param {?*} children Children tree container.
  18803. * @param {!string} nameSoFar Name of the key path so far.
  18804. * @param {!number} indexSoFar Number of children encountered until this point.
  18805. * @param {!function} callback Callback to invoke with each child found.
  18806. * @param {?*} traverseContext Used to pass information throughout the traversal
  18807. * process.
  18808. * @return {!number} The number of children in this subtree.
  18809. */
  18810. function traverseAllChildrenImpl(
  18811. children,
  18812. nameSoFar,
  18813. indexSoFar,
  18814. callback,
  18815. traverseContext
  18816. ) {
  18817. var type = typeof children;
  18818. if (type === 'undefined' || type === 'boolean') {
  18819. // All of the above are perceived as null.
  18820. children = null;
  18821. }
  18822. if (children === null ||
  18823. type === 'string' ||
  18824. type === 'number' ||
  18825. ReactElement.isValidElement(children)) {
  18826. callback(
  18827. traverseContext,
  18828. children,
  18829. // If it's the only child, treat the name as if it was wrapped in an array
  18830. // so that it's consistent if the number of children grows.
  18831. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar,
  18832. indexSoFar
  18833. );
  18834. return 1;
  18835. }
  18836. var child, nextName, nextIndex;
  18837. var subtreeCount = 0; // Count of children found in the current subtree.
  18838. if (Array.isArray(children)) {
  18839. for (var i = 0; i < children.length; i++) {
  18840. child = children[i];
  18841. nextName = (
  18842. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  18843. getComponentKey(child, i)
  18844. );
  18845. nextIndex = indexSoFar + subtreeCount;
  18846. subtreeCount += traverseAllChildrenImpl(
  18847. child,
  18848. nextName,
  18849. nextIndex,
  18850. callback,
  18851. traverseContext
  18852. );
  18853. }
  18854. } else {
  18855. var iteratorFn = getIteratorFn(children);
  18856. if (iteratorFn) {
  18857. var iterator = iteratorFn.call(children);
  18858. var step;
  18859. if (iteratorFn !== children.entries) {
  18860. var ii = 0;
  18861. while (!(step = iterator.next()).done) {
  18862. child = step.value;
  18863. nextName = (
  18864. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  18865. getComponentKey(child, ii++)
  18866. );
  18867. nextIndex = indexSoFar + subtreeCount;
  18868. subtreeCount += traverseAllChildrenImpl(
  18869. child,
  18870. nextName,
  18871. nextIndex,
  18872. callback,
  18873. traverseContext
  18874. );
  18875. }
  18876. } else {
  18877. if ("production" !== "development") {
  18878. ("production" !== "development" ? warning(
  18879. didWarnAboutMaps,
  18880. 'Using Maps as children is not yet fully supported. It is an ' +
  18881. 'experimental feature that might be removed. Convert it to a ' +
  18882. 'sequence / iterable of keyed ReactElements instead.'
  18883. ) : null);
  18884. didWarnAboutMaps = true;
  18885. }
  18886. // Iterator will provide entry [k,v] tuples rather than values.
  18887. while (!(step = iterator.next()).done) {
  18888. var entry = step.value;
  18889. if (entry) {
  18890. child = entry[1];
  18891. nextName = (
  18892. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  18893. wrapUserProvidedKey(entry[0]) + SUBSEPARATOR +
  18894. getComponentKey(child, 0)
  18895. );
  18896. nextIndex = indexSoFar + subtreeCount;
  18897. subtreeCount += traverseAllChildrenImpl(
  18898. child,
  18899. nextName,
  18900. nextIndex,
  18901. callback,
  18902. traverseContext
  18903. );
  18904. }
  18905. }
  18906. }
  18907. } else if (type === 'object') {
  18908. ("production" !== "development" ? invariant(
  18909. children.nodeType !== 1,
  18910. 'traverseAllChildren(...): Encountered an invalid child; DOM ' +
  18911. 'elements are not valid children of React components.'
  18912. ) : invariant(children.nodeType !== 1));
  18913. var fragment = ReactFragment.extract(children);
  18914. for (var key in fragment) {
  18915. if (fragment.hasOwnProperty(key)) {
  18916. child = fragment[key];
  18917. nextName = (
  18918. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  18919. wrapUserProvidedKey(key) + SUBSEPARATOR +
  18920. getComponentKey(child, 0)
  18921. );
  18922. nextIndex = indexSoFar + subtreeCount;
  18923. subtreeCount += traverseAllChildrenImpl(
  18924. child,
  18925. nextName,
  18926. nextIndex,
  18927. callback,
  18928. traverseContext
  18929. );
  18930. }
  18931. }
  18932. }
  18933. }
  18934. return subtreeCount;
  18935. }
  18936. /**
  18937. * Traverses children that are typically specified as `props.children`, but
  18938. * might also be specified through attributes:
  18939. *
  18940. * - `traverseAllChildren(this.props.children, ...)`
  18941. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  18942. *
  18943. * The `traverseContext` is an optional argument that is passed through the
  18944. * entire traversal. It can be used to store accumulations or anything else that
  18945. * the callback might find relevant.
  18946. *
  18947. * @param {?*} children Children tree object.
  18948. * @param {!function} callback To invoke upon traversing each child.
  18949. * @param {?*} traverseContext Context for traversal.
  18950. * @return {!number} The number of children in this subtree.
  18951. */
  18952. function traverseAllChildren(children, callback, traverseContext) {
  18953. if (children == null) {
  18954. return 0;
  18955. }
  18956. return traverseAllChildrenImpl(children, '', 0, callback, traverseContext);
  18957. }
  18958. module.exports = traverseAllChildren;
  18959. },{"141":141,"150":150,"171":171,"63":63,"69":69,"72":72}],170:[function(_dereq_,module,exports){
  18960. /**
  18961. * Copyright 2013-2015, Facebook, Inc.
  18962. * All rights reserved.
  18963. *
  18964. * This source code is licensed under the BSD-style license found in the
  18965. * LICENSE file in the root directory of this source tree. An additional grant
  18966. * of patent rights can be found in the PATENTS file in the same directory.
  18967. *
  18968. * @providesModule update
  18969. */
  18970. /* global hasOwnProperty:true */
  18971. 'use strict';
  18972. var assign = _dereq_(29);
  18973. var keyOf = _dereq_(157);
  18974. var invariant = _dereq_(150);
  18975. var hasOwnProperty = {}.hasOwnProperty;
  18976. function shallowCopy(x) {
  18977. if (Array.isArray(x)) {
  18978. return x.concat();
  18979. } else if (x && typeof x === 'object') {
  18980. return assign(new x.constructor(), x);
  18981. } else {
  18982. return x;
  18983. }
  18984. }
  18985. var COMMAND_PUSH = keyOf({$push: null});
  18986. var COMMAND_UNSHIFT = keyOf({$unshift: null});
  18987. var COMMAND_SPLICE = keyOf({$splice: null});
  18988. var COMMAND_SET = keyOf({$set: null});
  18989. var COMMAND_MERGE = keyOf({$merge: null});
  18990. var COMMAND_APPLY = keyOf({$apply: null});
  18991. var ALL_COMMANDS_LIST = [
  18992. COMMAND_PUSH,
  18993. COMMAND_UNSHIFT,
  18994. COMMAND_SPLICE,
  18995. COMMAND_SET,
  18996. COMMAND_MERGE,
  18997. COMMAND_APPLY
  18998. ];
  18999. var ALL_COMMANDS_SET = {};
  19000. ALL_COMMANDS_LIST.forEach(function(command) {
  19001. ALL_COMMANDS_SET[command] = true;
  19002. });
  19003. function invariantArrayCase(value, spec, command) {
  19004. ("production" !== "development" ? invariant(
  19005. Array.isArray(value),
  19006. 'update(): expected target of %s to be an array; got %s.',
  19007. command,
  19008. value
  19009. ) : invariant(Array.isArray(value)));
  19010. var specValue = spec[command];
  19011. ("production" !== "development" ? invariant(
  19012. Array.isArray(specValue),
  19013. 'update(): expected spec of %s to be an array; got %s. ' +
  19014. 'Did you forget to wrap your parameter in an array?',
  19015. command,
  19016. specValue
  19017. ) : invariant(Array.isArray(specValue)));
  19018. }
  19019. function update(value, spec) {
  19020. ("production" !== "development" ? invariant(
  19021. typeof spec === 'object',
  19022. 'update(): You provided a key path to update() that did not contain one ' +
  19023. 'of %s. Did you forget to include {%s: ...}?',
  19024. ALL_COMMANDS_LIST.join(', '),
  19025. COMMAND_SET
  19026. ) : invariant(typeof spec === 'object'));
  19027. if (hasOwnProperty.call(spec, COMMAND_SET)) {
  19028. ("production" !== "development" ? invariant(
  19029. Object.keys(spec).length === 1,
  19030. 'Cannot have more than one key in an object with %s',
  19031. COMMAND_SET
  19032. ) : invariant(Object.keys(spec).length === 1));
  19033. return spec[COMMAND_SET];
  19034. }
  19035. var nextValue = shallowCopy(value);
  19036. if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
  19037. var mergeObj = spec[COMMAND_MERGE];
  19038. ("production" !== "development" ? invariant(
  19039. mergeObj && typeof mergeObj === 'object',
  19040. 'update(): %s expects a spec of type \'object\'; got %s',
  19041. COMMAND_MERGE,
  19042. mergeObj
  19043. ) : invariant(mergeObj && typeof mergeObj === 'object'));
  19044. ("production" !== "development" ? invariant(
  19045. nextValue && typeof nextValue === 'object',
  19046. 'update(): %s expects a target of type \'object\'; got %s',
  19047. COMMAND_MERGE,
  19048. nextValue
  19049. ) : invariant(nextValue && typeof nextValue === 'object'));
  19050. assign(nextValue, spec[COMMAND_MERGE]);
  19051. }
  19052. if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
  19053. invariantArrayCase(value, spec, COMMAND_PUSH);
  19054. spec[COMMAND_PUSH].forEach(function(item) {
  19055. nextValue.push(item);
  19056. });
  19057. }
  19058. if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
  19059. invariantArrayCase(value, spec, COMMAND_UNSHIFT);
  19060. spec[COMMAND_UNSHIFT].forEach(function(item) {
  19061. nextValue.unshift(item);
  19062. });
  19063. }
  19064. if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
  19065. ("production" !== "development" ? invariant(
  19066. Array.isArray(value),
  19067. 'Expected %s target to be an array; got %s',
  19068. COMMAND_SPLICE,
  19069. value
  19070. ) : invariant(Array.isArray(value)));
  19071. ("production" !== "development" ? invariant(
  19072. Array.isArray(spec[COMMAND_SPLICE]),
  19073. 'update(): expected spec of %s to be an array of arrays; got %s. ' +
  19074. 'Did you forget to wrap your parameters in an array?',
  19075. COMMAND_SPLICE,
  19076. spec[COMMAND_SPLICE]
  19077. ) : invariant(Array.isArray(spec[COMMAND_SPLICE])));
  19078. spec[COMMAND_SPLICE].forEach(function(args) {
  19079. ("production" !== "development" ? invariant(
  19080. Array.isArray(args),
  19081. 'update(): expected spec of %s to be an array of arrays; got %s. ' +
  19082. 'Did you forget to wrap your parameters in an array?',
  19083. COMMAND_SPLICE,
  19084. spec[COMMAND_SPLICE]
  19085. ) : invariant(Array.isArray(args)));
  19086. nextValue.splice.apply(nextValue, args);
  19087. });
  19088. }
  19089. if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
  19090. ("production" !== "development" ? invariant(
  19091. typeof spec[COMMAND_APPLY] === 'function',
  19092. 'update(): expected spec of %s to be a function; got %s.',
  19093. COMMAND_APPLY,
  19094. spec[COMMAND_APPLY]
  19095. ) : invariant(typeof spec[COMMAND_APPLY] === 'function'));
  19096. nextValue = spec[COMMAND_APPLY](nextValue);
  19097. }
  19098. for (var k in spec) {
  19099. if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {
  19100. nextValue[k] = update(value[k], spec[k]);
  19101. }
  19102. }
  19103. return nextValue;
  19104. }
  19105. module.exports = update;
  19106. },{"150":150,"157":157,"29":29}],171:[function(_dereq_,module,exports){
  19107. /**
  19108. * Copyright 2014-2015, Facebook, Inc.
  19109. * All rights reserved.
  19110. *
  19111. * This source code is licensed under the BSD-style license found in the
  19112. * LICENSE file in the root directory of this source tree. An additional grant
  19113. * of patent rights can be found in the PATENTS file in the same directory.
  19114. *
  19115. * @providesModule warning
  19116. */
  19117. "use strict";
  19118. var emptyFunction = _dereq_(129);
  19119. /**
  19120. * Similar to invariant but only logs a warning if the condition is not met.
  19121. * This can be used to log issues in development environments in critical
  19122. * paths. Removing the logging code for production environments will keep the
  19123. * same logic and follow the same code paths.
  19124. */
  19125. var warning = emptyFunction;
  19126. if ("production" !== "development") {
  19127. warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  19128. if (format === undefined) {
  19129. throw new Error(
  19130. '`warning(condition, format, ...args)` requires a warning ' +
  19131. 'message argument'
  19132. );
  19133. }
  19134. if (format.length < 10 || /^[s\W]*$/.test(format)) {
  19135. throw new Error(
  19136. 'The warning format should be able to uniquely identify this ' +
  19137. 'warning. Please, use a more descriptive format than: ' + format
  19138. );
  19139. }
  19140. if (format.indexOf('Failed Composite propType: ') === 0) {
  19141. return; // Ignore CompositeComponent proptype check.
  19142. }
  19143. if (!condition) {
  19144. var argIndex = 0;
  19145. var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];});
  19146. console.warn(message);
  19147. try {
  19148. // --- Welcome to debugging React ---
  19149. // This error was thrown as a convenience so that you can use this stack
  19150. // to find the callsite that caused this warning to fire.
  19151. throw new Error(message);
  19152. } catch(x) {}
  19153. }
  19154. };
  19155. }
  19156. module.exports = warning;
  19157. },{"129":129}]},{},[1])(1)
  19158. });