react-with-addons.js 644 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574
  1. /**
  2. * React (with addons) v0.13.1
  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. flexShrink: true,
  641. fontWeight: true,
  642. lineClamp: true,
  643. lineHeight: true,
  644. opacity: true,
  645. order: true,
  646. orphans: true,
  647. widows: true,
  648. zIndex: true,
  649. zoom: true,
  650. // SVG-related properties
  651. fillOpacity: true,
  652. strokeOpacity: true
  653. };
  654. /**
  655. * @param {string} prefix vendor-specific prefix, eg: Webkit
  656. * @param {string} key style name, eg: transitionDuration
  657. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  658. * WebkitTransitionDuration
  659. */
  660. function prefixKey(prefix, key) {
  661. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  662. }
  663. /**
  664. * Support style names that may come passed in prefixed by adding permutations
  665. * of vendor prefixes.
  666. */
  667. var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
  668. // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  669. // infinite loop, because it iterates over the newly added props too.
  670. Object.keys(isUnitlessNumber).forEach(function(prop) {
  671. prefixes.forEach(function(prefix) {
  672. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  673. });
  674. });
  675. /**
  676. * Most style properties can be unset by doing .style[prop] = '' but IE8
  677. * doesn't like doing that with shorthand properties so for the properties that
  678. * IE8 breaks on, which are listed here, we instead unset each of the
  679. * individual properties. See http://bugs.jquery.com/ticket/12385.
  680. * The 4-value 'clock' properties like margin, padding, border-width seem to
  681. * behave without any problems. Curiously, list-style works too without any
  682. * special prodding.
  683. */
  684. var shorthandPropertyExpansions = {
  685. background: {
  686. backgroundImage: true,
  687. backgroundPosition: true,
  688. backgroundRepeat: true,
  689. backgroundColor: true
  690. },
  691. border: {
  692. borderWidth: true,
  693. borderStyle: true,
  694. borderColor: true
  695. },
  696. borderBottom: {
  697. borderBottomWidth: true,
  698. borderBottomStyle: true,
  699. borderBottomColor: true
  700. },
  701. borderLeft: {
  702. borderLeftWidth: true,
  703. borderLeftStyle: true,
  704. borderLeftColor: true
  705. },
  706. borderRight: {
  707. borderRightWidth: true,
  708. borderRightStyle: true,
  709. borderRightColor: true
  710. },
  711. borderTop: {
  712. borderTopWidth: true,
  713. borderTopStyle: true,
  714. borderTopColor: true
  715. },
  716. font: {
  717. fontStyle: true,
  718. fontVariant: true,
  719. fontWeight: true,
  720. fontSize: true,
  721. lineHeight: true,
  722. fontFamily: true
  723. }
  724. };
  725. var CSSProperty = {
  726. isUnitlessNumber: isUnitlessNumber,
  727. shorthandPropertyExpansions: shorthandPropertyExpansions
  728. };
  729. module.exports = CSSProperty;
  730. },{}],6:[function(_dereq_,module,exports){
  731. /**
  732. * Copyright 2013-2015, Facebook, Inc.
  733. * All rights reserved.
  734. *
  735. * This source code is licensed under the BSD-style license found in the
  736. * LICENSE file in the root directory of this source tree. An additional grant
  737. * of patent rights can be found in the PATENTS file in the same directory.
  738. *
  739. * @providesModule CSSPropertyOperations
  740. * @typechecks static-only
  741. */
  742. 'use strict';
  743. var CSSProperty = _dereq_(5);
  744. var ExecutionEnvironment = _dereq_(22);
  745. var camelizeStyleName = _dereq_(121);
  746. var dangerousStyleValue = _dereq_(128);
  747. var hyphenateStyleName = _dereq_(148);
  748. var memoizeStringOnly = _dereq_(159);
  749. var warning = _dereq_(171);
  750. var processStyleName = memoizeStringOnly(function(styleName) {
  751. return hyphenateStyleName(styleName);
  752. });
  753. var styleFloatAccessor = 'cssFloat';
  754. if (ExecutionEnvironment.canUseDOM) {
  755. // IE8 only supports accessing cssFloat (standard) as styleFloat
  756. if (document.documentElement.style.cssFloat === undefined) {
  757. styleFloatAccessor = 'styleFloat';
  758. }
  759. }
  760. if ("production" !== "development") {
  761. // 'msTransform' is correct, but the other prefixes should be capitalized
  762. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  763. // style values shouldn't contain a semicolon
  764. var badStyleValueWithSemicolonPattern = /;\s*$/;
  765. var warnedStyleNames = {};
  766. var warnedStyleValues = {};
  767. var warnHyphenatedStyleName = function(name) {
  768. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  769. return;
  770. }
  771. warnedStyleNames[name] = true;
  772. ("production" !== "development" ? warning(
  773. false,
  774. 'Unsupported style property %s. Did you mean %s?',
  775. name,
  776. camelizeStyleName(name)
  777. ) : null);
  778. };
  779. var warnBadVendoredStyleName = function(name) {
  780. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  781. return;
  782. }
  783. warnedStyleNames[name] = true;
  784. ("production" !== "development" ? warning(
  785. false,
  786. 'Unsupported vendor-prefixed style property %s. Did you mean %s?',
  787. name,
  788. name.charAt(0).toUpperCase() + name.slice(1)
  789. ) : null);
  790. };
  791. var warnStyleValueWithSemicolon = function(name, value) {
  792. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  793. return;
  794. }
  795. warnedStyleValues[value] = true;
  796. ("production" !== "development" ? warning(
  797. false,
  798. 'Style property values shouldn\'t contain a semicolon. ' +
  799. 'Try "%s: %s" instead.',
  800. name,
  801. value.replace(badStyleValueWithSemicolonPattern, '')
  802. ) : null);
  803. };
  804. /**
  805. * @param {string} name
  806. * @param {*} value
  807. */
  808. var warnValidStyle = function(name, value) {
  809. if (name.indexOf('-') > -1) {
  810. warnHyphenatedStyleName(name);
  811. } else if (badVendoredStyleNamePattern.test(name)) {
  812. warnBadVendoredStyleName(name);
  813. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  814. warnStyleValueWithSemicolon(name, value);
  815. }
  816. };
  817. }
  818. /**
  819. * Operations for dealing with CSS properties.
  820. */
  821. var CSSPropertyOperations = {
  822. /**
  823. * Serializes a mapping of style properties for use as inline styles:
  824. *
  825. * > createMarkupForStyles({width: '200px', height: 0})
  826. * "width:200px;height:0;"
  827. *
  828. * Undefined values are ignored so that declarative programming is easier.
  829. * The result should be HTML-escaped before insertion into the DOM.
  830. *
  831. * @param {object} styles
  832. * @return {?string}
  833. */
  834. createMarkupForStyles: function(styles) {
  835. var serialized = '';
  836. for (var styleName in styles) {
  837. if (!styles.hasOwnProperty(styleName)) {
  838. continue;
  839. }
  840. var styleValue = styles[styleName];
  841. if ("production" !== "development") {
  842. warnValidStyle(styleName, styleValue);
  843. }
  844. if (styleValue != null) {
  845. serialized += processStyleName(styleName) + ':';
  846. serialized += dangerousStyleValue(styleName, styleValue) + ';';
  847. }
  848. }
  849. return serialized || null;
  850. },
  851. /**
  852. * Sets the value for multiple styles on a node. If a value is specified as
  853. * '' (empty string), the corresponding style property will be unset.
  854. *
  855. * @param {DOMElement} node
  856. * @param {object} styles
  857. */
  858. setValueForStyles: function(node, styles) {
  859. var style = node.style;
  860. for (var styleName in styles) {
  861. if (!styles.hasOwnProperty(styleName)) {
  862. continue;
  863. }
  864. if ("production" !== "development") {
  865. warnValidStyle(styleName, styles[styleName]);
  866. }
  867. var styleValue = dangerousStyleValue(styleName, styles[styleName]);
  868. if (styleName === 'float') {
  869. styleName = styleFloatAccessor;
  870. }
  871. if (styleValue) {
  872. style[styleName] = styleValue;
  873. } else {
  874. var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
  875. if (expansion) {
  876. // Shorthand property that IE8 won't like unsetting, so unset each
  877. // component to placate it
  878. for (var individualStyleName in expansion) {
  879. style[individualStyleName] = '';
  880. }
  881. } else {
  882. style[styleName] = '';
  883. }
  884. }
  885. }
  886. }
  887. };
  888. module.exports = CSSPropertyOperations;
  889. },{"121":121,"128":128,"148":148,"159":159,"171":171,"22":22,"5":5}],7:[function(_dereq_,module,exports){
  890. /**
  891. * Copyright 2013-2015, Facebook, Inc.
  892. * All rights reserved.
  893. *
  894. * This source code is licensed under the BSD-style license found in the
  895. * LICENSE file in the root directory of this source tree. An additional grant
  896. * of patent rights can be found in the PATENTS file in the same directory.
  897. *
  898. * @providesModule CallbackQueue
  899. */
  900. 'use strict';
  901. var PooledClass = _dereq_(30);
  902. var assign = _dereq_(29);
  903. var invariant = _dereq_(150);
  904. /**
  905. * A specialized pseudo-event module to help keep track of components waiting to
  906. * be notified when their DOM representations are available for use.
  907. *
  908. * This implements `PooledClass`, so you should never need to instantiate this.
  909. * Instead, use `CallbackQueue.getPooled()`.
  910. *
  911. * @class ReactMountReady
  912. * @implements PooledClass
  913. * @internal
  914. */
  915. function CallbackQueue() {
  916. this._callbacks = null;
  917. this._contexts = null;
  918. }
  919. assign(CallbackQueue.prototype, {
  920. /**
  921. * Enqueues a callback to be invoked when `notifyAll` is invoked.
  922. *
  923. * @param {function} callback Invoked when `notifyAll` is invoked.
  924. * @param {?object} context Context to call `callback` with.
  925. * @internal
  926. */
  927. enqueue: function(callback, context) {
  928. this._callbacks = this._callbacks || [];
  929. this._contexts = this._contexts || [];
  930. this._callbacks.push(callback);
  931. this._contexts.push(context);
  932. },
  933. /**
  934. * Invokes all enqueued callbacks and clears the queue. This is invoked after
  935. * the DOM representation of a component has been created or updated.
  936. *
  937. * @internal
  938. */
  939. notifyAll: function() {
  940. var callbacks = this._callbacks;
  941. var contexts = this._contexts;
  942. if (callbacks) {
  943. ("production" !== "development" ? invariant(
  944. callbacks.length === contexts.length,
  945. 'Mismatched list of contexts in callback queue'
  946. ) : invariant(callbacks.length === contexts.length));
  947. this._callbacks = null;
  948. this._contexts = null;
  949. for (var i = 0, l = callbacks.length; i < l; i++) {
  950. callbacks[i].call(contexts[i]);
  951. }
  952. callbacks.length = 0;
  953. contexts.length = 0;
  954. }
  955. },
  956. /**
  957. * Resets the internal queue.
  958. *
  959. * @internal
  960. */
  961. reset: function() {
  962. this._callbacks = null;
  963. this._contexts = null;
  964. },
  965. /**
  966. * `PooledClass` looks for this.
  967. */
  968. destructor: function() {
  969. this.reset();
  970. }
  971. });
  972. PooledClass.addPoolingTo(CallbackQueue);
  973. module.exports = CallbackQueue;
  974. },{"150":150,"29":29,"30":30}],8:[function(_dereq_,module,exports){
  975. /**
  976. * Copyright 2013-2015, Facebook, Inc.
  977. * All rights reserved.
  978. *
  979. * This source code is licensed under the BSD-style license found in the
  980. * LICENSE file in the root directory of this source tree. An additional grant
  981. * of patent rights can be found in the PATENTS file in the same directory.
  982. *
  983. * @providesModule ChangeEventPlugin
  984. */
  985. 'use strict';
  986. var EventConstants = _dereq_(16);
  987. var EventPluginHub = _dereq_(18);
  988. var EventPropagators = _dereq_(21);
  989. var ExecutionEnvironment = _dereq_(22);
  990. var ReactUpdates = _dereq_(100);
  991. var SyntheticEvent = _dereq_(108);
  992. var isEventSupported = _dereq_(151);
  993. var isTextInputElement = _dereq_(153);
  994. var keyOf = _dereq_(157);
  995. var topLevelTypes = EventConstants.topLevelTypes;
  996. var eventTypes = {
  997. change: {
  998. phasedRegistrationNames: {
  999. bubbled: keyOf({onChange: null}),
  1000. captured: keyOf({onChangeCapture: null})
  1001. },
  1002. dependencies: [
  1003. topLevelTypes.topBlur,
  1004. topLevelTypes.topChange,
  1005. topLevelTypes.topClick,
  1006. topLevelTypes.topFocus,
  1007. topLevelTypes.topInput,
  1008. topLevelTypes.topKeyDown,
  1009. topLevelTypes.topKeyUp,
  1010. topLevelTypes.topSelectionChange
  1011. ]
  1012. }
  1013. };
  1014. /**
  1015. * For IE shims
  1016. */
  1017. var activeElement = null;
  1018. var activeElementID = null;
  1019. var activeElementValue = null;
  1020. var activeElementValueProp = null;
  1021. /**
  1022. * SECTION: handle `change` event
  1023. */
  1024. function shouldUseChangeEvent(elem) {
  1025. return (
  1026. elem.nodeName === 'SELECT' ||
  1027. (elem.nodeName === 'INPUT' && elem.type === 'file')
  1028. );
  1029. }
  1030. var doesChangeEventBubble = false;
  1031. if (ExecutionEnvironment.canUseDOM) {
  1032. // See `handleChange` comment below
  1033. doesChangeEventBubble = isEventSupported('change') && (
  1034. (!('documentMode' in document) || document.documentMode > 8)
  1035. );
  1036. }
  1037. function manualDispatchChangeEvent(nativeEvent) {
  1038. var event = SyntheticEvent.getPooled(
  1039. eventTypes.change,
  1040. activeElementID,
  1041. nativeEvent
  1042. );
  1043. EventPropagators.accumulateTwoPhaseDispatches(event);
  1044. // If change and propertychange bubbled, we'd just bind to it like all the
  1045. // other events and have it go through ReactBrowserEventEmitter. Since it
  1046. // doesn't, we manually listen for the events and so we have to enqueue and
  1047. // process the abstract event manually.
  1048. //
  1049. // Batching is necessary here in order to ensure that all event handlers run
  1050. // before the next rerender (including event handlers attached to ancestor
  1051. // elements instead of directly on the input). Without this, controlled
  1052. // components don't work properly in conjunction with event bubbling because
  1053. // the component is rerendered and the value reverted before all the event
  1054. // handlers can run. See https://github.com/facebook/react/issues/708.
  1055. ReactUpdates.batchedUpdates(runEventInBatch, event);
  1056. }
  1057. function runEventInBatch(event) {
  1058. EventPluginHub.enqueueEvents(event);
  1059. EventPluginHub.processEventQueue();
  1060. }
  1061. function startWatchingForChangeEventIE8(target, targetID) {
  1062. activeElement = target;
  1063. activeElementID = targetID;
  1064. activeElement.attachEvent('onchange', manualDispatchChangeEvent);
  1065. }
  1066. function stopWatchingForChangeEventIE8() {
  1067. if (!activeElement) {
  1068. return;
  1069. }
  1070. activeElement.detachEvent('onchange', manualDispatchChangeEvent);
  1071. activeElement = null;
  1072. activeElementID = null;
  1073. }
  1074. function getTargetIDForChangeEvent(
  1075. topLevelType,
  1076. topLevelTarget,
  1077. topLevelTargetID) {
  1078. if (topLevelType === topLevelTypes.topChange) {
  1079. return topLevelTargetID;
  1080. }
  1081. }
  1082. function handleEventsForChangeEventIE8(
  1083. topLevelType,
  1084. topLevelTarget,
  1085. topLevelTargetID) {
  1086. if (topLevelType === topLevelTypes.topFocus) {
  1087. // stopWatching() should be a noop here but we call it just in case we
  1088. // missed a blur event somehow.
  1089. stopWatchingForChangeEventIE8();
  1090. startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
  1091. } else if (topLevelType === topLevelTypes.topBlur) {
  1092. stopWatchingForChangeEventIE8();
  1093. }
  1094. }
  1095. /**
  1096. * SECTION: handle `input` event
  1097. */
  1098. var isInputEventSupported = false;
  1099. if (ExecutionEnvironment.canUseDOM) {
  1100. // IE9 claims to support the input event but fails to trigger it when
  1101. // deleting text, so we ignore its input events
  1102. isInputEventSupported = isEventSupported('input') && (
  1103. (!('documentMode' in document) || document.documentMode > 9)
  1104. );
  1105. }
  1106. /**
  1107. * (For old IE.) Replacement getter/setter for the `value` property that gets
  1108. * set on the active element.
  1109. */
  1110. var newValueProp = {
  1111. get: function() {
  1112. return activeElementValueProp.get.call(this);
  1113. },
  1114. set: function(val) {
  1115. // Cast to a string so we can do equality checks.
  1116. activeElementValue = '' + val;
  1117. activeElementValueProp.set.call(this, val);
  1118. }
  1119. };
  1120. /**
  1121. * (For old IE.) Starts tracking propertychange events on the passed-in element
  1122. * and override the value property so that we can distinguish user events from
  1123. * value changes in JS.
  1124. */
  1125. function startWatchingForValueChange(target, targetID) {
  1126. activeElement = target;
  1127. activeElementID = targetID;
  1128. activeElementValue = target.value;
  1129. activeElementValueProp = Object.getOwnPropertyDescriptor(
  1130. target.constructor.prototype,
  1131. 'value'
  1132. );
  1133. Object.defineProperty(activeElement, 'value', newValueProp);
  1134. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  1135. }
  1136. /**
  1137. * (For old IE.) Removes the event listeners from the currently-tracked element,
  1138. * if any exists.
  1139. */
  1140. function stopWatchingForValueChange() {
  1141. if (!activeElement) {
  1142. return;
  1143. }
  1144. // delete restores the original property definition
  1145. delete activeElement.value;
  1146. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  1147. activeElement = null;
  1148. activeElementID = null;
  1149. activeElementValue = null;
  1150. activeElementValueProp = null;
  1151. }
  1152. /**
  1153. * (For old IE.) Handles a propertychange event, sending a `change` event if
  1154. * the value of the active element has changed.
  1155. */
  1156. function handlePropertyChange(nativeEvent) {
  1157. if (nativeEvent.propertyName !== 'value') {
  1158. return;
  1159. }
  1160. var value = nativeEvent.srcElement.value;
  1161. if (value === activeElementValue) {
  1162. return;
  1163. }
  1164. activeElementValue = value;
  1165. manualDispatchChangeEvent(nativeEvent);
  1166. }
  1167. /**
  1168. * If a `change` event should be fired, returns the target's ID.
  1169. */
  1170. function getTargetIDForInputEvent(
  1171. topLevelType,
  1172. topLevelTarget,
  1173. topLevelTargetID) {
  1174. if (topLevelType === topLevelTypes.topInput) {
  1175. // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
  1176. // what we want so fall through here and trigger an abstract event
  1177. return topLevelTargetID;
  1178. }
  1179. }
  1180. // For IE8 and IE9.
  1181. function handleEventsForInputEventIE(
  1182. topLevelType,
  1183. topLevelTarget,
  1184. topLevelTargetID) {
  1185. if (topLevelType === topLevelTypes.topFocus) {
  1186. // In IE8, we can capture almost all .value changes by adding a
  1187. // propertychange handler and looking for events with propertyName
  1188. // equal to 'value'
  1189. // In IE9, propertychange fires for most input events but is buggy and
  1190. // doesn't fire when text is deleted, but conveniently, selectionchange
  1191. // appears to fire in all of the remaining cases so we catch those and
  1192. // forward the event if the value has changed
  1193. // In either case, we don't want to call the event handler if the value
  1194. // is changed from JS so we redefine a setter for `.value` that updates
  1195. // our activeElementValue variable, allowing us to ignore those changes
  1196. //
  1197. // stopWatching() should be a noop here but we call it just in case we
  1198. // missed a blur event somehow.
  1199. stopWatchingForValueChange();
  1200. startWatchingForValueChange(topLevelTarget, topLevelTargetID);
  1201. } else if (topLevelType === topLevelTypes.topBlur) {
  1202. stopWatchingForValueChange();
  1203. }
  1204. }
  1205. // For IE8 and IE9.
  1206. function getTargetIDForInputEventIE(
  1207. topLevelType,
  1208. topLevelTarget,
  1209. topLevelTargetID) {
  1210. if (topLevelType === topLevelTypes.topSelectionChange ||
  1211. topLevelType === topLevelTypes.topKeyUp ||
  1212. topLevelType === topLevelTypes.topKeyDown) {
  1213. // On the selectionchange event, the target is just document which isn't
  1214. // helpful for us so just check activeElement instead.
  1215. //
  1216. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  1217. // propertychange on the first input event after setting `value` from a
  1218. // script and fires only keydown, keypress, keyup. Catching keyup usually
  1219. // gets it and catching keydown lets us fire an event for the first
  1220. // keystroke if user does a key repeat (it'll be a little delayed: right
  1221. // before the second keystroke). Other input methods (e.g., paste) seem to
  1222. // fire selectionchange normally.
  1223. if (activeElement && activeElement.value !== activeElementValue) {
  1224. activeElementValue = activeElement.value;
  1225. return activeElementID;
  1226. }
  1227. }
  1228. }
  1229. /**
  1230. * SECTION: handle `click` event
  1231. */
  1232. function shouldUseClickEvent(elem) {
  1233. // Use the `click` event to detect changes to checkbox and radio inputs.
  1234. // This approach works across all browsers, whereas `change` does not fire
  1235. // until `blur` in IE8.
  1236. return (
  1237. elem.nodeName === 'INPUT' &&
  1238. (elem.type === 'checkbox' || elem.type === 'radio')
  1239. );
  1240. }
  1241. function getTargetIDForClickEvent(
  1242. topLevelType,
  1243. topLevelTarget,
  1244. topLevelTargetID) {
  1245. if (topLevelType === topLevelTypes.topClick) {
  1246. return topLevelTargetID;
  1247. }
  1248. }
  1249. /**
  1250. * This plugin creates an `onChange` event that normalizes change events
  1251. * across form elements. This event fires at a time when it's possible to
  1252. * change the element's value without seeing a flicker.
  1253. *
  1254. * Supported elements are:
  1255. * - input (see `isTextInputElement`)
  1256. * - textarea
  1257. * - select
  1258. */
  1259. var ChangeEventPlugin = {
  1260. eventTypes: eventTypes,
  1261. /**
  1262. * @param {string} topLevelType Record from `EventConstants`.
  1263. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  1264. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  1265. * @param {object} nativeEvent Native browser event.
  1266. * @return {*} An accumulation of synthetic events.
  1267. * @see {EventPluginHub.extractEvents}
  1268. */
  1269. extractEvents: function(
  1270. topLevelType,
  1271. topLevelTarget,
  1272. topLevelTargetID,
  1273. nativeEvent) {
  1274. var getTargetIDFunc, handleEventFunc;
  1275. if (shouldUseChangeEvent(topLevelTarget)) {
  1276. if (doesChangeEventBubble) {
  1277. getTargetIDFunc = getTargetIDForChangeEvent;
  1278. } else {
  1279. handleEventFunc = handleEventsForChangeEventIE8;
  1280. }
  1281. } else if (isTextInputElement(topLevelTarget)) {
  1282. if (isInputEventSupported) {
  1283. getTargetIDFunc = getTargetIDForInputEvent;
  1284. } else {
  1285. getTargetIDFunc = getTargetIDForInputEventIE;
  1286. handleEventFunc = handleEventsForInputEventIE;
  1287. }
  1288. } else if (shouldUseClickEvent(topLevelTarget)) {
  1289. getTargetIDFunc = getTargetIDForClickEvent;
  1290. }
  1291. if (getTargetIDFunc) {
  1292. var targetID = getTargetIDFunc(
  1293. topLevelType,
  1294. topLevelTarget,
  1295. topLevelTargetID
  1296. );
  1297. if (targetID) {
  1298. var event = SyntheticEvent.getPooled(
  1299. eventTypes.change,
  1300. targetID,
  1301. nativeEvent
  1302. );
  1303. EventPropagators.accumulateTwoPhaseDispatches(event);
  1304. return event;
  1305. }
  1306. }
  1307. if (handleEventFunc) {
  1308. handleEventFunc(
  1309. topLevelType,
  1310. topLevelTarget,
  1311. topLevelTargetID
  1312. );
  1313. }
  1314. }
  1315. };
  1316. module.exports = ChangeEventPlugin;
  1317. },{"100":100,"108":108,"151":151,"153":153,"157":157,"16":16,"18":18,"21":21,"22":22}],9:[function(_dereq_,module,exports){
  1318. /**
  1319. * Copyright 2013-2015, Facebook, Inc.
  1320. * All rights reserved.
  1321. *
  1322. * This source code is licensed under the BSD-style license found in the
  1323. * LICENSE file in the root directory of this source tree. An additional grant
  1324. * of patent rights can be found in the PATENTS file in the same directory.
  1325. *
  1326. * @providesModule ClientReactRootIndex
  1327. * @typechecks
  1328. */
  1329. 'use strict';
  1330. var nextReactRootIndex = 0;
  1331. var ClientReactRootIndex = {
  1332. createReactRootIndex: function() {
  1333. return nextReactRootIndex++;
  1334. }
  1335. };
  1336. module.exports = ClientReactRootIndex;
  1337. },{}],10:[function(_dereq_,module,exports){
  1338. /**
  1339. * Copyright 2013-2015, Facebook, Inc.
  1340. * All rights reserved.
  1341. *
  1342. * This source code is licensed under the BSD-style license found in the
  1343. * LICENSE file in the root directory of this source tree. An additional grant
  1344. * of patent rights can be found in the PATENTS file in the same directory.
  1345. *
  1346. * @providesModule DOMChildrenOperations
  1347. * @typechecks static-only
  1348. */
  1349. 'use strict';
  1350. var Danger = _dereq_(13);
  1351. var ReactMultiChildUpdateTypes = _dereq_(79);
  1352. var setTextContent = _dereq_(165);
  1353. var invariant = _dereq_(150);
  1354. /**
  1355. * Inserts `childNode` as a child of `parentNode` at the `index`.
  1356. *
  1357. * @param {DOMElement} parentNode Parent node in which to insert.
  1358. * @param {DOMElement} childNode Child node to insert.
  1359. * @param {number} index Index at which to insert the child.
  1360. * @internal
  1361. */
  1362. function insertChildAt(parentNode, childNode, index) {
  1363. // By exploiting arrays returning `undefined` for an undefined index, we can
  1364. // rely exclusively on `insertBefore(node, null)` instead of also using
  1365. // `appendChild(node)`. However, using `undefined` is not allowed by all
  1366. // browsers so we must replace it with `null`.
  1367. parentNode.insertBefore(
  1368. childNode,
  1369. parentNode.childNodes[index] || null
  1370. );
  1371. }
  1372. /**
  1373. * Operations for updating with DOM children.
  1374. */
  1375. var DOMChildrenOperations = {
  1376. dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
  1377. updateTextContent: setTextContent,
  1378. /**
  1379. * Updates a component's children by processing a series of updates. The
  1380. * update configurations are each expected to have a `parentNode` property.
  1381. *
  1382. * @param {array<object>} updates List of update configurations.
  1383. * @param {array<string>} markupList List of markup strings.
  1384. * @internal
  1385. */
  1386. processUpdates: function(updates, markupList) {
  1387. var update;
  1388. // Mapping from parent IDs to initial child orderings.
  1389. var initialChildren = null;
  1390. // List of children that will be moved or removed.
  1391. var updatedChildren = null;
  1392. for (var i = 0; i < updates.length; i++) {
  1393. update = updates[i];
  1394. if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
  1395. update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
  1396. var updatedIndex = update.fromIndex;
  1397. var updatedChild = update.parentNode.childNodes[updatedIndex];
  1398. var parentID = update.parentID;
  1399. ("production" !== "development" ? invariant(
  1400. updatedChild,
  1401. 'processUpdates(): Unable to find child %s of element. This ' +
  1402. 'probably means the DOM was unexpectedly mutated (e.g., by the ' +
  1403. 'browser), usually due to forgetting a <tbody> when using tables, ' +
  1404. 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
  1405. 'in an <svg> parent. Try inspecting the child nodes of the element ' +
  1406. 'with React ID `%s`.',
  1407. updatedIndex,
  1408. parentID
  1409. ) : invariant(updatedChild));
  1410. initialChildren = initialChildren || {};
  1411. initialChildren[parentID] = initialChildren[parentID] || [];
  1412. initialChildren[parentID][updatedIndex] = updatedChild;
  1413. updatedChildren = updatedChildren || [];
  1414. updatedChildren.push(updatedChild);
  1415. }
  1416. }
  1417. var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
  1418. // Remove updated children first so that `toIndex` is consistent.
  1419. if (updatedChildren) {
  1420. for (var j = 0; j < updatedChildren.length; j++) {
  1421. updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
  1422. }
  1423. }
  1424. for (var k = 0; k < updates.length; k++) {
  1425. update = updates[k];
  1426. switch (update.type) {
  1427. case ReactMultiChildUpdateTypes.INSERT_MARKUP:
  1428. insertChildAt(
  1429. update.parentNode,
  1430. renderedMarkup[update.markupIndex],
  1431. update.toIndex
  1432. );
  1433. break;
  1434. case ReactMultiChildUpdateTypes.MOVE_EXISTING:
  1435. insertChildAt(
  1436. update.parentNode,
  1437. initialChildren[update.parentID][update.fromIndex],
  1438. update.toIndex
  1439. );
  1440. break;
  1441. case ReactMultiChildUpdateTypes.TEXT_CONTENT:
  1442. setTextContent(
  1443. update.parentNode,
  1444. update.textContent
  1445. );
  1446. break;
  1447. case ReactMultiChildUpdateTypes.REMOVE_NODE:
  1448. // Already removed by the for-loop above.
  1449. break;
  1450. }
  1451. }
  1452. }
  1453. };
  1454. module.exports = DOMChildrenOperations;
  1455. },{"13":13,"150":150,"165":165,"79":79}],11:[function(_dereq_,module,exports){
  1456. /**
  1457. * Copyright 2013-2015, Facebook, Inc.
  1458. * All rights reserved.
  1459. *
  1460. * This source code is licensed under the BSD-style license found in the
  1461. * LICENSE file in the root directory of this source tree. An additional grant
  1462. * of patent rights can be found in the PATENTS file in the same directory.
  1463. *
  1464. * @providesModule DOMProperty
  1465. * @typechecks static-only
  1466. */
  1467. /*jslint bitwise: true */
  1468. 'use strict';
  1469. var invariant = _dereq_(150);
  1470. function checkMask(value, bitmask) {
  1471. return (value & bitmask) === bitmask;
  1472. }
  1473. var DOMPropertyInjection = {
  1474. /**
  1475. * Mapping from normalized, camelcased property names to a configuration that
  1476. * specifies how the associated DOM property should be accessed or rendered.
  1477. */
  1478. MUST_USE_ATTRIBUTE: 0x1,
  1479. MUST_USE_PROPERTY: 0x2,
  1480. HAS_SIDE_EFFECTS: 0x4,
  1481. HAS_BOOLEAN_VALUE: 0x8,
  1482. HAS_NUMERIC_VALUE: 0x10,
  1483. HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
  1484. HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
  1485. /**
  1486. * Inject some specialized knowledge about the DOM. This takes a config object
  1487. * with the following properties:
  1488. *
  1489. * isCustomAttribute: function that given an attribute name will return true
  1490. * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
  1491. * attributes where it's impossible to enumerate all of the possible
  1492. * attribute names,
  1493. *
  1494. * Properties: object mapping DOM property name to one of the
  1495. * DOMPropertyInjection constants or null. If your attribute isn't in here,
  1496. * it won't get written to the DOM.
  1497. *
  1498. * DOMAttributeNames: object mapping React attribute name to the DOM
  1499. * attribute name. Attribute names not specified use the **lowercase**
  1500. * normalized name.
  1501. *
  1502. * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
  1503. * Property names not specified use the normalized name.
  1504. *
  1505. * DOMMutationMethods: Properties that require special mutation methods. If
  1506. * `value` is undefined, the mutation method should unset the property.
  1507. *
  1508. * @param {object} domPropertyConfig the config as described above.
  1509. */
  1510. injectDOMPropertyConfig: function(domPropertyConfig) {
  1511. var Properties = domPropertyConfig.Properties || {};
  1512. var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
  1513. var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
  1514. var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
  1515. if (domPropertyConfig.isCustomAttribute) {
  1516. DOMProperty._isCustomAttributeFunctions.push(
  1517. domPropertyConfig.isCustomAttribute
  1518. );
  1519. }
  1520. for (var propName in Properties) {
  1521. ("production" !== "development" ? invariant(
  1522. !DOMProperty.isStandardName.hasOwnProperty(propName),
  1523. 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
  1524. '\'%s\' which has already been injected. You may be accidentally ' +
  1525. 'injecting the same DOM property config twice, or you may be ' +
  1526. 'injecting two configs that have conflicting property names.',
  1527. propName
  1528. ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
  1529. DOMProperty.isStandardName[propName] = true;
  1530. var lowerCased = propName.toLowerCase();
  1531. DOMProperty.getPossibleStandardName[lowerCased] = propName;
  1532. if (DOMAttributeNames.hasOwnProperty(propName)) {
  1533. var attributeName = DOMAttributeNames[propName];
  1534. DOMProperty.getPossibleStandardName[attributeName] = propName;
  1535. DOMProperty.getAttributeName[propName] = attributeName;
  1536. } else {
  1537. DOMProperty.getAttributeName[propName] = lowerCased;
  1538. }
  1539. DOMProperty.getPropertyName[propName] =
  1540. DOMPropertyNames.hasOwnProperty(propName) ?
  1541. DOMPropertyNames[propName] :
  1542. propName;
  1543. if (DOMMutationMethods.hasOwnProperty(propName)) {
  1544. DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
  1545. } else {
  1546. DOMProperty.getMutationMethod[propName] = null;
  1547. }
  1548. var propConfig = Properties[propName];
  1549. DOMProperty.mustUseAttribute[propName] =
  1550. checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
  1551. DOMProperty.mustUseProperty[propName] =
  1552. checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
  1553. DOMProperty.hasSideEffects[propName] =
  1554. checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
  1555. DOMProperty.hasBooleanValue[propName] =
  1556. checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
  1557. DOMProperty.hasNumericValue[propName] =
  1558. checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
  1559. DOMProperty.hasPositiveNumericValue[propName] =
  1560. checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
  1561. DOMProperty.hasOverloadedBooleanValue[propName] =
  1562. checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
  1563. ("production" !== "development" ? invariant(
  1564. !DOMProperty.mustUseAttribute[propName] ||
  1565. !DOMProperty.mustUseProperty[propName],
  1566. 'DOMProperty: Cannot require using both attribute and property: %s',
  1567. propName
  1568. ) : invariant(!DOMProperty.mustUseAttribute[propName] ||
  1569. !DOMProperty.mustUseProperty[propName]));
  1570. ("production" !== "development" ? invariant(
  1571. DOMProperty.mustUseProperty[propName] ||
  1572. !DOMProperty.hasSideEffects[propName],
  1573. 'DOMProperty: Properties that have side effects must use property: %s',
  1574. propName
  1575. ) : invariant(DOMProperty.mustUseProperty[propName] ||
  1576. !DOMProperty.hasSideEffects[propName]));
  1577. ("production" !== "development" ? invariant(
  1578. !!DOMProperty.hasBooleanValue[propName] +
  1579. !!DOMProperty.hasNumericValue[propName] +
  1580. !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
  1581. 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
  1582. 'numeric value, but not a combination: %s',
  1583. propName
  1584. ) : invariant(!!DOMProperty.hasBooleanValue[propName] +
  1585. !!DOMProperty.hasNumericValue[propName] +
  1586. !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
  1587. }
  1588. }
  1589. };
  1590. var defaultValueCache = {};
  1591. /**
  1592. * DOMProperty exports lookup objects that can be used like functions:
  1593. *
  1594. * > DOMProperty.isValid['id']
  1595. * true
  1596. * > DOMProperty.isValid['foobar']
  1597. * undefined
  1598. *
  1599. * Although this may be confusing, it performs better in general.
  1600. *
  1601. * @see http://jsperf.com/key-exists
  1602. * @see http://jsperf.com/key-missing
  1603. */
  1604. var DOMProperty = {
  1605. ID_ATTRIBUTE_NAME: 'data-reactid',
  1606. /**
  1607. * Checks whether a property name is a standard property.
  1608. * @type {Object}
  1609. */
  1610. isStandardName: {},
  1611. /**
  1612. * Mapping from lowercase property names to the properly cased version, used
  1613. * to warn in the case of missing properties.
  1614. * @type {Object}
  1615. */
  1616. getPossibleStandardName: {},
  1617. /**
  1618. * Mapping from normalized names to attribute names that differ. Attribute
  1619. * names are used when rendering markup or with `*Attribute()`.
  1620. * @type {Object}
  1621. */
  1622. getAttributeName: {},
  1623. /**
  1624. * Mapping from normalized names to properties on DOM node instances.
  1625. * (This includes properties that mutate due to external factors.)
  1626. * @type {Object}
  1627. */
  1628. getPropertyName: {},
  1629. /**
  1630. * Mapping from normalized names to mutation methods. This will only exist if
  1631. * mutation cannot be set simply by the property or `setAttribute()`.
  1632. * @type {Object}
  1633. */
  1634. getMutationMethod: {},
  1635. /**
  1636. * Whether the property must be accessed and mutated as an object property.
  1637. * @type {Object}
  1638. */
  1639. mustUseAttribute: {},
  1640. /**
  1641. * Whether the property must be accessed and mutated using `*Attribute()`.
  1642. * (This includes anything that fails `<propName> in <element>`.)
  1643. * @type {Object}
  1644. */
  1645. mustUseProperty: {},
  1646. /**
  1647. * Whether or not setting a value causes side effects such as triggering
  1648. * resources to be loaded or text selection changes. We must ensure that
  1649. * the value is only set if it has changed.
  1650. * @type {Object}
  1651. */
  1652. hasSideEffects: {},
  1653. /**
  1654. * Whether the property should be removed when set to a falsey value.
  1655. * @type {Object}
  1656. */
  1657. hasBooleanValue: {},
  1658. /**
  1659. * Whether the property must be numeric or parse as a
  1660. * numeric and should be removed when set to a falsey value.
  1661. * @type {Object}
  1662. */
  1663. hasNumericValue: {},
  1664. /**
  1665. * Whether the property must be positive numeric or parse as a positive
  1666. * numeric and should be removed when set to a falsey value.
  1667. * @type {Object}
  1668. */
  1669. hasPositiveNumericValue: {},
  1670. /**
  1671. * Whether the property can be used as a flag as well as with a value. Removed
  1672. * when strictly equal to false; present without a value when strictly equal
  1673. * to true; present with a value otherwise.
  1674. * @type {Object}
  1675. */
  1676. hasOverloadedBooleanValue: {},
  1677. /**
  1678. * All of the isCustomAttribute() functions that have been injected.
  1679. */
  1680. _isCustomAttributeFunctions: [],
  1681. /**
  1682. * Checks whether a property name is a custom attribute.
  1683. * @method
  1684. */
  1685. isCustomAttribute: function(attributeName) {
  1686. for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
  1687. var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
  1688. if (isCustomAttributeFn(attributeName)) {
  1689. return true;
  1690. }
  1691. }
  1692. return false;
  1693. },
  1694. /**
  1695. * Returns the default property value for a DOM property (i.e., not an
  1696. * attribute). Most default values are '' or false, but not all. Worse yet,
  1697. * some (in particular, `type`) vary depending on the type of element.
  1698. *
  1699. * TODO: Is it better to grab all the possible properties when creating an
  1700. * element to avoid having to create the same element twice?
  1701. */
  1702. getDefaultValueForProperty: function(nodeName, prop) {
  1703. var nodeDefaults = defaultValueCache[nodeName];
  1704. var testElement;
  1705. if (!nodeDefaults) {
  1706. defaultValueCache[nodeName] = nodeDefaults = {};
  1707. }
  1708. if (!(prop in nodeDefaults)) {
  1709. testElement = document.createElement(nodeName);
  1710. nodeDefaults[prop] = testElement[prop];
  1711. }
  1712. return nodeDefaults[prop];
  1713. },
  1714. injection: DOMPropertyInjection
  1715. };
  1716. module.exports = DOMProperty;
  1717. },{"150":150}],12:[function(_dereq_,module,exports){
  1718. /**
  1719. * Copyright 2013-2015, Facebook, Inc.
  1720. * All rights reserved.
  1721. *
  1722. * This source code is licensed under the BSD-style license found in the
  1723. * LICENSE file in the root directory of this source tree. An additional grant
  1724. * of patent rights can be found in the PATENTS file in the same directory.
  1725. *
  1726. * @providesModule DOMPropertyOperations
  1727. * @typechecks static-only
  1728. */
  1729. 'use strict';
  1730. var DOMProperty = _dereq_(11);
  1731. var quoteAttributeValueForBrowser = _dereq_(163);
  1732. var warning = _dereq_(171);
  1733. function shouldIgnoreValue(name, value) {
  1734. return value == null ||
  1735. (DOMProperty.hasBooleanValue[name] && !value) ||
  1736. (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
  1737. (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
  1738. (DOMProperty.hasOverloadedBooleanValue[name] && value === false);
  1739. }
  1740. if ("production" !== "development") {
  1741. var reactProps = {
  1742. children: true,
  1743. dangerouslySetInnerHTML: true,
  1744. key: true,
  1745. ref: true
  1746. };
  1747. var warnedProperties = {};
  1748. var warnUnknownProperty = function(name) {
  1749. if (reactProps.hasOwnProperty(name) && reactProps[name] ||
  1750. warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
  1751. return;
  1752. }
  1753. warnedProperties[name] = true;
  1754. var lowerCasedName = name.toLowerCase();
  1755. // data-* attributes should be lowercase; suggest the lowercase version
  1756. var standardName = (
  1757. DOMProperty.isCustomAttribute(lowerCasedName) ?
  1758. lowerCasedName :
  1759. DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
  1760. DOMProperty.getPossibleStandardName[lowerCasedName] :
  1761. null
  1762. );
  1763. // For now, only warn when we have a suggested correction. This prevents
  1764. // logging too much when using transferPropsTo.
  1765. ("production" !== "development" ? warning(
  1766. standardName == null,
  1767. 'Unknown DOM property %s. Did you mean %s?',
  1768. name,
  1769. standardName
  1770. ) : null);
  1771. };
  1772. }
  1773. /**
  1774. * Operations for dealing with DOM properties.
  1775. */
  1776. var DOMPropertyOperations = {
  1777. /**
  1778. * Creates markup for the ID property.
  1779. *
  1780. * @param {string} id Unescaped ID.
  1781. * @return {string} Markup string.
  1782. */
  1783. createMarkupForID: function(id) {
  1784. return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
  1785. quoteAttributeValueForBrowser(id);
  1786. },
  1787. /**
  1788. * Creates markup for a property.
  1789. *
  1790. * @param {string} name
  1791. * @param {*} value
  1792. * @return {?string} Markup string, or null if the property was invalid.
  1793. */
  1794. createMarkupForProperty: function(name, value) {
  1795. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1796. DOMProperty.isStandardName[name]) {
  1797. if (shouldIgnoreValue(name, value)) {
  1798. return '';
  1799. }
  1800. var attributeName = DOMProperty.getAttributeName[name];
  1801. if (DOMProperty.hasBooleanValue[name] ||
  1802. (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
  1803. return attributeName;
  1804. }
  1805. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  1806. } else if (DOMProperty.isCustomAttribute(name)) {
  1807. if (value == null) {
  1808. return '';
  1809. }
  1810. return name + '=' + quoteAttributeValueForBrowser(value);
  1811. } else if ("production" !== "development") {
  1812. warnUnknownProperty(name);
  1813. }
  1814. return null;
  1815. },
  1816. /**
  1817. * Sets the value for a property on a node.
  1818. *
  1819. * @param {DOMElement} node
  1820. * @param {string} name
  1821. * @param {*} value
  1822. */
  1823. setValueForProperty: function(node, name, value) {
  1824. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1825. DOMProperty.isStandardName[name]) {
  1826. var mutationMethod = DOMProperty.getMutationMethod[name];
  1827. if (mutationMethod) {
  1828. mutationMethod(node, value);
  1829. } else if (shouldIgnoreValue(name, value)) {
  1830. this.deleteValueForProperty(node, name);
  1831. } else if (DOMProperty.mustUseAttribute[name]) {
  1832. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  1833. // ('' + value) makes it output the correct toString()-value.
  1834. node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
  1835. } else {
  1836. var propName = DOMProperty.getPropertyName[name];
  1837. // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
  1838. // property type before comparing; only `value` does and is string.
  1839. if (!DOMProperty.hasSideEffects[name] ||
  1840. ('' + node[propName]) !== ('' + value)) {
  1841. // Contrary to `setAttribute`, object properties are properly
  1842. // `toString`ed by IE8/9.
  1843. node[propName] = value;
  1844. }
  1845. }
  1846. } else if (DOMProperty.isCustomAttribute(name)) {
  1847. if (value == null) {
  1848. node.removeAttribute(name);
  1849. } else {
  1850. node.setAttribute(name, '' + value);
  1851. }
  1852. } else if ("production" !== "development") {
  1853. warnUnknownProperty(name);
  1854. }
  1855. },
  1856. /**
  1857. * Deletes the value for a property on a node.
  1858. *
  1859. * @param {DOMElement} node
  1860. * @param {string} name
  1861. */
  1862. deleteValueForProperty: function(node, name) {
  1863. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1864. DOMProperty.isStandardName[name]) {
  1865. var mutationMethod = DOMProperty.getMutationMethod[name];
  1866. if (mutationMethod) {
  1867. mutationMethod(node, undefined);
  1868. } else if (DOMProperty.mustUseAttribute[name]) {
  1869. node.removeAttribute(DOMProperty.getAttributeName[name]);
  1870. } else {
  1871. var propName = DOMProperty.getPropertyName[name];
  1872. var defaultValue = DOMProperty.getDefaultValueForProperty(
  1873. node.nodeName,
  1874. propName
  1875. );
  1876. if (!DOMProperty.hasSideEffects[name] ||
  1877. ('' + node[propName]) !== defaultValue) {
  1878. node[propName] = defaultValue;
  1879. }
  1880. }
  1881. } else if (DOMProperty.isCustomAttribute(name)) {
  1882. node.removeAttribute(name);
  1883. } else if ("production" !== "development") {
  1884. warnUnknownProperty(name);
  1885. }
  1886. }
  1887. };
  1888. module.exports = DOMPropertyOperations;
  1889. },{"11":11,"163":163,"171":171}],13:[function(_dereq_,module,exports){
  1890. /**
  1891. * Copyright 2013-2015, Facebook, Inc.
  1892. * All rights reserved.
  1893. *
  1894. * This source code is licensed under the BSD-style license found in the
  1895. * LICENSE file in the root directory of this source tree. An additional grant
  1896. * of patent rights can be found in the PATENTS file in the same directory.
  1897. *
  1898. * @providesModule Danger
  1899. * @typechecks static-only
  1900. */
  1901. /*jslint evil: true, sub: true */
  1902. 'use strict';
  1903. var ExecutionEnvironment = _dereq_(22);
  1904. var createNodesFromMarkup = _dereq_(126);
  1905. var emptyFunction = _dereq_(129);
  1906. var getMarkupWrap = _dereq_(142);
  1907. var invariant = _dereq_(150);
  1908. var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
  1909. var RESULT_INDEX_ATTR = 'data-danger-index';
  1910. /**
  1911. * Extracts the `nodeName` from a string of markup.
  1912. *
  1913. * NOTE: Extracting the `nodeName` does not require a regular expression match
  1914. * because we make assumptions about React-generated markup (i.e. there are no
  1915. * spaces surrounding the opening tag and there is at least one attribute).
  1916. *
  1917. * @param {string} markup String of markup.
  1918. * @return {string} Node name of the supplied markup.
  1919. * @see http://jsperf.com/extract-nodename
  1920. */
  1921. function getNodeName(markup) {
  1922. return markup.substring(1, markup.indexOf(' '));
  1923. }
  1924. var Danger = {
  1925. /**
  1926. * Renders markup into an array of nodes. The markup is expected to render
  1927. * into a list of root nodes. Also, the length of `resultList` and
  1928. * `markupList` should be the same.
  1929. *
  1930. * @param {array<string>} markupList List of markup strings to render.
  1931. * @return {array<DOMElement>} List of rendered nodes.
  1932. * @internal
  1933. */
  1934. dangerouslyRenderMarkup: function(markupList) {
  1935. ("production" !== "development" ? invariant(
  1936. ExecutionEnvironment.canUseDOM,
  1937. 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
  1938. 'thread. Make sure `window` and `document` are available globally ' +
  1939. 'before requiring React when unit testing or use ' +
  1940. 'React.renderToString for server rendering.'
  1941. ) : invariant(ExecutionEnvironment.canUseDOM));
  1942. var nodeName;
  1943. var markupByNodeName = {};
  1944. // Group markup by `nodeName` if a wrap is necessary, else by '*'.
  1945. for (var i = 0; i < markupList.length; i++) {
  1946. ("production" !== "development" ? invariant(
  1947. markupList[i],
  1948. 'dangerouslyRenderMarkup(...): Missing markup.'
  1949. ) : invariant(markupList[i]));
  1950. nodeName = getNodeName(markupList[i]);
  1951. nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
  1952. markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
  1953. markupByNodeName[nodeName][i] = markupList[i];
  1954. }
  1955. var resultList = [];
  1956. var resultListAssignmentCount = 0;
  1957. for (nodeName in markupByNodeName) {
  1958. if (!markupByNodeName.hasOwnProperty(nodeName)) {
  1959. continue;
  1960. }
  1961. var markupListByNodeName = markupByNodeName[nodeName];
  1962. // This for-in loop skips the holes of the sparse array. The order of
  1963. // iteration should follow the order of assignment, which happens to match
  1964. // numerical index order, but we don't rely on that.
  1965. var resultIndex;
  1966. for (resultIndex in markupListByNodeName) {
  1967. if (markupListByNodeName.hasOwnProperty(resultIndex)) {
  1968. var markup = markupListByNodeName[resultIndex];
  1969. // Push the requested markup with an additional RESULT_INDEX_ATTR
  1970. // attribute. If the markup does not start with a < character, it
  1971. // will be discarded below (with an appropriate console.error).
  1972. markupListByNodeName[resultIndex] = markup.replace(
  1973. OPEN_TAG_NAME_EXP,
  1974. // This index will be parsed back out below.
  1975. '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
  1976. );
  1977. }
  1978. }
  1979. // Render each group of markup with similar wrapping `nodeName`.
  1980. var renderNodes = createNodesFromMarkup(
  1981. markupListByNodeName.join(''),
  1982. emptyFunction // Do nothing special with <script> tags.
  1983. );
  1984. for (var j = 0; j < renderNodes.length; ++j) {
  1985. var renderNode = renderNodes[j];
  1986. if (renderNode.hasAttribute &&
  1987. renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
  1988. resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
  1989. renderNode.removeAttribute(RESULT_INDEX_ATTR);
  1990. ("production" !== "development" ? invariant(
  1991. !resultList.hasOwnProperty(resultIndex),
  1992. 'Danger: Assigning to an already-occupied result index.'
  1993. ) : invariant(!resultList.hasOwnProperty(resultIndex)));
  1994. resultList[resultIndex] = renderNode;
  1995. // This should match resultList.length and markupList.length when
  1996. // we're done.
  1997. resultListAssignmentCount += 1;
  1998. } else if ("production" !== "development") {
  1999. console.error(
  2000. 'Danger: Discarding unexpected node:',
  2001. renderNode
  2002. );
  2003. }
  2004. }
  2005. }
  2006. // Although resultList was populated out of order, it should now be a dense
  2007. // array.
  2008. ("production" !== "development" ? invariant(
  2009. resultListAssignmentCount === resultList.length,
  2010. 'Danger: Did not assign to every index of resultList.'
  2011. ) : invariant(resultListAssignmentCount === resultList.length));
  2012. ("production" !== "development" ? invariant(
  2013. resultList.length === markupList.length,
  2014. 'Danger: Expected markup to render %s nodes, but rendered %s.',
  2015. markupList.length,
  2016. resultList.length
  2017. ) : invariant(resultList.length === markupList.length));
  2018. return resultList;
  2019. },
  2020. /**
  2021. * Replaces a node with a string of markup at its current position within its
  2022. * parent. The markup must render into a single root node.
  2023. *
  2024. * @param {DOMElement} oldChild Child node to replace.
  2025. * @param {string} markup Markup to render in place of the child node.
  2026. * @internal
  2027. */
  2028. dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
  2029. ("production" !== "development" ? invariant(
  2030. ExecutionEnvironment.canUseDOM,
  2031. 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
  2032. 'worker thread. Make sure `window` and `document` are available ' +
  2033. 'globally before requiring React when unit testing or use ' +
  2034. 'React.renderToString for server rendering.'
  2035. ) : invariant(ExecutionEnvironment.canUseDOM));
  2036. ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
  2037. ("production" !== "development" ? invariant(
  2038. oldChild.tagName.toLowerCase() !== 'html',
  2039. 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
  2040. '<html> node. This is because browser quirks make this unreliable ' +
  2041. 'and/or slow. If you want to render to the root you must use ' +
  2042. 'server rendering. See React.renderToString().'
  2043. ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
  2044. var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
  2045. oldChild.parentNode.replaceChild(newChild, oldChild);
  2046. }
  2047. };
  2048. module.exports = Danger;
  2049. },{"126":126,"129":129,"142":142,"150":150,"22":22}],14:[function(_dereq_,module,exports){
  2050. /**
  2051. * Copyright 2013-2015, Facebook, Inc.
  2052. * All rights reserved.
  2053. *
  2054. * This source code is licensed under the BSD-style license found in the
  2055. * LICENSE file in the root directory of this source tree. An additional grant
  2056. * of patent rights can be found in the PATENTS file in the same directory.
  2057. *
  2058. * @providesModule DefaultEventPluginOrder
  2059. */
  2060. 'use strict';
  2061. var keyOf = _dereq_(157);
  2062. /**
  2063. * Module that is injectable into `EventPluginHub`, that specifies a
  2064. * deterministic ordering of `EventPlugin`s. A convenient way to reason about
  2065. * plugins, without having to package every one of them. This is better than
  2066. * having plugins be ordered in the same order that they are injected because
  2067. * that ordering would be influenced by the packaging order.
  2068. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  2069. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  2070. */
  2071. var DefaultEventPluginOrder = [
  2072. keyOf({ResponderEventPlugin: null}),
  2073. keyOf({SimpleEventPlugin: null}),
  2074. keyOf({TapEventPlugin: null}),
  2075. keyOf({EnterLeaveEventPlugin: null}),
  2076. keyOf({ChangeEventPlugin: null}),
  2077. keyOf({SelectEventPlugin: null}),
  2078. keyOf({BeforeInputEventPlugin: null}),
  2079. keyOf({AnalyticsEventPlugin: null}),
  2080. keyOf({MobileSafariClickEventPlugin: null})
  2081. ];
  2082. module.exports = DefaultEventPluginOrder;
  2083. },{"157":157}],15:[function(_dereq_,module,exports){
  2084. /**
  2085. * Copyright 2013-2015, Facebook, Inc.
  2086. * All rights reserved.
  2087. *
  2088. * This source code is licensed under the BSD-style license found in the
  2089. * LICENSE file in the root directory of this source tree. An additional grant
  2090. * of patent rights can be found in the PATENTS file in the same directory.
  2091. *
  2092. * @providesModule EnterLeaveEventPlugin
  2093. * @typechecks static-only
  2094. */
  2095. 'use strict';
  2096. var EventConstants = _dereq_(16);
  2097. var EventPropagators = _dereq_(21);
  2098. var SyntheticMouseEvent = _dereq_(112);
  2099. var ReactMount = _dereq_(77);
  2100. var keyOf = _dereq_(157);
  2101. var topLevelTypes = EventConstants.topLevelTypes;
  2102. var getFirstReactDOM = ReactMount.getFirstReactDOM;
  2103. var eventTypes = {
  2104. mouseEnter: {
  2105. registrationName: keyOf({onMouseEnter: null}),
  2106. dependencies: [
  2107. topLevelTypes.topMouseOut,
  2108. topLevelTypes.topMouseOver
  2109. ]
  2110. },
  2111. mouseLeave: {
  2112. registrationName: keyOf({onMouseLeave: null}),
  2113. dependencies: [
  2114. topLevelTypes.topMouseOut,
  2115. topLevelTypes.topMouseOver
  2116. ]
  2117. }
  2118. };
  2119. var extractedEvents = [null, null];
  2120. var EnterLeaveEventPlugin = {
  2121. eventTypes: eventTypes,
  2122. /**
  2123. * For almost every interaction we care about, there will be both a top-level
  2124. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  2125. * we do not extract duplicate events. However, moving the mouse into the
  2126. * browser from outside will not fire a `mouseout` event. In this case, we use
  2127. * the `mouseover` top-level event.
  2128. *
  2129. * @param {string} topLevelType Record from `EventConstants`.
  2130. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  2131. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  2132. * @param {object} nativeEvent Native browser event.
  2133. * @return {*} An accumulation of synthetic events.
  2134. * @see {EventPluginHub.extractEvents}
  2135. */
  2136. extractEvents: function(
  2137. topLevelType,
  2138. topLevelTarget,
  2139. topLevelTargetID,
  2140. nativeEvent) {
  2141. if (topLevelType === topLevelTypes.topMouseOver &&
  2142. (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  2143. return null;
  2144. }
  2145. if (topLevelType !== topLevelTypes.topMouseOut &&
  2146. topLevelType !== topLevelTypes.topMouseOver) {
  2147. // Must not be a mouse in or mouse out - ignoring.
  2148. return null;
  2149. }
  2150. var win;
  2151. if (topLevelTarget.window === topLevelTarget) {
  2152. // `topLevelTarget` is probably a window object.
  2153. win = topLevelTarget;
  2154. } else {
  2155. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  2156. var doc = topLevelTarget.ownerDocument;
  2157. if (doc) {
  2158. win = doc.defaultView || doc.parentWindow;
  2159. } else {
  2160. win = window;
  2161. }
  2162. }
  2163. var from, to;
  2164. if (topLevelType === topLevelTypes.topMouseOut) {
  2165. from = topLevelTarget;
  2166. to =
  2167. getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
  2168. win;
  2169. } else {
  2170. from = win;
  2171. to = topLevelTarget;
  2172. }
  2173. if (from === to) {
  2174. // Nothing pertains to our managed components.
  2175. return null;
  2176. }
  2177. var fromID = from ? ReactMount.getID(from) : '';
  2178. var toID = to ? ReactMount.getID(to) : '';
  2179. var leave = SyntheticMouseEvent.getPooled(
  2180. eventTypes.mouseLeave,
  2181. fromID,
  2182. nativeEvent
  2183. );
  2184. leave.type = 'mouseleave';
  2185. leave.target = from;
  2186. leave.relatedTarget = to;
  2187. var enter = SyntheticMouseEvent.getPooled(
  2188. eventTypes.mouseEnter,
  2189. toID,
  2190. nativeEvent
  2191. );
  2192. enter.type = 'mouseenter';
  2193. enter.target = to;
  2194. enter.relatedTarget = from;
  2195. EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
  2196. extractedEvents[0] = leave;
  2197. extractedEvents[1] = enter;
  2198. return extractedEvents;
  2199. }
  2200. };
  2201. module.exports = EnterLeaveEventPlugin;
  2202. },{"112":112,"157":157,"16":16,"21":21,"77":77}],16:[function(_dereq_,module,exports){
  2203. /**
  2204. * Copyright 2013-2015, Facebook, Inc.
  2205. * All rights reserved.
  2206. *
  2207. * This source code is licensed under the BSD-style license found in the
  2208. * LICENSE file in the root directory of this source tree. An additional grant
  2209. * of patent rights can be found in the PATENTS file in the same directory.
  2210. *
  2211. * @providesModule EventConstants
  2212. */
  2213. 'use strict';
  2214. var keyMirror = _dereq_(156);
  2215. var PropagationPhases = keyMirror({bubbled: null, captured: null});
  2216. /**
  2217. * Types of raw signals from the browser caught at the top level.
  2218. */
  2219. var topLevelTypes = keyMirror({
  2220. topBlur: null,
  2221. topChange: null,
  2222. topClick: null,
  2223. topCompositionEnd: null,
  2224. topCompositionStart: null,
  2225. topCompositionUpdate: null,
  2226. topContextMenu: null,
  2227. topCopy: null,
  2228. topCut: null,
  2229. topDoubleClick: null,
  2230. topDrag: null,
  2231. topDragEnd: null,
  2232. topDragEnter: null,
  2233. topDragExit: null,
  2234. topDragLeave: null,
  2235. topDragOver: null,
  2236. topDragStart: null,
  2237. topDrop: null,
  2238. topError: null,
  2239. topFocus: null,
  2240. topInput: null,
  2241. topKeyDown: null,
  2242. topKeyPress: null,
  2243. topKeyUp: null,
  2244. topLoad: null,
  2245. topMouseDown: null,
  2246. topMouseMove: null,
  2247. topMouseOut: null,
  2248. topMouseOver: null,
  2249. topMouseUp: null,
  2250. topPaste: null,
  2251. topReset: null,
  2252. topScroll: null,
  2253. topSelectionChange: null,
  2254. topSubmit: null,
  2255. topTextInput: null,
  2256. topTouchCancel: null,
  2257. topTouchEnd: null,
  2258. topTouchMove: null,
  2259. topTouchStart: null,
  2260. topWheel: null
  2261. });
  2262. var EventConstants = {
  2263. topLevelTypes: topLevelTypes,
  2264. PropagationPhases: PropagationPhases
  2265. };
  2266. module.exports = EventConstants;
  2267. },{"156":156}],17:[function(_dereq_,module,exports){
  2268. /**
  2269. * Copyright 2013-2015, Facebook, Inc.
  2270. *
  2271. * Licensed under the Apache License, Version 2.0 (the "License");
  2272. * you may not use this file except in compliance with the License.
  2273. * You may obtain a copy of the License at
  2274. *
  2275. * http://www.apache.org/licenses/LICENSE-2.0
  2276. *
  2277. * Unless required by applicable law or agreed to in writing, software
  2278. * distributed under the License is distributed on an "AS IS" BASIS,
  2279. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2280. * See the License for the specific language governing permissions and
  2281. * limitations under the License.
  2282. *
  2283. * @providesModule EventListener
  2284. * @typechecks
  2285. */
  2286. var emptyFunction = _dereq_(129);
  2287. /**
  2288. * Upstream version of event listener. Does not take into account specific
  2289. * nature of platform.
  2290. */
  2291. var EventListener = {
  2292. /**
  2293. * Listen to DOM events during the bubble phase.
  2294. *
  2295. * @param {DOMEventTarget} target DOM element to register listener on.
  2296. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  2297. * @param {function} callback Callback function.
  2298. * @return {object} Object with a `remove` method.
  2299. */
  2300. listen: function(target, eventType, callback) {
  2301. if (target.addEventListener) {
  2302. target.addEventListener(eventType, callback, false);
  2303. return {
  2304. remove: function() {
  2305. target.removeEventListener(eventType, callback, false);
  2306. }
  2307. };
  2308. } else if (target.attachEvent) {
  2309. target.attachEvent('on' + eventType, callback);
  2310. return {
  2311. remove: function() {
  2312. target.detachEvent('on' + eventType, callback);
  2313. }
  2314. };
  2315. }
  2316. },
  2317. /**
  2318. * Listen to DOM events during the capture phase.
  2319. *
  2320. * @param {DOMEventTarget} target DOM element to register listener on.
  2321. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  2322. * @param {function} callback Callback function.
  2323. * @return {object} Object with a `remove` method.
  2324. */
  2325. capture: function(target, eventType, callback) {
  2326. if (!target.addEventListener) {
  2327. if ("production" !== "development") {
  2328. console.error(
  2329. 'Attempted to listen to events during the capture phase on a ' +
  2330. 'browser that does not support the capture phase. Your application ' +
  2331. 'will not receive some events.'
  2332. );
  2333. }
  2334. return {
  2335. remove: emptyFunction
  2336. };
  2337. } else {
  2338. target.addEventListener(eventType, callback, true);
  2339. return {
  2340. remove: function() {
  2341. target.removeEventListener(eventType, callback, true);
  2342. }
  2343. };
  2344. }
  2345. },
  2346. registerDefault: function() {}
  2347. };
  2348. module.exports = EventListener;
  2349. },{"129":129}],18:[function(_dereq_,module,exports){
  2350. /**
  2351. * Copyright 2013-2015, Facebook, Inc.
  2352. * All rights reserved.
  2353. *
  2354. * This source code is licensed under the BSD-style license found in the
  2355. * LICENSE file in the root directory of this source tree. An additional grant
  2356. * of patent rights can be found in the PATENTS file in the same directory.
  2357. *
  2358. * @providesModule EventPluginHub
  2359. */
  2360. 'use strict';
  2361. var EventPluginRegistry = _dereq_(19);
  2362. var EventPluginUtils = _dereq_(20);
  2363. var accumulateInto = _dereq_(118);
  2364. var forEachAccumulated = _dereq_(135);
  2365. var invariant = _dereq_(150);
  2366. /**
  2367. * Internal store for event listeners
  2368. */
  2369. var listenerBank = {};
  2370. /**
  2371. * Internal queue of events that have accumulated their dispatches and are
  2372. * waiting to have their dispatches executed.
  2373. */
  2374. var eventQueue = null;
  2375. /**
  2376. * Dispatches an event and releases it back into the pool, unless persistent.
  2377. *
  2378. * @param {?object} event Synthetic event to be dispatched.
  2379. * @private
  2380. */
  2381. var executeDispatchesAndRelease = function(event) {
  2382. if (event) {
  2383. var executeDispatch = EventPluginUtils.executeDispatch;
  2384. // Plugins can provide custom behavior when dispatching events.
  2385. var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
  2386. if (PluginModule && PluginModule.executeDispatch) {
  2387. executeDispatch = PluginModule.executeDispatch;
  2388. }
  2389. EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
  2390. if (!event.isPersistent()) {
  2391. event.constructor.release(event);
  2392. }
  2393. }
  2394. };
  2395. /**
  2396. * - `InstanceHandle`: [required] Module that performs logical traversals of DOM
  2397. * hierarchy given ids of the logical DOM elements involved.
  2398. */
  2399. var InstanceHandle = null;
  2400. function validateInstanceHandle() {
  2401. var valid =
  2402. InstanceHandle &&
  2403. InstanceHandle.traverseTwoPhase &&
  2404. InstanceHandle.traverseEnterLeave;
  2405. ("production" !== "development" ? invariant(
  2406. valid,
  2407. 'InstanceHandle not injected before use!'
  2408. ) : invariant(valid));
  2409. }
  2410. /**
  2411. * This is a unified interface for event plugins to be installed and configured.
  2412. *
  2413. * Event plugins can implement the following properties:
  2414. *
  2415. * `extractEvents` {function(string, DOMEventTarget, string, object): *}
  2416. * Required. When a top-level event is fired, this method is expected to
  2417. * extract synthetic events that will in turn be queued and dispatched.
  2418. *
  2419. * `eventTypes` {object}
  2420. * Optional, plugins that fire events must publish a mapping of registration
  2421. * names that are used to register listeners. Values of this mapping must
  2422. * be objects that contain `registrationName` or `phasedRegistrationNames`.
  2423. *
  2424. * `executeDispatch` {function(object, function, string)}
  2425. * Optional, allows plugins to override how an event gets dispatched. By
  2426. * default, the listener is simply invoked.
  2427. *
  2428. * Each plugin that is injected into `EventsPluginHub` is immediately operable.
  2429. *
  2430. * @public
  2431. */
  2432. var EventPluginHub = {
  2433. /**
  2434. * Methods for injecting dependencies.
  2435. */
  2436. injection: {
  2437. /**
  2438. * @param {object} InjectedMount
  2439. * @public
  2440. */
  2441. injectMount: EventPluginUtils.injection.injectMount,
  2442. /**
  2443. * @param {object} InjectedInstanceHandle
  2444. * @public
  2445. */
  2446. injectInstanceHandle: function(InjectedInstanceHandle) {
  2447. InstanceHandle = InjectedInstanceHandle;
  2448. if ("production" !== "development") {
  2449. validateInstanceHandle();
  2450. }
  2451. },
  2452. getInstanceHandle: function() {
  2453. if ("production" !== "development") {
  2454. validateInstanceHandle();
  2455. }
  2456. return InstanceHandle;
  2457. },
  2458. /**
  2459. * @param {array} InjectedEventPluginOrder
  2460. * @public
  2461. */
  2462. injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
  2463. /**
  2464. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2465. */
  2466. injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
  2467. },
  2468. eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
  2469. registrationNameModules: EventPluginRegistry.registrationNameModules,
  2470. /**
  2471. * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
  2472. *
  2473. * @param {string} id ID of the DOM element.
  2474. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2475. * @param {?function} listener The callback to store.
  2476. */
  2477. putListener: function(id, registrationName, listener) {
  2478. ("production" !== "development" ? invariant(
  2479. !listener || typeof listener === 'function',
  2480. 'Expected %s listener to be a function, instead got type %s',
  2481. registrationName, typeof listener
  2482. ) : invariant(!listener || typeof listener === 'function'));
  2483. var bankForRegistrationName =
  2484. listenerBank[registrationName] || (listenerBank[registrationName] = {});
  2485. bankForRegistrationName[id] = listener;
  2486. },
  2487. /**
  2488. * @param {string} id ID of the DOM element.
  2489. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2490. * @return {?function} The stored callback.
  2491. */
  2492. getListener: function(id, registrationName) {
  2493. var bankForRegistrationName = listenerBank[registrationName];
  2494. return bankForRegistrationName && bankForRegistrationName[id];
  2495. },
  2496. /**
  2497. * Deletes a listener from the registration bank.
  2498. *
  2499. * @param {string} id ID of the DOM element.
  2500. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2501. */
  2502. deleteListener: function(id, registrationName) {
  2503. var bankForRegistrationName = listenerBank[registrationName];
  2504. if (bankForRegistrationName) {
  2505. delete bankForRegistrationName[id];
  2506. }
  2507. },
  2508. /**
  2509. * Deletes all listeners for the DOM element with the supplied ID.
  2510. *
  2511. * @param {string} id ID of the DOM element.
  2512. */
  2513. deleteAllListeners: function(id) {
  2514. for (var registrationName in listenerBank) {
  2515. delete listenerBank[registrationName][id];
  2516. }
  2517. },
  2518. /**
  2519. * Allows registered plugins an opportunity to extract events from top-level
  2520. * native browser events.
  2521. *
  2522. * @param {string} topLevelType Record from `EventConstants`.
  2523. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  2524. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  2525. * @param {object} nativeEvent Native browser event.
  2526. * @return {*} An accumulation of synthetic events.
  2527. * @internal
  2528. */
  2529. extractEvents: function(
  2530. topLevelType,
  2531. topLevelTarget,
  2532. topLevelTargetID,
  2533. nativeEvent) {
  2534. var events;
  2535. var plugins = EventPluginRegistry.plugins;
  2536. for (var i = 0, l = plugins.length; i < l; i++) {
  2537. // Not every plugin in the ordering may be loaded at runtime.
  2538. var possiblePlugin = plugins[i];
  2539. if (possiblePlugin) {
  2540. var extractedEvents = possiblePlugin.extractEvents(
  2541. topLevelType,
  2542. topLevelTarget,
  2543. topLevelTargetID,
  2544. nativeEvent
  2545. );
  2546. if (extractedEvents) {
  2547. events = accumulateInto(events, extractedEvents);
  2548. }
  2549. }
  2550. }
  2551. return events;
  2552. },
  2553. /**
  2554. * Enqueues a synthetic event that should be dispatched when
  2555. * `processEventQueue` is invoked.
  2556. *
  2557. * @param {*} events An accumulation of synthetic events.
  2558. * @internal
  2559. */
  2560. enqueueEvents: function(events) {
  2561. if (events) {
  2562. eventQueue = accumulateInto(eventQueue, events);
  2563. }
  2564. },
  2565. /**
  2566. * Dispatches all synthetic events on the event queue.
  2567. *
  2568. * @internal
  2569. */
  2570. processEventQueue: function() {
  2571. // Set `eventQueue` to null before processing it so that we can tell if more
  2572. // events get enqueued while processing.
  2573. var processingEventQueue = eventQueue;
  2574. eventQueue = null;
  2575. forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
  2576. ("production" !== "development" ? invariant(
  2577. !eventQueue,
  2578. 'processEventQueue(): Additional events were enqueued while processing ' +
  2579. 'an event queue. Support for this has not yet been implemented.'
  2580. ) : invariant(!eventQueue));
  2581. },
  2582. /**
  2583. * These are needed for tests only. Do not use!
  2584. */
  2585. __purge: function() {
  2586. listenerBank = {};
  2587. },
  2588. __getListenerBank: function() {
  2589. return listenerBank;
  2590. }
  2591. };
  2592. module.exports = EventPluginHub;
  2593. },{"118":118,"135":135,"150":150,"19":19,"20":20}],19:[function(_dereq_,module,exports){
  2594. /**
  2595. * Copyright 2013-2015, Facebook, Inc.
  2596. * All rights reserved.
  2597. *
  2598. * This source code is licensed under the BSD-style license found in the
  2599. * LICENSE file in the root directory of this source tree. An additional grant
  2600. * of patent rights can be found in the PATENTS file in the same directory.
  2601. *
  2602. * @providesModule EventPluginRegistry
  2603. * @typechecks static-only
  2604. */
  2605. 'use strict';
  2606. var invariant = _dereq_(150);
  2607. /**
  2608. * Injectable ordering of event plugins.
  2609. */
  2610. var EventPluginOrder = null;
  2611. /**
  2612. * Injectable mapping from names to event plugin modules.
  2613. */
  2614. var namesToPlugins = {};
  2615. /**
  2616. * Recomputes the plugin list using the injected plugins and plugin ordering.
  2617. *
  2618. * @private
  2619. */
  2620. function recomputePluginOrdering() {
  2621. if (!EventPluginOrder) {
  2622. // Wait until an `EventPluginOrder` is injected.
  2623. return;
  2624. }
  2625. for (var pluginName in namesToPlugins) {
  2626. var PluginModule = namesToPlugins[pluginName];
  2627. var pluginIndex = EventPluginOrder.indexOf(pluginName);
  2628. ("production" !== "development" ? invariant(
  2629. pluginIndex > -1,
  2630. 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
  2631. 'the plugin ordering, `%s`.',
  2632. pluginName
  2633. ) : invariant(pluginIndex > -1));
  2634. if (EventPluginRegistry.plugins[pluginIndex]) {
  2635. continue;
  2636. }
  2637. ("production" !== "development" ? invariant(
  2638. PluginModule.extractEvents,
  2639. 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
  2640. 'method, but `%s` does not.',
  2641. pluginName
  2642. ) : invariant(PluginModule.extractEvents));
  2643. EventPluginRegistry.plugins[pluginIndex] = PluginModule;
  2644. var publishedEvents = PluginModule.eventTypes;
  2645. for (var eventName in publishedEvents) {
  2646. ("production" !== "development" ? invariant(
  2647. publishEventForPlugin(
  2648. publishedEvents[eventName],
  2649. PluginModule,
  2650. eventName
  2651. ),
  2652. 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
  2653. eventName,
  2654. pluginName
  2655. ) : invariant(publishEventForPlugin(
  2656. publishedEvents[eventName],
  2657. PluginModule,
  2658. eventName
  2659. )));
  2660. }
  2661. }
  2662. }
  2663. /**
  2664. * Publishes an event so that it can be dispatched by the supplied plugin.
  2665. *
  2666. * @param {object} dispatchConfig Dispatch configuration for the event.
  2667. * @param {object} PluginModule Plugin publishing the event.
  2668. * @return {boolean} True if the event was successfully published.
  2669. * @private
  2670. */
  2671. function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
  2672. ("production" !== "development" ? invariant(
  2673. !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
  2674. 'EventPluginHub: More than one plugin attempted to publish the same ' +
  2675. 'event name, `%s`.',
  2676. eventName
  2677. ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
  2678. EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
  2679. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  2680. if (phasedRegistrationNames) {
  2681. for (var phaseName in phasedRegistrationNames) {
  2682. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  2683. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  2684. publishRegistrationName(
  2685. phasedRegistrationName,
  2686. PluginModule,
  2687. eventName
  2688. );
  2689. }
  2690. }
  2691. return true;
  2692. } else if (dispatchConfig.registrationName) {
  2693. publishRegistrationName(
  2694. dispatchConfig.registrationName,
  2695. PluginModule,
  2696. eventName
  2697. );
  2698. return true;
  2699. }
  2700. return false;
  2701. }
  2702. /**
  2703. * Publishes a registration name that is used to identify dispatched events and
  2704. * can be used with `EventPluginHub.putListener` to register listeners.
  2705. *
  2706. * @param {string} registrationName Registration name to add.
  2707. * @param {object} PluginModule Plugin publishing the event.
  2708. * @private
  2709. */
  2710. function publishRegistrationName(registrationName, PluginModule, eventName) {
  2711. ("production" !== "development" ? invariant(
  2712. !EventPluginRegistry.registrationNameModules[registrationName],
  2713. 'EventPluginHub: More than one plugin attempted to publish the same ' +
  2714. 'registration name, `%s`.',
  2715. registrationName
  2716. ) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
  2717. EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
  2718. EventPluginRegistry.registrationNameDependencies[registrationName] =
  2719. PluginModule.eventTypes[eventName].dependencies;
  2720. }
  2721. /**
  2722. * Registers plugins so that they can extract and dispatch events.
  2723. *
  2724. * @see {EventPluginHub}
  2725. */
  2726. var EventPluginRegistry = {
  2727. /**
  2728. * Ordered list of injected plugins.
  2729. */
  2730. plugins: [],
  2731. /**
  2732. * Mapping from event name to dispatch config
  2733. */
  2734. eventNameDispatchConfigs: {},
  2735. /**
  2736. * Mapping from registration name to plugin module
  2737. */
  2738. registrationNameModules: {},
  2739. /**
  2740. * Mapping from registration name to event name
  2741. */
  2742. registrationNameDependencies: {},
  2743. /**
  2744. * Injects an ordering of plugins (by plugin name). This allows the ordering
  2745. * to be decoupled from injection of the actual plugins so that ordering is
  2746. * always deterministic regardless of packaging, on-the-fly injection, etc.
  2747. *
  2748. * @param {array} InjectedEventPluginOrder
  2749. * @internal
  2750. * @see {EventPluginHub.injection.injectEventPluginOrder}
  2751. */
  2752. injectEventPluginOrder: function(InjectedEventPluginOrder) {
  2753. ("production" !== "development" ? invariant(
  2754. !EventPluginOrder,
  2755. 'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
  2756. 'once. You are likely trying to load more than one copy of React.'
  2757. ) : invariant(!EventPluginOrder));
  2758. // Clone the ordering so it cannot be dynamically mutated.
  2759. EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
  2760. recomputePluginOrdering();
  2761. },
  2762. /**
  2763. * Injects plugins to be used by `EventPluginHub`. The plugin names must be
  2764. * in the ordering injected by `injectEventPluginOrder`.
  2765. *
  2766. * Plugins can be injected as part of page initialization or on-the-fly.
  2767. *
  2768. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2769. * @internal
  2770. * @see {EventPluginHub.injection.injectEventPluginsByName}
  2771. */
  2772. injectEventPluginsByName: function(injectedNamesToPlugins) {
  2773. var isOrderingDirty = false;
  2774. for (var pluginName in injectedNamesToPlugins) {
  2775. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  2776. continue;
  2777. }
  2778. var PluginModule = injectedNamesToPlugins[pluginName];
  2779. if (!namesToPlugins.hasOwnProperty(pluginName) ||
  2780. namesToPlugins[pluginName] !== PluginModule) {
  2781. ("production" !== "development" ? invariant(
  2782. !namesToPlugins[pluginName],
  2783. 'EventPluginRegistry: Cannot inject two different event plugins ' +
  2784. 'using the same name, `%s`.',
  2785. pluginName
  2786. ) : invariant(!namesToPlugins[pluginName]));
  2787. namesToPlugins[pluginName] = PluginModule;
  2788. isOrderingDirty = true;
  2789. }
  2790. }
  2791. if (isOrderingDirty) {
  2792. recomputePluginOrdering();
  2793. }
  2794. },
  2795. /**
  2796. * Looks up the plugin for the supplied event.
  2797. *
  2798. * @param {object} event A synthetic event.
  2799. * @return {?object} The plugin that created the supplied event.
  2800. * @internal
  2801. */
  2802. getPluginModuleForEvent: function(event) {
  2803. var dispatchConfig = event.dispatchConfig;
  2804. if (dispatchConfig.registrationName) {
  2805. return EventPluginRegistry.registrationNameModules[
  2806. dispatchConfig.registrationName
  2807. ] || null;
  2808. }
  2809. for (var phase in dispatchConfig.phasedRegistrationNames) {
  2810. if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
  2811. continue;
  2812. }
  2813. var PluginModule = EventPluginRegistry.registrationNameModules[
  2814. dispatchConfig.phasedRegistrationNames[phase]
  2815. ];
  2816. if (PluginModule) {
  2817. return PluginModule;
  2818. }
  2819. }
  2820. return null;
  2821. },
  2822. /**
  2823. * Exposed for unit testing.
  2824. * @private
  2825. */
  2826. _resetEventPlugins: function() {
  2827. EventPluginOrder = null;
  2828. for (var pluginName in namesToPlugins) {
  2829. if (namesToPlugins.hasOwnProperty(pluginName)) {
  2830. delete namesToPlugins[pluginName];
  2831. }
  2832. }
  2833. EventPluginRegistry.plugins.length = 0;
  2834. var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
  2835. for (var eventName in eventNameDispatchConfigs) {
  2836. if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  2837. delete eventNameDispatchConfigs[eventName];
  2838. }
  2839. }
  2840. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  2841. for (var registrationName in registrationNameModules) {
  2842. if (registrationNameModules.hasOwnProperty(registrationName)) {
  2843. delete registrationNameModules[registrationName];
  2844. }
  2845. }
  2846. }
  2847. };
  2848. module.exports = EventPluginRegistry;
  2849. },{"150":150}],20:[function(_dereq_,module,exports){
  2850. /**
  2851. * Copyright 2013-2015, Facebook, Inc.
  2852. * All rights reserved.
  2853. *
  2854. * This source code is licensed under the BSD-style license found in the
  2855. * LICENSE file in the root directory of this source tree. An additional grant
  2856. * of patent rights can be found in the PATENTS file in the same directory.
  2857. *
  2858. * @providesModule EventPluginUtils
  2859. */
  2860. 'use strict';
  2861. var EventConstants = _dereq_(16);
  2862. var invariant = _dereq_(150);
  2863. /**
  2864. * Injected dependencies:
  2865. */
  2866. /**
  2867. * - `Mount`: [required] Module that can convert between React dom IDs and
  2868. * actual node references.
  2869. */
  2870. var injection = {
  2871. Mount: null,
  2872. injectMount: function(InjectedMount) {
  2873. injection.Mount = InjectedMount;
  2874. if ("production" !== "development") {
  2875. ("production" !== "development" ? invariant(
  2876. InjectedMount && InjectedMount.getNode,
  2877. 'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
  2878. 'is missing getNode.'
  2879. ) : invariant(InjectedMount && InjectedMount.getNode));
  2880. }
  2881. }
  2882. };
  2883. var topLevelTypes = EventConstants.topLevelTypes;
  2884. function isEndish(topLevelType) {
  2885. return topLevelType === topLevelTypes.topMouseUp ||
  2886. topLevelType === topLevelTypes.topTouchEnd ||
  2887. topLevelType === topLevelTypes.topTouchCancel;
  2888. }
  2889. function isMoveish(topLevelType) {
  2890. return topLevelType === topLevelTypes.topMouseMove ||
  2891. topLevelType === topLevelTypes.topTouchMove;
  2892. }
  2893. function isStartish(topLevelType) {
  2894. return topLevelType === topLevelTypes.topMouseDown ||
  2895. topLevelType === topLevelTypes.topTouchStart;
  2896. }
  2897. var validateEventDispatches;
  2898. if ("production" !== "development") {
  2899. validateEventDispatches = function(event) {
  2900. var dispatchListeners = event._dispatchListeners;
  2901. var dispatchIDs = event._dispatchIDs;
  2902. var listenersIsArr = Array.isArray(dispatchListeners);
  2903. var idsIsArr = Array.isArray(dispatchIDs);
  2904. var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
  2905. var listenersLen = listenersIsArr ?
  2906. dispatchListeners.length :
  2907. dispatchListeners ? 1 : 0;
  2908. ("production" !== "development" ? invariant(
  2909. idsIsArr === listenersIsArr && IDsLen === listenersLen,
  2910. 'EventPluginUtils: Invalid `event`.'
  2911. ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
  2912. };
  2913. }
  2914. /**
  2915. * Invokes `cb(event, listener, id)`. Avoids using call if no scope is
  2916. * provided. The `(listener,id)` pair effectively forms the "dispatch" but are
  2917. * kept separate to conserve memory.
  2918. */
  2919. function forEachEventDispatch(event, cb) {
  2920. var dispatchListeners = event._dispatchListeners;
  2921. var dispatchIDs = event._dispatchIDs;
  2922. if ("production" !== "development") {
  2923. validateEventDispatches(event);
  2924. }
  2925. if (Array.isArray(dispatchListeners)) {
  2926. for (var i = 0; i < dispatchListeners.length; i++) {
  2927. if (event.isPropagationStopped()) {
  2928. break;
  2929. }
  2930. // Listeners and IDs are two parallel arrays that are always in sync.
  2931. cb(event, dispatchListeners[i], dispatchIDs[i]);
  2932. }
  2933. } else if (dispatchListeners) {
  2934. cb(event, dispatchListeners, dispatchIDs);
  2935. }
  2936. }
  2937. /**
  2938. * Default implementation of PluginModule.executeDispatch().
  2939. * @param {SyntheticEvent} SyntheticEvent to handle
  2940. * @param {function} Application-level callback
  2941. * @param {string} domID DOM id to pass to the callback.
  2942. */
  2943. function executeDispatch(event, listener, domID) {
  2944. event.currentTarget = injection.Mount.getNode(domID);
  2945. var returnValue = listener(event, domID);
  2946. event.currentTarget = null;
  2947. return returnValue;
  2948. }
  2949. /**
  2950. * Standard/simple iteration through an event's collected dispatches.
  2951. */
  2952. function executeDispatchesInOrder(event, cb) {
  2953. forEachEventDispatch(event, cb);
  2954. event._dispatchListeners = null;
  2955. event._dispatchIDs = null;
  2956. }
  2957. /**
  2958. * Standard/simple iteration through an event's collected dispatches, but stops
  2959. * at the first dispatch execution returning true, and returns that id.
  2960. *
  2961. * @return id of the first dispatch execution who's listener returns true, or
  2962. * null if no listener returned true.
  2963. */
  2964. function executeDispatchesInOrderStopAtTrueImpl(event) {
  2965. var dispatchListeners = event._dispatchListeners;
  2966. var dispatchIDs = event._dispatchIDs;
  2967. if ("production" !== "development") {
  2968. validateEventDispatches(event);
  2969. }
  2970. if (Array.isArray(dispatchListeners)) {
  2971. for (var i = 0; i < dispatchListeners.length; i++) {
  2972. if (event.isPropagationStopped()) {
  2973. break;
  2974. }
  2975. // Listeners and IDs are two parallel arrays that are always in sync.
  2976. if (dispatchListeners[i](event, dispatchIDs[i])) {
  2977. return dispatchIDs[i];
  2978. }
  2979. }
  2980. } else if (dispatchListeners) {
  2981. if (dispatchListeners(event, dispatchIDs)) {
  2982. return dispatchIDs;
  2983. }
  2984. }
  2985. return null;
  2986. }
  2987. /**
  2988. * @see executeDispatchesInOrderStopAtTrueImpl
  2989. */
  2990. function executeDispatchesInOrderStopAtTrue(event) {
  2991. var ret = executeDispatchesInOrderStopAtTrueImpl(event);
  2992. event._dispatchIDs = null;
  2993. event._dispatchListeners = null;
  2994. return ret;
  2995. }
  2996. /**
  2997. * Execution of a "direct" dispatch - there must be at most one dispatch
  2998. * accumulated on the event or it is considered an error. It doesn't really make
  2999. * sense for an event with multiple dispatches (bubbled) to keep track of the
  3000. * return values at each dispatch execution, but it does tend to make sense when
  3001. * dealing with "direct" dispatches.
  3002. *
  3003. * @return The return value of executing the single dispatch.
  3004. */
  3005. function executeDirectDispatch(event) {
  3006. if ("production" !== "development") {
  3007. validateEventDispatches(event);
  3008. }
  3009. var dispatchListener = event._dispatchListeners;
  3010. var dispatchID = event._dispatchIDs;
  3011. ("production" !== "development" ? invariant(
  3012. !Array.isArray(dispatchListener),
  3013. 'executeDirectDispatch(...): Invalid `event`.'
  3014. ) : invariant(!Array.isArray(dispatchListener)));
  3015. var res = dispatchListener ?
  3016. dispatchListener(event, dispatchID) :
  3017. null;
  3018. event._dispatchListeners = null;
  3019. event._dispatchIDs = null;
  3020. return res;
  3021. }
  3022. /**
  3023. * @param {SyntheticEvent} event
  3024. * @return {bool} True iff number of dispatches accumulated is greater than 0.
  3025. */
  3026. function hasDispatches(event) {
  3027. return !!event._dispatchListeners;
  3028. }
  3029. /**
  3030. * General utilities that are useful in creating custom Event Plugins.
  3031. */
  3032. var EventPluginUtils = {
  3033. isEndish: isEndish,
  3034. isMoveish: isMoveish,
  3035. isStartish: isStartish,
  3036. executeDirectDispatch: executeDirectDispatch,
  3037. executeDispatch: executeDispatch,
  3038. executeDispatchesInOrder: executeDispatchesInOrder,
  3039. executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
  3040. hasDispatches: hasDispatches,
  3041. injection: injection,
  3042. useTouchEvents: false
  3043. };
  3044. module.exports = EventPluginUtils;
  3045. },{"150":150,"16":16}],21:[function(_dereq_,module,exports){
  3046. /**
  3047. * Copyright 2013-2015, Facebook, Inc.
  3048. * All rights reserved.
  3049. *
  3050. * This source code is licensed under the BSD-style license found in the
  3051. * LICENSE file in the root directory of this source tree. An additional grant
  3052. * of patent rights can be found in the PATENTS file in the same directory.
  3053. *
  3054. * @providesModule EventPropagators
  3055. */
  3056. 'use strict';
  3057. var EventConstants = _dereq_(16);
  3058. var EventPluginHub = _dereq_(18);
  3059. var accumulateInto = _dereq_(118);
  3060. var forEachAccumulated = _dereq_(135);
  3061. var PropagationPhases = EventConstants.PropagationPhases;
  3062. var getListener = EventPluginHub.getListener;
  3063. /**
  3064. * Some event types have a notion of different registration names for different
  3065. * "phases" of propagation. This finds listeners by a given phase.
  3066. */
  3067. function listenerAtPhase(id, event, propagationPhase) {
  3068. var registrationName =
  3069. event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  3070. return getListener(id, registrationName);
  3071. }
  3072. /**
  3073. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  3074. * here, allows us to not have to bind or create functions for each event.
  3075. * Mutating the event's members allows us to not have to create a wrapping
  3076. * "dispatch" object that pairs the event with the listener.
  3077. */
  3078. function accumulateDirectionalDispatches(domID, upwards, event) {
  3079. if ("production" !== "development") {
  3080. if (!domID) {
  3081. throw new Error('Dispatching id must not be null');
  3082. }
  3083. }
  3084. var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
  3085. var listener = listenerAtPhase(domID, event, phase);
  3086. if (listener) {
  3087. event._dispatchListeners =
  3088. accumulateInto(event._dispatchListeners, listener);
  3089. event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
  3090. }
  3091. }
  3092. /**
  3093. * Collect dispatches (must be entirely collected before dispatching - see unit
  3094. * tests). Lazily allocate the array to conserve memory. We must loop through
  3095. * each event and perform the traversal for each one. We can not perform a
  3096. * single traversal for the entire collection of events because each event may
  3097. * have a different target.
  3098. */
  3099. function accumulateTwoPhaseDispatchesSingle(event) {
  3100. if (event && event.dispatchConfig.phasedRegistrationNames) {
  3101. EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
  3102. event.dispatchMarker,
  3103. accumulateDirectionalDispatches,
  3104. event
  3105. );
  3106. }
  3107. }
  3108. /**
  3109. * Accumulates without regard to direction, does not look for phased
  3110. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  3111. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  3112. */
  3113. function accumulateDispatches(id, ignoredDirection, event) {
  3114. if (event && event.dispatchConfig.registrationName) {
  3115. var registrationName = event.dispatchConfig.registrationName;
  3116. var listener = getListener(id, registrationName);
  3117. if (listener) {
  3118. event._dispatchListeners =
  3119. accumulateInto(event._dispatchListeners, listener);
  3120. event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
  3121. }
  3122. }
  3123. }
  3124. /**
  3125. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  3126. * `dispatchMarker`.
  3127. * @param {SyntheticEvent} event
  3128. */
  3129. function accumulateDirectDispatchesSingle(event) {
  3130. if (event && event.dispatchConfig.registrationName) {
  3131. accumulateDispatches(event.dispatchMarker, null, event);
  3132. }
  3133. }
  3134. function accumulateTwoPhaseDispatches(events) {
  3135. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  3136. }
  3137. function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
  3138. EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
  3139. fromID,
  3140. toID,
  3141. accumulateDispatches,
  3142. leave,
  3143. enter
  3144. );
  3145. }
  3146. function accumulateDirectDispatches(events) {
  3147. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  3148. }
  3149. /**
  3150. * A small set of propagation patterns, each of which will accept a small amount
  3151. * of information, and generate a set of "dispatch ready event objects" - which
  3152. * are sets of events that have already been annotated with a set of dispatched
  3153. * listener functions/ids. The API is designed this way to discourage these
  3154. * propagation strategies from actually executing the dispatches, since we
  3155. * always want to collect the entire set of dispatches before executing event a
  3156. * single one.
  3157. *
  3158. * @constructor EventPropagators
  3159. */
  3160. var EventPropagators = {
  3161. accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
  3162. accumulateDirectDispatches: accumulateDirectDispatches,
  3163. accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
  3164. };
  3165. module.exports = EventPropagators;
  3166. },{"118":118,"135":135,"16":16,"18":18}],22:[function(_dereq_,module,exports){
  3167. /**
  3168. * Copyright 2013-2015, Facebook, Inc.
  3169. * All rights reserved.
  3170. *
  3171. * This source code is licensed under the BSD-style license found in the
  3172. * LICENSE file in the root directory of this source tree. An additional grant
  3173. * of patent rights can be found in the PATENTS file in the same directory.
  3174. *
  3175. * @providesModule ExecutionEnvironment
  3176. */
  3177. /*jslint evil: true */
  3178. "use strict";
  3179. var canUseDOM = !!(
  3180. (typeof window !== 'undefined' &&
  3181. window.document && window.document.createElement)
  3182. );
  3183. /**
  3184. * Simple, lightweight module assisting with the detection and context of
  3185. * Worker. Helps avoid circular dependencies and allows code to reason about
  3186. * whether or not they are in a Worker, even if they never include the main
  3187. * `ReactWorker` dependency.
  3188. */
  3189. var ExecutionEnvironment = {
  3190. canUseDOM: canUseDOM,
  3191. canUseWorkers: typeof Worker !== 'undefined',
  3192. canUseEventListeners:
  3193. canUseDOM && !!(window.addEventListener || window.attachEvent),
  3194. canUseViewport: canUseDOM && !!window.screen,
  3195. isInWorker: !canUseDOM // For now, this is true - might change in the future.
  3196. };
  3197. module.exports = ExecutionEnvironment;
  3198. },{}],23:[function(_dereq_,module,exports){
  3199. /**
  3200. * Copyright 2013-2015, Facebook, Inc.
  3201. * All rights reserved.
  3202. *
  3203. * This source code is licensed under the BSD-style license found in the
  3204. * LICENSE file in the root directory of this source tree. An additional grant
  3205. * of patent rights can be found in the PATENTS file in the same directory.
  3206. *
  3207. * @providesModule FallbackCompositionState
  3208. * @typechecks static-only
  3209. */
  3210. 'use strict';
  3211. var PooledClass = _dereq_(30);
  3212. var assign = _dereq_(29);
  3213. var getTextContentAccessor = _dereq_(145);
  3214. /**
  3215. * This helper class stores information about text content of a target node,
  3216. * allowing comparison of content before and after a given event.
  3217. *
  3218. * Identify the node where selection currently begins, then observe
  3219. * both its text content and its current position in the DOM. Since the
  3220. * browser may natively replace the target node during composition, we can
  3221. * use its position to find its replacement.
  3222. *
  3223. * @param {DOMEventTarget} root
  3224. */
  3225. function FallbackCompositionState(root) {
  3226. this._root = root;
  3227. this._startText = this.getText();
  3228. this._fallbackText = null;
  3229. }
  3230. assign(FallbackCompositionState.prototype, {
  3231. /**
  3232. * Get current text of input.
  3233. *
  3234. * @return {string}
  3235. */
  3236. getText: function() {
  3237. if ('value' in this._root) {
  3238. return this._root.value;
  3239. }
  3240. return this._root[getTextContentAccessor()];
  3241. },
  3242. /**
  3243. * Determine the differing substring between the initially stored
  3244. * text content and the current content.
  3245. *
  3246. * @return {string}
  3247. */
  3248. getData: function() {
  3249. if (this._fallbackText) {
  3250. return this._fallbackText;
  3251. }
  3252. var start;
  3253. var startValue = this._startText;
  3254. var startLength = startValue.length;
  3255. var end;
  3256. var endValue = this.getText();
  3257. var endLength = endValue.length;
  3258. for (start = 0; start < startLength; start++) {
  3259. if (startValue[start] !== endValue[start]) {
  3260. break;
  3261. }
  3262. }
  3263. var minEnd = startLength - start;
  3264. for (end = 1; end <= minEnd; end++) {
  3265. if (startValue[startLength - end] !== endValue[endLength - end]) {
  3266. break;
  3267. }
  3268. }
  3269. var sliceTail = end > 1 ? 1 - end : undefined;
  3270. this._fallbackText = endValue.slice(start, sliceTail);
  3271. return this._fallbackText;
  3272. }
  3273. });
  3274. PooledClass.addPoolingTo(FallbackCompositionState);
  3275. module.exports = FallbackCompositionState;
  3276. },{"145":145,"29":29,"30":30}],24:[function(_dereq_,module,exports){
  3277. /**
  3278. * Copyright 2013-2015, Facebook, Inc.
  3279. * All rights reserved.
  3280. *
  3281. * This source code is licensed under the BSD-style license found in the
  3282. * LICENSE file in the root directory of this source tree. An additional grant
  3283. * of patent rights can be found in the PATENTS file in the same directory.
  3284. *
  3285. * @providesModule HTMLDOMPropertyConfig
  3286. */
  3287. /*jslint bitwise: true*/
  3288. 'use strict';
  3289. var DOMProperty = _dereq_(11);
  3290. var ExecutionEnvironment = _dereq_(22);
  3291. var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
  3292. var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
  3293. var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
  3294. var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
  3295. var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
  3296. var HAS_POSITIVE_NUMERIC_VALUE =
  3297. DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
  3298. var HAS_OVERLOADED_BOOLEAN_VALUE =
  3299. DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
  3300. var hasSVG;
  3301. if (ExecutionEnvironment.canUseDOM) {
  3302. var implementation = document.implementation;
  3303. hasSVG = (
  3304. implementation &&
  3305. implementation.hasFeature &&
  3306. implementation.hasFeature(
  3307. 'http://www.w3.org/TR/SVG11/feature#BasicStructure',
  3308. '1.1'
  3309. )
  3310. );
  3311. }
  3312. var HTMLDOMPropertyConfig = {
  3313. isCustomAttribute: RegExp.prototype.test.bind(
  3314. /^(data|aria)-[a-z_][a-z\d_.\-]*$/
  3315. ),
  3316. Properties: {
  3317. /**
  3318. * Standard Properties
  3319. */
  3320. accept: null,
  3321. acceptCharset: null,
  3322. accessKey: null,
  3323. action: null,
  3324. allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3325. allowTransparency: MUST_USE_ATTRIBUTE,
  3326. alt: null,
  3327. async: HAS_BOOLEAN_VALUE,
  3328. autoComplete: null,
  3329. // autoFocus is polyfilled/normalized by AutoFocusMixin
  3330. // autoFocus: HAS_BOOLEAN_VALUE,
  3331. autoPlay: HAS_BOOLEAN_VALUE,
  3332. cellPadding: null,
  3333. cellSpacing: null,
  3334. charSet: MUST_USE_ATTRIBUTE,
  3335. checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3336. classID: MUST_USE_ATTRIBUTE,
  3337. // To set className on SVG elements, it's necessary to use .setAttribute;
  3338. // this works on HTML elements too in all browsers except IE8. Conveniently,
  3339. // IE8 doesn't support SVG and so we can simply use the attribute in
  3340. // browsers that support SVG and the property in browsers that don't,
  3341. // regardless of whether the element is HTML or SVG.
  3342. className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
  3343. cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3344. colSpan: null,
  3345. content: null,
  3346. contentEditable: null,
  3347. contextMenu: MUST_USE_ATTRIBUTE,
  3348. controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3349. coords: null,
  3350. crossOrigin: null,
  3351. data: null, // For `<object />` acts as `src`.
  3352. dateTime: MUST_USE_ATTRIBUTE,
  3353. defer: HAS_BOOLEAN_VALUE,
  3354. dir: null,
  3355. disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3356. download: HAS_OVERLOADED_BOOLEAN_VALUE,
  3357. draggable: null,
  3358. encType: null,
  3359. form: MUST_USE_ATTRIBUTE,
  3360. formAction: MUST_USE_ATTRIBUTE,
  3361. formEncType: MUST_USE_ATTRIBUTE,
  3362. formMethod: MUST_USE_ATTRIBUTE,
  3363. formNoValidate: HAS_BOOLEAN_VALUE,
  3364. formTarget: MUST_USE_ATTRIBUTE,
  3365. frameBorder: MUST_USE_ATTRIBUTE,
  3366. headers: null,
  3367. height: MUST_USE_ATTRIBUTE,
  3368. hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3369. href: null,
  3370. hrefLang: null,
  3371. htmlFor: null,
  3372. httpEquiv: null,
  3373. icon: null,
  3374. id: MUST_USE_PROPERTY,
  3375. label: null,
  3376. lang: null,
  3377. list: MUST_USE_ATTRIBUTE,
  3378. loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3379. manifest: MUST_USE_ATTRIBUTE,
  3380. marginHeight: null,
  3381. marginWidth: null,
  3382. max: null,
  3383. maxLength: MUST_USE_ATTRIBUTE,
  3384. media: MUST_USE_ATTRIBUTE,
  3385. mediaGroup: null,
  3386. method: null,
  3387. min: null,
  3388. multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3389. muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3390. name: null,
  3391. noValidate: HAS_BOOLEAN_VALUE,
  3392. open: HAS_BOOLEAN_VALUE,
  3393. pattern: null,
  3394. placeholder: null,
  3395. poster: null,
  3396. preload: null,
  3397. radioGroup: null,
  3398. readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3399. rel: null,
  3400. required: HAS_BOOLEAN_VALUE,
  3401. role: MUST_USE_ATTRIBUTE,
  3402. rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3403. rowSpan: null,
  3404. sandbox: null,
  3405. scope: null,
  3406. scrolling: null,
  3407. seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3408. selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3409. shape: null,
  3410. size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3411. sizes: MUST_USE_ATTRIBUTE,
  3412. span: HAS_POSITIVE_NUMERIC_VALUE,
  3413. spellCheck: null,
  3414. src: null,
  3415. srcDoc: MUST_USE_PROPERTY,
  3416. srcSet: MUST_USE_ATTRIBUTE,
  3417. start: HAS_NUMERIC_VALUE,
  3418. step: null,
  3419. style: null,
  3420. tabIndex: null,
  3421. target: null,
  3422. title: null,
  3423. type: null,
  3424. useMap: null,
  3425. value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
  3426. width: MUST_USE_ATTRIBUTE,
  3427. wmode: MUST_USE_ATTRIBUTE,
  3428. /**
  3429. * Non-standard Properties
  3430. */
  3431. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  3432. // keyboard hints.
  3433. autoCapitalize: null,
  3434. autoCorrect: null,
  3435. // itemProp, itemScope, itemType are for
  3436. // Microdata support. See http://schema.org/docs/gs.html
  3437. itemProp: MUST_USE_ATTRIBUTE,
  3438. itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3439. itemType: MUST_USE_ATTRIBUTE,
  3440. // itemID and itemRef are for Microdata support as well but
  3441. // only specified in the the WHATWG spec document. See
  3442. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  3443. itemID: MUST_USE_ATTRIBUTE,
  3444. itemRef: MUST_USE_ATTRIBUTE,
  3445. // property is supported for OpenGraph in meta tags.
  3446. property: null
  3447. },
  3448. DOMAttributeNames: {
  3449. acceptCharset: 'accept-charset',
  3450. className: 'class',
  3451. htmlFor: 'for',
  3452. httpEquiv: 'http-equiv'
  3453. },
  3454. DOMPropertyNames: {
  3455. autoCapitalize: 'autocapitalize',
  3456. autoComplete: 'autocomplete',
  3457. autoCorrect: 'autocorrect',
  3458. autoFocus: 'autofocus',
  3459. autoPlay: 'autoplay',
  3460. // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
  3461. // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
  3462. encType: 'encoding',
  3463. hrefLang: 'hreflang',
  3464. radioGroup: 'radiogroup',
  3465. spellCheck: 'spellcheck',
  3466. srcDoc: 'srcdoc',
  3467. srcSet: 'srcset'
  3468. }
  3469. };
  3470. module.exports = HTMLDOMPropertyConfig;
  3471. },{"11":11,"22":22}],25:[function(_dereq_,module,exports){
  3472. /**
  3473. * Copyright 2013-2015, Facebook, Inc.
  3474. * All rights reserved.
  3475. *
  3476. * This source code is licensed under the BSD-style license found in the
  3477. * LICENSE file in the root directory of this source tree. An additional grant
  3478. * of patent rights can be found in the PATENTS file in the same directory.
  3479. *
  3480. * @providesModule LinkedStateMixin
  3481. * @typechecks static-only
  3482. */
  3483. 'use strict';
  3484. var ReactLink = _dereq_(75);
  3485. var ReactStateSetters = _dereq_(94);
  3486. /**
  3487. * A simple mixin around ReactLink.forState().
  3488. */
  3489. var LinkedStateMixin = {
  3490. /**
  3491. * Create a ReactLink that's linked to part of this component's state. The
  3492. * ReactLink will have the current value of this.state[key] and will call
  3493. * setState() when a change is requested.
  3494. *
  3495. * @param {string} key state key to update. Note: you may want to use keyOf()
  3496. * if you're using Google Closure Compiler advanced mode.
  3497. * @return {ReactLink} ReactLink instance linking to the state.
  3498. */
  3499. linkState: function(key) {
  3500. return new ReactLink(
  3501. this.state[key],
  3502. ReactStateSetters.createStateKeySetter(this, key)
  3503. );
  3504. }
  3505. };
  3506. module.exports = LinkedStateMixin;
  3507. },{"75":75,"94":94}],26:[function(_dereq_,module,exports){
  3508. /**
  3509. * Copyright 2013-2015, Facebook, Inc.
  3510. * All rights reserved.
  3511. *
  3512. * This source code is licensed under the BSD-style license found in the
  3513. * LICENSE file in the root directory of this source tree. An additional grant
  3514. * of patent rights can be found in the PATENTS file in the same directory.
  3515. *
  3516. * @providesModule LinkedValueUtils
  3517. * @typechecks static-only
  3518. */
  3519. 'use strict';
  3520. var ReactPropTypes = _dereq_(86);
  3521. var invariant = _dereq_(150);
  3522. var hasReadOnlyValue = {
  3523. 'button': true,
  3524. 'checkbox': true,
  3525. 'image': true,
  3526. 'hidden': true,
  3527. 'radio': true,
  3528. 'reset': true,
  3529. 'submit': true
  3530. };
  3531. function _assertSingleLink(input) {
  3532. ("production" !== "development" ? invariant(
  3533. input.props.checkedLink == null || input.props.valueLink == null,
  3534. 'Cannot provide a checkedLink and a valueLink. If you want to use ' +
  3535. 'checkedLink, you probably don\'t want to use valueLink and vice versa.'
  3536. ) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
  3537. }
  3538. function _assertValueLink(input) {
  3539. _assertSingleLink(input);
  3540. ("production" !== "development" ? invariant(
  3541. input.props.value == null && input.props.onChange == null,
  3542. 'Cannot provide a valueLink and a value or onChange event. If you want ' +
  3543. 'to use value or onChange, you probably don\'t want to use valueLink.'
  3544. ) : invariant(input.props.value == null && input.props.onChange == null));
  3545. }
  3546. function _assertCheckedLink(input) {
  3547. _assertSingleLink(input);
  3548. ("production" !== "development" ? invariant(
  3549. input.props.checked == null && input.props.onChange == null,
  3550. 'Cannot provide a checkedLink and a checked property or onChange event. ' +
  3551. 'If you want to use checked or onChange, you probably don\'t want to ' +
  3552. 'use checkedLink'
  3553. ) : invariant(input.props.checked == null && input.props.onChange == null));
  3554. }
  3555. /**
  3556. * @param {SyntheticEvent} e change event to handle
  3557. */
  3558. function _handleLinkedValueChange(e) {
  3559. /*jshint validthis:true */
  3560. this.props.valueLink.requestChange(e.target.value);
  3561. }
  3562. /**
  3563. * @param {SyntheticEvent} e change event to handle
  3564. */
  3565. function _handleLinkedCheckChange(e) {
  3566. /*jshint validthis:true */
  3567. this.props.checkedLink.requestChange(e.target.checked);
  3568. }
  3569. /**
  3570. * Provide a linked `value` attribute for controlled forms. You should not use
  3571. * this outside of the ReactDOM controlled form components.
  3572. */
  3573. var LinkedValueUtils = {
  3574. Mixin: {
  3575. propTypes: {
  3576. value: function(props, propName, componentName) {
  3577. if (!props[propName] ||
  3578. hasReadOnlyValue[props.type] ||
  3579. props.onChange ||
  3580. props.readOnly ||
  3581. props.disabled) {
  3582. return null;
  3583. }
  3584. return new Error(
  3585. 'You provided a `value` prop to a form field without an ' +
  3586. '`onChange` handler. This will render a read-only field. If ' +
  3587. 'the field should be mutable use `defaultValue`. Otherwise, ' +
  3588. 'set either `onChange` or `readOnly`.'
  3589. );
  3590. },
  3591. checked: function(props, propName, componentName) {
  3592. if (!props[propName] ||
  3593. props.onChange ||
  3594. props.readOnly ||
  3595. props.disabled) {
  3596. return null;
  3597. }
  3598. return new Error(
  3599. 'You provided a `checked` prop to a form field without an ' +
  3600. '`onChange` handler. This will render a read-only field. If ' +
  3601. 'the field should be mutable use `defaultChecked`. Otherwise, ' +
  3602. 'set either `onChange` or `readOnly`.'
  3603. );
  3604. },
  3605. onChange: ReactPropTypes.func
  3606. }
  3607. },
  3608. /**
  3609. * @param {ReactComponent} input Form component
  3610. * @return {*} current value of the input either from value prop or link.
  3611. */
  3612. getValue: function(input) {
  3613. if (input.props.valueLink) {
  3614. _assertValueLink(input);
  3615. return input.props.valueLink.value;
  3616. }
  3617. return input.props.value;
  3618. },
  3619. /**
  3620. * @param {ReactComponent} input Form component
  3621. * @return {*} current checked status of the input either from checked prop
  3622. * or link.
  3623. */
  3624. getChecked: function(input) {
  3625. if (input.props.checkedLink) {
  3626. _assertCheckedLink(input);
  3627. return input.props.checkedLink.value;
  3628. }
  3629. return input.props.checked;
  3630. },
  3631. /**
  3632. * @param {ReactComponent} input Form component
  3633. * @return {function} change callback either from onChange prop or link.
  3634. */
  3635. getOnChange: function(input) {
  3636. if (input.props.valueLink) {
  3637. _assertValueLink(input);
  3638. return _handleLinkedValueChange;
  3639. } else if (input.props.checkedLink) {
  3640. _assertCheckedLink(input);
  3641. return _handleLinkedCheckChange;
  3642. }
  3643. return input.props.onChange;
  3644. }
  3645. };
  3646. module.exports = LinkedValueUtils;
  3647. },{"150":150,"86":86}],27:[function(_dereq_,module,exports){
  3648. /**
  3649. * Copyright 2014-2015, Facebook, Inc.
  3650. * All rights reserved.
  3651. *
  3652. * This source code is licensed under the BSD-style license found in the
  3653. * LICENSE file in the root directory of this source tree. An additional grant
  3654. * of patent rights can be found in the PATENTS file in the same directory.
  3655. *
  3656. * @providesModule LocalEventTrapMixin
  3657. */
  3658. 'use strict';
  3659. var ReactBrowserEventEmitter = _dereq_(33);
  3660. var accumulateInto = _dereq_(118);
  3661. var forEachAccumulated = _dereq_(135);
  3662. var invariant = _dereq_(150);
  3663. function remove(event) {
  3664. event.remove();
  3665. }
  3666. var LocalEventTrapMixin = {
  3667. trapBubbledEvent:function(topLevelType, handlerBaseName) {
  3668. ("production" !== "development" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
  3669. // If a component renders to null or if another component fatals and causes
  3670. // the state of the tree to be corrupted, `node` here can be null.
  3671. var node = this.getDOMNode();
  3672. ("production" !== "development" ? invariant(
  3673. node,
  3674. 'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
  3675. ) : invariant(node));
  3676. var listener = ReactBrowserEventEmitter.trapBubbledEvent(
  3677. topLevelType,
  3678. handlerBaseName,
  3679. node
  3680. );
  3681. this._localEventListeners =
  3682. accumulateInto(this._localEventListeners, listener);
  3683. },
  3684. // trapCapturedEvent would look nearly identical. We don't implement that
  3685. // method because it isn't currently needed.
  3686. componentWillUnmount:function() {
  3687. if (this._localEventListeners) {
  3688. forEachAccumulated(this._localEventListeners, remove);
  3689. }
  3690. }
  3691. };
  3692. module.exports = LocalEventTrapMixin;
  3693. },{"118":118,"135":135,"150":150,"33":33}],28:[function(_dereq_,module,exports){
  3694. /**
  3695. * Copyright 2013-2015, Facebook, Inc.
  3696. * All rights reserved.
  3697. *
  3698. * This source code is licensed under the BSD-style license found in the
  3699. * LICENSE file in the root directory of this source tree. An additional grant
  3700. * of patent rights can be found in the PATENTS file in the same directory.
  3701. *
  3702. * @providesModule MobileSafariClickEventPlugin
  3703. * @typechecks static-only
  3704. */
  3705. 'use strict';
  3706. var EventConstants = _dereq_(16);
  3707. var emptyFunction = _dereq_(129);
  3708. var topLevelTypes = EventConstants.topLevelTypes;
  3709. /**
  3710. * Mobile Safari does not fire properly bubble click events on non-interactive
  3711. * elements, which means delegated click listeners do not fire. The workaround
  3712. * for this bug involves attaching an empty click listener on the target node.
  3713. *
  3714. * This particular plugin works around the bug by attaching an empty click
  3715. * listener on `touchstart` (which does fire on every element).
  3716. */
  3717. var MobileSafariClickEventPlugin = {
  3718. eventTypes: null,
  3719. /**
  3720. * @param {string} topLevelType Record from `EventConstants`.
  3721. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  3722. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  3723. * @param {object} nativeEvent Native browser event.
  3724. * @return {*} An accumulation of synthetic events.
  3725. * @see {EventPluginHub.extractEvents}
  3726. */
  3727. extractEvents: function(
  3728. topLevelType,
  3729. topLevelTarget,
  3730. topLevelTargetID,
  3731. nativeEvent) {
  3732. if (topLevelType === topLevelTypes.topTouchStart) {
  3733. var target = nativeEvent.target;
  3734. if (target && !target.onclick) {
  3735. target.onclick = emptyFunction;
  3736. }
  3737. }
  3738. }
  3739. };
  3740. module.exports = MobileSafariClickEventPlugin;
  3741. },{"129":129,"16":16}],29:[function(_dereq_,module,exports){
  3742. /**
  3743. * Copyright 2014-2015, Facebook, Inc.
  3744. * All rights reserved.
  3745. *
  3746. * This source code is licensed under the BSD-style license found in the
  3747. * LICENSE file in the root directory of this source tree. An additional grant
  3748. * of patent rights can be found in the PATENTS file in the same directory.
  3749. *
  3750. * @providesModule Object.assign
  3751. */
  3752. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
  3753. 'use strict';
  3754. function assign(target, sources) {
  3755. if (target == null) {
  3756. throw new TypeError('Object.assign target cannot be null or undefined');
  3757. }
  3758. var to = Object(target);
  3759. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3760. for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
  3761. var nextSource = arguments[nextIndex];
  3762. if (nextSource == null) {
  3763. continue;
  3764. }
  3765. var from = Object(nextSource);
  3766. // We don't currently support accessors nor proxies. Therefore this
  3767. // copy cannot throw. If we ever supported this then we must handle
  3768. // exceptions and side-effects. We don't support symbols so they won't
  3769. // be transferred.
  3770. for (var key in from) {
  3771. if (hasOwnProperty.call(from, key)) {
  3772. to[key] = from[key];
  3773. }
  3774. }
  3775. }
  3776. return to;
  3777. }
  3778. module.exports = assign;
  3779. },{}],30:[function(_dereq_,module,exports){
  3780. /**
  3781. * Copyright 2013-2015, Facebook, Inc.
  3782. * All rights reserved.
  3783. *
  3784. * This source code is licensed under the BSD-style license found in the
  3785. * LICENSE file in the root directory of this source tree. An additional grant
  3786. * of patent rights can be found in the PATENTS file in the same directory.
  3787. *
  3788. * @providesModule PooledClass
  3789. */
  3790. 'use strict';
  3791. var invariant = _dereq_(150);
  3792. /**
  3793. * Static poolers. Several custom versions for each potential number of
  3794. * arguments. A completely generic pooler is easy to implement, but would
  3795. * require accessing the `arguments` object. In each of these, `this` refers to
  3796. * the Class itself, not an instance. If any others are needed, simply add them
  3797. * here, or in their own files.
  3798. */
  3799. var oneArgumentPooler = function(copyFieldsFrom) {
  3800. var Klass = this;
  3801. if (Klass.instancePool.length) {
  3802. var instance = Klass.instancePool.pop();
  3803. Klass.call(instance, copyFieldsFrom);
  3804. return instance;
  3805. } else {
  3806. return new Klass(copyFieldsFrom);
  3807. }
  3808. };
  3809. var twoArgumentPooler = function(a1, a2) {
  3810. var Klass = this;
  3811. if (Klass.instancePool.length) {
  3812. var instance = Klass.instancePool.pop();
  3813. Klass.call(instance, a1, a2);
  3814. return instance;
  3815. } else {
  3816. return new Klass(a1, a2);
  3817. }
  3818. };
  3819. var threeArgumentPooler = function(a1, a2, a3) {
  3820. var Klass = this;
  3821. if (Klass.instancePool.length) {
  3822. var instance = Klass.instancePool.pop();
  3823. Klass.call(instance, a1, a2, a3);
  3824. return instance;
  3825. } else {
  3826. return new Klass(a1, a2, a3);
  3827. }
  3828. };
  3829. var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
  3830. var Klass = this;
  3831. if (Klass.instancePool.length) {
  3832. var instance = Klass.instancePool.pop();
  3833. Klass.call(instance, a1, a2, a3, a4, a5);
  3834. return instance;
  3835. } else {
  3836. return new Klass(a1, a2, a3, a4, a5);
  3837. }
  3838. };
  3839. var standardReleaser = function(instance) {
  3840. var Klass = this;
  3841. ("production" !== "development" ? invariant(
  3842. instance instanceof Klass,
  3843. 'Trying to release an instance into a pool of a different type.'
  3844. ) : invariant(instance instanceof Klass));
  3845. if (instance.destructor) {
  3846. instance.destructor();
  3847. }
  3848. if (Klass.instancePool.length < Klass.poolSize) {
  3849. Klass.instancePool.push(instance);
  3850. }
  3851. };
  3852. var DEFAULT_POOL_SIZE = 10;
  3853. var DEFAULT_POOLER = oneArgumentPooler;
  3854. /**
  3855. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  3856. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  3857. * you give this may have a `poolSize` property, and will look for a
  3858. * prototypical `destructor` on instances (optional).
  3859. *
  3860. * @param {Function} CopyConstructor Constructor that can be used to reset.
  3861. * @param {Function} pooler Customizable pooler.
  3862. */
  3863. var addPoolingTo = function(CopyConstructor, pooler) {
  3864. var NewKlass = CopyConstructor;
  3865. NewKlass.instancePool = [];
  3866. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  3867. if (!NewKlass.poolSize) {
  3868. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  3869. }
  3870. NewKlass.release = standardReleaser;
  3871. return NewKlass;
  3872. };
  3873. var PooledClass = {
  3874. addPoolingTo: addPoolingTo,
  3875. oneArgumentPooler: oneArgumentPooler,
  3876. twoArgumentPooler: twoArgumentPooler,
  3877. threeArgumentPooler: threeArgumentPooler,
  3878. fiveArgumentPooler: fiveArgumentPooler
  3879. };
  3880. module.exports = PooledClass;
  3881. },{"150":150}],31:[function(_dereq_,module,exports){
  3882. /**
  3883. * Copyright 2013-2015, Facebook, Inc.
  3884. * All rights reserved.
  3885. *
  3886. * This source code is licensed under the BSD-style license found in the
  3887. * LICENSE file in the root directory of this source tree. An additional grant
  3888. * of patent rights can be found in the PATENTS file in the same directory.
  3889. *
  3890. * @providesModule React
  3891. */
  3892. /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
  3893. 'use strict';
  3894. var EventPluginUtils = _dereq_(20);
  3895. var ReactChildren = _dereq_(37);
  3896. var ReactComponent = _dereq_(39);
  3897. var ReactClass = _dereq_(38);
  3898. var ReactContext = _dereq_(44);
  3899. var ReactCurrentOwner = _dereq_(45);
  3900. var ReactElement = _dereq_(63);
  3901. var ReactElementValidator = _dereq_(64);
  3902. var ReactDOM = _dereq_(46);
  3903. var ReactDOMTextComponent = _dereq_(57);
  3904. var ReactDefaultInjection = _dereq_(60);
  3905. var ReactInstanceHandles = _dereq_(72);
  3906. var ReactMount = _dereq_(77);
  3907. var ReactPerf = _dereq_(82);
  3908. var ReactPropTypes = _dereq_(86);
  3909. var ReactReconciler = _dereq_(89);
  3910. var ReactServerRendering = _dereq_(92);
  3911. var assign = _dereq_(29);
  3912. var findDOMNode = _dereq_(132);
  3913. var onlyChild = _dereq_(160);
  3914. ReactDefaultInjection.inject();
  3915. var createElement = ReactElement.createElement;
  3916. var createFactory = ReactElement.createFactory;
  3917. var cloneElement = ReactElement.cloneElement;
  3918. if ("production" !== "development") {
  3919. createElement = ReactElementValidator.createElement;
  3920. createFactory = ReactElementValidator.createFactory;
  3921. cloneElement = ReactElementValidator.cloneElement;
  3922. }
  3923. var render = ReactPerf.measure('React', 'render', ReactMount.render);
  3924. var React = {
  3925. Children: {
  3926. map: ReactChildren.map,
  3927. forEach: ReactChildren.forEach,
  3928. count: ReactChildren.count,
  3929. only: onlyChild
  3930. },
  3931. Component: ReactComponent,
  3932. DOM: ReactDOM,
  3933. PropTypes: ReactPropTypes,
  3934. initializeTouchEvents: function(shouldUseTouch) {
  3935. EventPluginUtils.useTouchEvents = shouldUseTouch;
  3936. },
  3937. createClass: ReactClass.createClass,
  3938. createElement: createElement,
  3939. cloneElement: cloneElement,
  3940. createFactory: createFactory,
  3941. createMixin: function(mixin) {
  3942. // Currently a noop. Will be used to validate and trace mixins.
  3943. return mixin;
  3944. },
  3945. constructAndRenderComponent: ReactMount.constructAndRenderComponent,
  3946. constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
  3947. findDOMNode: findDOMNode,
  3948. render: render,
  3949. renderToString: ReactServerRendering.renderToString,
  3950. renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
  3951. unmountComponentAtNode: ReactMount.unmountComponentAtNode,
  3952. isValidElement: ReactElement.isValidElement,
  3953. withContext: ReactContext.withContext,
  3954. // Hook for JSX spread, don't use this for anything else.
  3955. __spread: assign
  3956. };
  3957. // Inject the runtime into a devtools global hook regardless of browser.
  3958. // Allows for debugging when the hook is injected on the page.
  3959. if (
  3960. typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
  3961. typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
  3962. __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
  3963. CurrentOwner: ReactCurrentOwner,
  3964. InstanceHandles: ReactInstanceHandles,
  3965. Mount: ReactMount,
  3966. Reconciler: ReactReconciler,
  3967. TextComponent: ReactDOMTextComponent
  3968. });
  3969. }
  3970. if ("production" !== "development") {
  3971. var ExecutionEnvironment = _dereq_(22);
  3972. if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
  3973. // If we're in Chrome, look for the devtools marker and provide a download
  3974. // link if not installed.
  3975. if (navigator.userAgent.indexOf('Chrome') > -1) {
  3976. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  3977. console.debug(
  3978. 'Download the React DevTools for a better development experience: ' +
  3979. 'http://fb.me/react-devtools'
  3980. );
  3981. }
  3982. }
  3983. var expectedFeatures = [
  3984. // shims
  3985. Array.isArray,
  3986. Array.prototype.every,
  3987. Array.prototype.forEach,
  3988. Array.prototype.indexOf,
  3989. Array.prototype.map,
  3990. Date.now,
  3991. Function.prototype.bind,
  3992. Object.keys,
  3993. String.prototype.split,
  3994. String.prototype.trim,
  3995. // shams
  3996. Object.create,
  3997. Object.freeze
  3998. ];
  3999. for (var i = 0; i < expectedFeatures.length; i++) {
  4000. if (!expectedFeatures[i]) {
  4001. console.error(
  4002. 'One or more ES5 shim/shams expected by React are not available: ' +
  4003. 'http://fb.me/react-warning-polyfills'
  4004. );
  4005. break;
  4006. }
  4007. }
  4008. }
  4009. }
  4010. React.version = '0.13.1';
  4011. module.exports = React;
  4012. },{"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){
  4013. /**
  4014. * Copyright 2013-2015, Facebook, Inc.
  4015. * All rights reserved.
  4016. *
  4017. * This source code is licensed under the BSD-style license found in the
  4018. * LICENSE file in the root directory of this source tree. An additional grant
  4019. * of patent rights can be found in the PATENTS file in the same directory.
  4020. *
  4021. * @providesModule ReactBrowserComponentMixin
  4022. */
  4023. 'use strict';
  4024. var findDOMNode = _dereq_(132);
  4025. var ReactBrowserComponentMixin = {
  4026. /**
  4027. * Returns the DOM node rendered by this component.
  4028. *
  4029. * @return {DOMElement} The root node of this component.
  4030. * @final
  4031. * @protected
  4032. */
  4033. getDOMNode: function() {
  4034. return findDOMNode(this);
  4035. }
  4036. };
  4037. module.exports = ReactBrowserComponentMixin;
  4038. },{"132":132}],33:[function(_dereq_,module,exports){
  4039. /**
  4040. * Copyright 2013-2015, Facebook, Inc.
  4041. * All rights reserved.
  4042. *
  4043. * This source code is licensed under the BSD-style license found in the
  4044. * LICENSE file in the root directory of this source tree. An additional grant
  4045. * of patent rights can be found in the PATENTS file in the same directory.
  4046. *
  4047. * @providesModule ReactBrowserEventEmitter
  4048. * @typechecks static-only
  4049. */
  4050. 'use strict';
  4051. var EventConstants = _dereq_(16);
  4052. var EventPluginHub = _dereq_(18);
  4053. var EventPluginRegistry = _dereq_(19);
  4054. var ReactEventEmitterMixin = _dereq_(67);
  4055. var ViewportMetrics = _dereq_(117);
  4056. var assign = _dereq_(29);
  4057. var isEventSupported = _dereq_(151);
  4058. /**
  4059. * Summary of `ReactBrowserEventEmitter` event handling:
  4060. *
  4061. * - Top-level delegation is used to trap most native browser events. This
  4062. * may only occur in the main thread and is the responsibility of
  4063. * ReactEventListener, which is injected and can therefore support pluggable
  4064. * event sources. This is the only work that occurs in the main thread.
  4065. *
  4066. * - We normalize and de-duplicate events to account for browser quirks. This
  4067. * may be done in the worker thread.
  4068. *
  4069. * - Forward these native events (with the associated top-level type used to
  4070. * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
  4071. * to extract any synthetic events.
  4072. *
  4073. * - The `EventPluginHub` will then process each event by annotating them with
  4074. * "dispatches", a sequence of listeners and IDs that care about that event.
  4075. *
  4076. * - The `EventPluginHub` then dispatches the events.
  4077. *
  4078. * Overview of React and the event system:
  4079. *
  4080. * +------------+ .
  4081. * | DOM | .
  4082. * +------------+ .
  4083. * | .
  4084. * v .
  4085. * +------------+ .
  4086. * | ReactEvent | .
  4087. * | Listener | .
  4088. * +------------+ . +-----------+
  4089. * | . +--------+|SimpleEvent|
  4090. * | . | |Plugin |
  4091. * +-----|------+ . v +-----------+
  4092. * | | | . +--------------+ +------------+
  4093. * | +-----------.--->|EventPluginHub| | Event |
  4094. * | | . | | +-----------+ | Propagators|
  4095. * | ReactEvent | . | | |TapEvent | |------------|
  4096. * | Emitter | . | |<---+|Plugin | |other plugin|
  4097. * | | . | | +-----------+ | utilities |
  4098. * | +-----------.--->| | +------------+
  4099. * | | | . +--------------+
  4100. * +-----|------+ . ^ +-----------+
  4101. * | . | |Enter/Leave|
  4102. * + . +-------+|Plugin |
  4103. * +-------------+ . +-----------+
  4104. * | application | .
  4105. * |-------------| .
  4106. * | | .
  4107. * | | .
  4108. * +-------------+ .
  4109. * .
  4110. * React Core . General Purpose Event Plugin System
  4111. */
  4112. var alreadyListeningTo = {};
  4113. var isMonitoringScrollValue = false;
  4114. var reactTopListenersCounter = 0;
  4115. // For events like 'submit' which don't consistently bubble (which we trap at a
  4116. // lower node than `document`), binding at `document` would cause duplicate
  4117. // events so we don't include them here
  4118. var topEventMapping = {
  4119. topBlur: 'blur',
  4120. topChange: 'change',
  4121. topClick: 'click',
  4122. topCompositionEnd: 'compositionend',
  4123. topCompositionStart: 'compositionstart',
  4124. topCompositionUpdate: 'compositionupdate',
  4125. topContextMenu: 'contextmenu',
  4126. topCopy: 'copy',
  4127. topCut: 'cut',
  4128. topDoubleClick: 'dblclick',
  4129. topDrag: 'drag',
  4130. topDragEnd: 'dragend',
  4131. topDragEnter: 'dragenter',
  4132. topDragExit: 'dragexit',
  4133. topDragLeave: 'dragleave',
  4134. topDragOver: 'dragover',
  4135. topDragStart: 'dragstart',
  4136. topDrop: 'drop',
  4137. topFocus: 'focus',
  4138. topInput: 'input',
  4139. topKeyDown: 'keydown',
  4140. topKeyPress: 'keypress',
  4141. topKeyUp: 'keyup',
  4142. topMouseDown: 'mousedown',
  4143. topMouseMove: 'mousemove',
  4144. topMouseOut: 'mouseout',
  4145. topMouseOver: 'mouseover',
  4146. topMouseUp: 'mouseup',
  4147. topPaste: 'paste',
  4148. topScroll: 'scroll',
  4149. topSelectionChange: 'selectionchange',
  4150. topTextInput: 'textInput',
  4151. topTouchCancel: 'touchcancel',
  4152. topTouchEnd: 'touchend',
  4153. topTouchMove: 'touchmove',
  4154. topTouchStart: 'touchstart',
  4155. topWheel: 'wheel'
  4156. };
  4157. /**
  4158. * To ensure no conflicts with other potential React instances on the page
  4159. */
  4160. var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
  4161. function getListeningForDocument(mountAt) {
  4162. // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  4163. // directly.
  4164. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
  4165. mountAt[topListenersIDKey] = reactTopListenersCounter++;
  4166. alreadyListeningTo[mountAt[topListenersIDKey]] = {};
  4167. }
  4168. return alreadyListeningTo[mountAt[topListenersIDKey]];
  4169. }
  4170. /**
  4171. * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
  4172. * example:
  4173. *
  4174. * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
  4175. *
  4176. * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
  4177. *
  4178. * @internal
  4179. */
  4180. var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
  4181. /**
  4182. * Injectable event backend
  4183. */
  4184. ReactEventListener: null,
  4185. injection: {
  4186. /**
  4187. * @param {object} ReactEventListener
  4188. */
  4189. injectReactEventListener: function(ReactEventListener) {
  4190. ReactEventListener.setHandleTopLevel(
  4191. ReactBrowserEventEmitter.handleTopLevel
  4192. );
  4193. ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
  4194. }
  4195. },
  4196. /**
  4197. * Sets whether or not any created callbacks should be enabled.
  4198. *
  4199. * @param {boolean} enabled True if callbacks should be enabled.
  4200. */
  4201. setEnabled: function(enabled) {
  4202. if (ReactBrowserEventEmitter.ReactEventListener) {
  4203. ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
  4204. }
  4205. },
  4206. /**
  4207. * @return {boolean} True if callbacks are enabled.
  4208. */
  4209. isEnabled: function() {
  4210. return !!(
  4211. (ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
  4212. );
  4213. },
  4214. /**
  4215. * We listen for bubbled touch events on the document object.
  4216. *
  4217. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  4218. * mounting `onmousemove` events at some node that was not the document
  4219. * element. The symptoms were that if your mouse is not moving over something
  4220. * contained within that mount point (for example on the background) the
  4221. * top-level listeners for `onmousemove` won't be called. However, if you
  4222. * register the `mousemove` on the document object, then it will of course
  4223. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  4224. * top-level listeners to the document object only, at least for these
  4225. * movement types of events and possibly all events.
  4226. *
  4227. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  4228. *
  4229. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  4230. * they bubble to document.
  4231. *
  4232. * @param {string} registrationName Name of listener (e.g. `onClick`).
  4233. * @param {object} contentDocumentHandle Document which owns the container
  4234. */
  4235. listenTo: function(registrationName, contentDocumentHandle) {
  4236. var mountAt = contentDocumentHandle;
  4237. var isListening = getListeningForDocument(mountAt);
  4238. var dependencies = EventPluginRegistry.
  4239. registrationNameDependencies[registrationName];
  4240. var topLevelTypes = EventConstants.topLevelTypes;
  4241. for (var i = 0, l = dependencies.length; i < l; i++) {
  4242. var dependency = dependencies[i];
  4243. if (!(
  4244. (isListening.hasOwnProperty(dependency) && isListening[dependency])
  4245. )) {
  4246. if (dependency === topLevelTypes.topWheel) {
  4247. if (isEventSupported('wheel')) {
  4248. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4249. topLevelTypes.topWheel,
  4250. 'wheel',
  4251. mountAt
  4252. );
  4253. } else if (isEventSupported('mousewheel')) {
  4254. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4255. topLevelTypes.topWheel,
  4256. 'mousewheel',
  4257. mountAt
  4258. );
  4259. } else {
  4260. // Firefox needs to capture a different mouse scroll event.
  4261. // @see http://www.quirksmode.org/dom/events/tests/scroll.html
  4262. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4263. topLevelTypes.topWheel,
  4264. 'DOMMouseScroll',
  4265. mountAt
  4266. );
  4267. }
  4268. } else if (dependency === topLevelTypes.topScroll) {
  4269. if (isEventSupported('scroll', true)) {
  4270. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4271. topLevelTypes.topScroll,
  4272. 'scroll',
  4273. mountAt
  4274. );
  4275. } else {
  4276. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4277. topLevelTypes.topScroll,
  4278. 'scroll',
  4279. ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
  4280. );
  4281. }
  4282. } else if (dependency === topLevelTypes.topFocus ||
  4283. dependency === topLevelTypes.topBlur) {
  4284. if (isEventSupported('focus', true)) {
  4285. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4286. topLevelTypes.topFocus,
  4287. 'focus',
  4288. mountAt
  4289. );
  4290. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4291. topLevelTypes.topBlur,
  4292. 'blur',
  4293. mountAt
  4294. );
  4295. } else if (isEventSupported('focusin')) {
  4296. // IE has `focusin` and `focusout` events which bubble.
  4297. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
  4298. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4299. topLevelTypes.topFocus,
  4300. 'focusin',
  4301. mountAt
  4302. );
  4303. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4304. topLevelTypes.topBlur,
  4305. 'focusout',
  4306. mountAt
  4307. );
  4308. }
  4309. // to make sure blur and focus event listeners are only attached once
  4310. isListening[topLevelTypes.topBlur] = true;
  4311. isListening[topLevelTypes.topFocus] = true;
  4312. } else if (topEventMapping.hasOwnProperty(dependency)) {
  4313. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4314. dependency,
  4315. topEventMapping[dependency],
  4316. mountAt
  4317. );
  4318. }
  4319. isListening[dependency] = true;
  4320. }
  4321. }
  4322. },
  4323. trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
  4324. return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4325. topLevelType,
  4326. handlerBaseName,
  4327. handle
  4328. );
  4329. },
  4330. trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
  4331. return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4332. topLevelType,
  4333. handlerBaseName,
  4334. handle
  4335. );
  4336. },
  4337. /**
  4338. * Listens to window scroll and resize events. We cache scroll values so that
  4339. * application code can access them without triggering reflows.
  4340. *
  4341. * NOTE: Scroll events do not bubble.
  4342. *
  4343. * @see http://www.quirksmode.org/dom/events/scroll.html
  4344. */
  4345. ensureScrollValueMonitoring: function() {
  4346. if (!isMonitoringScrollValue) {
  4347. var refresh = ViewportMetrics.refreshScrollValues;
  4348. ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
  4349. isMonitoringScrollValue = true;
  4350. }
  4351. },
  4352. eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
  4353. registrationNameModules: EventPluginHub.registrationNameModules,
  4354. putListener: EventPluginHub.putListener,
  4355. getListener: EventPluginHub.getListener,
  4356. deleteListener: EventPluginHub.deleteListener,
  4357. deleteAllListeners: EventPluginHub.deleteAllListeners
  4358. });
  4359. module.exports = ReactBrowserEventEmitter;
  4360. },{"117":117,"151":151,"16":16,"18":18,"19":19,"29":29,"67":67}],34:[function(_dereq_,module,exports){
  4361. /**
  4362. * Copyright 2013-2015, Facebook, Inc.
  4363. * All rights reserved.
  4364. *
  4365. * This source code is licensed under the BSD-style license found in the
  4366. * LICENSE file in the root directory of this source tree. An additional grant
  4367. * of patent rights can be found in the PATENTS file in the same directory.
  4368. *
  4369. * @typechecks
  4370. * @providesModule ReactCSSTransitionGroup
  4371. */
  4372. 'use strict';
  4373. var React = _dereq_(31);
  4374. var assign = _dereq_(29);
  4375. var ReactTransitionGroup = React.createFactory(
  4376. _dereq_(98)
  4377. );
  4378. var ReactCSSTransitionGroupChild = React.createFactory(
  4379. _dereq_(35)
  4380. );
  4381. var ReactCSSTransitionGroup = React.createClass({
  4382. displayName: 'ReactCSSTransitionGroup',
  4383. propTypes: {
  4384. transitionName: React.PropTypes.string.isRequired,
  4385. transitionAppear: React.PropTypes.bool,
  4386. transitionEnter: React.PropTypes.bool,
  4387. transitionLeave: React.PropTypes.bool
  4388. },
  4389. getDefaultProps: function() {
  4390. return {
  4391. transitionAppear: false,
  4392. transitionEnter: true,
  4393. transitionLeave: true
  4394. };
  4395. },
  4396. _wrapChild: function(child) {
  4397. // We need to provide this childFactory so that
  4398. // ReactCSSTransitionGroupChild can receive updates to name, enter, and
  4399. // leave while it is leaving.
  4400. return ReactCSSTransitionGroupChild(
  4401. {
  4402. name: this.props.transitionName,
  4403. appear: this.props.transitionAppear,
  4404. enter: this.props.transitionEnter,
  4405. leave: this.props.transitionLeave
  4406. },
  4407. child
  4408. );
  4409. },
  4410. render: function() {
  4411. return (
  4412. ReactTransitionGroup(
  4413. assign({}, this.props, {childFactory: this._wrapChild})
  4414. )
  4415. );
  4416. }
  4417. });
  4418. module.exports = ReactCSSTransitionGroup;
  4419. },{"29":29,"31":31,"35":35,"98":98}],35:[function(_dereq_,module,exports){
  4420. /**
  4421. * Copyright 2013-2015, Facebook, Inc.
  4422. * All rights reserved.
  4423. *
  4424. * This source code is licensed under the BSD-style license found in the
  4425. * LICENSE file in the root directory of this source tree. An additional grant
  4426. * of patent rights can be found in the PATENTS file in the same directory.
  4427. *
  4428. * @typechecks
  4429. * @providesModule ReactCSSTransitionGroupChild
  4430. */
  4431. 'use strict';
  4432. var React = _dereq_(31);
  4433. var CSSCore = _dereq_(4);
  4434. var ReactTransitionEvents = _dereq_(97);
  4435. var onlyChild = _dereq_(160);
  4436. var warning = _dereq_(171);
  4437. // We don't remove the element from the DOM until we receive an animationend or
  4438. // transitionend event. If the user screws up and forgets to add an animation
  4439. // their node will be stuck in the DOM forever, so we detect if an animation
  4440. // does not start and if it doesn't, we just call the end listener immediately.
  4441. var TICK = 17;
  4442. var NO_EVENT_TIMEOUT = 5000;
  4443. var noEventListener = null;
  4444. if ("production" !== "development") {
  4445. noEventListener = function() {
  4446. ("production" !== "development" ? warning(
  4447. false,
  4448. 'transition(): tried to perform an animation without ' +
  4449. 'an animationend or transitionend event after timeout (' +
  4450. '%sms). You should either disable this ' +
  4451. 'transition in JS or add a CSS animation/transition.',
  4452. NO_EVENT_TIMEOUT
  4453. ) : null);
  4454. };
  4455. }
  4456. var ReactCSSTransitionGroupChild = React.createClass({
  4457. displayName: 'ReactCSSTransitionGroupChild',
  4458. transition: function(animationType, finishCallback) {
  4459. var node = this.getDOMNode();
  4460. var className = this.props.name + '-' + animationType;
  4461. var activeClassName = className + '-active';
  4462. var noEventTimeout = null;
  4463. var endListener = function(e) {
  4464. if (e && e.target !== node) {
  4465. return;
  4466. }
  4467. if ("production" !== "development") {
  4468. clearTimeout(noEventTimeout);
  4469. }
  4470. CSSCore.removeClass(node, className);
  4471. CSSCore.removeClass(node, activeClassName);
  4472. ReactTransitionEvents.removeEndEventListener(node, endListener);
  4473. // Usually this optional callback is used for informing an owner of
  4474. // a leave animation and telling it to remove the child.
  4475. if (finishCallback) {
  4476. finishCallback();
  4477. }
  4478. };
  4479. ReactTransitionEvents.addEndEventListener(node, endListener);
  4480. CSSCore.addClass(node, className);
  4481. // Need to do this to actually trigger a transition.
  4482. this.queueClass(activeClassName);
  4483. if ("production" !== "development") {
  4484. noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT);
  4485. }
  4486. },
  4487. queueClass: function(className) {
  4488. this.classNameQueue.push(className);
  4489. if (!this.timeout) {
  4490. this.timeout = setTimeout(this.flushClassNameQueue, TICK);
  4491. }
  4492. },
  4493. flushClassNameQueue: function() {
  4494. if (this.isMounted()) {
  4495. this.classNameQueue.forEach(
  4496. CSSCore.addClass.bind(CSSCore, this.getDOMNode())
  4497. );
  4498. }
  4499. this.classNameQueue.length = 0;
  4500. this.timeout = null;
  4501. },
  4502. componentWillMount: function() {
  4503. this.classNameQueue = [];
  4504. },
  4505. componentWillUnmount: function() {
  4506. if (this.timeout) {
  4507. clearTimeout(this.timeout);
  4508. }
  4509. },
  4510. componentWillAppear: function(done) {
  4511. if (this.props.appear) {
  4512. this.transition('appear', done);
  4513. } else {
  4514. done();
  4515. }
  4516. },
  4517. componentWillEnter: function(done) {
  4518. if (this.props.enter) {
  4519. this.transition('enter', done);
  4520. } else {
  4521. done();
  4522. }
  4523. },
  4524. componentWillLeave: function(done) {
  4525. if (this.props.leave) {
  4526. this.transition('leave', done);
  4527. } else {
  4528. done();
  4529. }
  4530. },
  4531. render: function() {
  4532. return onlyChild(this.props.children);
  4533. }
  4534. });
  4535. module.exports = ReactCSSTransitionGroupChild;
  4536. },{"160":160,"171":171,"31":31,"4":4,"97":97}],36:[function(_dereq_,module,exports){
  4537. /**
  4538. * Copyright 2014-2015, Facebook, Inc.
  4539. * All rights reserved.
  4540. *
  4541. * This source code is licensed under the BSD-style license found in the
  4542. * LICENSE file in the root directory of this source tree. An additional grant
  4543. * of patent rights can be found in the PATENTS file in the same directory.
  4544. *
  4545. * @providesModule ReactChildReconciler
  4546. * @typechecks static-only
  4547. */
  4548. 'use strict';
  4549. var ReactReconciler = _dereq_(89);
  4550. var flattenChildren = _dereq_(133);
  4551. var instantiateReactComponent = _dereq_(149);
  4552. var shouldUpdateReactComponent = _dereq_(167);
  4553. /**
  4554. * ReactChildReconciler provides helpers for initializing or updating a set of
  4555. * children. Its output is suitable for passing it onto ReactMultiChild which
  4556. * does diffed reordering and insertion.
  4557. */
  4558. var ReactChildReconciler = {
  4559. /**
  4560. * Generates a "mount image" for each of the supplied children. In the case
  4561. * of `ReactDOMComponent`, a mount image is a string of markup.
  4562. *
  4563. * @param {?object} nestedChildNodes Nested child maps.
  4564. * @return {?object} A set of child instances.
  4565. * @internal
  4566. */
  4567. instantiateChildren: function(nestedChildNodes, transaction, context) {
  4568. var children = flattenChildren(nestedChildNodes);
  4569. for (var name in children) {
  4570. if (children.hasOwnProperty(name)) {
  4571. var child = children[name];
  4572. // The rendered children must be turned into instances as they're
  4573. // mounted.
  4574. var childInstance = instantiateReactComponent(child, null);
  4575. children[name] = childInstance;
  4576. }
  4577. }
  4578. return children;
  4579. },
  4580. /**
  4581. * Updates the rendered children and returns a new set of children.
  4582. *
  4583. * @param {?object} prevChildren Previously initialized set of children.
  4584. * @param {?object} nextNestedChildNodes Nested child maps.
  4585. * @param {ReactReconcileTransaction} transaction
  4586. * @param {object} context
  4587. * @return {?object} A new set of child instances.
  4588. * @internal
  4589. */
  4590. updateChildren: function(
  4591. prevChildren,
  4592. nextNestedChildNodes,
  4593. transaction,
  4594. context) {
  4595. // We currently don't have a way to track moves here but if we use iterators
  4596. // instead of for..in we can zip the iterators and check if an item has
  4597. // moved.
  4598. // TODO: If nothing has changed, return the prevChildren object so that we
  4599. // can quickly bailout if nothing has changed.
  4600. var nextChildren = flattenChildren(nextNestedChildNodes);
  4601. if (!nextChildren && !prevChildren) {
  4602. return null;
  4603. }
  4604. var name;
  4605. for (name in nextChildren) {
  4606. if (!nextChildren.hasOwnProperty(name)) {
  4607. continue;
  4608. }
  4609. var prevChild = prevChildren && prevChildren[name];
  4610. var prevElement = prevChild && prevChild._currentElement;
  4611. var nextElement = nextChildren[name];
  4612. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  4613. ReactReconciler.receiveComponent(
  4614. prevChild, nextElement, transaction, context
  4615. );
  4616. nextChildren[name] = prevChild;
  4617. } else {
  4618. if (prevChild) {
  4619. ReactReconciler.unmountComponent(prevChild, name);
  4620. }
  4621. // The child must be instantiated before it's mounted.
  4622. var nextChildInstance = instantiateReactComponent(
  4623. nextElement,
  4624. null
  4625. );
  4626. nextChildren[name] = nextChildInstance;
  4627. }
  4628. }
  4629. // Unmount children that are no longer present.
  4630. for (name in prevChildren) {
  4631. if (prevChildren.hasOwnProperty(name) &&
  4632. !(nextChildren && nextChildren.hasOwnProperty(name))) {
  4633. ReactReconciler.unmountComponent(prevChildren[name]);
  4634. }
  4635. }
  4636. return nextChildren;
  4637. },
  4638. /**
  4639. * Unmounts all rendered children. This should be used to clean up children
  4640. * when this component is unmounted.
  4641. *
  4642. * @param {?object} renderedChildren Previously initialized set of children.
  4643. * @internal
  4644. */
  4645. unmountChildren: function(renderedChildren) {
  4646. for (var name in renderedChildren) {
  4647. var renderedChild = renderedChildren[name];
  4648. ReactReconciler.unmountComponent(renderedChild);
  4649. }
  4650. }
  4651. };
  4652. module.exports = ReactChildReconciler;
  4653. },{"133":133,"149":149,"167":167,"89":89}],37:[function(_dereq_,module,exports){
  4654. /**
  4655. * Copyright 2013-2015, Facebook, Inc.
  4656. * All rights reserved.
  4657. *
  4658. * This source code is licensed under the BSD-style license found in the
  4659. * LICENSE file in the root directory of this source tree. An additional grant
  4660. * of patent rights can be found in the PATENTS file in the same directory.
  4661. *
  4662. * @providesModule ReactChildren
  4663. */
  4664. 'use strict';
  4665. var PooledClass = _dereq_(30);
  4666. var ReactFragment = _dereq_(69);
  4667. var traverseAllChildren = _dereq_(169);
  4668. var warning = _dereq_(171);
  4669. var twoArgumentPooler = PooledClass.twoArgumentPooler;
  4670. var threeArgumentPooler = PooledClass.threeArgumentPooler;
  4671. /**
  4672. * PooledClass representing the bookkeeping associated with performing a child
  4673. * traversal. Allows avoiding binding callbacks.
  4674. *
  4675. * @constructor ForEachBookKeeping
  4676. * @param {!function} forEachFunction Function to perform traversal with.
  4677. * @param {?*} forEachContext Context to perform context with.
  4678. */
  4679. function ForEachBookKeeping(forEachFunction, forEachContext) {
  4680. this.forEachFunction = forEachFunction;
  4681. this.forEachContext = forEachContext;
  4682. }
  4683. PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
  4684. function forEachSingleChild(traverseContext, child, name, i) {
  4685. var forEachBookKeeping = traverseContext;
  4686. forEachBookKeeping.forEachFunction.call(
  4687. forEachBookKeeping.forEachContext, child, i);
  4688. }
  4689. /**
  4690. * Iterates through children that are typically specified as `props.children`.
  4691. *
  4692. * The provided forEachFunc(child, index) will be called for each
  4693. * leaf child.
  4694. *
  4695. * @param {?*} children Children tree container.
  4696. * @param {function(*, int)} forEachFunc.
  4697. * @param {*} forEachContext Context for forEachContext.
  4698. */
  4699. function forEachChildren(children, forEachFunc, forEachContext) {
  4700. if (children == null) {
  4701. return children;
  4702. }
  4703. var traverseContext =
  4704. ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
  4705. traverseAllChildren(children, forEachSingleChild, traverseContext);
  4706. ForEachBookKeeping.release(traverseContext);
  4707. }
  4708. /**
  4709. * PooledClass representing the bookkeeping associated with performing a child
  4710. * mapping. Allows avoiding binding callbacks.
  4711. *
  4712. * @constructor MapBookKeeping
  4713. * @param {!*} mapResult Object containing the ordered map of results.
  4714. * @param {!function} mapFunction Function to perform mapping with.
  4715. * @param {?*} mapContext Context to perform mapping with.
  4716. */
  4717. function MapBookKeeping(mapResult, mapFunction, mapContext) {
  4718. this.mapResult = mapResult;
  4719. this.mapFunction = mapFunction;
  4720. this.mapContext = mapContext;
  4721. }
  4722. PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
  4723. function mapSingleChildIntoContext(traverseContext, child, name, i) {
  4724. var mapBookKeeping = traverseContext;
  4725. var mapResult = mapBookKeeping.mapResult;
  4726. var keyUnique = !mapResult.hasOwnProperty(name);
  4727. if ("production" !== "development") {
  4728. ("production" !== "development" ? warning(
  4729. keyUnique,
  4730. 'ReactChildren.map(...): Encountered two children with the same key, ' +
  4731. '`%s`. Child keys must be unique; when two children share a key, only ' +
  4732. 'the first child will be used.',
  4733. name
  4734. ) : null);
  4735. }
  4736. if (keyUnique) {
  4737. var mappedChild =
  4738. mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
  4739. mapResult[name] = mappedChild;
  4740. }
  4741. }
  4742. /**
  4743. * Maps children that are typically specified as `props.children`.
  4744. *
  4745. * The provided mapFunction(child, key, index) will be called for each
  4746. * leaf child.
  4747. *
  4748. * TODO: This may likely break any calls to `ReactChildren.map` that were
  4749. * previously relying on the fact that we guarded against null children.
  4750. *
  4751. * @param {?*} children Children tree container.
  4752. * @param {function(*, int)} mapFunction.
  4753. * @param {*} mapContext Context for mapFunction.
  4754. * @return {object} Object containing the ordered map of results.
  4755. */
  4756. function mapChildren(children, func, context) {
  4757. if (children == null) {
  4758. return children;
  4759. }
  4760. var mapResult = {};
  4761. var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
  4762. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  4763. MapBookKeeping.release(traverseContext);
  4764. return ReactFragment.create(mapResult);
  4765. }
  4766. function forEachSingleChildDummy(traverseContext, child, name, i) {
  4767. return null;
  4768. }
  4769. /**
  4770. * Count the number of children that are typically specified as
  4771. * `props.children`.
  4772. *
  4773. * @param {?*} children Children tree container.
  4774. * @return {number} The number of children.
  4775. */
  4776. function countChildren(children, context) {
  4777. return traverseAllChildren(children, forEachSingleChildDummy, null);
  4778. }
  4779. var ReactChildren = {
  4780. forEach: forEachChildren,
  4781. map: mapChildren,
  4782. count: countChildren
  4783. };
  4784. module.exports = ReactChildren;
  4785. },{"169":169,"171":171,"30":30,"69":69}],38:[function(_dereq_,module,exports){
  4786. /**
  4787. * Copyright 2013-2015, Facebook, Inc.
  4788. * All rights reserved.
  4789. *
  4790. * This source code is licensed under the BSD-style license found in the
  4791. * LICENSE file in the root directory of this source tree. An additional grant
  4792. * of patent rights can be found in the PATENTS file in the same directory.
  4793. *
  4794. * @providesModule ReactClass
  4795. */
  4796. 'use strict';
  4797. var ReactComponent = _dereq_(39);
  4798. var ReactCurrentOwner = _dereq_(45);
  4799. var ReactElement = _dereq_(63);
  4800. var ReactErrorUtils = _dereq_(66);
  4801. var ReactInstanceMap = _dereq_(73);
  4802. var ReactLifeCycle = _dereq_(74);
  4803. var ReactPropTypeLocations = _dereq_(85);
  4804. var ReactPropTypeLocationNames = _dereq_(84);
  4805. var ReactUpdateQueue = _dereq_(99);
  4806. var assign = _dereq_(29);
  4807. var invariant = _dereq_(150);
  4808. var keyMirror = _dereq_(156);
  4809. var keyOf = _dereq_(157);
  4810. var warning = _dereq_(171);
  4811. var MIXINS_KEY = keyOf({mixins: null});
  4812. /**
  4813. * Policies that describe methods in `ReactClassInterface`.
  4814. */
  4815. var SpecPolicy = keyMirror({
  4816. /**
  4817. * These methods may be defined only once by the class specification or mixin.
  4818. */
  4819. DEFINE_ONCE: null,
  4820. /**
  4821. * These methods may be defined by both the class specification and mixins.
  4822. * Subsequent definitions will be chained. These methods must return void.
  4823. */
  4824. DEFINE_MANY: null,
  4825. /**
  4826. * These methods are overriding the base class.
  4827. */
  4828. OVERRIDE_BASE: null,
  4829. /**
  4830. * These methods are similar to DEFINE_MANY, except we assume they return
  4831. * objects. We try to merge the keys of the return values of all the mixed in
  4832. * functions. If there is a key conflict we throw.
  4833. */
  4834. DEFINE_MANY_MERGED: null
  4835. });
  4836. var injectedMixins = [];
  4837. /**
  4838. * Composite components are higher-level components that compose other composite
  4839. * or native components.
  4840. *
  4841. * To create a new type of `ReactClass`, pass a specification of
  4842. * your new class to `React.createClass`. The only requirement of your class
  4843. * specification is that you implement a `render` method.
  4844. *
  4845. * var MyComponent = React.createClass({
  4846. * render: function() {
  4847. * return <div>Hello World</div>;
  4848. * }
  4849. * });
  4850. *
  4851. * The class specification supports a specific protocol of methods that have
  4852. * special meaning (e.g. `render`). See `ReactClassInterface` for
  4853. * more the comprehensive protocol. Any other properties and methods in the
  4854. * class specification will available on the prototype.
  4855. *
  4856. * @interface ReactClassInterface
  4857. * @internal
  4858. */
  4859. var ReactClassInterface = {
  4860. /**
  4861. * An array of Mixin objects to include when defining your component.
  4862. *
  4863. * @type {array}
  4864. * @optional
  4865. */
  4866. mixins: SpecPolicy.DEFINE_MANY,
  4867. /**
  4868. * An object containing properties and methods that should be defined on
  4869. * the component's constructor instead of its prototype (static methods).
  4870. *
  4871. * @type {object}
  4872. * @optional
  4873. */
  4874. statics: SpecPolicy.DEFINE_MANY,
  4875. /**
  4876. * Definition of prop types for this component.
  4877. *
  4878. * @type {object}
  4879. * @optional
  4880. */
  4881. propTypes: SpecPolicy.DEFINE_MANY,
  4882. /**
  4883. * Definition of context types for this component.
  4884. *
  4885. * @type {object}
  4886. * @optional
  4887. */
  4888. contextTypes: SpecPolicy.DEFINE_MANY,
  4889. /**
  4890. * Definition of context types this component sets for its children.
  4891. *
  4892. * @type {object}
  4893. * @optional
  4894. */
  4895. childContextTypes: SpecPolicy.DEFINE_MANY,
  4896. // ==== Definition methods ====
  4897. /**
  4898. * Invoked when the component is mounted. Values in the mapping will be set on
  4899. * `this.props` if that prop is not specified (i.e. using an `in` check).
  4900. *
  4901. * This method is invoked before `getInitialState` and therefore cannot rely
  4902. * on `this.state` or use `this.setState`.
  4903. *
  4904. * @return {object}
  4905. * @optional
  4906. */
  4907. getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
  4908. /**
  4909. * Invoked once before the component is mounted. The return value will be used
  4910. * as the initial value of `this.state`.
  4911. *
  4912. * getInitialState: function() {
  4913. * return {
  4914. * isOn: false,
  4915. * fooBaz: new BazFoo()
  4916. * }
  4917. * }
  4918. *
  4919. * @return {object}
  4920. * @optional
  4921. */
  4922. getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
  4923. /**
  4924. * @return {object}
  4925. * @optional
  4926. */
  4927. getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
  4928. /**
  4929. * Uses props from `this.props` and state from `this.state` to render the
  4930. * structure of the component.
  4931. *
  4932. * No guarantees are made about when or how often this method is invoked, so
  4933. * it must not have side effects.
  4934. *
  4935. * render: function() {
  4936. * var name = this.props.name;
  4937. * return <div>Hello, {name}!</div>;
  4938. * }
  4939. *
  4940. * @return {ReactComponent}
  4941. * @nosideeffects
  4942. * @required
  4943. */
  4944. render: SpecPolicy.DEFINE_ONCE,
  4945. // ==== Delegate methods ====
  4946. /**
  4947. * Invoked when the component is initially created and about to be mounted.
  4948. * This may have side effects, but any external subscriptions or data created
  4949. * by this method must be cleaned up in `componentWillUnmount`.
  4950. *
  4951. * @optional
  4952. */
  4953. componentWillMount: SpecPolicy.DEFINE_MANY,
  4954. /**
  4955. * Invoked when the component has been mounted and has a DOM representation.
  4956. * However, there is no guarantee that the DOM node is in the document.
  4957. *
  4958. * Use this as an opportunity to operate on the DOM when the component has
  4959. * been mounted (initialized and rendered) for the first time.
  4960. *
  4961. * @param {DOMElement} rootNode DOM element representing the component.
  4962. * @optional
  4963. */
  4964. componentDidMount: SpecPolicy.DEFINE_MANY,
  4965. /**
  4966. * Invoked before the component receives new props.
  4967. *
  4968. * Use this as an opportunity to react to a prop transition by updating the
  4969. * state using `this.setState`. Current props are accessed via `this.props`.
  4970. *
  4971. * componentWillReceiveProps: function(nextProps, nextContext) {
  4972. * this.setState({
  4973. * likesIncreasing: nextProps.likeCount > this.props.likeCount
  4974. * });
  4975. * }
  4976. *
  4977. * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
  4978. * transition may cause a state change, but the opposite is not true. If you
  4979. * need it, you are probably looking for `componentWillUpdate`.
  4980. *
  4981. * @param {object} nextProps
  4982. * @optional
  4983. */
  4984. componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
  4985. /**
  4986. * Invoked while deciding if the component should be updated as a result of
  4987. * receiving new props, state and/or context.
  4988. *
  4989. * Use this as an opportunity to `return false` when you're certain that the
  4990. * transition to the new props/state/context will not require a component
  4991. * update.
  4992. *
  4993. * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
  4994. * return !equal(nextProps, this.props) ||
  4995. * !equal(nextState, this.state) ||
  4996. * !equal(nextContext, this.context);
  4997. * }
  4998. *
  4999. * @param {object} nextProps
  5000. * @param {?object} nextState
  5001. * @param {?object} nextContext
  5002. * @return {boolean} True if the component should update.
  5003. * @optional
  5004. */
  5005. shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
  5006. /**
  5007. * Invoked when the component is about to update due to a transition from
  5008. * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
  5009. * and `nextContext`.
  5010. *
  5011. * Use this as an opportunity to perform preparation before an update occurs.
  5012. *
  5013. * NOTE: You **cannot** use `this.setState()` in this method.
  5014. *
  5015. * @param {object} nextProps
  5016. * @param {?object} nextState
  5017. * @param {?object} nextContext
  5018. * @param {ReactReconcileTransaction} transaction
  5019. * @optional
  5020. */
  5021. componentWillUpdate: SpecPolicy.DEFINE_MANY,
  5022. /**
  5023. * Invoked when the component's DOM representation has been updated.
  5024. *
  5025. * Use this as an opportunity to operate on the DOM when the component has
  5026. * been updated.
  5027. *
  5028. * @param {object} prevProps
  5029. * @param {?object} prevState
  5030. * @param {?object} prevContext
  5031. * @param {DOMElement} rootNode DOM element representing the component.
  5032. * @optional
  5033. */
  5034. componentDidUpdate: SpecPolicy.DEFINE_MANY,
  5035. /**
  5036. * Invoked when the component is about to be removed from its parent and have
  5037. * its DOM representation destroyed.
  5038. *
  5039. * Use this as an opportunity to deallocate any external resources.
  5040. *
  5041. * NOTE: There is no `componentDidUnmount` since your component will have been
  5042. * destroyed by that point.
  5043. *
  5044. * @optional
  5045. */
  5046. componentWillUnmount: SpecPolicy.DEFINE_MANY,
  5047. // ==== Advanced methods ====
  5048. /**
  5049. * Updates the component's currently mounted DOM representation.
  5050. *
  5051. * By default, this implements React's rendering and reconciliation algorithm.
  5052. * Sophisticated clients may wish to override this.
  5053. *
  5054. * @param {ReactReconcileTransaction} transaction
  5055. * @internal
  5056. * @overridable
  5057. */
  5058. updateComponent: SpecPolicy.OVERRIDE_BASE
  5059. };
  5060. /**
  5061. * Mapping from class specification keys to special processing functions.
  5062. *
  5063. * Although these are declared like instance properties in the specification
  5064. * when defining classes using `React.createClass`, they are actually static
  5065. * and are accessible on the constructor instead of the prototype. Despite
  5066. * being static, they must be defined outside of the "statics" key under
  5067. * which all other static methods are defined.
  5068. */
  5069. var RESERVED_SPEC_KEYS = {
  5070. displayName: function(Constructor, displayName) {
  5071. Constructor.displayName = displayName;
  5072. },
  5073. mixins: function(Constructor, mixins) {
  5074. if (mixins) {
  5075. for (var i = 0; i < mixins.length; i++) {
  5076. mixSpecIntoComponent(Constructor, mixins[i]);
  5077. }
  5078. }
  5079. },
  5080. childContextTypes: function(Constructor, childContextTypes) {
  5081. if ("production" !== "development") {
  5082. validateTypeDef(
  5083. Constructor,
  5084. childContextTypes,
  5085. ReactPropTypeLocations.childContext
  5086. );
  5087. }
  5088. Constructor.childContextTypes = assign(
  5089. {},
  5090. Constructor.childContextTypes,
  5091. childContextTypes
  5092. );
  5093. },
  5094. contextTypes: function(Constructor, contextTypes) {
  5095. if ("production" !== "development") {
  5096. validateTypeDef(
  5097. Constructor,
  5098. contextTypes,
  5099. ReactPropTypeLocations.context
  5100. );
  5101. }
  5102. Constructor.contextTypes = assign(
  5103. {},
  5104. Constructor.contextTypes,
  5105. contextTypes
  5106. );
  5107. },
  5108. /**
  5109. * Special case getDefaultProps which should move into statics but requires
  5110. * automatic merging.
  5111. */
  5112. getDefaultProps: function(Constructor, getDefaultProps) {
  5113. if (Constructor.getDefaultProps) {
  5114. Constructor.getDefaultProps = createMergedResultFunction(
  5115. Constructor.getDefaultProps,
  5116. getDefaultProps
  5117. );
  5118. } else {
  5119. Constructor.getDefaultProps = getDefaultProps;
  5120. }
  5121. },
  5122. propTypes: function(Constructor, propTypes) {
  5123. if ("production" !== "development") {
  5124. validateTypeDef(
  5125. Constructor,
  5126. propTypes,
  5127. ReactPropTypeLocations.prop
  5128. );
  5129. }
  5130. Constructor.propTypes = assign(
  5131. {},
  5132. Constructor.propTypes,
  5133. propTypes
  5134. );
  5135. },
  5136. statics: function(Constructor, statics) {
  5137. mixStaticSpecIntoComponent(Constructor, statics);
  5138. }
  5139. };
  5140. function validateTypeDef(Constructor, typeDef, location) {
  5141. for (var propName in typeDef) {
  5142. if (typeDef.hasOwnProperty(propName)) {
  5143. // use a warning instead of an invariant so components
  5144. // don't show up in prod but not in __DEV__
  5145. ("production" !== "development" ? warning(
  5146. typeof typeDef[propName] === 'function',
  5147. '%s: %s type `%s` is invalid; it must be a function, usually from ' +
  5148. 'React.PropTypes.',
  5149. Constructor.displayName || 'ReactClass',
  5150. ReactPropTypeLocationNames[location],
  5151. propName
  5152. ) : null);
  5153. }
  5154. }
  5155. }
  5156. function validateMethodOverride(proto, name) {
  5157. var specPolicy = ReactClassInterface.hasOwnProperty(name) ?
  5158. ReactClassInterface[name] :
  5159. null;
  5160. // Disallow overriding of base class methods unless explicitly allowed.
  5161. if (ReactClassMixin.hasOwnProperty(name)) {
  5162. ("production" !== "development" ? invariant(
  5163. specPolicy === SpecPolicy.OVERRIDE_BASE,
  5164. 'ReactClassInterface: You are attempting to override ' +
  5165. '`%s` from your class specification. Ensure that your method names ' +
  5166. 'do not overlap with React methods.',
  5167. name
  5168. ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
  5169. }
  5170. // Disallow defining methods more than once unless explicitly allowed.
  5171. if (proto.hasOwnProperty(name)) {
  5172. ("production" !== "development" ? invariant(
  5173. specPolicy === SpecPolicy.DEFINE_MANY ||
  5174. specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
  5175. 'ReactClassInterface: You are attempting to define ' +
  5176. '`%s` on your component more than once. This conflict may be due ' +
  5177. 'to a mixin.',
  5178. name
  5179. ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
  5180. specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
  5181. }
  5182. }
  5183. /**
  5184. * Mixin helper which handles policy validation and reserved
  5185. * specification keys when building React classses.
  5186. */
  5187. function mixSpecIntoComponent(Constructor, spec) {
  5188. if (!spec) {
  5189. return;
  5190. }
  5191. ("production" !== "development" ? invariant(
  5192. typeof spec !== 'function',
  5193. 'ReactClass: You\'re attempting to ' +
  5194. 'use a component class as a mixin. Instead, just use a regular object.'
  5195. ) : invariant(typeof spec !== 'function'));
  5196. ("production" !== "development" ? invariant(
  5197. !ReactElement.isValidElement(spec),
  5198. 'ReactClass: You\'re attempting to ' +
  5199. 'use a component as a mixin. Instead, just use a regular object.'
  5200. ) : invariant(!ReactElement.isValidElement(spec)));
  5201. var proto = Constructor.prototype;
  5202. // By handling mixins before any other properties, we ensure the same
  5203. // chaining order is applied to methods with DEFINE_MANY policy, whether
  5204. // mixins are listed before or after these methods in the spec.
  5205. if (spec.hasOwnProperty(MIXINS_KEY)) {
  5206. RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
  5207. }
  5208. for (var name in spec) {
  5209. if (!spec.hasOwnProperty(name)) {
  5210. continue;
  5211. }
  5212. if (name === MIXINS_KEY) {
  5213. // We have already handled mixins in a special case above
  5214. continue;
  5215. }
  5216. var property = spec[name];
  5217. validateMethodOverride(proto, name);
  5218. if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
  5219. RESERVED_SPEC_KEYS[name](Constructor, property);
  5220. } else {
  5221. // Setup methods on prototype:
  5222. // The following member methods should not be automatically bound:
  5223. // 1. Expected ReactClass methods (in the "interface").
  5224. // 2. Overridden methods (that were mixed in).
  5225. var isReactClassMethod =
  5226. ReactClassInterface.hasOwnProperty(name);
  5227. var isAlreadyDefined = proto.hasOwnProperty(name);
  5228. var markedDontBind = property && property.__reactDontBind;
  5229. var isFunction = typeof property === 'function';
  5230. var shouldAutoBind =
  5231. isFunction &&
  5232. !isReactClassMethod &&
  5233. !isAlreadyDefined &&
  5234. !markedDontBind;
  5235. if (shouldAutoBind) {
  5236. if (!proto.__reactAutoBindMap) {
  5237. proto.__reactAutoBindMap = {};
  5238. }
  5239. proto.__reactAutoBindMap[name] = property;
  5240. proto[name] = property;
  5241. } else {
  5242. if (isAlreadyDefined) {
  5243. var specPolicy = ReactClassInterface[name];
  5244. // These cases should already be caught by validateMethodOverride
  5245. ("production" !== "development" ? invariant(
  5246. isReactClassMethod && (
  5247. (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
  5248. ),
  5249. 'ReactClass: Unexpected spec policy %s for key %s ' +
  5250. 'when mixing in component specs.',
  5251. specPolicy,
  5252. name
  5253. ) : invariant(isReactClassMethod && (
  5254. (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
  5255. )));
  5256. // For methods which are defined more than once, call the existing
  5257. // methods before calling the new property, merging if appropriate.
  5258. if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
  5259. proto[name] = createMergedResultFunction(proto[name], property);
  5260. } else if (specPolicy === SpecPolicy.DEFINE_MANY) {
  5261. proto[name] = createChainedFunction(proto[name], property);
  5262. }
  5263. } else {
  5264. proto[name] = property;
  5265. if ("production" !== "development") {
  5266. // Add verbose displayName to the function, which helps when looking
  5267. // at profiling tools.
  5268. if (typeof property === 'function' && spec.displayName) {
  5269. proto[name].displayName = spec.displayName + '_' + name;
  5270. }
  5271. }
  5272. }
  5273. }
  5274. }
  5275. }
  5276. }
  5277. function mixStaticSpecIntoComponent(Constructor, statics) {
  5278. if (!statics) {
  5279. return;
  5280. }
  5281. for (var name in statics) {
  5282. var property = statics[name];
  5283. if (!statics.hasOwnProperty(name)) {
  5284. continue;
  5285. }
  5286. var isReserved = name in RESERVED_SPEC_KEYS;
  5287. ("production" !== "development" ? invariant(
  5288. !isReserved,
  5289. 'ReactClass: You are attempting to define a reserved ' +
  5290. 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
  5291. 'as an instance property instead; it will still be accessible on the ' +
  5292. 'constructor.',
  5293. name
  5294. ) : invariant(!isReserved));
  5295. var isInherited = name in Constructor;
  5296. ("production" !== "development" ? invariant(
  5297. !isInherited,
  5298. 'ReactClass: You are attempting to define ' +
  5299. '`%s` on your component more than once. This conflict may be ' +
  5300. 'due to a mixin.',
  5301. name
  5302. ) : invariant(!isInherited));
  5303. Constructor[name] = property;
  5304. }
  5305. }
  5306. /**
  5307. * Merge two objects, but throw if both contain the same key.
  5308. *
  5309. * @param {object} one The first object, which is mutated.
  5310. * @param {object} two The second object
  5311. * @return {object} one after it has been mutated to contain everything in two.
  5312. */
  5313. function mergeIntoWithNoDuplicateKeys(one, two) {
  5314. ("production" !== "development" ? invariant(
  5315. one && two && typeof one === 'object' && typeof two === 'object',
  5316. 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
  5317. ) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));
  5318. for (var key in two) {
  5319. if (two.hasOwnProperty(key)) {
  5320. ("production" !== "development" ? invariant(
  5321. one[key] === undefined,
  5322. 'mergeIntoWithNoDuplicateKeys(): ' +
  5323. 'Tried to merge two objects with the same key: `%s`. This conflict ' +
  5324. 'may be due to a mixin; in particular, this may be caused by two ' +
  5325. 'getInitialState() or getDefaultProps() methods returning objects ' +
  5326. 'with clashing keys.',
  5327. key
  5328. ) : invariant(one[key] === undefined));
  5329. one[key] = two[key];
  5330. }
  5331. }
  5332. return one;
  5333. }
  5334. /**
  5335. * Creates a function that invokes two functions and merges their return values.
  5336. *
  5337. * @param {function} one Function to invoke first.
  5338. * @param {function} two Function to invoke second.
  5339. * @return {function} Function that invokes the two argument functions.
  5340. * @private
  5341. */
  5342. function createMergedResultFunction(one, two) {
  5343. return function mergedResult() {
  5344. var a = one.apply(this, arguments);
  5345. var b = two.apply(this, arguments);
  5346. if (a == null) {
  5347. return b;
  5348. } else if (b == null) {
  5349. return a;
  5350. }
  5351. var c = {};
  5352. mergeIntoWithNoDuplicateKeys(c, a);
  5353. mergeIntoWithNoDuplicateKeys(c, b);
  5354. return c;
  5355. };
  5356. }
  5357. /**
  5358. * Creates a function that invokes two functions and ignores their return vales.
  5359. *
  5360. * @param {function} one Function to invoke first.
  5361. * @param {function} two Function to invoke second.
  5362. * @return {function} Function that invokes the two argument functions.
  5363. * @private
  5364. */
  5365. function createChainedFunction(one, two) {
  5366. return function chainedFunction() {
  5367. one.apply(this, arguments);
  5368. two.apply(this, arguments);
  5369. };
  5370. }
  5371. /**
  5372. * Binds a method to the component.
  5373. *
  5374. * @param {object} component Component whose method is going to be bound.
  5375. * @param {function} method Method to be bound.
  5376. * @return {function} The bound method.
  5377. */
  5378. function bindAutoBindMethod(component, method) {
  5379. var boundMethod = method.bind(component);
  5380. if ("production" !== "development") {
  5381. boundMethod.__reactBoundContext = component;
  5382. boundMethod.__reactBoundMethod = method;
  5383. boundMethod.__reactBoundArguments = null;
  5384. var componentName = component.constructor.displayName;
  5385. var _bind = boundMethod.bind;
  5386. /* eslint-disable block-scoped-var, no-undef */
  5387. boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  5388. // User is trying to bind() an autobound method; we effectively will
  5389. // ignore the value of "this" that the user is trying to use, so
  5390. // let's warn.
  5391. if (newThis !== component && newThis !== null) {
  5392. ("production" !== "development" ? warning(
  5393. false,
  5394. 'bind(): React component methods may only be bound to the ' +
  5395. 'component instance. See %s',
  5396. componentName
  5397. ) : null);
  5398. } else if (!args.length) {
  5399. ("production" !== "development" ? warning(
  5400. false,
  5401. 'bind(): You are binding a component method to the component. ' +
  5402. 'React does this for you automatically in a high-performance ' +
  5403. 'way, so you can safely remove this call. See %s',
  5404. componentName
  5405. ) : null);
  5406. return boundMethod;
  5407. }
  5408. var reboundMethod = _bind.apply(boundMethod, arguments);
  5409. reboundMethod.__reactBoundContext = component;
  5410. reboundMethod.__reactBoundMethod = method;
  5411. reboundMethod.__reactBoundArguments = args;
  5412. return reboundMethod;
  5413. /* eslint-enable */
  5414. };
  5415. }
  5416. return boundMethod;
  5417. }
  5418. /**
  5419. * Binds all auto-bound methods in a component.
  5420. *
  5421. * @param {object} component Component whose method is going to be bound.
  5422. */
  5423. function bindAutoBindMethods(component) {
  5424. for (var autoBindKey in component.__reactAutoBindMap) {
  5425. if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
  5426. var method = component.__reactAutoBindMap[autoBindKey];
  5427. component[autoBindKey] = bindAutoBindMethod(
  5428. component,
  5429. ReactErrorUtils.guard(
  5430. method,
  5431. component.constructor.displayName + '.' + autoBindKey
  5432. )
  5433. );
  5434. }
  5435. }
  5436. }
  5437. var typeDeprecationDescriptor = {
  5438. enumerable: false,
  5439. get: function() {
  5440. var displayName = this.displayName || this.name || 'Component';
  5441. ("production" !== "development" ? warning(
  5442. false,
  5443. '%s.type is deprecated. Use %s directly to access the class.',
  5444. displayName,
  5445. displayName
  5446. ) : null);
  5447. Object.defineProperty(this, 'type', {
  5448. value: this
  5449. });
  5450. return this;
  5451. }
  5452. };
  5453. /**
  5454. * Add more to the ReactClass base class. These are all legacy features and
  5455. * therefore not already part of the modern ReactComponent.
  5456. */
  5457. var ReactClassMixin = {
  5458. /**
  5459. * TODO: This will be deprecated because state should always keep a consistent
  5460. * type signature and the only use case for this, is to avoid that.
  5461. */
  5462. replaceState: function(newState, callback) {
  5463. ReactUpdateQueue.enqueueReplaceState(this, newState);
  5464. if (callback) {
  5465. ReactUpdateQueue.enqueueCallback(this, callback);
  5466. }
  5467. },
  5468. /**
  5469. * Checks whether or not this composite component is mounted.
  5470. * @return {boolean} True if mounted, false otherwise.
  5471. * @protected
  5472. * @final
  5473. */
  5474. isMounted: function() {
  5475. if ("production" !== "development") {
  5476. var owner = ReactCurrentOwner.current;
  5477. if (owner !== null) {
  5478. ("production" !== "development" ? warning(
  5479. owner._warnedAboutRefsInRender,
  5480. '%s is accessing isMounted inside its render() function. ' +
  5481. 'render() should be a pure function of props and state. It should ' +
  5482. 'never access something that requires stale data from the previous ' +
  5483. 'render, such as refs. Move this logic to componentDidMount and ' +
  5484. 'componentDidUpdate instead.',
  5485. owner.getName() || 'A component'
  5486. ) : null);
  5487. owner._warnedAboutRefsInRender = true;
  5488. }
  5489. }
  5490. var internalInstance = ReactInstanceMap.get(this);
  5491. return (
  5492. internalInstance &&
  5493. internalInstance !== ReactLifeCycle.currentlyMountingInstance
  5494. );
  5495. },
  5496. /**
  5497. * Sets a subset of the props.
  5498. *
  5499. * @param {object} partialProps Subset of the next props.
  5500. * @param {?function} callback Called after props are updated.
  5501. * @final
  5502. * @public
  5503. * @deprecated
  5504. */
  5505. setProps: function(partialProps, callback) {
  5506. ReactUpdateQueue.enqueueSetProps(this, partialProps);
  5507. if (callback) {
  5508. ReactUpdateQueue.enqueueCallback(this, callback);
  5509. }
  5510. },
  5511. /**
  5512. * Replace all the props.
  5513. *
  5514. * @param {object} newProps Subset of the next props.
  5515. * @param {?function} callback Called after props are updated.
  5516. * @final
  5517. * @public
  5518. * @deprecated
  5519. */
  5520. replaceProps: function(newProps, callback) {
  5521. ReactUpdateQueue.enqueueReplaceProps(this, newProps);
  5522. if (callback) {
  5523. ReactUpdateQueue.enqueueCallback(this, callback);
  5524. }
  5525. }
  5526. };
  5527. var ReactClassComponent = function() {};
  5528. assign(
  5529. ReactClassComponent.prototype,
  5530. ReactComponent.prototype,
  5531. ReactClassMixin
  5532. );
  5533. /**
  5534. * Module for creating composite components.
  5535. *
  5536. * @class ReactClass
  5537. */
  5538. var ReactClass = {
  5539. /**
  5540. * Creates a composite component class given a class specification.
  5541. *
  5542. * @param {object} spec Class specification (which must define `render`).
  5543. * @return {function} Component constructor function.
  5544. * @public
  5545. */
  5546. createClass: function(spec) {
  5547. var Constructor = function(props, context) {
  5548. // This constructor is overridden by mocks. The argument is used
  5549. // by mocks to assert on what gets mounted.
  5550. if ("production" !== "development") {
  5551. ("production" !== "development" ? warning(
  5552. this instanceof Constructor,
  5553. 'Something is calling a React component directly. Use a factory or ' +
  5554. 'JSX instead. See: http://fb.me/react-legacyfactory'
  5555. ) : null);
  5556. }
  5557. // Wire up auto-binding
  5558. if (this.__reactAutoBindMap) {
  5559. bindAutoBindMethods(this);
  5560. }
  5561. this.props = props;
  5562. this.context = context;
  5563. this.state = null;
  5564. // ReactClasses doesn't have constructors. Instead, they use the
  5565. // getInitialState and componentWillMount methods for initialization.
  5566. var initialState = this.getInitialState ? this.getInitialState() : null;
  5567. if ("production" !== "development") {
  5568. // We allow auto-mocks to proceed as if they're returning null.
  5569. if (typeof initialState === 'undefined' &&
  5570. this.getInitialState._isMockFunction) {
  5571. // This is probably bad practice. Consider warning here and
  5572. // deprecating this convenience.
  5573. initialState = null;
  5574. }
  5575. }
  5576. ("production" !== "development" ? invariant(
  5577. typeof initialState === 'object' && !Array.isArray(initialState),
  5578. '%s.getInitialState(): must return an object or null',
  5579. Constructor.displayName || 'ReactCompositeComponent'
  5580. ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
  5581. this.state = initialState;
  5582. };
  5583. Constructor.prototype = new ReactClassComponent();
  5584. Constructor.prototype.constructor = Constructor;
  5585. injectedMixins.forEach(
  5586. mixSpecIntoComponent.bind(null, Constructor)
  5587. );
  5588. mixSpecIntoComponent(Constructor, spec);
  5589. // Initialize the defaultProps property after all mixins have been merged
  5590. if (Constructor.getDefaultProps) {
  5591. Constructor.defaultProps = Constructor.getDefaultProps();
  5592. }
  5593. if ("production" !== "development") {
  5594. // This is a tag to indicate that the use of these method names is ok,
  5595. // since it's used with createClass. If it's not, then it's likely a
  5596. // mistake so we'll warn you to use the static property, property
  5597. // initializer or constructor respectively.
  5598. if (Constructor.getDefaultProps) {
  5599. Constructor.getDefaultProps.isReactClassApproved = {};
  5600. }
  5601. if (Constructor.prototype.getInitialState) {
  5602. Constructor.prototype.getInitialState.isReactClassApproved = {};
  5603. }
  5604. }
  5605. ("production" !== "development" ? invariant(
  5606. Constructor.prototype.render,
  5607. 'createClass(...): Class specification must implement a `render` method.'
  5608. ) : invariant(Constructor.prototype.render));
  5609. if ("production" !== "development") {
  5610. ("production" !== "development" ? warning(
  5611. !Constructor.prototype.componentShouldUpdate,
  5612. '%s has a method called ' +
  5613. 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
  5614. 'The name is phrased as a question because the function is ' +
  5615. 'expected to return a value.',
  5616. spec.displayName || 'A component'
  5617. ) : null);
  5618. }
  5619. // Reduce time spent doing lookups by setting these on the prototype.
  5620. for (var methodName in ReactClassInterface) {
  5621. if (!Constructor.prototype[methodName]) {
  5622. Constructor.prototype[methodName] = null;
  5623. }
  5624. }
  5625. // Legacy hook
  5626. Constructor.type = Constructor;
  5627. if ("production" !== "development") {
  5628. try {
  5629. Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);
  5630. } catch (x) {
  5631. // IE will fail on defineProperty (es5-shim/sham too)
  5632. }
  5633. }
  5634. return Constructor;
  5635. },
  5636. injection: {
  5637. injectMixin: function(mixin) {
  5638. injectedMixins.push(mixin);
  5639. }
  5640. }
  5641. };
  5642. module.exports = ReactClass;
  5643. },{"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){
  5644. /**
  5645. * Copyright 2013-2015, Facebook, Inc.
  5646. * All rights reserved.
  5647. *
  5648. * This source code is licensed under the BSD-style license found in the
  5649. * LICENSE file in the root directory of this source tree. An additional grant
  5650. * of patent rights can be found in the PATENTS file in the same directory.
  5651. *
  5652. * @providesModule ReactComponent
  5653. */
  5654. 'use strict';
  5655. var ReactUpdateQueue = _dereq_(99);
  5656. var invariant = _dereq_(150);
  5657. var warning = _dereq_(171);
  5658. /**
  5659. * Base class helpers for the updating state of a component.
  5660. */
  5661. function ReactComponent(props, context) {
  5662. this.props = props;
  5663. this.context = context;
  5664. }
  5665. /**
  5666. * Sets a subset of the state. Always use this to mutate
  5667. * state. You should treat `this.state` as immutable.
  5668. *
  5669. * There is no guarantee that `this.state` will be immediately updated, so
  5670. * accessing `this.state` after calling this method may return the old value.
  5671. *
  5672. * There is no guarantee that calls to `setState` will run synchronously,
  5673. * as they may eventually be batched together. You can provide an optional
  5674. * callback that will be executed when the call to setState is actually
  5675. * completed.
  5676. *
  5677. * When a function is provided to setState, it will be called at some point in
  5678. * the future (not synchronously). It will be called with the up to date
  5679. * component arguments (state, props, context). These values can be different
  5680. * from this.* because your function may be called after receiveProps but before
  5681. * shouldComponentUpdate, and this new state, props, and context will not yet be
  5682. * assigned to this.
  5683. *
  5684. * @param {object|function} partialState Next partial state or function to
  5685. * produce next partial state to be merged with current state.
  5686. * @param {?function} callback Called after state is updated.
  5687. * @final
  5688. * @protected
  5689. */
  5690. ReactComponent.prototype.setState = function(partialState, callback) {
  5691. ("production" !== "development" ? invariant(
  5692. typeof partialState === 'object' ||
  5693. typeof partialState === 'function' ||
  5694. partialState == null,
  5695. 'setState(...): takes an object of state variables to update or a ' +
  5696. 'function which returns an object of state variables.'
  5697. ) : invariant(typeof partialState === 'object' ||
  5698. typeof partialState === 'function' ||
  5699. partialState == null));
  5700. if ("production" !== "development") {
  5701. ("production" !== "development" ? warning(
  5702. partialState != null,
  5703. 'setState(...): You passed an undefined or null state object; ' +
  5704. 'instead, use forceUpdate().'
  5705. ) : null);
  5706. }
  5707. ReactUpdateQueue.enqueueSetState(this, partialState);
  5708. if (callback) {
  5709. ReactUpdateQueue.enqueueCallback(this, callback);
  5710. }
  5711. };
  5712. /**
  5713. * Forces an update. This should only be invoked when it is known with
  5714. * certainty that we are **not** in a DOM transaction.
  5715. *
  5716. * You may want to call this when you know that some deeper aspect of the
  5717. * component's state has changed but `setState` was not called.
  5718. *
  5719. * This will not invoke `shouldComponentUpdate`, but it will invoke
  5720. * `componentWillUpdate` and `componentDidUpdate`.
  5721. *
  5722. * @param {?function} callback Called after update is complete.
  5723. * @final
  5724. * @protected
  5725. */
  5726. ReactComponent.prototype.forceUpdate = function(callback) {
  5727. ReactUpdateQueue.enqueueForceUpdate(this);
  5728. if (callback) {
  5729. ReactUpdateQueue.enqueueCallback(this, callback);
  5730. }
  5731. };
  5732. /**
  5733. * Deprecated APIs. These APIs used to exist on classic React classes but since
  5734. * we would like to deprecate them, we're not going to move them over to this
  5735. * modern base class. Instead, we define a getter that warns if it's accessed.
  5736. */
  5737. if ("production" !== "development") {
  5738. var deprecatedAPIs = {
  5739. getDOMNode: 'getDOMNode',
  5740. isMounted: 'isMounted',
  5741. replaceProps: 'replaceProps',
  5742. replaceState: 'replaceState',
  5743. setProps: 'setProps'
  5744. };
  5745. var defineDeprecationWarning = function(methodName, displayName) {
  5746. try {
  5747. Object.defineProperty(ReactComponent.prototype, methodName, {
  5748. get: function() {
  5749. ("production" !== "development" ? warning(
  5750. false,
  5751. '%s(...) is deprecated in plain JavaScript React classes.',
  5752. displayName
  5753. ) : null);
  5754. return undefined;
  5755. }
  5756. });
  5757. } catch (x) {
  5758. // IE will fail on defineProperty (es5-shim/sham too)
  5759. }
  5760. };
  5761. for (var fnName in deprecatedAPIs) {
  5762. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  5763. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  5764. }
  5765. }
  5766. }
  5767. module.exports = ReactComponent;
  5768. },{"150":150,"171":171,"99":99}],40:[function(_dereq_,module,exports){
  5769. /**
  5770. * Copyright 2013-2015, Facebook, Inc.
  5771. * All rights reserved.
  5772. *
  5773. * This source code is licensed under the BSD-style license found in the
  5774. * LICENSE file in the root directory of this source tree. An additional grant
  5775. * of patent rights can be found in the PATENTS file in the same directory.
  5776. *
  5777. * @providesModule ReactComponentBrowserEnvironment
  5778. */
  5779. /*jslint evil: true */
  5780. 'use strict';
  5781. var ReactDOMIDOperations = _dereq_(50);
  5782. var ReactMount = _dereq_(77);
  5783. /**
  5784. * Abstracts away all functionality of the reconciler that requires knowledge of
  5785. * the browser context. TODO: These callers should be refactored to avoid the
  5786. * need for this injection.
  5787. */
  5788. var ReactComponentBrowserEnvironment = {
  5789. processChildrenUpdates:
  5790. ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
  5791. replaceNodeWithMarkupByID:
  5792. ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
  5793. /**
  5794. * If a particular environment requires that some resources be cleaned up,
  5795. * specify this in the injected Mixin. In the DOM, we would likely want to
  5796. * purge any cached node ID lookups.
  5797. *
  5798. * @private
  5799. */
  5800. unmountIDFromEnvironment: function(rootNodeID) {
  5801. ReactMount.purgeID(rootNodeID);
  5802. }
  5803. };
  5804. module.exports = ReactComponentBrowserEnvironment;
  5805. },{"50":50,"77":77}],41:[function(_dereq_,module,exports){
  5806. /**
  5807. * Copyright 2014-2015, Facebook, Inc.
  5808. * All rights reserved.
  5809. *
  5810. * This source code is licensed under the BSD-style license found in the
  5811. * LICENSE file in the root directory of this source tree. An additional grant
  5812. * of patent rights can be found in the PATENTS file in the same directory.
  5813. *
  5814. * @providesModule ReactComponentEnvironment
  5815. */
  5816. 'use strict';
  5817. var invariant = _dereq_(150);
  5818. var injected = false;
  5819. var ReactComponentEnvironment = {
  5820. /**
  5821. * Optionally injectable environment dependent cleanup hook. (server vs.
  5822. * browser etc). Example: A browser system caches DOM nodes based on component
  5823. * ID and must remove that cache entry when this instance is unmounted.
  5824. */
  5825. unmountIDFromEnvironment: null,
  5826. /**
  5827. * Optionally injectable hook for swapping out mount images in the middle of
  5828. * the tree.
  5829. */
  5830. replaceNodeWithMarkupByID: null,
  5831. /**
  5832. * Optionally injectable hook for processing a queue of child updates. Will
  5833. * later move into MultiChildComponents.
  5834. */
  5835. processChildrenUpdates: null,
  5836. injection: {
  5837. injectEnvironment: function(environment) {
  5838. ("production" !== "development" ? invariant(
  5839. !injected,
  5840. 'ReactCompositeComponent: injectEnvironment() can only be called once.'
  5841. ) : invariant(!injected));
  5842. ReactComponentEnvironment.unmountIDFromEnvironment =
  5843. environment.unmountIDFromEnvironment;
  5844. ReactComponentEnvironment.replaceNodeWithMarkupByID =
  5845. environment.replaceNodeWithMarkupByID;
  5846. ReactComponentEnvironment.processChildrenUpdates =
  5847. environment.processChildrenUpdates;
  5848. injected = true;
  5849. }
  5850. }
  5851. };
  5852. module.exports = ReactComponentEnvironment;
  5853. },{"150":150}],42:[function(_dereq_,module,exports){
  5854. /**
  5855. * Copyright 2013-2015, Facebook, Inc.
  5856. * All rights reserved.
  5857. *
  5858. * This source code is licensed under the BSD-style license found in the
  5859. * LICENSE file in the root directory of this source tree. An additional grant
  5860. * of patent rights can be found in the PATENTS file in the same directory.
  5861. *
  5862. * @providesModule ReactComponentWithPureRenderMixin
  5863. */
  5864. 'use strict';
  5865. var shallowEqual = _dereq_(166);
  5866. /**
  5867. * If your React component's render function is "pure", e.g. it will render the
  5868. * same result given the same props and state, provide this Mixin for a
  5869. * considerable performance boost.
  5870. *
  5871. * Most React components have pure render functions.
  5872. *
  5873. * Example:
  5874. *
  5875. * var ReactComponentWithPureRenderMixin =
  5876. * require('ReactComponentWithPureRenderMixin');
  5877. * React.createClass({
  5878. * mixins: [ReactComponentWithPureRenderMixin],
  5879. *
  5880. * render: function() {
  5881. * return <div className={this.props.className}>foo</div>;
  5882. * }
  5883. * });
  5884. *
  5885. * Note: This only checks shallow equality for props and state. If these contain
  5886. * complex data structures this mixin may have false-negatives for deeper
  5887. * differences. Only mixin to components which have simple props and state, or
  5888. * use `forceUpdate()` when you know deep data structures have changed.
  5889. */
  5890. var ReactComponentWithPureRenderMixin = {
  5891. shouldComponentUpdate: function(nextProps, nextState) {
  5892. return !shallowEqual(this.props, nextProps) ||
  5893. !shallowEqual(this.state, nextState);
  5894. }
  5895. };
  5896. module.exports = ReactComponentWithPureRenderMixin;
  5897. },{"166":166}],43:[function(_dereq_,module,exports){
  5898. /**
  5899. * Copyright 2013-2015, Facebook, Inc.
  5900. * All rights reserved.
  5901. *
  5902. * This source code is licensed under the BSD-style license found in the
  5903. * LICENSE file in the root directory of this source tree. An additional grant
  5904. * of patent rights can be found in the PATENTS file in the same directory.
  5905. *
  5906. * @providesModule ReactCompositeComponent
  5907. */
  5908. 'use strict';
  5909. var ReactComponentEnvironment = _dereq_(41);
  5910. var ReactContext = _dereq_(44);
  5911. var ReactCurrentOwner = _dereq_(45);
  5912. var ReactElement = _dereq_(63);
  5913. var ReactElementValidator = _dereq_(64);
  5914. var ReactInstanceMap = _dereq_(73);
  5915. var ReactLifeCycle = _dereq_(74);
  5916. var ReactNativeComponent = _dereq_(80);
  5917. var ReactPerf = _dereq_(82);
  5918. var ReactPropTypeLocations = _dereq_(85);
  5919. var ReactPropTypeLocationNames = _dereq_(84);
  5920. var ReactReconciler = _dereq_(89);
  5921. var ReactUpdates = _dereq_(100);
  5922. var assign = _dereq_(29);
  5923. var emptyObject = _dereq_(130);
  5924. var invariant = _dereq_(150);
  5925. var shouldUpdateReactComponent = _dereq_(167);
  5926. var warning = _dereq_(171);
  5927. function getDeclarationErrorAddendum(component) {
  5928. var owner = component._currentElement._owner || null;
  5929. if (owner) {
  5930. var name = owner.getName();
  5931. if (name) {
  5932. return ' Check the render method of `' + name + '`.';
  5933. }
  5934. }
  5935. return '';
  5936. }
  5937. /**
  5938. * ------------------ The Life-Cycle of a Composite Component ------------------
  5939. *
  5940. * - constructor: Initialization of state. The instance is now retained.
  5941. * - componentWillMount
  5942. * - render
  5943. * - [children's constructors]
  5944. * - [children's componentWillMount and render]
  5945. * - [children's componentDidMount]
  5946. * - componentDidMount
  5947. *
  5948. * Update Phases:
  5949. * - componentWillReceiveProps (only called if parent updated)
  5950. * - shouldComponentUpdate
  5951. * - componentWillUpdate
  5952. * - render
  5953. * - [children's constructors or receive props phases]
  5954. * - componentDidUpdate
  5955. *
  5956. * - componentWillUnmount
  5957. * - [children's componentWillUnmount]
  5958. * - [children destroyed]
  5959. * - (destroyed): The instance is now blank, released by React and ready for GC.
  5960. *
  5961. * -----------------------------------------------------------------------------
  5962. */
  5963. /**
  5964. * An incrementing ID assigned to each component when it is mounted. This is
  5965. * used to enforce the order in which `ReactUpdates` updates dirty components.
  5966. *
  5967. * @private
  5968. */
  5969. var nextMountID = 1;
  5970. /**
  5971. * @lends {ReactCompositeComponent.prototype}
  5972. */
  5973. var ReactCompositeComponentMixin = {
  5974. /**
  5975. * Base constructor for all composite component.
  5976. *
  5977. * @param {ReactElement} element
  5978. * @final
  5979. * @internal
  5980. */
  5981. construct: function(element) {
  5982. this._currentElement = element;
  5983. this._rootNodeID = null;
  5984. this._instance = null;
  5985. // See ReactUpdateQueue
  5986. this._pendingElement = null;
  5987. this._pendingStateQueue = null;
  5988. this._pendingReplaceState = false;
  5989. this._pendingForceUpdate = false;
  5990. this._renderedComponent = null;
  5991. this._context = null;
  5992. this._mountOrder = 0;
  5993. this._isTopLevel = false;
  5994. // See ReactUpdates and ReactUpdateQueue.
  5995. this._pendingCallbacks = null;
  5996. },
  5997. /**
  5998. * Initializes the component, renders markup, and registers event listeners.
  5999. *
  6000. * @param {string} rootID DOM ID of the root node.
  6001. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6002. * @return {?string} Rendered markup to be inserted into the DOM.
  6003. * @final
  6004. * @internal
  6005. */
  6006. mountComponent: function(rootID, transaction, context) {
  6007. this._context = context;
  6008. this._mountOrder = nextMountID++;
  6009. this._rootNodeID = rootID;
  6010. var publicProps = this._processProps(this._currentElement.props);
  6011. var publicContext = this._processContext(this._currentElement._context);
  6012. var Component = ReactNativeComponent.getComponentClassForElement(
  6013. this._currentElement
  6014. );
  6015. // Initialize the public class
  6016. var inst = new Component(publicProps, publicContext);
  6017. if ("production" !== "development") {
  6018. // This will throw later in _renderValidatedComponent, but add an early
  6019. // warning now to help debugging
  6020. ("production" !== "development" ? warning(
  6021. inst.render != null,
  6022. '%s(...): No `render` method found on the returned component ' +
  6023. 'instance: you may have forgotten to define `render` in your ' +
  6024. 'component or you may have accidentally tried to render an element ' +
  6025. 'whose type is a function that isn\'t a React component.',
  6026. Component.displayName || Component.name || 'Component'
  6027. ) : null);
  6028. }
  6029. // These should be set up in the constructor, but as a convenience for
  6030. // simpler class abstractions, we set them up after the fact.
  6031. inst.props = publicProps;
  6032. inst.context = publicContext;
  6033. inst.refs = emptyObject;
  6034. this._instance = inst;
  6035. // Store a reference from the instance back to the internal representation
  6036. ReactInstanceMap.set(inst, this);
  6037. if ("production" !== "development") {
  6038. this._warnIfContextsDiffer(this._currentElement._context, context);
  6039. }
  6040. if ("production" !== "development") {
  6041. // Since plain JS classes are defined without any special initialization
  6042. // logic, we can not catch common errors early. Therefore, we have to
  6043. // catch them here, at initialization time, instead.
  6044. ("production" !== "development" ? warning(
  6045. !inst.getInitialState ||
  6046. inst.getInitialState.isReactClassApproved,
  6047. 'getInitialState was defined on %s, a plain JavaScript class. ' +
  6048. 'This is only supported for classes created using React.createClass. ' +
  6049. 'Did you mean to define a state property instead?',
  6050. this.getName() || 'a component'
  6051. ) : null);
  6052. ("production" !== "development" ? warning(
  6053. !inst.propTypes,
  6054. 'propTypes was defined as an instance property on %s. Use a static ' +
  6055. 'property to define propTypes instead.',
  6056. this.getName() || 'a component'
  6057. ) : null);
  6058. ("production" !== "development" ? warning(
  6059. !inst.contextTypes,
  6060. 'contextTypes was defined as an instance property on %s. Use a ' +
  6061. 'static property to define contextTypes instead.',
  6062. this.getName() || 'a component'
  6063. ) : null);
  6064. ("production" !== "development" ? warning(
  6065. typeof inst.componentShouldUpdate !== 'function',
  6066. '%s has a method called ' +
  6067. 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
  6068. 'The name is phrased as a question because the function is ' +
  6069. 'expected to return a value.',
  6070. (this.getName() || 'A component')
  6071. ) : null);
  6072. }
  6073. var initialState = inst.state;
  6074. if (initialState === undefined) {
  6075. inst.state = initialState = null;
  6076. }
  6077. ("production" !== "development" ? invariant(
  6078. typeof initialState === 'object' && !Array.isArray(initialState),
  6079. '%s.state: must be set to an object or null',
  6080. this.getName() || 'ReactCompositeComponent'
  6081. ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
  6082. this._pendingStateQueue = null;
  6083. this._pendingReplaceState = false;
  6084. this._pendingForceUpdate = false;
  6085. var renderedElement;
  6086. var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
  6087. ReactLifeCycle.currentlyMountingInstance = this;
  6088. try {
  6089. if (inst.componentWillMount) {
  6090. inst.componentWillMount();
  6091. // When mounting, calls to `setState` by `componentWillMount` will set
  6092. // `this._pendingStateQueue` without triggering a re-render.
  6093. if (this._pendingStateQueue) {
  6094. inst.state = this._processPendingState(inst.props, inst.context);
  6095. }
  6096. }
  6097. renderedElement = this._renderValidatedComponent();
  6098. } finally {
  6099. ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
  6100. }
  6101. this._renderedComponent = this._instantiateReactComponent(
  6102. renderedElement,
  6103. this._currentElement.type // The wrapping type
  6104. );
  6105. var markup = ReactReconciler.mountComponent(
  6106. this._renderedComponent,
  6107. rootID,
  6108. transaction,
  6109. this._processChildContext(context)
  6110. );
  6111. if (inst.componentDidMount) {
  6112. transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
  6113. }
  6114. return markup;
  6115. },
  6116. /**
  6117. * Releases any resources allocated by `mountComponent`.
  6118. *
  6119. * @final
  6120. * @internal
  6121. */
  6122. unmountComponent: function() {
  6123. var inst = this._instance;
  6124. if (inst.componentWillUnmount) {
  6125. var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;
  6126. ReactLifeCycle.currentlyUnmountingInstance = this;
  6127. try {
  6128. inst.componentWillUnmount();
  6129. } finally {
  6130. ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;
  6131. }
  6132. }
  6133. ReactReconciler.unmountComponent(this._renderedComponent);
  6134. this._renderedComponent = null;
  6135. // Reset pending fields
  6136. this._pendingStateQueue = null;
  6137. this._pendingReplaceState = false;
  6138. this._pendingForceUpdate = false;
  6139. this._pendingCallbacks = null;
  6140. this._pendingElement = null;
  6141. // These fields do not really need to be reset since this object is no
  6142. // longer accessible.
  6143. this._context = null;
  6144. this._rootNodeID = null;
  6145. // Delete the reference from the instance to this internal representation
  6146. // which allow the internals to be properly cleaned up even if the user
  6147. // leaks a reference to the public instance.
  6148. ReactInstanceMap.remove(inst);
  6149. // Some existing components rely on inst.props even after they've been
  6150. // destroyed (in event handlers).
  6151. // TODO: inst.props = null;
  6152. // TODO: inst.state = null;
  6153. // TODO: inst.context = null;
  6154. },
  6155. /**
  6156. * Schedule a partial update to the props. Only used for internal testing.
  6157. *
  6158. * @param {object} partialProps Subset of the next props.
  6159. * @param {?function} callback Called after props are updated.
  6160. * @final
  6161. * @internal
  6162. */
  6163. _setPropsInternal: function(partialProps, callback) {
  6164. // This is a deoptimized path. We optimize for always having an element.
  6165. // This creates an extra internal element.
  6166. var element = this._pendingElement || this._currentElement;
  6167. this._pendingElement = ReactElement.cloneAndReplaceProps(
  6168. element,
  6169. assign({}, element.props, partialProps)
  6170. );
  6171. ReactUpdates.enqueueUpdate(this, callback);
  6172. },
  6173. /**
  6174. * Filters the context object to only contain keys specified in
  6175. * `contextTypes`
  6176. *
  6177. * @param {object} context
  6178. * @return {?object}
  6179. * @private
  6180. */
  6181. _maskContext: function(context) {
  6182. var maskedContext = null;
  6183. // This really should be getting the component class for the element,
  6184. // but we know that we're not going to need it for built-ins.
  6185. if (typeof this._currentElement.type === 'string') {
  6186. return emptyObject;
  6187. }
  6188. var contextTypes = this._currentElement.type.contextTypes;
  6189. if (!contextTypes) {
  6190. return emptyObject;
  6191. }
  6192. maskedContext = {};
  6193. for (var contextName in contextTypes) {
  6194. maskedContext[contextName] = context[contextName];
  6195. }
  6196. return maskedContext;
  6197. },
  6198. /**
  6199. * Filters the context object to only contain keys specified in
  6200. * `contextTypes`, and asserts that they are valid.
  6201. *
  6202. * @param {object} context
  6203. * @return {?object}
  6204. * @private
  6205. */
  6206. _processContext: function(context) {
  6207. var maskedContext = this._maskContext(context);
  6208. if ("production" !== "development") {
  6209. var Component = ReactNativeComponent.getComponentClassForElement(
  6210. this._currentElement
  6211. );
  6212. if (Component.contextTypes) {
  6213. this._checkPropTypes(
  6214. Component.contextTypes,
  6215. maskedContext,
  6216. ReactPropTypeLocations.context
  6217. );
  6218. }
  6219. }
  6220. return maskedContext;
  6221. },
  6222. /**
  6223. * @param {object} currentContext
  6224. * @return {object}
  6225. * @private
  6226. */
  6227. _processChildContext: function(currentContext) {
  6228. var inst = this._instance;
  6229. var childContext = inst.getChildContext && inst.getChildContext();
  6230. if (childContext) {
  6231. ("production" !== "development" ? invariant(
  6232. typeof inst.constructor.childContextTypes === 'object',
  6233. '%s.getChildContext(): childContextTypes must be defined in order to ' +
  6234. 'use getChildContext().',
  6235. this.getName() || 'ReactCompositeComponent'
  6236. ) : invariant(typeof inst.constructor.childContextTypes === 'object'));
  6237. if ("production" !== "development") {
  6238. this._checkPropTypes(
  6239. inst.constructor.childContextTypes,
  6240. childContext,
  6241. ReactPropTypeLocations.childContext
  6242. );
  6243. }
  6244. for (var name in childContext) {
  6245. ("production" !== "development" ? invariant(
  6246. name in inst.constructor.childContextTypes,
  6247. '%s.getChildContext(): key "%s" is not defined in childContextTypes.',
  6248. this.getName() || 'ReactCompositeComponent',
  6249. name
  6250. ) : invariant(name in inst.constructor.childContextTypes));
  6251. }
  6252. return assign({}, currentContext, childContext);
  6253. }
  6254. return currentContext;
  6255. },
  6256. /**
  6257. * Processes props by setting default values for unspecified props and
  6258. * asserting that the props are valid. Does not mutate its argument; returns
  6259. * a new props object with defaults merged in.
  6260. *
  6261. * @param {object} newProps
  6262. * @return {object}
  6263. * @private
  6264. */
  6265. _processProps: function(newProps) {
  6266. if ("production" !== "development") {
  6267. var Component = ReactNativeComponent.getComponentClassForElement(
  6268. this._currentElement
  6269. );
  6270. if (Component.propTypes) {
  6271. this._checkPropTypes(
  6272. Component.propTypes,
  6273. newProps,
  6274. ReactPropTypeLocations.prop
  6275. );
  6276. }
  6277. }
  6278. return newProps;
  6279. },
  6280. /**
  6281. * Assert that the props are valid
  6282. *
  6283. * @param {object} propTypes Map of prop name to a ReactPropType
  6284. * @param {object} props
  6285. * @param {string} location e.g. "prop", "context", "child context"
  6286. * @private
  6287. */
  6288. _checkPropTypes: function(propTypes, props, location) {
  6289. // TODO: Stop validating prop types here and only use the element
  6290. // validation.
  6291. var componentName = this.getName();
  6292. for (var propName in propTypes) {
  6293. if (propTypes.hasOwnProperty(propName)) {
  6294. var error;
  6295. try {
  6296. // This is intentionally an invariant that gets caught. It's the same
  6297. // behavior as without this statement except with a better message.
  6298. ("production" !== "development" ? invariant(
  6299. typeof propTypes[propName] === 'function',
  6300. '%s: %s type `%s` is invalid; it must be a function, usually ' +
  6301. 'from React.PropTypes.',
  6302. componentName || 'React class',
  6303. ReactPropTypeLocationNames[location],
  6304. propName
  6305. ) : invariant(typeof propTypes[propName] === 'function'));
  6306. error = propTypes[propName](props, propName, componentName, location);
  6307. } catch (ex) {
  6308. error = ex;
  6309. }
  6310. if (error instanceof Error) {
  6311. // We may want to extend this logic for similar errors in
  6312. // React.render calls, so I'm abstracting it away into
  6313. // a function to minimize refactoring in the future
  6314. var addendum = getDeclarationErrorAddendum(this);
  6315. if (location === ReactPropTypeLocations.prop) {
  6316. // Preface gives us something to blacklist in warning module
  6317. ("production" !== "development" ? warning(
  6318. false,
  6319. 'Failed Composite propType: %s%s',
  6320. error.message,
  6321. addendum
  6322. ) : null);
  6323. } else {
  6324. ("production" !== "development" ? warning(
  6325. false,
  6326. 'Failed Context Types: %s%s',
  6327. error.message,
  6328. addendum
  6329. ) : null);
  6330. }
  6331. }
  6332. }
  6333. }
  6334. },
  6335. receiveComponent: function(nextElement, transaction, nextContext) {
  6336. var prevElement = this._currentElement;
  6337. var prevContext = this._context;
  6338. this._pendingElement = null;
  6339. this.updateComponent(
  6340. transaction,
  6341. prevElement,
  6342. nextElement,
  6343. prevContext,
  6344. nextContext
  6345. );
  6346. },
  6347. /**
  6348. * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
  6349. * is set, update the component.
  6350. *
  6351. * @param {ReactReconcileTransaction} transaction
  6352. * @internal
  6353. */
  6354. performUpdateIfNecessary: function(transaction) {
  6355. if (this._pendingElement != null) {
  6356. ReactReconciler.receiveComponent(
  6357. this,
  6358. this._pendingElement || this._currentElement,
  6359. transaction,
  6360. this._context
  6361. );
  6362. }
  6363. if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
  6364. if ("production" !== "development") {
  6365. ReactElementValidator.checkAndWarnForMutatedProps(
  6366. this._currentElement
  6367. );
  6368. }
  6369. this.updateComponent(
  6370. transaction,
  6371. this._currentElement,
  6372. this._currentElement,
  6373. this._context,
  6374. this._context
  6375. );
  6376. }
  6377. },
  6378. /**
  6379. * Compare two contexts, warning if they are different
  6380. * TODO: Remove this check when owner-context is removed
  6381. */
  6382. _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
  6383. ownerBasedContext = this._maskContext(ownerBasedContext);
  6384. parentBasedContext = this._maskContext(parentBasedContext);
  6385. var parentKeys = Object.keys(parentBasedContext).sort();
  6386. var displayName = this.getName() || 'ReactCompositeComponent';
  6387. for (var i = 0; i < parentKeys.length; i++) {
  6388. var key = parentKeys[i];
  6389. ("production" !== "development" ? warning(
  6390. ownerBasedContext[key] === parentBasedContext[key],
  6391. 'owner-based and parent-based contexts differ ' +
  6392. '(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
  6393. '(see: http://fb.me/react-context-by-parent)',
  6394. ownerBasedContext[key],
  6395. parentBasedContext[key],
  6396. key,
  6397. displayName
  6398. ) : null);
  6399. }
  6400. },
  6401. /**
  6402. * Perform an update to a mounted component. The componentWillReceiveProps and
  6403. * shouldComponentUpdate methods are called, then (assuming the update isn't
  6404. * skipped) the remaining update lifecycle methods are called and the DOM
  6405. * representation is updated.
  6406. *
  6407. * By default, this implements React's rendering and reconciliation algorithm.
  6408. * Sophisticated clients may wish to override this.
  6409. *
  6410. * @param {ReactReconcileTransaction} transaction
  6411. * @param {ReactElement} prevParentElement
  6412. * @param {ReactElement} nextParentElement
  6413. * @internal
  6414. * @overridable
  6415. */
  6416. updateComponent: function(
  6417. transaction,
  6418. prevParentElement,
  6419. nextParentElement,
  6420. prevUnmaskedContext,
  6421. nextUnmaskedContext
  6422. ) {
  6423. var inst = this._instance;
  6424. var nextContext = inst.context;
  6425. var nextProps = inst.props;
  6426. // Distinguish between a props update versus a simple state update
  6427. if (prevParentElement !== nextParentElement) {
  6428. nextContext = this._processContext(nextParentElement._context);
  6429. nextProps = this._processProps(nextParentElement.props);
  6430. if ("production" !== "development") {
  6431. if (nextUnmaskedContext != null) {
  6432. this._warnIfContextsDiffer(
  6433. nextParentElement._context,
  6434. nextUnmaskedContext
  6435. );
  6436. }
  6437. }
  6438. // An update here will schedule an update but immediately set
  6439. // _pendingStateQueue which will ensure that any state updates gets
  6440. // immediately reconciled instead of waiting for the next batch.
  6441. if (inst.componentWillReceiveProps) {
  6442. inst.componentWillReceiveProps(nextProps, nextContext);
  6443. }
  6444. }
  6445. var nextState = this._processPendingState(nextProps, nextContext);
  6446. var shouldUpdate =
  6447. this._pendingForceUpdate ||
  6448. !inst.shouldComponentUpdate ||
  6449. inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  6450. if ("production" !== "development") {
  6451. ("production" !== "development" ? warning(
  6452. typeof shouldUpdate !== 'undefined',
  6453. '%s.shouldComponentUpdate(): Returned undefined instead of a ' +
  6454. 'boolean value. Make sure to return true or false.',
  6455. this.getName() || 'ReactCompositeComponent'
  6456. ) : null);
  6457. }
  6458. if (shouldUpdate) {
  6459. this._pendingForceUpdate = false;
  6460. // Will set `this.props`, `this.state` and `this.context`.
  6461. this._performComponentUpdate(
  6462. nextParentElement,
  6463. nextProps,
  6464. nextState,
  6465. nextContext,
  6466. transaction,
  6467. nextUnmaskedContext
  6468. );
  6469. } else {
  6470. // If it's determined that a component should not update, we still want
  6471. // to set props and state but we shortcut the rest of the update.
  6472. this._currentElement = nextParentElement;
  6473. this._context = nextUnmaskedContext;
  6474. inst.props = nextProps;
  6475. inst.state = nextState;
  6476. inst.context = nextContext;
  6477. }
  6478. },
  6479. _processPendingState: function(props, context) {
  6480. var inst = this._instance;
  6481. var queue = this._pendingStateQueue;
  6482. var replace = this._pendingReplaceState;
  6483. this._pendingReplaceState = false;
  6484. this._pendingStateQueue = null;
  6485. if (!queue) {
  6486. return inst.state;
  6487. }
  6488. var nextState = assign({}, replace ? queue[0] : inst.state);
  6489. for (var i = replace ? 1 : 0; i < queue.length; i++) {
  6490. var partial = queue[i];
  6491. assign(
  6492. nextState,
  6493. typeof partial === 'function' ?
  6494. partial.call(inst, nextState, props, context) :
  6495. partial
  6496. );
  6497. }
  6498. return nextState;
  6499. },
  6500. /**
  6501. * Merges new props and state, notifies delegate methods of update and
  6502. * performs update.
  6503. *
  6504. * @param {ReactElement} nextElement Next element
  6505. * @param {object} nextProps Next public object to set as properties.
  6506. * @param {?object} nextState Next object to set as state.
  6507. * @param {?object} nextContext Next public object to set as context.
  6508. * @param {ReactReconcileTransaction} transaction
  6509. * @param {?object} unmaskedContext
  6510. * @private
  6511. */
  6512. _performComponentUpdate: function(
  6513. nextElement,
  6514. nextProps,
  6515. nextState,
  6516. nextContext,
  6517. transaction,
  6518. unmaskedContext
  6519. ) {
  6520. var inst = this._instance;
  6521. var prevProps = inst.props;
  6522. var prevState = inst.state;
  6523. var prevContext = inst.context;
  6524. if (inst.componentWillUpdate) {
  6525. inst.componentWillUpdate(nextProps, nextState, nextContext);
  6526. }
  6527. this._currentElement = nextElement;
  6528. this._context = unmaskedContext;
  6529. inst.props = nextProps;
  6530. inst.state = nextState;
  6531. inst.context = nextContext;
  6532. this._updateRenderedComponent(transaction, unmaskedContext);
  6533. if (inst.componentDidUpdate) {
  6534. transaction.getReactMountReady().enqueue(
  6535. inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
  6536. inst
  6537. );
  6538. }
  6539. },
  6540. /**
  6541. * Call the component's `render` method and update the DOM accordingly.
  6542. *
  6543. * @param {ReactReconcileTransaction} transaction
  6544. * @internal
  6545. */
  6546. _updateRenderedComponent: function(transaction, context) {
  6547. var prevComponentInstance = this._renderedComponent;
  6548. var prevRenderedElement = prevComponentInstance._currentElement;
  6549. var nextRenderedElement = this._renderValidatedComponent();
  6550. if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
  6551. ReactReconciler.receiveComponent(
  6552. prevComponentInstance,
  6553. nextRenderedElement,
  6554. transaction,
  6555. this._processChildContext(context)
  6556. );
  6557. } else {
  6558. // These two IDs are actually the same! But nothing should rely on that.
  6559. var thisID = this._rootNodeID;
  6560. var prevComponentID = prevComponentInstance._rootNodeID;
  6561. ReactReconciler.unmountComponent(prevComponentInstance);
  6562. this._renderedComponent = this._instantiateReactComponent(
  6563. nextRenderedElement,
  6564. this._currentElement.type
  6565. );
  6566. var nextMarkup = ReactReconciler.mountComponent(
  6567. this._renderedComponent,
  6568. thisID,
  6569. transaction,
  6570. context
  6571. );
  6572. this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
  6573. }
  6574. },
  6575. /**
  6576. * @protected
  6577. */
  6578. _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
  6579. ReactComponentEnvironment.replaceNodeWithMarkupByID(
  6580. prevComponentID,
  6581. nextMarkup
  6582. );
  6583. },
  6584. /**
  6585. * @protected
  6586. */
  6587. _renderValidatedComponentWithoutOwnerOrContext: function() {
  6588. var inst = this._instance;
  6589. var renderedComponent = inst.render();
  6590. if ("production" !== "development") {
  6591. // We allow auto-mocks to proceed as if they're returning null.
  6592. if (typeof renderedComponent === 'undefined' &&
  6593. inst.render._isMockFunction) {
  6594. // This is probably bad practice. Consider warning here and
  6595. // deprecating this convenience.
  6596. renderedComponent = null;
  6597. }
  6598. }
  6599. return renderedComponent;
  6600. },
  6601. /**
  6602. * @private
  6603. */
  6604. _renderValidatedComponent: function() {
  6605. var renderedComponent;
  6606. var previousContext = ReactContext.current;
  6607. ReactContext.current = this._processChildContext(
  6608. this._currentElement._context
  6609. );
  6610. ReactCurrentOwner.current = this;
  6611. try {
  6612. renderedComponent =
  6613. this._renderValidatedComponentWithoutOwnerOrContext();
  6614. } finally {
  6615. ReactContext.current = previousContext;
  6616. ReactCurrentOwner.current = null;
  6617. }
  6618. ("production" !== "development" ? invariant(
  6619. // TODO: An `isValidNode` function would probably be more appropriate
  6620. renderedComponent === null || renderedComponent === false ||
  6621. ReactElement.isValidElement(renderedComponent),
  6622. '%s.render(): A valid ReactComponent must be returned. You may have ' +
  6623. 'returned undefined, an array or some other invalid object.',
  6624. this.getName() || 'ReactCompositeComponent'
  6625. ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
  6626. renderedComponent === null || renderedComponent === false ||
  6627. ReactElement.isValidElement(renderedComponent)));
  6628. return renderedComponent;
  6629. },
  6630. /**
  6631. * Lazily allocates the refs object and stores `component` as `ref`.
  6632. *
  6633. * @param {string} ref Reference name.
  6634. * @param {component} component Component to store as `ref`.
  6635. * @final
  6636. * @private
  6637. */
  6638. attachRef: function(ref, component) {
  6639. var inst = this.getPublicInstance();
  6640. var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
  6641. refs[ref] = component.getPublicInstance();
  6642. },
  6643. /**
  6644. * Detaches a reference name.
  6645. *
  6646. * @param {string} ref Name to dereference.
  6647. * @final
  6648. * @private
  6649. */
  6650. detachRef: function(ref) {
  6651. var refs = this.getPublicInstance().refs;
  6652. delete refs[ref];
  6653. },
  6654. /**
  6655. * Get a text description of the component that can be used to identify it
  6656. * in error messages.
  6657. * @return {string} The name or null.
  6658. * @internal
  6659. */
  6660. getName: function() {
  6661. var type = this._currentElement.type;
  6662. var constructor = this._instance && this._instance.constructor;
  6663. return (
  6664. type.displayName || (constructor && constructor.displayName) ||
  6665. type.name || (constructor && constructor.name) ||
  6666. null
  6667. );
  6668. },
  6669. /**
  6670. * Get the publicly accessible representation of this component - i.e. what
  6671. * is exposed by refs and returned by React.render. Can be null for stateless
  6672. * components.
  6673. *
  6674. * @return {ReactComponent} the public component instance.
  6675. * @internal
  6676. */
  6677. getPublicInstance: function() {
  6678. return this._instance;
  6679. },
  6680. // Stub
  6681. _instantiateReactComponent: null
  6682. };
  6683. ReactPerf.measureMethods(
  6684. ReactCompositeComponentMixin,
  6685. 'ReactCompositeComponent',
  6686. {
  6687. mountComponent: 'mountComponent',
  6688. updateComponent: 'updateComponent',
  6689. _renderValidatedComponent: '_renderValidatedComponent'
  6690. }
  6691. );
  6692. var ReactCompositeComponent = {
  6693. Mixin: ReactCompositeComponentMixin
  6694. };
  6695. module.exports = ReactCompositeComponent;
  6696. },{"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){
  6697. /**
  6698. * Copyright 2013-2015, Facebook, Inc.
  6699. * All rights reserved.
  6700. *
  6701. * This source code is licensed under the BSD-style license found in the
  6702. * LICENSE file in the root directory of this source tree. An additional grant
  6703. * of patent rights can be found in the PATENTS file in the same directory.
  6704. *
  6705. * @providesModule ReactContext
  6706. */
  6707. 'use strict';
  6708. var assign = _dereq_(29);
  6709. var emptyObject = _dereq_(130);
  6710. var warning = _dereq_(171);
  6711. var didWarn = false;
  6712. /**
  6713. * Keeps track of the current context.
  6714. *
  6715. * The context is automatically passed down the component ownership hierarchy
  6716. * and is accessible via `this.context` on ReactCompositeComponents.
  6717. */
  6718. var ReactContext = {
  6719. /**
  6720. * @internal
  6721. * @type {object}
  6722. */
  6723. current: emptyObject,
  6724. /**
  6725. * Temporarily extends the current context while executing scopedCallback.
  6726. *
  6727. * A typical use case might look like
  6728. *
  6729. * render: function() {
  6730. * var children = ReactContext.withContext({foo: 'foo'}, () => (
  6731. *
  6732. * ));
  6733. * return <div>{children}</div>;
  6734. * }
  6735. *
  6736. * @param {object} newContext New context to merge into the existing context
  6737. * @param {function} scopedCallback Callback to run with the new context
  6738. * @return {ReactComponent|array<ReactComponent>}
  6739. */
  6740. withContext: function(newContext, scopedCallback) {
  6741. if ("production" !== "development") {
  6742. ("production" !== "development" ? warning(
  6743. didWarn,
  6744. 'withContext is deprecated and will be removed in a future version. ' +
  6745. 'Use a wrapper component with getChildContext instead.'
  6746. ) : null);
  6747. didWarn = true;
  6748. }
  6749. var result;
  6750. var previousContext = ReactContext.current;
  6751. ReactContext.current = assign({}, previousContext, newContext);
  6752. try {
  6753. result = scopedCallback();
  6754. } finally {
  6755. ReactContext.current = previousContext;
  6756. }
  6757. return result;
  6758. }
  6759. };
  6760. module.exports = ReactContext;
  6761. },{"130":130,"171":171,"29":29}],45:[function(_dereq_,module,exports){
  6762. /**
  6763. * Copyright 2013-2015, Facebook, Inc.
  6764. * All rights reserved.
  6765. *
  6766. * This source code is licensed under the BSD-style license found in the
  6767. * LICENSE file in the root directory of this source tree. An additional grant
  6768. * of patent rights can be found in the PATENTS file in the same directory.
  6769. *
  6770. * @providesModule ReactCurrentOwner
  6771. */
  6772. 'use strict';
  6773. /**
  6774. * Keeps track of the current owner.
  6775. *
  6776. * The current owner is the component who should own any components that are
  6777. * currently being constructed.
  6778. *
  6779. * The depth indicate how many composite components are above this render level.
  6780. */
  6781. var ReactCurrentOwner = {
  6782. /**
  6783. * @internal
  6784. * @type {ReactComponent}
  6785. */
  6786. current: null
  6787. };
  6788. module.exports = ReactCurrentOwner;
  6789. },{}],46:[function(_dereq_,module,exports){
  6790. /**
  6791. * Copyright 2013-2015, Facebook, Inc.
  6792. * All rights reserved.
  6793. *
  6794. * This source code is licensed under the BSD-style license found in the
  6795. * LICENSE file in the root directory of this source tree. An additional grant
  6796. * of patent rights can be found in the PATENTS file in the same directory.
  6797. *
  6798. * @providesModule ReactDOM
  6799. * @typechecks static-only
  6800. */
  6801. 'use strict';
  6802. var ReactElement = _dereq_(63);
  6803. var ReactElementValidator = _dereq_(64);
  6804. var mapObject = _dereq_(158);
  6805. /**
  6806. * Create a factory that creates HTML tag elements.
  6807. *
  6808. * @param {string} tag Tag name (e.g. `div`).
  6809. * @private
  6810. */
  6811. function createDOMFactory(tag) {
  6812. if ("production" !== "development") {
  6813. return ReactElementValidator.createFactory(tag);
  6814. }
  6815. return ReactElement.createFactory(tag);
  6816. }
  6817. /**
  6818. * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
  6819. * This is also accessible via `React.DOM`.
  6820. *
  6821. * @public
  6822. */
  6823. var ReactDOM = mapObject({
  6824. a: 'a',
  6825. abbr: 'abbr',
  6826. address: 'address',
  6827. area: 'area',
  6828. article: 'article',
  6829. aside: 'aside',
  6830. audio: 'audio',
  6831. b: 'b',
  6832. base: 'base',
  6833. bdi: 'bdi',
  6834. bdo: 'bdo',
  6835. big: 'big',
  6836. blockquote: 'blockquote',
  6837. body: 'body',
  6838. br: 'br',
  6839. button: 'button',
  6840. canvas: 'canvas',
  6841. caption: 'caption',
  6842. cite: 'cite',
  6843. code: 'code',
  6844. col: 'col',
  6845. colgroup: 'colgroup',
  6846. data: 'data',
  6847. datalist: 'datalist',
  6848. dd: 'dd',
  6849. del: 'del',
  6850. details: 'details',
  6851. dfn: 'dfn',
  6852. dialog: 'dialog',
  6853. div: 'div',
  6854. dl: 'dl',
  6855. dt: 'dt',
  6856. em: 'em',
  6857. embed: 'embed',
  6858. fieldset: 'fieldset',
  6859. figcaption: 'figcaption',
  6860. figure: 'figure',
  6861. footer: 'footer',
  6862. form: 'form',
  6863. h1: 'h1',
  6864. h2: 'h2',
  6865. h3: 'h3',
  6866. h4: 'h4',
  6867. h5: 'h5',
  6868. h6: 'h6',
  6869. head: 'head',
  6870. header: 'header',
  6871. hr: 'hr',
  6872. html: 'html',
  6873. i: 'i',
  6874. iframe: 'iframe',
  6875. img: 'img',
  6876. input: 'input',
  6877. ins: 'ins',
  6878. kbd: 'kbd',
  6879. keygen: 'keygen',
  6880. label: 'label',
  6881. legend: 'legend',
  6882. li: 'li',
  6883. link: 'link',
  6884. main: 'main',
  6885. map: 'map',
  6886. mark: 'mark',
  6887. menu: 'menu',
  6888. menuitem: 'menuitem',
  6889. meta: 'meta',
  6890. meter: 'meter',
  6891. nav: 'nav',
  6892. noscript: 'noscript',
  6893. object: 'object',
  6894. ol: 'ol',
  6895. optgroup: 'optgroup',
  6896. option: 'option',
  6897. output: 'output',
  6898. p: 'p',
  6899. param: 'param',
  6900. picture: 'picture',
  6901. pre: 'pre',
  6902. progress: 'progress',
  6903. q: 'q',
  6904. rp: 'rp',
  6905. rt: 'rt',
  6906. ruby: 'ruby',
  6907. s: 's',
  6908. samp: 'samp',
  6909. script: 'script',
  6910. section: 'section',
  6911. select: 'select',
  6912. small: 'small',
  6913. source: 'source',
  6914. span: 'span',
  6915. strong: 'strong',
  6916. style: 'style',
  6917. sub: 'sub',
  6918. summary: 'summary',
  6919. sup: 'sup',
  6920. table: 'table',
  6921. tbody: 'tbody',
  6922. td: 'td',
  6923. textarea: 'textarea',
  6924. tfoot: 'tfoot',
  6925. th: 'th',
  6926. thead: 'thead',
  6927. time: 'time',
  6928. title: 'title',
  6929. tr: 'tr',
  6930. track: 'track',
  6931. u: 'u',
  6932. ul: 'ul',
  6933. 'var': 'var',
  6934. video: 'video',
  6935. wbr: 'wbr',
  6936. // SVG
  6937. circle: 'circle',
  6938. defs: 'defs',
  6939. ellipse: 'ellipse',
  6940. g: 'g',
  6941. line: 'line',
  6942. linearGradient: 'linearGradient',
  6943. mask: 'mask',
  6944. path: 'path',
  6945. pattern: 'pattern',
  6946. polygon: 'polygon',
  6947. polyline: 'polyline',
  6948. radialGradient: 'radialGradient',
  6949. rect: 'rect',
  6950. stop: 'stop',
  6951. svg: 'svg',
  6952. text: 'text',
  6953. tspan: 'tspan'
  6954. }, createDOMFactory);
  6955. module.exports = ReactDOM;
  6956. },{"158":158,"63":63,"64":64}],47:[function(_dereq_,module,exports){
  6957. /**
  6958. * Copyright 2013-2015, Facebook, Inc.
  6959. * All rights reserved.
  6960. *
  6961. * This source code is licensed under the BSD-style license found in the
  6962. * LICENSE file in the root directory of this source tree. An additional grant
  6963. * of patent rights can be found in the PATENTS file in the same directory.
  6964. *
  6965. * @providesModule ReactDOMButton
  6966. */
  6967. 'use strict';
  6968. var AutoFocusMixin = _dereq_(2);
  6969. var ReactBrowserComponentMixin = _dereq_(32);
  6970. var ReactClass = _dereq_(38);
  6971. var ReactElement = _dereq_(63);
  6972. var keyMirror = _dereq_(156);
  6973. var button = ReactElement.createFactory('button');
  6974. var mouseListenerNames = keyMirror({
  6975. onClick: true,
  6976. onDoubleClick: true,
  6977. onMouseDown: true,
  6978. onMouseMove: true,
  6979. onMouseUp: true,
  6980. onClickCapture: true,
  6981. onDoubleClickCapture: true,
  6982. onMouseDownCapture: true,
  6983. onMouseMoveCapture: true,
  6984. onMouseUpCapture: true
  6985. });
  6986. /**
  6987. * Implements a <button> native component that does not receive mouse events
  6988. * when `disabled` is set.
  6989. */
  6990. var ReactDOMButton = ReactClass.createClass({
  6991. displayName: 'ReactDOMButton',
  6992. tagName: 'BUTTON',
  6993. mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
  6994. render: function() {
  6995. var props = {};
  6996. // Copy the props; except the mouse listeners if we're disabled
  6997. for (var key in this.props) {
  6998. if (this.props.hasOwnProperty(key) &&
  6999. (!this.props.disabled || !mouseListenerNames[key])) {
  7000. props[key] = this.props[key];
  7001. }
  7002. }
  7003. return button(props, this.props.children);
  7004. }
  7005. });
  7006. module.exports = ReactDOMButton;
  7007. },{"156":156,"2":2,"32":32,"38":38,"63":63}],48:[function(_dereq_,module,exports){
  7008. /**
  7009. * Copyright 2013-2015, Facebook, Inc.
  7010. * All rights reserved.
  7011. *
  7012. * This source code is licensed under the BSD-style license found in the
  7013. * LICENSE file in the root directory of this source tree. An additional grant
  7014. * of patent rights can be found in the PATENTS file in the same directory.
  7015. *
  7016. * @providesModule ReactDOMComponent
  7017. * @typechecks static-only
  7018. */
  7019. /* global hasOwnProperty:true */
  7020. 'use strict';
  7021. var CSSPropertyOperations = _dereq_(6);
  7022. var DOMProperty = _dereq_(11);
  7023. var DOMPropertyOperations = _dereq_(12);
  7024. var ReactBrowserEventEmitter = _dereq_(33);
  7025. var ReactComponentBrowserEnvironment =
  7026. _dereq_(40);
  7027. var ReactMount = _dereq_(77);
  7028. var ReactMultiChild = _dereq_(78);
  7029. var ReactPerf = _dereq_(82);
  7030. var assign = _dereq_(29);
  7031. var escapeTextContentForBrowser = _dereq_(131);
  7032. var invariant = _dereq_(150);
  7033. var isEventSupported = _dereq_(151);
  7034. var keyOf = _dereq_(157);
  7035. var warning = _dereq_(171);
  7036. var deleteListener = ReactBrowserEventEmitter.deleteListener;
  7037. var listenTo = ReactBrowserEventEmitter.listenTo;
  7038. var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
  7039. // For quickly matching children type, to test if can be treated as content.
  7040. var CONTENT_TYPES = {'string': true, 'number': true};
  7041. var STYLE = keyOf({style: null});
  7042. var ELEMENT_NODE_TYPE = 1;
  7043. /**
  7044. * Optionally injectable operations for mutating the DOM
  7045. */
  7046. var BackendIDOperations = null;
  7047. /**
  7048. * @param {?object} props
  7049. */
  7050. function assertValidProps(props) {
  7051. if (!props) {
  7052. return;
  7053. }
  7054. // Note the use of `==` which checks for null or undefined.
  7055. if (props.dangerouslySetInnerHTML != null) {
  7056. ("production" !== "development" ? invariant(
  7057. props.children == null,
  7058. 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
  7059. ) : invariant(props.children == null));
  7060. ("production" !== "development" ? invariant(
  7061. props.dangerouslySetInnerHTML.__html != null,
  7062. '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
  7063. 'Please visit http://fb.me/react-invariant-dangerously-set-inner-html ' +
  7064. 'for more information.'
  7065. ) : invariant(props.dangerouslySetInnerHTML.__html != null));
  7066. }
  7067. if ("production" !== "development") {
  7068. ("production" !== "development" ? warning(
  7069. props.innerHTML == null,
  7070. 'Directly setting property `innerHTML` is not permitted. ' +
  7071. 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
  7072. ) : null);
  7073. ("production" !== "development" ? warning(
  7074. !props.contentEditable || props.children == null,
  7075. 'A component is `contentEditable` and contains `children` managed by ' +
  7076. 'React. It is now your responsibility to guarantee that none of ' +
  7077. 'those nodes are unexpectedly modified or duplicated. This is ' +
  7078. 'probably not intentional.'
  7079. ) : null);
  7080. }
  7081. ("production" !== "development" ? invariant(
  7082. props.style == null || typeof props.style === 'object',
  7083. 'The `style` prop expects a mapping from style properties to values, ' +
  7084. 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
  7085. 'using JSX.'
  7086. ) : invariant(props.style == null || typeof props.style === 'object'));
  7087. }
  7088. function putListener(id, registrationName, listener, transaction) {
  7089. if ("production" !== "development") {
  7090. // IE8 has no API for event capturing and the `onScroll` event doesn't
  7091. // bubble.
  7092. ("production" !== "development" ? warning(
  7093. registrationName !== 'onScroll' || isEventSupported('scroll', true),
  7094. 'This browser doesn\'t support the `onScroll` event'
  7095. ) : null);
  7096. }
  7097. var container = ReactMount.findReactContainerForID(id);
  7098. if (container) {
  7099. var doc = container.nodeType === ELEMENT_NODE_TYPE ?
  7100. container.ownerDocument :
  7101. container;
  7102. listenTo(registrationName, doc);
  7103. }
  7104. transaction.getPutListenerQueue().enqueuePutListener(
  7105. id,
  7106. registrationName,
  7107. listener
  7108. );
  7109. }
  7110. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  7111. // those special cased tags.
  7112. var omittedCloseTags = {
  7113. 'area': true,
  7114. 'base': true,
  7115. 'br': true,
  7116. 'col': true,
  7117. 'embed': true,
  7118. 'hr': true,
  7119. 'img': true,
  7120. 'input': true,
  7121. 'keygen': true,
  7122. 'link': true,
  7123. 'meta': true,
  7124. 'param': true,
  7125. 'source': true,
  7126. 'track': true,
  7127. 'wbr': true
  7128. // NOTE: menuitem's close tag should be omitted, but that causes problems.
  7129. };
  7130. // We accept any tag to be rendered but since this gets injected into abitrary
  7131. // HTML, we want to make sure that it's a safe tag.
  7132. // http://www.w3.org/TR/REC-xml/#NT-Name
  7133. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  7134. var validatedTagCache = {};
  7135. var hasOwnProperty = {}.hasOwnProperty;
  7136. function validateDangerousTag(tag) {
  7137. if (!hasOwnProperty.call(validatedTagCache, tag)) {
  7138. ("production" !== "development" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag)));
  7139. validatedTagCache[tag] = true;
  7140. }
  7141. }
  7142. /**
  7143. * Creates a new React class that is idempotent and capable of containing other
  7144. * React components. It accepts event listeners and DOM properties that are
  7145. * valid according to `DOMProperty`.
  7146. *
  7147. * - Event listeners: `onClick`, `onMouseDown`, etc.
  7148. * - DOM properties: `className`, `name`, `title`, etc.
  7149. *
  7150. * The `style` property functions differently from the DOM API. It accepts an
  7151. * object mapping of style properties to values.
  7152. *
  7153. * @constructor ReactDOMComponent
  7154. * @extends ReactMultiChild
  7155. */
  7156. function ReactDOMComponent(tag) {
  7157. validateDangerousTag(tag);
  7158. this._tag = tag;
  7159. this._renderedChildren = null;
  7160. this._previousStyleCopy = null;
  7161. this._rootNodeID = null;
  7162. }
  7163. ReactDOMComponent.displayName = 'ReactDOMComponent';
  7164. ReactDOMComponent.Mixin = {
  7165. construct: function(element) {
  7166. this._currentElement = element;
  7167. },
  7168. /**
  7169. * Generates root tag markup then recurses. This method has side effects and
  7170. * is not idempotent.
  7171. *
  7172. * @internal
  7173. * @param {string} rootID The root DOM ID for this node.
  7174. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  7175. * @return {string} The computed markup.
  7176. */
  7177. mountComponent: function(rootID, transaction, context) {
  7178. this._rootNodeID = rootID;
  7179. assertValidProps(this._currentElement.props);
  7180. var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';
  7181. return (
  7182. this._createOpenTagMarkupAndPutListeners(transaction) +
  7183. this._createContentMarkup(transaction, context) +
  7184. closeTag
  7185. );
  7186. },
  7187. /**
  7188. * Creates markup for the open tag and all attributes.
  7189. *
  7190. * This method has side effects because events get registered.
  7191. *
  7192. * Iterating over object properties is faster than iterating over arrays.
  7193. * @see http://jsperf.com/obj-vs-arr-iteration
  7194. *
  7195. * @private
  7196. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  7197. * @return {string} Markup of opening tag.
  7198. */
  7199. _createOpenTagMarkupAndPutListeners: function(transaction) {
  7200. var props = this._currentElement.props;
  7201. var ret = '<' + this._tag;
  7202. for (var propKey in props) {
  7203. if (!props.hasOwnProperty(propKey)) {
  7204. continue;
  7205. }
  7206. var propValue = props[propKey];
  7207. if (propValue == null) {
  7208. continue;
  7209. }
  7210. if (registrationNameModules.hasOwnProperty(propKey)) {
  7211. putListener(this._rootNodeID, propKey, propValue, transaction);
  7212. } else {
  7213. if (propKey === STYLE) {
  7214. if (propValue) {
  7215. propValue = this._previousStyleCopy = assign({}, props.style);
  7216. }
  7217. propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
  7218. }
  7219. var markup =
  7220. DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
  7221. if (markup) {
  7222. ret += ' ' + markup;
  7223. }
  7224. }
  7225. }
  7226. // For static pages, no need to put React ID and checksum. Saves lots of
  7227. // bytes.
  7228. if (transaction.renderToStaticMarkup) {
  7229. return ret + '>';
  7230. }
  7231. var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
  7232. return ret + ' ' + markupForID + '>';
  7233. },
  7234. /**
  7235. * Creates markup for the content between the tags.
  7236. *
  7237. * @private
  7238. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  7239. * @param {object} context
  7240. * @return {string} Content markup.
  7241. */
  7242. _createContentMarkup: function(transaction, context) {
  7243. var prefix = '';
  7244. if (this._tag === 'listing' ||
  7245. this._tag === 'pre' ||
  7246. this._tag === 'textarea') {
  7247. // Add an initial newline because browsers ignore the first newline in
  7248. // a <listing>, <pre>, or <textarea> as an "authoring convenience" -- see
  7249. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.
  7250. prefix = '\n';
  7251. }
  7252. var props = this._currentElement.props;
  7253. // Intentional use of != to avoid catching zero/false.
  7254. var innerHTML = props.dangerouslySetInnerHTML;
  7255. if (innerHTML != null) {
  7256. if (innerHTML.__html != null) {
  7257. return prefix + innerHTML.__html;
  7258. }
  7259. } else {
  7260. var contentToUse =
  7261. CONTENT_TYPES[typeof props.children] ? props.children : null;
  7262. var childrenToUse = contentToUse != null ? null : props.children;
  7263. if (contentToUse != null) {
  7264. return prefix + escapeTextContentForBrowser(contentToUse);
  7265. } else if (childrenToUse != null) {
  7266. var mountImages = this.mountChildren(
  7267. childrenToUse,
  7268. transaction,
  7269. context
  7270. );
  7271. return prefix + mountImages.join('');
  7272. }
  7273. }
  7274. return prefix;
  7275. },
  7276. receiveComponent: function(nextElement, transaction, context) {
  7277. var prevElement = this._currentElement;
  7278. this._currentElement = nextElement;
  7279. this.updateComponent(transaction, prevElement, nextElement, context);
  7280. },
  7281. /**
  7282. * Updates a native DOM component after it has already been allocated and
  7283. * attached to the DOM. Reconciles the root DOM node, then recurses.
  7284. *
  7285. * @param {ReactReconcileTransaction} transaction
  7286. * @param {ReactElement} prevElement
  7287. * @param {ReactElement} nextElement
  7288. * @internal
  7289. * @overridable
  7290. */
  7291. updateComponent: function(transaction, prevElement, nextElement, context) {
  7292. assertValidProps(this._currentElement.props);
  7293. this._updateDOMProperties(prevElement.props, transaction);
  7294. this._updateDOMChildren(prevElement.props, transaction, context);
  7295. },
  7296. /**
  7297. * Reconciles the properties by detecting differences in property values and
  7298. * updating the DOM as necessary. This function is probably the single most
  7299. * critical path for performance optimization.
  7300. *
  7301. * TODO: Benchmark whether checking for changed values in memory actually
  7302. * improves performance (especially statically positioned elements).
  7303. * TODO: Benchmark the effects of putting this at the top since 99% of props
  7304. * do not change for a given reconciliation.
  7305. * TODO: Benchmark areas that can be improved with caching.
  7306. *
  7307. * @private
  7308. * @param {object} lastProps
  7309. * @param {ReactReconcileTransaction} transaction
  7310. */
  7311. _updateDOMProperties: function(lastProps, transaction) {
  7312. var nextProps = this._currentElement.props;
  7313. var propKey;
  7314. var styleName;
  7315. var styleUpdates;
  7316. for (propKey in lastProps) {
  7317. if (nextProps.hasOwnProperty(propKey) ||
  7318. !lastProps.hasOwnProperty(propKey)) {
  7319. continue;
  7320. }
  7321. if (propKey === STYLE) {
  7322. var lastStyle = this._previousStyleCopy;
  7323. for (styleName in lastStyle) {
  7324. if (lastStyle.hasOwnProperty(styleName)) {
  7325. styleUpdates = styleUpdates || {};
  7326. styleUpdates[styleName] = '';
  7327. }
  7328. }
  7329. this._previousStyleCopy = null;
  7330. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  7331. deleteListener(this._rootNodeID, propKey);
  7332. } else if (
  7333. DOMProperty.isStandardName[propKey] ||
  7334. DOMProperty.isCustomAttribute(propKey)) {
  7335. BackendIDOperations.deletePropertyByID(
  7336. this._rootNodeID,
  7337. propKey
  7338. );
  7339. }
  7340. }
  7341. for (propKey in nextProps) {
  7342. var nextProp = nextProps[propKey];
  7343. var lastProp = propKey === STYLE ?
  7344. this._previousStyleCopy :
  7345. lastProps[propKey];
  7346. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
  7347. continue;
  7348. }
  7349. if (propKey === STYLE) {
  7350. if (nextProp) {
  7351. nextProp = this._previousStyleCopy = assign({}, nextProp);
  7352. }
  7353. if (lastProp) {
  7354. // Unset styles on `lastProp` but not on `nextProp`.
  7355. for (styleName in lastProp) {
  7356. if (lastProp.hasOwnProperty(styleName) &&
  7357. (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  7358. styleUpdates = styleUpdates || {};
  7359. styleUpdates[styleName] = '';
  7360. }
  7361. }
  7362. // Update styles that changed since `lastProp`.
  7363. for (styleName in nextProp) {
  7364. if (nextProp.hasOwnProperty(styleName) &&
  7365. lastProp[styleName] !== nextProp[styleName]) {
  7366. styleUpdates = styleUpdates || {};
  7367. styleUpdates[styleName] = nextProp[styleName];
  7368. }
  7369. }
  7370. } else {
  7371. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  7372. styleUpdates = nextProp;
  7373. }
  7374. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  7375. putListener(this._rootNodeID, propKey, nextProp, transaction);
  7376. } else if (
  7377. DOMProperty.isStandardName[propKey] ||
  7378. DOMProperty.isCustomAttribute(propKey)) {
  7379. BackendIDOperations.updatePropertyByID(
  7380. this._rootNodeID,
  7381. propKey,
  7382. nextProp
  7383. );
  7384. }
  7385. }
  7386. if (styleUpdates) {
  7387. BackendIDOperations.updateStylesByID(
  7388. this._rootNodeID,
  7389. styleUpdates
  7390. );
  7391. }
  7392. },
  7393. /**
  7394. * Reconciles the children with the various properties that affect the
  7395. * children content.
  7396. *
  7397. * @param {object} lastProps
  7398. * @param {ReactReconcileTransaction} transaction
  7399. */
  7400. _updateDOMChildren: function(lastProps, transaction, context) {
  7401. var nextProps = this._currentElement.props;
  7402. var lastContent =
  7403. CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
  7404. var nextContent =
  7405. CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
  7406. var lastHtml =
  7407. lastProps.dangerouslySetInnerHTML &&
  7408. lastProps.dangerouslySetInnerHTML.__html;
  7409. var nextHtml =
  7410. nextProps.dangerouslySetInnerHTML &&
  7411. nextProps.dangerouslySetInnerHTML.__html;
  7412. // Note the use of `!=` which checks for null or undefined.
  7413. var lastChildren = lastContent != null ? null : lastProps.children;
  7414. var nextChildren = nextContent != null ? null : nextProps.children;
  7415. // If we're switching from children to content/html or vice versa, remove
  7416. // the old content
  7417. var lastHasContentOrHtml = lastContent != null || lastHtml != null;
  7418. var nextHasContentOrHtml = nextContent != null || nextHtml != null;
  7419. if (lastChildren != null && nextChildren == null) {
  7420. this.updateChildren(null, transaction, context);
  7421. } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
  7422. this.updateTextContent('');
  7423. }
  7424. if (nextContent != null) {
  7425. if (lastContent !== nextContent) {
  7426. this.updateTextContent('' + nextContent);
  7427. }
  7428. } else if (nextHtml != null) {
  7429. if (lastHtml !== nextHtml) {
  7430. BackendIDOperations.updateInnerHTMLByID(
  7431. this._rootNodeID,
  7432. nextHtml
  7433. );
  7434. }
  7435. } else if (nextChildren != null) {
  7436. this.updateChildren(nextChildren, transaction, context);
  7437. }
  7438. },
  7439. /**
  7440. * Destroys all event registrations for this instance. Does not remove from
  7441. * the DOM. That must be done by the parent.
  7442. *
  7443. * @internal
  7444. */
  7445. unmountComponent: function() {
  7446. this.unmountChildren();
  7447. ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
  7448. ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
  7449. this._rootNodeID = null;
  7450. }
  7451. };
  7452. ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
  7453. mountComponent: 'mountComponent',
  7454. updateComponent: 'updateComponent'
  7455. });
  7456. assign(
  7457. ReactDOMComponent.prototype,
  7458. ReactDOMComponent.Mixin,
  7459. ReactMultiChild.Mixin
  7460. );
  7461. ReactDOMComponent.injection = {
  7462. injectIDOperations: function(IDOperations) {
  7463. ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;
  7464. }
  7465. };
  7466. module.exports = ReactDOMComponent;
  7467. },{"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){
  7468. /**
  7469. * Copyright 2013-2015, Facebook, Inc.
  7470. * All rights reserved.
  7471. *
  7472. * This source code is licensed under the BSD-style license found in the
  7473. * LICENSE file in the root directory of this source tree. An additional grant
  7474. * of patent rights can be found in the PATENTS file in the same directory.
  7475. *
  7476. * @providesModule ReactDOMForm
  7477. */
  7478. 'use strict';
  7479. var EventConstants = _dereq_(16);
  7480. var LocalEventTrapMixin = _dereq_(27);
  7481. var ReactBrowserComponentMixin = _dereq_(32);
  7482. var ReactClass = _dereq_(38);
  7483. var ReactElement = _dereq_(63);
  7484. var form = ReactElement.createFactory('form');
  7485. /**
  7486. * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
  7487. * to capture it on the <form> element itself. There are lots of hacks we could
  7488. * do to accomplish this, but the most reliable is to make <form> a
  7489. * composite component and use `componentDidMount` to attach the event handlers.
  7490. */
  7491. var ReactDOMForm = ReactClass.createClass({
  7492. displayName: 'ReactDOMForm',
  7493. tagName: 'FORM',
  7494. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7495. render: function() {
  7496. // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
  7497. // `jshint` fails to parse JSX so in order for linting to work in the open
  7498. // source repo, we need to just use `ReactDOM.form`.
  7499. return form(this.props);
  7500. },
  7501. componentDidMount: function() {
  7502. this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
  7503. this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
  7504. }
  7505. });
  7506. module.exports = ReactDOMForm;
  7507. },{"16":16,"27":27,"32":32,"38":38,"63":63}],50:[function(_dereq_,module,exports){
  7508. /**
  7509. * Copyright 2013-2015, Facebook, Inc.
  7510. * All rights reserved.
  7511. *
  7512. * This source code is licensed under the BSD-style license found in the
  7513. * LICENSE file in the root directory of this source tree. An additional grant
  7514. * of patent rights can be found in the PATENTS file in the same directory.
  7515. *
  7516. * @providesModule ReactDOMIDOperations
  7517. * @typechecks static-only
  7518. */
  7519. /*jslint evil: true */
  7520. 'use strict';
  7521. var CSSPropertyOperations = _dereq_(6);
  7522. var DOMChildrenOperations = _dereq_(10);
  7523. var DOMPropertyOperations = _dereq_(12);
  7524. var ReactMount = _dereq_(77);
  7525. var ReactPerf = _dereq_(82);
  7526. var invariant = _dereq_(150);
  7527. var setInnerHTML = _dereq_(164);
  7528. /**
  7529. * Errors for properties that should not be updated with `updatePropertyById()`.
  7530. *
  7531. * @type {object}
  7532. * @private
  7533. */
  7534. var INVALID_PROPERTY_ERRORS = {
  7535. dangerouslySetInnerHTML:
  7536. '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
  7537. style: '`style` must be set using `updateStylesByID()`.'
  7538. };
  7539. /**
  7540. * Operations used to process updates to DOM nodes. This is made injectable via
  7541. * `ReactDOMComponent.BackendIDOperations`.
  7542. */
  7543. var ReactDOMIDOperations = {
  7544. /**
  7545. * Updates a DOM node with new property values. This should only be used to
  7546. * update DOM properties in `DOMProperty`.
  7547. *
  7548. * @param {string} id ID of the node to update.
  7549. * @param {string} name A valid property name, see `DOMProperty`.
  7550. * @param {*} value New value of the property.
  7551. * @internal
  7552. */
  7553. updatePropertyByID: function(id, name, value) {
  7554. var node = ReactMount.getNode(id);
  7555. ("production" !== "development" ? invariant(
  7556. !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
  7557. 'updatePropertyByID(...): %s',
  7558. INVALID_PROPERTY_ERRORS[name]
  7559. ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
  7560. // If we're updating to null or undefined, we should remove the property
  7561. // from the DOM node instead of inadvertantly setting to a string. This
  7562. // brings us in line with the same behavior we have on initial render.
  7563. if (value != null) {
  7564. DOMPropertyOperations.setValueForProperty(node, name, value);
  7565. } else {
  7566. DOMPropertyOperations.deleteValueForProperty(node, name);
  7567. }
  7568. },
  7569. /**
  7570. * Updates a DOM node to remove a property. This should only be used to remove
  7571. * DOM properties in `DOMProperty`.
  7572. *
  7573. * @param {string} id ID of the node to update.
  7574. * @param {string} name A property name to remove, see `DOMProperty`.
  7575. * @internal
  7576. */
  7577. deletePropertyByID: function(id, name, value) {
  7578. var node = ReactMount.getNode(id);
  7579. ("production" !== "development" ? invariant(
  7580. !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
  7581. 'updatePropertyByID(...): %s',
  7582. INVALID_PROPERTY_ERRORS[name]
  7583. ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
  7584. DOMPropertyOperations.deleteValueForProperty(node, name, value);
  7585. },
  7586. /**
  7587. * Updates a DOM node with new style values. If a value is specified as '',
  7588. * the corresponding style property will be unset.
  7589. *
  7590. * @param {string} id ID of the node to update.
  7591. * @param {object} styles Mapping from styles to values.
  7592. * @internal
  7593. */
  7594. updateStylesByID: function(id, styles) {
  7595. var node = ReactMount.getNode(id);
  7596. CSSPropertyOperations.setValueForStyles(node, styles);
  7597. },
  7598. /**
  7599. * Updates a DOM node's innerHTML.
  7600. *
  7601. * @param {string} id ID of the node to update.
  7602. * @param {string} html An HTML string.
  7603. * @internal
  7604. */
  7605. updateInnerHTMLByID: function(id, html) {
  7606. var node = ReactMount.getNode(id);
  7607. setInnerHTML(node, html);
  7608. },
  7609. /**
  7610. * Updates a DOM node's text content set by `props.content`.
  7611. *
  7612. * @param {string} id ID of the node to update.
  7613. * @param {string} content Text content.
  7614. * @internal
  7615. */
  7616. updateTextContentByID: function(id, content) {
  7617. var node = ReactMount.getNode(id);
  7618. DOMChildrenOperations.updateTextContent(node, content);
  7619. },
  7620. /**
  7621. * Replaces a DOM node that exists in the document with markup.
  7622. *
  7623. * @param {string} id ID of child to be replaced.
  7624. * @param {string} markup Dangerous markup to inject in place of child.
  7625. * @internal
  7626. * @see {Danger.dangerouslyReplaceNodeWithMarkup}
  7627. */
  7628. dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
  7629. var node = ReactMount.getNode(id);
  7630. DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
  7631. },
  7632. /**
  7633. * Updates a component's children by processing a series of updates.
  7634. *
  7635. * @param {array<object>} updates List of update configurations.
  7636. * @param {array<string>} markup List of markup strings.
  7637. * @internal
  7638. */
  7639. dangerouslyProcessChildrenUpdates: function(updates, markup) {
  7640. for (var i = 0; i < updates.length; i++) {
  7641. updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
  7642. }
  7643. DOMChildrenOperations.processUpdates(updates, markup);
  7644. }
  7645. };
  7646. ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
  7647. updatePropertyByID: 'updatePropertyByID',
  7648. deletePropertyByID: 'deletePropertyByID',
  7649. updateStylesByID: 'updateStylesByID',
  7650. updateInnerHTMLByID: 'updateInnerHTMLByID',
  7651. updateTextContentByID: 'updateTextContentByID',
  7652. dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
  7653. dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
  7654. });
  7655. module.exports = ReactDOMIDOperations;
  7656. },{"10":10,"12":12,"150":150,"164":164,"6":6,"77":77,"82":82}],51:[function(_dereq_,module,exports){
  7657. /**
  7658. * Copyright 2013-2015, Facebook, Inc.
  7659. * All rights reserved.
  7660. *
  7661. * This source code is licensed under the BSD-style license found in the
  7662. * LICENSE file in the root directory of this source tree. An additional grant
  7663. * of patent rights can be found in the PATENTS file in the same directory.
  7664. *
  7665. * @providesModule ReactDOMIframe
  7666. */
  7667. 'use strict';
  7668. var EventConstants = _dereq_(16);
  7669. var LocalEventTrapMixin = _dereq_(27);
  7670. var ReactBrowserComponentMixin = _dereq_(32);
  7671. var ReactClass = _dereq_(38);
  7672. var ReactElement = _dereq_(63);
  7673. var iframe = ReactElement.createFactory('iframe');
  7674. /**
  7675. * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
  7676. * capture it on the <iframe> element itself. There are lots of hacks we could
  7677. * do to accomplish this, but the most reliable is to make <iframe> a composite
  7678. * component and use `componentDidMount` to attach the event handlers.
  7679. */
  7680. var ReactDOMIframe = ReactClass.createClass({
  7681. displayName: 'ReactDOMIframe',
  7682. tagName: 'IFRAME',
  7683. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7684. render: function() {
  7685. return iframe(this.props);
  7686. },
  7687. componentDidMount: function() {
  7688. this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
  7689. }
  7690. });
  7691. module.exports = ReactDOMIframe;
  7692. },{"16":16,"27":27,"32":32,"38":38,"63":63}],52:[function(_dereq_,module,exports){
  7693. /**
  7694. * Copyright 2013-2015, Facebook, Inc.
  7695. * All rights reserved.
  7696. *
  7697. * This source code is licensed under the BSD-style license found in the
  7698. * LICENSE file in the root directory of this source tree. An additional grant
  7699. * of patent rights can be found in the PATENTS file in the same directory.
  7700. *
  7701. * @providesModule ReactDOMImg
  7702. */
  7703. 'use strict';
  7704. var EventConstants = _dereq_(16);
  7705. var LocalEventTrapMixin = _dereq_(27);
  7706. var ReactBrowserComponentMixin = _dereq_(32);
  7707. var ReactClass = _dereq_(38);
  7708. var ReactElement = _dereq_(63);
  7709. var img = ReactElement.createFactory('img');
  7710. /**
  7711. * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
  7712. * capture it on the <img> element itself. There are lots of hacks we could do
  7713. * to accomplish this, but the most reliable is to make <img> a composite
  7714. * component and use `componentDidMount` to attach the event handlers.
  7715. */
  7716. var ReactDOMImg = ReactClass.createClass({
  7717. displayName: 'ReactDOMImg',
  7718. tagName: 'IMG',
  7719. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7720. render: function() {
  7721. return img(this.props);
  7722. },
  7723. componentDidMount: function() {
  7724. this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
  7725. this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
  7726. }
  7727. });
  7728. module.exports = ReactDOMImg;
  7729. },{"16":16,"27":27,"32":32,"38":38,"63":63}],53:[function(_dereq_,module,exports){
  7730. /**
  7731. * Copyright 2013-2015, Facebook, Inc.
  7732. * All rights reserved.
  7733. *
  7734. * This source code is licensed under the BSD-style license found in the
  7735. * LICENSE file in the root directory of this source tree. An additional grant
  7736. * of patent rights can be found in the PATENTS file in the same directory.
  7737. *
  7738. * @providesModule ReactDOMInput
  7739. */
  7740. 'use strict';
  7741. var AutoFocusMixin = _dereq_(2);
  7742. var DOMPropertyOperations = _dereq_(12);
  7743. var LinkedValueUtils = _dereq_(26);
  7744. var ReactBrowserComponentMixin = _dereq_(32);
  7745. var ReactClass = _dereq_(38);
  7746. var ReactElement = _dereq_(63);
  7747. var ReactMount = _dereq_(77);
  7748. var ReactUpdates = _dereq_(100);
  7749. var assign = _dereq_(29);
  7750. var invariant = _dereq_(150);
  7751. var input = ReactElement.createFactory('input');
  7752. var instancesByReactID = {};
  7753. function forceUpdateIfMounted() {
  7754. /*jshint validthis:true */
  7755. if (this.isMounted()) {
  7756. this.forceUpdate();
  7757. }
  7758. }
  7759. /**
  7760. * Implements an <input> native component that allows setting these optional
  7761. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  7762. *
  7763. * If `checked` or `value` are not supplied (or null/undefined), user actions
  7764. * that affect the checked state or value will trigger updates to the element.
  7765. *
  7766. * If they are supplied (and not null/undefined), the rendered element will not
  7767. * trigger updates to the element. Instead, the props must change in order for
  7768. * the rendered element to be updated.
  7769. *
  7770. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  7771. * with an empty value (or `defaultValue`).
  7772. *
  7773. * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  7774. */
  7775. var ReactDOMInput = ReactClass.createClass({
  7776. displayName: 'ReactDOMInput',
  7777. tagName: 'INPUT',
  7778. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  7779. getInitialState: function() {
  7780. var defaultValue = this.props.defaultValue;
  7781. return {
  7782. initialChecked: this.props.defaultChecked || false,
  7783. initialValue: defaultValue != null ? defaultValue : null
  7784. };
  7785. },
  7786. render: function() {
  7787. // Clone `this.props` so we don't mutate the input.
  7788. var props = assign({}, this.props);
  7789. props.defaultChecked = null;
  7790. props.defaultValue = null;
  7791. var value = LinkedValueUtils.getValue(this);
  7792. props.value = value != null ? value : this.state.initialValue;
  7793. var checked = LinkedValueUtils.getChecked(this);
  7794. props.checked = checked != null ? checked : this.state.initialChecked;
  7795. props.onChange = this._handleChange;
  7796. return input(props, this.props.children);
  7797. },
  7798. componentDidMount: function() {
  7799. var id = ReactMount.getID(this.getDOMNode());
  7800. instancesByReactID[id] = this;
  7801. },
  7802. componentWillUnmount: function() {
  7803. var rootNode = this.getDOMNode();
  7804. var id = ReactMount.getID(rootNode);
  7805. delete instancesByReactID[id];
  7806. },
  7807. componentDidUpdate: function(prevProps, prevState, prevContext) {
  7808. var rootNode = this.getDOMNode();
  7809. if (this.props.checked != null) {
  7810. DOMPropertyOperations.setValueForProperty(
  7811. rootNode,
  7812. 'checked',
  7813. this.props.checked || false
  7814. );
  7815. }
  7816. var value = LinkedValueUtils.getValue(this);
  7817. if (value != null) {
  7818. // Cast `value` to a string to ensure the value is set correctly. While
  7819. // browsers typically do this as necessary, jsdom doesn't.
  7820. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
  7821. }
  7822. },
  7823. _handleChange: function(event) {
  7824. var returnValue;
  7825. var onChange = LinkedValueUtils.getOnChange(this);
  7826. if (onChange) {
  7827. returnValue = onChange.call(this, event);
  7828. }
  7829. // Here we use asap to wait until all updates have propagated, which
  7830. // is important when using controlled components within layers:
  7831. // https://github.com/facebook/react/issues/1698
  7832. ReactUpdates.asap(forceUpdateIfMounted, this);
  7833. var name = this.props.name;
  7834. if (this.props.type === 'radio' && name != null) {
  7835. var rootNode = this.getDOMNode();
  7836. var queryRoot = rootNode;
  7837. while (queryRoot.parentNode) {
  7838. queryRoot = queryRoot.parentNode;
  7839. }
  7840. // If `rootNode.form` was non-null, then we could try `form.elements`,
  7841. // but that sometimes behaves strangely in IE8. We could also try using
  7842. // `form.getElementsByName`, but that will only return direct children
  7843. // and won't include inputs that use the HTML5 `form=` attribute. Since
  7844. // the input might not even be in a form, let's just use the global
  7845. // `querySelectorAll` to ensure we don't miss anything.
  7846. var group = queryRoot.querySelectorAll(
  7847. 'input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  7848. for (var i = 0, groupLen = group.length; i < groupLen; i++) {
  7849. var otherNode = group[i];
  7850. if (otherNode === rootNode ||
  7851. otherNode.form !== rootNode.form) {
  7852. continue;
  7853. }
  7854. var otherID = ReactMount.getID(otherNode);
  7855. ("production" !== "development" ? invariant(
  7856. otherID,
  7857. 'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
  7858. 'same `name` is not supported.'
  7859. ) : invariant(otherID));
  7860. var otherInstance = instancesByReactID[otherID];
  7861. ("production" !== "development" ? invariant(
  7862. otherInstance,
  7863. 'ReactDOMInput: Unknown radio button ID %s.',
  7864. otherID
  7865. ) : invariant(otherInstance));
  7866. // If this is a controlled radio button group, forcing the input that
  7867. // was previously checked to update will cause it to be come re-checked
  7868. // as appropriate.
  7869. ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
  7870. }
  7871. }
  7872. return returnValue;
  7873. }
  7874. });
  7875. module.exports = ReactDOMInput;
  7876. },{"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){
  7877. /**
  7878. * Copyright 2013-2015, Facebook, Inc.
  7879. * All rights reserved.
  7880. *
  7881. * This source code is licensed under the BSD-style license found in the
  7882. * LICENSE file in the root directory of this source tree. An additional grant
  7883. * of patent rights can be found in the PATENTS file in the same directory.
  7884. *
  7885. * @providesModule ReactDOMOption
  7886. */
  7887. 'use strict';
  7888. var ReactBrowserComponentMixin = _dereq_(32);
  7889. var ReactClass = _dereq_(38);
  7890. var ReactElement = _dereq_(63);
  7891. var warning = _dereq_(171);
  7892. var option = ReactElement.createFactory('option');
  7893. /**
  7894. * Implements an <option> native component that warns when `selected` is set.
  7895. */
  7896. var ReactDOMOption = ReactClass.createClass({
  7897. displayName: 'ReactDOMOption',
  7898. tagName: 'OPTION',
  7899. mixins: [ReactBrowserComponentMixin],
  7900. componentWillMount: function() {
  7901. // TODO (yungsters): Remove support for `selected` in <option>.
  7902. if ("production" !== "development") {
  7903. ("production" !== "development" ? warning(
  7904. this.props.selected == null,
  7905. 'Use the `defaultValue` or `value` props on <select> instead of ' +
  7906. 'setting `selected` on <option>.'
  7907. ) : null);
  7908. }
  7909. },
  7910. render: function() {
  7911. return option(this.props, this.props.children);
  7912. }
  7913. });
  7914. module.exports = ReactDOMOption;
  7915. },{"171":171,"32":32,"38":38,"63":63}],55:[function(_dereq_,module,exports){
  7916. /**
  7917. * Copyright 2013-2015, Facebook, Inc.
  7918. * All rights reserved.
  7919. *
  7920. * This source code is licensed under the BSD-style license found in the
  7921. * LICENSE file in the root directory of this source tree. An additional grant
  7922. * of patent rights can be found in the PATENTS file in the same directory.
  7923. *
  7924. * @providesModule ReactDOMSelect
  7925. */
  7926. 'use strict';
  7927. var AutoFocusMixin = _dereq_(2);
  7928. var LinkedValueUtils = _dereq_(26);
  7929. var ReactBrowserComponentMixin = _dereq_(32);
  7930. var ReactClass = _dereq_(38);
  7931. var ReactElement = _dereq_(63);
  7932. var ReactUpdates = _dereq_(100);
  7933. var assign = _dereq_(29);
  7934. var select = ReactElement.createFactory('select');
  7935. function updateOptionsIfPendingUpdateAndMounted() {
  7936. /*jshint validthis:true */
  7937. if (this._pendingUpdate) {
  7938. this._pendingUpdate = false;
  7939. var value = LinkedValueUtils.getValue(this);
  7940. if (value != null && this.isMounted()) {
  7941. updateOptions(this, value);
  7942. }
  7943. }
  7944. }
  7945. /**
  7946. * Validation function for `value` and `defaultValue`.
  7947. * @private
  7948. */
  7949. function selectValueType(props, propName, componentName) {
  7950. if (props[propName] == null) {
  7951. return null;
  7952. }
  7953. if (props.multiple) {
  7954. if (!Array.isArray(props[propName])) {
  7955. return new Error(
  7956. ("The `" + propName + "` prop supplied to <select> must be an array if ") +
  7957. ("`multiple` is true.")
  7958. );
  7959. }
  7960. } else {
  7961. if (Array.isArray(props[propName])) {
  7962. return new Error(
  7963. ("The `" + propName + "` prop supplied to <select> must be a scalar ") +
  7964. ("value if `multiple` is false.")
  7965. );
  7966. }
  7967. }
  7968. }
  7969. /**
  7970. * @param {ReactComponent} component Instance of ReactDOMSelect
  7971. * @param {*} propValue A stringable (with `multiple`, a list of stringables).
  7972. * @private
  7973. */
  7974. function updateOptions(component, propValue) {
  7975. var selectedValue, i, l;
  7976. var options = component.getDOMNode().options;
  7977. if (component.props.multiple) {
  7978. selectedValue = {};
  7979. for (i = 0, l = propValue.length; i < l; i++) {
  7980. selectedValue['' + propValue[i]] = true;
  7981. }
  7982. for (i = 0, l = options.length; i < l; i++) {
  7983. var selected = selectedValue.hasOwnProperty(options[i].value);
  7984. if (options[i].selected !== selected) {
  7985. options[i].selected = selected;
  7986. }
  7987. }
  7988. } else {
  7989. // Do not set `select.value` as exact behavior isn't consistent across all
  7990. // browsers for all cases.
  7991. selectedValue = '' + propValue;
  7992. for (i = 0, l = options.length; i < l; i++) {
  7993. if (options[i].value === selectedValue) {
  7994. options[i].selected = true;
  7995. return;
  7996. }
  7997. }
  7998. if (options.length) {
  7999. options[0].selected = true;
  8000. }
  8001. }
  8002. }
  8003. /**
  8004. * Implements a <select> native component that allows optionally setting the
  8005. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  8006. * stringable. If `multiple` is true, the prop must be an array of stringables.
  8007. *
  8008. * If `value` is not supplied (or null/undefined), user actions that change the
  8009. * selected option will trigger updates to the rendered options.
  8010. *
  8011. * If it is supplied (and not null/undefined), the rendered options will not
  8012. * update in response to user actions. Instead, the `value` prop must change in
  8013. * order for the rendered options to update.
  8014. *
  8015. * If `defaultValue` is provided, any options with the supplied values will be
  8016. * selected.
  8017. */
  8018. var ReactDOMSelect = ReactClass.createClass({
  8019. displayName: 'ReactDOMSelect',
  8020. tagName: 'SELECT',
  8021. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  8022. propTypes: {
  8023. defaultValue: selectValueType,
  8024. value: selectValueType
  8025. },
  8026. render: function() {
  8027. // Clone `this.props` so we don't mutate the input.
  8028. var props = assign({}, this.props);
  8029. props.onChange = this._handleChange;
  8030. props.value = null;
  8031. return select(props, this.props.children);
  8032. },
  8033. componentWillMount: function() {
  8034. this._pendingUpdate = false;
  8035. },
  8036. componentDidMount: function() {
  8037. var value = LinkedValueUtils.getValue(this);
  8038. if (value != null) {
  8039. updateOptions(this, value);
  8040. } else if (this.props.defaultValue != null) {
  8041. updateOptions(this, this.props.defaultValue);
  8042. }
  8043. },
  8044. componentDidUpdate: function(prevProps) {
  8045. var value = LinkedValueUtils.getValue(this);
  8046. if (value != null) {
  8047. this._pendingUpdate = false;
  8048. updateOptions(this, value);
  8049. } else if (!prevProps.multiple !== !this.props.multiple) {
  8050. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  8051. if (this.props.defaultValue != null) {
  8052. updateOptions(this, this.props.defaultValue);
  8053. } else {
  8054. // Revert the select back to its default unselected state.
  8055. updateOptions(this, this.props.multiple ? [] : '');
  8056. }
  8057. }
  8058. },
  8059. _handleChange: function(event) {
  8060. var returnValue;
  8061. var onChange = LinkedValueUtils.getOnChange(this);
  8062. if (onChange) {
  8063. returnValue = onChange.call(this, event);
  8064. }
  8065. this._pendingUpdate = true;
  8066. ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
  8067. return returnValue;
  8068. }
  8069. });
  8070. module.exports = ReactDOMSelect;
  8071. },{"100":100,"2":2,"26":26,"29":29,"32":32,"38":38,"63":63}],56:[function(_dereq_,module,exports){
  8072. /**
  8073. * Copyright 2013-2015, Facebook, Inc.
  8074. * All rights reserved.
  8075. *
  8076. * This source code is licensed under the BSD-style license found in the
  8077. * LICENSE file in the root directory of this source tree. An additional grant
  8078. * of patent rights can be found in the PATENTS file in the same directory.
  8079. *
  8080. * @providesModule ReactDOMSelection
  8081. */
  8082. 'use strict';
  8083. var ExecutionEnvironment = _dereq_(22);
  8084. var getNodeForCharacterOffset = _dereq_(143);
  8085. var getTextContentAccessor = _dereq_(145);
  8086. /**
  8087. * While `isCollapsed` is available on the Selection object and `collapsed`
  8088. * is available on the Range object, IE11 sometimes gets them wrong.
  8089. * If the anchor/focus nodes and offsets are the same, the range is collapsed.
  8090. */
  8091. function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  8092. return anchorNode === focusNode && anchorOffset === focusOffset;
  8093. }
  8094. /**
  8095. * Get the appropriate anchor and focus node/offset pairs for IE.
  8096. *
  8097. * The catch here is that IE's selection API doesn't provide information
  8098. * about whether the selection is forward or backward, so we have to
  8099. * behave as though it's always forward.
  8100. *
  8101. * IE text differs from modern selection in that it behaves as though
  8102. * block elements end with a new line. This means character offsets will
  8103. * differ between the two APIs.
  8104. *
  8105. * @param {DOMElement} node
  8106. * @return {object}
  8107. */
  8108. function getIEOffsets(node) {
  8109. var selection = document.selection;
  8110. var selectedRange = selection.createRange();
  8111. var selectedLength = selectedRange.text.length;
  8112. // Duplicate selection so we can move range without breaking user selection.
  8113. var fromStart = selectedRange.duplicate();
  8114. fromStart.moveToElementText(node);
  8115. fromStart.setEndPoint('EndToStart', selectedRange);
  8116. var startOffset = fromStart.text.length;
  8117. var endOffset = startOffset + selectedLength;
  8118. return {
  8119. start: startOffset,
  8120. end: endOffset
  8121. };
  8122. }
  8123. /**
  8124. * @param {DOMElement} node
  8125. * @return {?object}
  8126. */
  8127. function getModernOffsets(node) {
  8128. var selection = window.getSelection && window.getSelection();
  8129. if (!selection || selection.rangeCount === 0) {
  8130. return null;
  8131. }
  8132. var anchorNode = selection.anchorNode;
  8133. var anchorOffset = selection.anchorOffset;
  8134. var focusNode = selection.focusNode;
  8135. var focusOffset = selection.focusOffset;
  8136. var currentRange = selection.getRangeAt(0);
  8137. // If the node and offset values are the same, the selection is collapsed.
  8138. // `Selection.isCollapsed` is available natively, but IE sometimes gets
  8139. // this value wrong.
  8140. var isSelectionCollapsed = isCollapsed(
  8141. selection.anchorNode,
  8142. selection.anchorOffset,
  8143. selection.focusNode,
  8144. selection.focusOffset
  8145. );
  8146. var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
  8147. var tempRange = currentRange.cloneRange();
  8148. tempRange.selectNodeContents(node);
  8149. tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
  8150. var isTempRangeCollapsed = isCollapsed(
  8151. tempRange.startContainer,
  8152. tempRange.startOffset,
  8153. tempRange.endContainer,
  8154. tempRange.endOffset
  8155. );
  8156. var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
  8157. var end = start + rangeLength;
  8158. // Detect whether the selection is backward.
  8159. var detectionRange = document.createRange();
  8160. detectionRange.setStart(anchorNode, anchorOffset);
  8161. detectionRange.setEnd(focusNode, focusOffset);
  8162. var isBackward = detectionRange.collapsed;
  8163. return {
  8164. start: isBackward ? end : start,
  8165. end: isBackward ? start : end
  8166. };
  8167. }
  8168. /**
  8169. * @param {DOMElement|DOMTextNode} node
  8170. * @param {object} offsets
  8171. */
  8172. function setIEOffsets(node, offsets) {
  8173. var range = document.selection.createRange().duplicate();
  8174. var start, end;
  8175. if (typeof offsets.end === 'undefined') {
  8176. start = offsets.start;
  8177. end = start;
  8178. } else if (offsets.start > offsets.end) {
  8179. start = offsets.end;
  8180. end = offsets.start;
  8181. } else {
  8182. start = offsets.start;
  8183. end = offsets.end;
  8184. }
  8185. range.moveToElementText(node);
  8186. range.moveStart('character', start);
  8187. range.setEndPoint('EndToStart', range);
  8188. range.moveEnd('character', end - start);
  8189. range.select();
  8190. }
  8191. /**
  8192. * In modern non-IE browsers, we can support both forward and backward
  8193. * selections.
  8194. *
  8195. * Note: IE10+ supports the Selection object, but it does not support
  8196. * the `extend` method, which means that even in modern IE, it's not possible
  8197. * to programatically create a backward selection. Thus, for all IE
  8198. * versions, we use the old IE API to create our selections.
  8199. *
  8200. * @param {DOMElement|DOMTextNode} node
  8201. * @param {object} offsets
  8202. */
  8203. function setModernOffsets(node, offsets) {
  8204. if (!window.getSelection) {
  8205. return;
  8206. }
  8207. var selection = window.getSelection();
  8208. var length = node[getTextContentAccessor()].length;
  8209. var start = Math.min(offsets.start, length);
  8210. var end = typeof offsets.end === 'undefined' ?
  8211. start : Math.min(offsets.end, length);
  8212. // IE 11 uses modern selection, but doesn't support the extend method.
  8213. // Flip backward selections, so we can set with a single range.
  8214. if (!selection.extend && start > end) {
  8215. var temp = end;
  8216. end = start;
  8217. start = temp;
  8218. }
  8219. var startMarker = getNodeForCharacterOffset(node, start);
  8220. var endMarker = getNodeForCharacterOffset(node, end);
  8221. if (startMarker && endMarker) {
  8222. var range = document.createRange();
  8223. range.setStart(startMarker.node, startMarker.offset);
  8224. selection.removeAllRanges();
  8225. if (start > end) {
  8226. selection.addRange(range);
  8227. selection.extend(endMarker.node, endMarker.offset);
  8228. } else {
  8229. range.setEnd(endMarker.node, endMarker.offset);
  8230. selection.addRange(range);
  8231. }
  8232. }
  8233. }
  8234. var useIEOffsets = (
  8235. ExecutionEnvironment.canUseDOM &&
  8236. 'selection' in document &&
  8237. !('getSelection' in window)
  8238. );
  8239. var ReactDOMSelection = {
  8240. /**
  8241. * @param {DOMElement} node
  8242. */
  8243. getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
  8244. /**
  8245. * @param {DOMElement|DOMTextNode} node
  8246. * @param {object} offsets
  8247. */
  8248. setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
  8249. };
  8250. module.exports = ReactDOMSelection;
  8251. },{"143":143,"145":145,"22":22}],57:[function(_dereq_,module,exports){
  8252. /**
  8253. * Copyright 2013-2015, Facebook, Inc.
  8254. * All rights reserved.
  8255. *
  8256. * This source code is licensed under the BSD-style license found in the
  8257. * LICENSE file in the root directory of this source tree. An additional grant
  8258. * of patent rights can be found in the PATENTS file in the same directory.
  8259. *
  8260. * @providesModule ReactDOMTextComponent
  8261. * @typechecks static-only
  8262. */
  8263. 'use strict';
  8264. var DOMPropertyOperations = _dereq_(12);
  8265. var ReactComponentBrowserEnvironment =
  8266. _dereq_(40);
  8267. var ReactDOMComponent = _dereq_(48);
  8268. var assign = _dereq_(29);
  8269. var escapeTextContentForBrowser = _dereq_(131);
  8270. /**
  8271. * Text nodes violate a couple assumptions that React makes about components:
  8272. *
  8273. * - When mounting text into the DOM, adjacent text nodes are merged.
  8274. * - Text nodes cannot be assigned a React root ID.
  8275. *
  8276. * This component is used to wrap strings in elements so that they can undergo
  8277. * the same reconciliation that is applied to elements.
  8278. *
  8279. * TODO: Investigate representing React components in the DOM with text nodes.
  8280. *
  8281. * @class ReactDOMTextComponent
  8282. * @extends ReactComponent
  8283. * @internal
  8284. */
  8285. var ReactDOMTextComponent = function(props) {
  8286. // This constructor and its argument is currently used by mocks.
  8287. };
  8288. assign(ReactDOMTextComponent.prototype, {
  8289. /**
  8290. * @param {ReactText} text
  8291. * @internal
  8292. */
  8293. construct: function(text) {
  8294. // TODO: This is really a ReactText (ReactNode), not a ReactElement
  8295. this._currentElement = text;
  8296. this._stringText = '' + text;
  8297. // Properties
  8298. this._rootNodeID = null;
  8299. this._mountIndex = 0;
  8300. },
  8301. /**
  8302. * Creates the markup for this text node. This node is not intended to have
  8303. * any features besides containing text content.
  8304. *
  8305. * @param {string} rootID DOM ID of the root node.
  8306. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  8307. * @return {string} Markup for this text node.
  8308. * @internal
  8309. */
  8310. mountComponent: function(rootID, transaction, context) {
  8311. this._rootNodeID = rootID;
  8312. var escapedText = escapeTextContentForBrowser(this._stringText);
  8313. if (transaction.renderToStaticMarkup) {
  8314. // Normally we'd wrap this in a `span` for the reasons stated above, but
  8315. // since this is a situation where React won't take over (static pages),
  8316. // we can simply return the text as it is.
  8317. return escapedText;
  8318. }
  8319. return (
  8320. '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
  8321. escapedText +
  8322. '</span>'
  8323. );
  8324. },
  8325. /**
  8326. * Updates this component by updating the text content.
  8327. *
  8328. * @param {ReactText} nextText The next text content
  8329. * @param {ReactReconcileTransaction} transaction
  8330. * @internal
  8331. */
  8332. receiveComponent: function(nextText, transaction) {
  8333. if (nextText !== this._currentElement) {
  8334. this._currentElement = nextText;
  8335. var nextStringText = '' + nextText;
  8336. if (nextStringText !== this._stringText) {
  8337. // TODO: Save this as pending props and use performUpdateIfNecessary
  8338. // and/or updateComponent to do the actual update for consistency with
  8339. // other component types?
  8340. this._stringText = nextStringText;
  8341. ReactDOMComponent.BackendIDOperations.updateTextContentByID(
  8342. this._rootNodeID,
  8343. nextStringText
  8344. );
  8345. }
  8346. }
  8347. },
  8348. unmountComponent: function() {
  8349. ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
  8350. }
  8351. });
  8352. module.exports = ReactDOMTextComponent;
  8353. },{"12":12,"131":131,"29":29,"40":40,"48":48}],58:[function(_dereq_,module,exports){
  8354. /**
  8355. * Copyright 2013-2015, Facebook, Inc.
  8356. * All rights reserved.
  8357. *
  8358. * This source code is licensed under the BSD-style license found in the
  8359. * LICENSE file in the root directory of this source tree. An additional grant
  8360. * of patent rights can be found in the PATENTS file in the same directory.
  8361. *
  8362. * @providesModule ReactDOMTextarea
  8363. */
  8364. 'use strict';
  8365. var AutoFocusMixin = _dereq_(2);
  8366. var DOMPropertyOperations = _dereq_(12);
  8367. var LinkedValueUtils = _dereq_(26);
  8368. var ReactBrowserComponentMixin = _dereq_(32);
  8369. var ReactClass = _dereq_(38);
  8370. var ReactElement = _dereq_(63);
  8371. var ReactUpdates = _dereq_(100);
  8372. var assign = _dereq_(29);
  8373. var invariant = _dereq_(150);
  8374. var warning = _dereq_(171);
  8375. var textarea = ReactElement.createFactory('textarea');
  8376. function forceUpdateIfMounted() {
  8377. /*jshint validthis:true */
  8378. if (this.isMounted()) {
  8379. this.forceUpdate();
  8380. }
  8381. }
  8382. /**
  8383. * Implements a <textarea> native component that allows setting `value`, and
  8384. * `defaultValue`. This differs from the traditional DOM API because value is
  8385. * usually set as PCDATA children.
  8386. *
  8387. * If `value` is not supplied (or null/undefined), user actions that affect the
  8388. * value will trigger updates to the element.
  8389. *
  8390. * If `value` is supplied (and not null/undefined), the rendered element will
  8391. * not trigger updates to the element. Instead, the `value` prop must change in
  8392. * order for the rendered element to be updated.
  8393. *
  8394. * The rendered element will be initialized with an empty value, the prop
  8395. * `defaultValue` if specified, or the children content (deprecated).
  8396. */
  8397. var ReactDOMTextarea = ReactClass.createClass({
  8398. displayName: 'ReactDOMTextarea',
  8399. tagName: 'TEXTAREA',
  8400. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  8401. getInitialState: function() {
  8402. var defaultValue = this.props.defaultValue;
  8403. // TODO (yungsters): Remove support for children content in <textarea>.
  8404. var children = this.props.children;
  8405. if (children != null) {
  8406. if ("production" !== "development") {
  8407. ("production" !== "development" ? warning(
  8408. false,
  8409. 'Use the `defaultValue` or `value` props instead of setting ' +
  8410. 'children on <textarea>.'
  8411. ) : null);
  8412. }
  8413. ("production" !== "development" ? invariant(
  8414. defaultValue == null,
  8415. 'If you supply `defaultValue` on a <textarea>, do not pass children.'
  8416. ) : invariant(defaultValue == null));
  8417. if (Array.isArray(children)) {
  8418. ("production" !== "development" ? invariant(
  8419. children.length <= 1,
  8420. '<textarea> can only have at most one child.'
  8421. ) : invariant(children.length <= 1));
  8422. children = children[0];
  8423. }
  8424. defaultValue = '' + children;
  8425. }
  8426. if (defaultValue == null) {
  8427. defaultValue = '';
  8428. }
  8429. var value = LinkedValueUtils.getValue(this);
  8430. return {
  8431. // We save the initial value so that `ReactDOMComponent` doesn't update
  8432. // `textContent` (unnecessary since we update value).
  8433. // The initial value can be a boolean or object so that's why it's
  8434. // forced to be a string.
  8435. initialValue: '' + (value != null ? value : defaultValue)
  8436. };
  8437. },
  8438. render: function() {
  8439. // Clone `this.props` so we don't mutate the input.
  8440. var props = assign({}, this.props);
  8441. ("production" !== "development" ? invariant(
  8442. props.dangerouslySetInnerHTML == null,
  8443. '`dangerouslySetInnerHTML` does not make sense on <textarea>.'
  8444. ) : invariant(props.dangerouslySetInnerHTML == null));
  8445. props.defaultValue = null;
  8446. props.value = null;
  8447. props.onChange = this._handleChange;
  8448. // Always set children to the same thing. In IE9, the selection range will
  8449. // get reset if `textContent` is mutated.
  8450. return textarea(props, this.state.initialValue);
  8451. },
  8452. componentDidUpdate: function(prevProps, prevState, prevContext) {
  8453. var value = LinkedValueUtils.getValue(this);
  8454. if (value != null) {
  8455. var rootNode = this.getDOMNode();
  8456. // Cast `value` to a string to ensure the value is set correctly. While
  8457. // browsers typically do this as necessary, jsdom doesn't.
  8458. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
  8459. }
  8460. },
  8461. _handleChange: function(event) {
  8462. var returnValue;
  8463. var onChange = LinkedValueUtils.getOnChange(this);
  8464. if (onChange) {
  8465. returnValue = onChange.call(this, event);
  8466. }
  8467. ReactUpdates.asap(forceUpdateIfMounted, this);
  8468. return returnValue;
  8469. }
  8470. });
  8471. module.exports = ReactDOMTextarea;
  8472. },{"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){
  8473. /**
  8474. * Copyright 2013-2015, Facebook, Inc.
  8475. * All rights reserved.
  8476. *
  8477. * This source code is licensed under the BSD-style license found in the
  8478. * LICENSE file in the root directory of this source tree. An additional grant
  8479. * of patent rights can be found in the PATENTS file in the same directory.
  8480. *
  8481. * @providesModule ReactDefaultBatchingStrategy
  8482. */
  8483. 'use strict';
  8484. var ReactUpdates = _dereq_(100);
  8485. var Transaction = _dereq_(116);
  8486. var assign = _dereq_(29);
  8487. var emptyFunction = _dereq_(129);
  8488. var RESET_BATCHED_UPDATES = {
  8489. initialize: emptyFunction,
  8490. close: function() {
  8491. ReactDefaultBatchingStrategy.isBatchingUpdates = false;
  8492. }
  8493. };
  8494. var FLUSH_BATCHED_UPDATES = {
  8495. initialize: emptyFunction,
  8496. close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
  8497. };
  8498. var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
  8499. function ReactDefaultBatchingStrategyTransaction() {
  8500. this.reinitializeTransaction();
  8501. }
  8502. assign(
  8503. ReactDefaultBatchingStrategyTransaction.prototype,
  8504. Transaction.Mixin,
  8505. {
  8506. getTransactionWrappers: function() {
  8507. return TRANSACTION_WRAPPERS;
  8508. }
  8509. }
  8510. );
  8511. var transaction = new ReactDefaultBatchingStrategyTransaction();
  8512. var ReactDefaultBatchingStrategy = {
  8513. isBatchingUpdates: false,
  8514. /**
  8515. * Call the provided function in a context within which calls to `setState`
  8516. * and friends are batched such that components aren't updated unnecessarily.
  8517. */
  8518. batchedUpdates: function(callback, a, b, c, d) {
  8519. var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
  8520. ReactDefaultBatchingStrategy.isBatchingUpdates = true;
  8521. // The code is written this way to avoid extra allocations
  8522. if (alreadyBatchingUpdates) {
  8523. callback(a, b, c, d);
  8524. } else {
  8525. transaction.perform(callback, null, a, b, c, d);
  8526. }
  8527. }
  8528. };
  8529. module.exports = ReactDefaultBatchingStrategy;
  8530. },{"100":100,"116":116,"129":129,"29":29}],60:[function(_dereq_,module,exports){
  8531. /**
  8532. * Copyright 2013-2015, Facebook, Inc.
  8533. * All rights reserved.
  8534. *
  8535. * This source code is licensed under the BSD-style license found in the
  8536. * LICENSE file in the root directory of this source tree. An additional grant
  8537. * of patent rights can be found in the PATENTS file in the same directory.
  8538. *
  8539. * @providesModule ReactDefaultInjection
  8540. */
  8541. 'use strict';
  8542. var BeforeInputEventPlugin = _dereq_(3);
  8543. var ChangeEventPlugin = _dereq_(8);
  8544. var ClientReactRootIndex = _dereq_(9);
  8545. var DefaultEventPluginOrder = _dereq_(14);
  8546. var EnterLeaveEventPlugin = _dereq_(15);
  8547. var ExecutionEnvironment = _dereq_(22);
  8548. var HTMLDOMPropertyConfig = _dereq_(24);
  8549. var MobileSafariClickEventPlugin = _dereq_(28);
  8550. var ReactBrowserComponentMixin = _dereq_(32);
  8551. var ReactClass = _dereq_(38);
  8552. var ReactComponentBrowserEnvironment =
  8553. _dereq_(40);
  8554. var ReactDefaultBatchingStrategy = _dereq_(59);
  8555. var ReactDOMComponent = _dereq_(48);
  8556. var ReactDOMButton = _dereq_(47);
  8557. var ReactDOMForm = _dereq_(49);
  8558. var ReactDOMImg = _dereq_(52);
  8559. var ReactDOMIDOperations = _dereq_(50);
  8560. var ReactDOMIframe = _dereq_(51);
  8561. var ReactDOMInput = _dereq_(53);
  8562. var ReactDOMOption = _dereq_(54);
  8563. var ReactDOMSelect = _dereq_(55);
  8564. var ReactDOMTextarea = _dereq_(58);
  8565. var ReactDOMTextComponent = _dereq_(57);
  8566. var ReactElement = _dereq_(63);
  8567. var ReactEventListener = _dereq_(68);
  8568. var ReactInjection = _dereq_(70);
  8569. var ReactInstanceHandles = _dereq_(72);
  8570. var ReactMount = _dereq_(77);
  8571. var ReactReconcileTransaction = _dereq_(88);
  8572. var SelectEventPlugin = _dereq_(102);
  8573. var ServerReactRootIndex = _dereq_(103);
  8574. var SimpleEventPlugin = _dereq_(104);
  8575. var SVGDOMPropertyConfig = _dereq_(101);
  8576. var createFullPageComponent = _dereq_(125);
  8577. function autoGenerateWrapperClass(type) {
  8578. return ReactClass.createClass({
  8579. tagName: type.toUpperCase(),
  8580. render: function() {
  8581. return new ReactElement(
  8582. type,
  8583. null,
  8584. null,
  8585. null,
  8586. null,
  8587. this.props
  8588. );
  8589. }
  8590. });
  8591. }
  8592. function inject() {
  8593. ReactInjection.EventEmitter.injectReactEventListener(
  8594. ReactEventListener
  8595. );
  8596. /**
  8597. * Inject modules for resolving DOM hierarchy and plugin ordering.
  8598. */
  8599. ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
  8600. ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
  8601. ReactInjection.EventPluginHub.injectMount(ReactMount);
  8602. /**
  8603. * Some important event plugins included by default (without having to require
  8604. * them).
  8605. */
  8606. ReactInjection.EventPluginHub.injectEventPluginsByName({
  8607. SimpleEventPlugin: SimpleEventPlugin,
  8608. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  8609. ChangeEventPlugin: ChangeEventPlugin,
  8610. MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
  8611. SelectEventPlugin: SelectEventPlugin,
  8612. BeforeInputEventPlugin: BeforeInputEventPlugin
  8613. });
  8614. ReactInjection.NativeComponent.injectGenericComponentClass(
  8615. ReactDOMComponent
  8616. );
  8617. ReactInjection.NativeComponent.injectTextComponentClass(
  8618. ReactDOMTextComponent
  8619. );
  8620. ReactInjection.NativeComponent.injectAutoWrapper(
  8621. autoGenerateWrapperClass
  8622. );
  8623. // This needs to happen before createFullPageComponent() otherwise the mixin
  8624. // won't be included.
  8625. ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
  8626. ReactInjection.NativeComponent.injectComponentClasses({
  8627. 'button': ReactDOMButton,
  8628. 'form': ReactDOMForm,
  8629. 'iframe': ReactDOMIframe,
  8630. 'img': ReactDOMImg,
  8631. 'input': ReactDOMInput,
  8632. 'option': ReactDOMOption,
  8633. 'select': ReactDOMSelect,
  8634. 'textarea': ReactDOMTextarea,
  8635. 'html': createFullPageComponent('html'),
  8636. 'head': createFullPageComponent('head'),
  8637. 'body': createFullPageComponent('body')
  8638. });
  8639. ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
  8640. ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
  8641. ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
  8642. ReactInjection.Updates.injectReconcileTransaction(
  8643. ReactReconcileTransaction
  8644. );
  8645. ReactInjection.Updates.injectBatchingStrategy(
  8646. ReactDefaultBatchingStrategy
  8647. );
  8648. ReactInjection.RootIndex.injectCreateReactRootIndex(
  8649. ExecutionEnvironment.canUseDOM ?
  8650. ClientReactRootIndex.createReactRootIndex :
  8651. ServerReactRootIndex.createReactRootIndex
  8652. );
  8653. ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
  8654. ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
  8655. if ("production" !== "development") {
  8656. var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
  8657. if ((/[?&]react_perf\b/).test(url)) {
  8658. var ReactDefaultPerf = _dereq_(61);
  8659. ReactDefaultPerf.start();
  8660. }
  8661. }
  8662. }
  8663. module.exports = {
  8664. inject: inject
  8665. };
  8666. },{"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){
  8667. /**
  8668. * Copyright 2013-2015, Facebook, Inc.
  8669. * All rights reserved.
  8670. *
  8671. * This source code is licensed under the BSD-style license found in the
  8672. * LICENSE file in the root directory of this source tree. An additional grant
  8673. * of patent rights can be found in the PATENTS file in the same directory.
  8674. *
  8675. * @providesModule ReactDefaultPerf
  8676. * @typechecks static-only
  8677. */
  8678. 'use strict';
  8679. var DOMProperty = _dereq_(11);
  8680. var ReactDefaultPerfAnalysis = _dereq_(62);
  8681. var ReactMount = _dereq_(77);
  8682. var ReactPerf = _dereq_(82);
  8683. var performanceNow = _dereq_(162);
  8684. function roundFloat(val) {
  8685. return Math.floor(val * 100) / 100;
  8686. }
  8687. function addValue(obj, key, val) {
  8688. obj[key] = (obj[key] || 0) + val;
  8689. }
  8690. var ReactDefaultPerf = {
  8691. _allMeasurements: [], // last item in the list is the current one
  8692. _mountStack: [0],
  8693. _injected: false,
  8694. start: function() {
  8695. if (!ReactDefaultPerf._injected) {
  8696. ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
  8697. }
  8698. ReactDefaultPerf._allMeasurements.length = 0;
  8699. ReactPerf.enableMeasure = true;
  8700. },
  8701. stop: function() {
  8702. ReactPerf.enableMeasure = false;
  8703. },
  8704. getLastMeasurements: function() {
  8705. return ReactDefaultPerf._allMeasurements;
  8706. },
  8707. printExclusive: function(measurements) {
  8708. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8709. var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
  8710. console.table(summary.map(function(item) {
  8711. return {
  8712. 'Component class name': item.componentName,
  8713. 'Total inclusive time (ms)': roundFloat(item.inclusive),
  8714. 'Exclusive mount time (ms)': roundFloat(item.exclusive),
  8715. 'Exclusive render time (ms)': roundFloat(item.render),
  8716. 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
  8717. 'Render time per instance (ms)': roundFloat(item.render / item.count),
  8718. 'Instances': item.count
  8719. };
  8720. }));
  8721. // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
  8722. // number.
  8723. },
  8724. printInclusive: function(measurements) {
  8725. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8726. var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
  8727. console.table(summary.map(function(item) {
  8728. return {
  8729. 'Owner > component': item.componentName,
  8730. 'Inclusive time (ms)': roundFloat(item.time),
  8731. 'Instances': item.count
  8732. };
  8733. }));
  8734. console.log(
  8735. 'Total time:',
  8736. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8737. );
  8738. },
  8739. getMeasurementsSummaryMap: function(measurements) {
  8740. var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
  8741. measurements,
  8742. true
  8743. );
  8744. return summary.map(function(item) {
  8745. return {
  8746. 'Owner > component': item.componentName,
  8747. 'Wasted time (ms)': item.time,
  8748. 'Instances': item.count
  8749. };
  8750. });
  8751. },
  8752. printWasted: function(measurements) {
  8753. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8754. console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
  8755. console.log(
  8756. 'Total time:',
  8757. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8758. );
  8759. },
  8760. printDOM: function(measurements) {
  8761. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8762. var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
  8763. console.table(summary.map(function(item) {
  8764. var result = {};
  8765. result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
  8766. result['type'] = item.type;
  8767. result['args'] = JSON.stringify(item.args);
  8768. return result;
  8769. }));
  8770. console.log(
  8771. 'Total time:',
  8772. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8773. );
  8774. },
  8775. _recordWrite: function(id, fnName, totalTime, args) {
  8776. // TODO: totalTime isn't that useful since it doesn't count paints/reflows
  8777. var writes =
  8778. ReactDefaultPerf
  8779. ._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]
  8780. .writes;
  8781. writes[id] = writes[id] || [];
  8782. writes[id].push({
  8783. type: fnName,
  8784. time: totalTime,
  8785. args: args
  8786. });
  8787. },
  8788. measure: function(moduleName, fnName, func) {
  8789. return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  8790. var totalTime;
  8791. var rv;
  8792. var start;
  8793. if (fnName === '_renderNewRootComponent' ||
  8794. fnName === 'flushBatchedUpdates') {
  8795. // A "measurement" is a set of metrics recorded for each flush. We want
  8796. // to group the metrics for a given flush together so we can look at the
  8797. // components that rendered and the DOM operations that actually
  8798. // happened to determine the amount of "wasted work" performed.
  8799. ReactDefaultPerf._allMeasurements.push({
  8800. exclusive: {},
  8801. inclusive: {},
  8802. render: {},
  8803. counts: {},
  8804. writes: {},
  8805. displayNames: {},
  8806. totalTime: 0
  8807. });
  8808. start = performanceNow();
  8809. rv = func.apply(this, args);
  8810. ReactDefaultPerf._allMeasurements[
  8811. ReactDefaultPerf._allMeasurements.length - 1
  8812. ].totalTime = performanceNow() - start;
  8813. return rv;
  8814. } else if (fnName === '_mountImageIntoNode' ||
  8815. moduleName === 'ReactDOMIDOperations') {
  8816. start = performanceNow();
  8817. rv = func.apply(this, args);
  8818. totalTime = performanceNow() - start;
  8819. if (fnName === '_mountImageIntoNode') {
  8820. var mountID = ReactMount.getID(args[1]);
  8821. ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
  8822. } else if (fnName === 'dangerouslyProcessChildrenUpdates') {
  8823. // special format
  8824. args[0].forEach(function(update) {
  8825. var writeArgs = {};
  8826. if (update.fromIndex !== null) {
  8827. writeArgs.fromIndex = update.fromIndex;
  8828. }
  8829. if (update.toIndex !== null) {
  8830. writeArgs.toIndex = update.toIndex;
  8831. }
  8832. if (update.textContent !== null) {
  8833. writeArgs.textContent = update.textContent;
  8834. }
  8835. if (update.markupIndex !== null) {
  8836. writeArgs.markup = args[1][update.markupIndex];
  8837. }
  8838. ReactDefaultPerf._recordWrite(
  8839. update.parentID,
  8840. update.type,
  8841. totalTime,
  8842. writeArgs
  8843. );
  8844. });
  8845. } else {
  8846. // basic format
  8847. ReactDefaultPerf._recordWrite(
  8848. args[0],
  8849. fnName,
  8850. totalTime,
  8851. Array.prototype.slice.call(args, 1)
  8852. );
  8853. }
  8854. return rv;
  8855. } else if (moduleName === 'ReactCompositeComponent' && (
  8856. (// TODO: receiveComponent()?
  8857. (fnName === 'mountComponent' ||
  8858. fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {
  8859. if (typeof this._currentElement.type === 'string') {
  8860. return func.apply(this, args);
  8861. }
  8862. var rootNodeID = fnName === 'mountComponent' ?
  8863. args[0] :
  8864. this._rootNodeID;
  8865. var isRender = fnName === '_renderValidatedComponent';
  8866. var isMount = fnName === 'mountComponent';
  8867. var mountStack = ReactDefaultPerf._mountStack;
  8868. var entry = ReactDefaultPerf._allMeasurements[
  8869. ReactDefaultPerf._allMeasurements.length - 1
  8870. ];
  8871. if (isRender) {
  8872. addValue(entry.counts, rootNodeID, 1);
  8873. } else if (isMount) {
  8874. mountStack.push(0);
  8875. }
  8876. start = performanceNow();
  8877. rv = func.apply(this, args);
  8878. totalTime = performanceNow() - start;
  8879. if (isRender) {
  8880. addValue(entry.render, rootNodeID, totalTime);
  8881. } else if (isMount) {
  8882. var subMountTime = mountStack.pop();
  8883. mountStack[mountStack.length - 1] += totalTime;
  8884. addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
  8885. addValue(entry.inclusive, rootNodeID, totalTime);
  8886. } else {
  8887. addValue(entry.inclusive, rootNodeID, totalTime);
  8888. }
  8889. entry.displayNames[rootNodeID] = {
  8890. current: this.getName(),
  8891. owner: this._currentElement._owner ?
  8892. this._currentElement._owner.getName() :
  8893. '<root>'
  8894. };
  8895. return rv;
  8896. } else {
  8897. return func.apply(this, args);
  8898. }
  8899. };
  8900. }
  8901. };
  8902. module.exports = ReactDefaultPerf;
  8903. },{"11":11,"162":162,"62":62,"77":77,"82":82}],62:[function(_dereq_,module,exports){
  8904. /**
  8905. * Copyright 2013-2015, Facebook, Inc.
  8906. * All rights reserved.
  8907. *
  8908. * This source code is licensed under the BSD-style license found in the
  8909. * LICENSE file in the root directory of this source tree. An additional grant
  8910. * of patent rights can be found in the PATENTS file in the same directory.
  8911. *
  8912. * @providesModule ReactDefaultPerfAnalysis
  8913. */
  8914. var assign = _dereq_(29);
  8915. // Don't try to save users less than 1.2ms (a number I made up)
  8916. var DONT_CARE_THRESHOLD = 1.2;
  8917. var DOM_OPERATION_TYPES = {
  8918. '_mountImageIntoNode': 'set innerHTML',
  8919. INSERT_MARKUP: 'set innerHTML',
  8920. MOVE_EXISTING: 'move',
  8921. REMOVE_NODE: 'remove',
  8922. TEXT_CONTENT: 'set textContent',
  8923. 'updatePropertyByID': 'update attribute',
  8924. 'deletePropertyByID': 'delete attribute',
  8925. 'updateStylesByID': 'update styles',
  8926. 'updateInnerHTMLByID': 'set innerHTML',
  8927. 'dangerouslyReplaceNodeWithMarkupByID': 'replace'
  8928. };
  8929. function getTotalTime(measurements) {
  8930. // TODO: return number of DOM ops? could be misleading.
  8931. // TODO: measure dropped frames after reconcile?
  8932. // TODO: log total time of each reconcile and the top-level component
  8933. // class that triggered it.
  8934. var totalTime = 0;
  8935. for (var i = 0; i < measurements.length; i++) {
  8936. var measurement = measurements[i];
  8937. totalTime += measurement.totalTime;
  8938. }
  8939. return totalTime;
  8940. }
  8941. function getDOMSummary(measurements) {
  8942. var items = [];
  8943. for (var i = 0; i < measurements.length; i++) {
  8944. var measurement = measurements[i];
  8945. var id;
  8946. for (id in measurement.writes) {
  8947. measurement.writes[id].forEach(function(write) {
  8948. items.push({
  8949. id: id,
  8950. type: DOM_OPERATION_TYPES[write.type] || write.type,
  8951. args: write.args
  8952. });
  8953. });
  8954. }
  8955. }
  8956. return items;
  8957. }
  8958. function getExclusiveSummary(measurements) {
  8959. var candidates = {};
  8960. var displayName;
  8961. for (var i = 0; i < measurements.length; i++) {
  8962. var measurement = measurements[i];
  8963. var allIDs = assign(
  8964. {},
  8965. measurement.exclusive,
  8966. measurement.inclusive
  8967. );
  8968. for (var id in allIDs) {
  8969. displayName = measurement.displayNames[id].current;
  8970. candidates[displayName] = candidates[displayName] || {
  8971. componentName: displayName,
  8972. inclusive: 0,
  8973. exclusive: 0,
  8974. render: 0,
  8975. count: 0
  8976. };
  8977. if (measurement.render[id]) {
  8978. candidates[displayName].render += measurement.render[id];
  8979. }
  8980. if (measurement.exclusive[id]) {
  8981. candidates[displayName].exclusive += measurement.exclusive[id];
  8982. }
  8983. if (measurement.inclusive[id]) {
  8984. candidates[displayName].inclusive += measurement.inclusive[id];
  8985. }
  8986. if (measurement.counts[id]) {
  8987. candidates[displayName].count += measurement.counts[id];
  8988. }
  8989. }
  8990. }
  8991. // Now make a sorted array with the results.
  8992. var arr = [];
  8993. for (displayName in candidates) {
  8994. if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
  8995. arr.push(candidates[displayName]);
  8996. }
  8997. }
  8998. arr.sort(function(a, b) {
  8999. return b.exclusive - a.exclusive;
  9000. });
  9001. return arr;
  9002. }
  9003. function getInclusiveSummary(measurements, onlyClean) {
  9004. var candidates = {};
  9005. var inclusiveKey;
  9006. for (var i = 0; i < measurements.length; i++) {
  9007. var measurement = measurements[i];
  9008. var allIDs = assign(
  9009. {},
  9010. measurement.exclusive,
  9011. measurement.inclusive
  9012. );
  9013. var cleanComponents;
  9014. if (onlyClean) {
  9015. cleanComponents = getUnchangedComponents(measurement);
  9016. }
  9017. for (var id in allIDs) {
  9018. if (onlyClean && !cleanComponents[id]) {
  9019. continue;
  9020. }
  9021. var displayName = measurement.displayNames[id];
  9022. // Inclusive time is not useful for many components without knowing where
  9023. // they are instantiated. So we aggregate inclusive time with both the
  9024. // owner and current displayName as the key.
  9025. inclusiveKey = displayName.owner + ' > ' + displayName.current;
  9026. candidates[inclusiveKey] = candidates[inclusiveKey] || {
  9027. componentName: inclusiveKey,
  9028. time: 0,
  9029. count: 0
  9030. };
  9031. if (measurement.inclusive[id]) {
  9032. candidates[inclusiveKey].time += measurement.inclusive[id];
  9033. }
  9034. if (measurement.counts[id]) {
  9035. candidates[inclusiveKey].count += measurement.counts[id];
  9036. }
  9037. }
  9038. }
  9039. // Now make a sorted array with the results.
  9040. var arr = [];
  9041. for (inclusiveKey in candidates) {
  9042. if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
  9043. arr.push(candidates[inclusiveKey]);
  9044. }
  9045. }
  9046. arr.sort(function(a, b) {
  9047. return b.time - a.time;
  9048. });
  9049. return arr;
  9050. }
  9051. function getUnchangedComponents(measurement) {
  9052. // For a given reconcile, look at which components did not actually
  9053. // render anything to the DOM and return a mapping of their ID to
  9054. // the amount of time it took to render the entire subtree.
  9055. var cleanComponents = {};
  9056. var dirtyLeafIDs = Object.keys(measurement.writes);
  9057. var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
  9058. for (var id in allIDs) {
  9059. var isDirty = false;
  9060. // For each component that rendered, see if a component that triggered
  9061. // a DOM op is in its subtree.
  9062. for (var i = 0; i < dirtyLeafIDs.length; i++) {
  9063. if (dirtyLeafIDs[i].indexOf(id) === 0) {
  9064. isDirty = true;
  9065. break;
  9066. }
  9067. }
  9068. if (!isDirty && measurement.counts[id] > 0) {
  9069. cleanComponents[id] = true;
  9070. }
  9071. }
  9072. return cleanComponents;
  9073. }
  9074. var ReactDefaultPerfAnalysis = {
  9075. getExclusiveSummary: getExclusiveSummary,
  9076. getInclusiveSummary: getInclusiveSummary,
  9077. getDOMSummary: getDOMSummary,
  9078. getTotalTime: getTotalTime
  9079. };
  9080. module.exports = ReactDefaultPerfAnalysis;
  9081. },{"29":29}],63:[function(_dereq_,module,exports){
  9082. /**
  9083. * Copyright 2014-2015, Facebook, Inc.
  9084. * All rights reserved.
  9085. *
  9086. * This source code is licensed under the BSD-style license found in the
  9087. * LICENSE file in the root directory of this source tree. An additional grant
  9088. * of patent rights can be found in the PATENTS file in the same directory.
  9089. *
  9090. * @providesModule ReactElement
  9091. */
  9092. 'use strict';
  9093. var ReactContext = _dereq_(44);
  9094. var ReactCurrentOwner = _dereq_(45);
  9095. var assign = _dereq_(29);
  9096. var warning = _dereq_(171);
  9097. var RESERVED_PROPS = {
  9098. key: true,
  9099. ref: true
  9100. };
  9101. /**
  9102. * Warn for mutations.
  9103. *
  9104. * @internal
  9105. * @param {object} object
  9106. * @param {string} key
  9107. */
  9108. function defineWarningProperty(object, key) {
  9109. Object.defineProperty(object, key, {
  9110. configurable: false,
  9111. enumerable: true,
  9112. get: function() {
  9113. if (!this._store) {
  9114. return null;
  9115. }
  9116. return this._store[key];
  9117. },
  9118. set: function(value) {
  9119. ("production" !== "development" ? warning(
  9120. false,
  9121. 'Don\'t set the %s property of the React element. Instead, ' +
  9122. 'specify the correct value when initially creating the element.',
  9123. key
  9124. ) : null);
  9125. this._store[key] = value;
  9126. }
  9127. });
  9128. }
  9129. /**
  9130. * This is updated to true if the membrane is successfully created.
  9131. */
  9132. var useMutationMembrane = false;
  9133. /**
  9134. * Warn for mutations.
  9135. *
  9136. * @internal
  9137. * @param {object} element
  9138. */
  9139. function defineMutationMembrane(prototype) {
  9140. try {
  9141. var pseudoFrozenProperties = {
  9142. props: true
  9143. };
  9144. for (var key in pseudoFrozenProperties) {
  9145. defineWarningProperty(prototype, key);
  9146. }
  9147. useMutationMembrane = true;
  9148. } catch (x) {
  9149. // IE will fail on defineProperty
  9150. }
  9151. }
  9152. /**
  9153. * Base constructor for all React elements. This is only used to make this
  9154. * work with a dynamic instanceof check. Nothing should live on this prototype.
  9155. *
  9156. * @param {*} type
  9157. * @param {string|object} ref
  9158. * @param {*} key
  9159. * @param {*} props
  9160. * @internal
  9161. */
  9162. var ReactElement = function(type, key, ref, owner, context, props) {
  9163. // Built-in properties that belong on the element
  9164. this.type = type;
  9165. this.key = key;
  9166. this.ref = ref;
  9167. // Record the component responsible for creating this element.
  9168. this._owner = owner;
  9169. // TODO: Deprecate withContext, and then the context becomes accessible
  9170. // through the owner.
  9171. this._context = context;
  9172. if ("production" !== "development") {
  9173. // The validation flag and props are currently mutative. We put them on
  9174. // an external backing store so that we can freeze the whole object.
  9175. // This can be replaced with a WeakMap once they are implemented in
  9176. // commonly used development environments.
  9177. this._store = {props: props, originalProps: assign({}, props)};
  9178. // To make comparing ReactElements easier for testing purposes, we make
  9179. // the validation flag non-enumerable (where possible, which should
  9180. // include every environment we run tests in), so the test framework
  9181. // ignores it.
  9182. try {
  9183. Object.defineProperty(this._store, 'validated', {
  9184. configurable: false,
  9185. enumerable: false,
  9186. writable: true
  9187. });
  9188. } catch (x) {
  9189. }
  9190. this._store.validated = false;
  9191. // We're not allowed to set props directly on the object so we early
  9192. // return and rely on the prototype membrane to forward to the backing
  9193. // store.
  9194. if (useMutationMembrane) {
  9195. Object.freeze(this);
  9196. return;
  9197. }
  9198. }
  9199. this.props = props;
  9200. };
  9201. // We intentionally don't expose the function on the constructor property.
  9202. // ReactElement should be indistinguishable from a plain object.
  9203. ReactElement.prototype = {
  9204. _isReactElement: true
  9205. };
  9206. if ("production" !== "development") {
  9207. defineMutationMembrane(ReactElement.prototype);
  9208. }
  9209. ReactElement.createElement = function(type, config, children) {
  9210. var propName;
  9211. // Reserved names are extracted
  9212. var props = {};
  9213. var key = null;
  9214. var ref = null;
  9215. if (config != null) {
  9216. ref = config.ref === undefined ? null : config.ref;
  9217. key = config.key === undefined ? null : '' + config.key;
  9218. // Remaining properties are added to a new props object
  9219. for (propName in config) {
  9220. if (config.hasOwnProperty(propName) &&
  9221. !RESERVED_PROPS.hasOwnProperty(propName)) {
  9222. props[propName] = config[propName];
  9223. }
  9224. }
  9225. }
  9226. // Children can be more than one argument, and those are transferred onto
  9227. // the newly allocated props object.
  9228. var childrenLength = arguments.length - 2;
  9229. if (childrenLength === 1) {
  9230. props.children = children;
  9231. } else if (childrenLength > 1) {
  9232. var childArray = Array(childrenLength);
  9233. for (var i = 0; i < childrenLength; i++) {
  9234. childArray[i] = arguments[i + 2];
  9235. }
  9236. props.children = childArray;
  9237. }
  9238. // Resolve default props
  9239. if (type && type.defaultProps) {
  9240. var defaultProps = type.defaultProps;
  9241. for (propName in defaultProps) {
  9242. if (typeof props[propName] === 'undefined') {
  9243. props[propName] = defaultProps[propName];
  9244. }
  9245. }
  9246. }
  9247. return new ReactElement(
  9248. type,
  9249. key,
  9250. ref,
  9251. ReactCurrentOwner.current,
  9252. ReactContext.current,
  9253. props
  9254. );
  9255. };
  9256. ReactElement.createFactory = function(type) {
  9257. var factory = ReactElement.createElement.bind(null, type);
  9258. // Expose the type on the factory and the prototype so that it can be
  9259. // easily accessed on elements. E.g. <Foo />.type === Foo.type.
  9260. // This should not be named `constructor` since this may not be the function
  9261. // that created the element, and it may not even be a constructor.
  9262. // Legacy hook TODO: Warn if this is accessed
  9263. factory.type = type;
  9264. return factory;
  9265. };
  9266. ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {
  9267. var newElement = new ReactElement(
  9268. oldElement.type,
  9269. oldElement.key,
  9270. oldElement.ref,
  9271. oldElement._owner,
  9272. oldElement._context,
  9273. newProps
  9274. );
  9275. if ("production" !== "development") {
  9276. // If the key on the original is valid, then the clone is valid
  9277. newElement._store.validated = oldElement._store.validated;
  9278. }
  9279. return newElement;
  9280. };
  9281. ReactElement.cloneElement = function(element, config, children) {
  9282. var propName;
  9283. // Original props are copied
  9284. var props = assign({}, element.props);
  9285. // Reserved names are extracted
  9286. var key = element.key;
  9287. var ref = element.ref;
  9288. // Owner will be preserved, unless ref is overridden
  9289. var owner = element._owner;
  9290. if (config != null) {
  9291. if (config.ref !== undefined) {
  9292. // Silently steal the ref from the parent.
  9293. ref = config.ref;
  9294. owner = ReactCurrentOwner.current;
  9295. }
  9296. if (config.key !== undefined) {
  9297. key = '' + config.key;
  9298. }
  9299. // Remaining properties override existing props
  9300. for (propName in config) {
  9301. if (config.hasOwnProperty(propName) &&
  9302. !RESERVED_PROPS.hasOwnProperty(propName)) {
  9303. props[propName] = config[propName];
  9304. }
  9305. }
  9306. }
  9307. // Children can be more than one argument, and those are transferred onto
  9308. // the newly allocated props object.
  9309. var childrenLength = arguments.length - 2;
  9310. if (childrenLength === 1) {
  9311. props.children = children;
  9312. } else if (childrenLength > 1) {
  9313. var childArray = Array(childrenLength);
  9314. for (var i = 0; i < childrenLength; i++) {
  9315. childArray[i] = arguments[i + 2];
  9316. }
  9317. props.children = childArray;
  9318. }
  9319. return new ReactElement(
  9320. element.type,
  9321. key,
  9322. ref,
  9323. owner,
  9324. element._context,
  9325. props
  9326. );
  9327. };
  9328. /**
  9329. * @param {?object} object
  9330. * @return {boolean} True if `object` is a valid component.
  9331. * @final
  9332. */
  9333. ReactElement.isValidElement = function(object) {
  9334. // ReactTestUtils is often used outside of beforeEach where as React is
  9335. // within it. This leads to two different instances of React on the same
  9336. // page. To identify a element from a different React instance we use
  9337. // a flag instead of an instanceof check.
  9338. var isElement = !!(object && object._isReactElement);
  9339. // if (isElement && !(object instanceof ReactElement)) {
  9340. // This is an indicator that you're using multiple versions of React at the
  9341. // same time. This will screw with ownership and stuff. Fix it, please.
  9342. // TODO: We could possibly warn here.
  9343. // }
  9344. return isElement;
  9345. };
  9346. module.exports = ReactElement;
  9347. },{"171":171,"29":29,"44":44,"45":45}],64:[function(_dereq_,module,exports){
  9348. /**
  9349. * Copyright 2014-2015, Facebook, Inc.
  9350. * All rights reserved.
  9351. *
  9352. * This source code is licensed under the BSD-style license found in the
  9353. * LICENSE file in the root directory of this source tree. An additional grant
  9354. * of patent rights can be found in the PATENTS file in the same directory.
  9355. *
  9356. * @providesModule ReactElementValidator
  9357. */
  9358. /**
  9359. * ReactElementValidator provides a wrapper around a element factory
  9360. * which validates the props passed to the element. This is intended to be
  9361. * used only in DEV and could be replaced by a static type checker for languages
  9362. * that support it.
  9363. */
  9364. 'use strict';
  9365. var ReactElement = _dereq_(63);
  9366. var ReactFragment = _dereq_(69);
  9367. var ReactPropTypeLocations = _dereq_(85);
  9368. var ReactPropTypeLocationNames = _dereq_(84);
  9369. var ReactCurrentOwner = _dereq_(45);
  9370. var ReactNativeComponent = _dereq_(80);
  9371. var getIteratorFn = _dereq_(141);
  9372. var invariant = _dereq_(150);
  9373. var warning = _dereq_(171);
  9374. function getDeclarationErrorAddendum() {
  9375. if (ReactCurrentOwner.current) {
  9376. var name = ReactCurrentOwner.current.getName();
  9377. if (name) {
  9378. return ' Check the render method of `' + name + '`.';
  9379. }
  9380. }
  9381. return '';
  9382. }
  9383. /**
  9384. * Warn if there's no key explicitly set on dynamic arrays of children or
  9385. * object keys are not valid. This allows us to keep track of children between
  9386. * updates.
  9387. */
  9388. var ownerHasKeyUseWarning = {};
  9389. var loggedTypeFailures = {};
  9390. var NUMERIC_PROPERTY_REGEX = /^\d+$/;
  9391. /**
  9392. * Gets the instance's name for use in warnings.
  9393. *
  9394. * @internal
  9395. * @return {?string} Display name or undefined
  9396. */
  9397. function getName(instance) {
  9398. var publicInstance = instance && instance.getPublicInstance();
  9399. if (!publicInstance) {
  9400. return undefined;
  9401. }
  9402. var constructor = publicInstance.constructor;
  9403. if (!constructor) {
  9404. return undefined;
  9405. }
  9406. return constructor.displayName || constructor.name || undefined;
  9407. }
  9408. /**
  9409. * Gets the current owner's displayName for use in warnings.
  9410. *
  9411. * @internal
  9412. * @return {?string} Display name or undefined
  9413. */
  9414. function getCurrentOwnerDisplayName() {
  9415. var current = ReactCurrentOwner.current;
  9416. return (
  9417. current && getName(current) || undefined
  9418. );
  9419. }
  9420. /**
  9421. * Warn if the element doesn't have an explicit key assigned to it.
  9422. * This element is in an array. The array could grow and shrink or be
  9423. * reordered. All children that haven't already been validated are required to
  9424. * have a "key" property assigned to it.
  9425. *
  9426. * @internal
  9427. * @param {ReactElement} element Element that requires a key.
  9428. * @param {*} parentType element's parent's type.
  9429. */
  9430. function validateExplicitKey(element, parentType) {
  9431. if (element._store.validated || element.key != null) {
  9432. return;
  9433. }
  9434. element._store.validated = true;
  9435. warnAndMonitorForKeyUse(
  9436. 'Each child in an array or iterator should have a unique "key" prop.',
  9437. element,
  9438. parentType
  9439. );
  9440. }
  9441. /**
  9442. * Warn if the key is being defined as an object property but has an incorrect
  9443. * value.
  9444. *
  9445. * @internal
  9446. * @param {string} name Property name of the key.
  9447. * @param {ReactElement} element Component that requires a key.
  9448. * @param {*} parentType element's parent's type.
  9449. */
  9450. function validatePropertyKey(name, element, parentType) {
  9451. if (!NUMERIC_PROPERTY_REGEX.test(name)) {
  9452. return;
  9453. }
  9454. warnAndMonitorForKeyUse(
  9455. 'Child objects should have non-numeric keys so ordering is preserved.',
  9456. element,
  9457. parentType
  9458. );
  9459. }
  9460. /**
  9461. * Shared warning and monitoring code for the key warnings.
  9462. *
  9463. * @internal
  9464. * @param {string} message The base warning that gets output.
  9465. * @param {ReactElement} element Component that requires a key.
  9466. * @param {*} parentType element's parent's type.
  9467. */
  9468. function warnAndMonitorForKeyUse(message, element, parentType) {
  9469. var ownerName = getCurrentOwnerDisplayName();
  9470. var parentName = typeof parentType === 'string' ?
  9471. parentType : parentType.displayName || parentType.name;
  9472. var useName = ownerName || parentName;
  9473. var memoizer = ownerHasKeyUseWarning[message] || (
  9474. (ownerHasKeyUseWarning[message] = {})
  9475. );
  9476. if (memoizer.hasOwnProperty(useName)) {
  9477. return;
  9478. }
  9479. memoizer[useName] = true;
  9480. var parentOrOwnerAddendum =
  9481. ownerName ? (" Check the render method of " + ownerName + ".") :
  9482. parentName ? (" Check the React.render call using <" + parentName + ">.") :
  9483. '';
  9484. // Usually the current owner is the offender, but if it accepts children as a
  9485. // property, it may be the creator of the child that's responsible for
  9486. // assigning it a key.
  9487. var childOwnerAddendum = '';
  9488. if (element &&
  9489. element._owner &&
  9490. element._owner !== ReactCurrentOwner.current) {
  9491. // Name of the component that originally created this child.
  9492. var childOwnerName = getName(element._owner);
  9493. childOwnerAddendum = (" It was passed a child from " + childOwnerName + ".");
  9494. }
  9495. ("production" !== "development" ? warning(
  9496. false,
  9497. message + '%s%s See http://fb.me/react-warning-keys for more information.',
  9498. parentOrOwnerAddendum,
  9499. childOwnerAddendum
  9500. ) : null);
  9501. }
  9502. /**
  9503. * Ensure that every element either is passed in a static location, in an
  9504. * array with an explicit keys property defined, or in an object literal
  9505. * with valid key property.
  9506. *
  9507. * @internal
  9508. * @param {ReactNode} node Statically passed child of any type.
  9509. * @param {*} parentType node's parent's type.
  9510. */
  9511. function validateChildKeys(node, parentType) {
  9512. if (Array.isArray(node)) {
  9513. for (var i = 0; i < node.length; i++) {
  9514. var child = node[i];
  9515. if (ReactElement.isValidElement(child)) {
  9516. validateExplicitKey(child, parentType);
  9517. }
  9518. }
  9519. } else if (ReactElement.isValidElement(node)) {
  9520. // This element was passed in a valid location.
  9521. node._store.validated = true;
  9522. } else if (node) {
  9523. var iteratorFn = getIteratorFn(node);
  9524. // Entry iterators provide implicit keys.
  9525. if (iteratorFn) {
  9526. if (iteratorFn !== node.entries) {
  9527. var iterator = iteratorFn.call(node);
  9528. var step;
  9529. while (!(step = iterator.next()).done) {
  9530. if (ReactElement.isValidElement(step.value)) {
  9531. validateExplicitKey(step.value, parentType);
  9532. }
  9533. }
  9534. }
  9535. } else if (typeof node === 'object') {
  9536. var fragment = ReactFragment.extractIfFragment(node);
  9537. for (var key in fragment) {
  9538. if (fragment.hasOwnProperty(key)) {
  9539. validatePropertyKey(key, fragment[key], parentType);
  9540. }
  9541. }
  9542. }
  9543. }
  9544. }
  9545. /**
  9546. * Assert that the props are valid
  9547. *
  9548. * @param {string} componentName Name of the component for error messages.
  9549. * @param {object} propTypes Map of prop name to a ReactPropType
  9550. * @param {object} props
  9551. * @param {string} location e.g. "prop", "context", "child context"
  9552. * @private
  9553. */
  9554. function checkPropTypes(componentName, propTypes, props, location) {
  9555. for (var propName in propTypes) {
  9556. if (propTypes.hasOwnProperty(propName)) {
  9557. var error;
  9558. // Prop type validation may throw. In case they do, we don't want to
  9559. // fail the render phase where it didn't fail before. So we log it.
  9560. // After these have been cleaned up, we'll let them throw.
  9561. try {
  9562. // This is intentionally an invariant that gets caught. It's the same
  9563. // behavior as without this statement except with a better message.
  9564. ("production" !== "development" ? invariant(
  9565. typeof propTypes[propName] === 'function',
  9566. '%s: %s type `%s` is invalid; it must be a function, usually from ' +
  9567. 'React.PropTypes.',
  9568. componentName || 'React class',
  9569. ReactPropTypeLocationNames[location],
  9570. propName
  9571. ) : invariant(typeof propTypes[propName] === 'function'));
  9572. error = propTypes[propName](props, propName, componentName, location);
  9573. } catch (ex) {
  9574. error = ex;
  9575. }
  9576. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  9577. // Only monitor this failure once because there tends to be a lot of the
  9578. // same error.
  9579. loggedTypeFailures[error.message] = true;
  9580. var addendum = getDeclarationErrorAddendum(this);
  9581. ("production" !== "development" ? warning(false, 'Failed propType: %s%s', error.message, addendum) : null);
  9582. }
  9583. }
  9584. }
  9585. }
  9586. var warnedPropsMutations = {};
  9587. /**
  9588. * Warn about mutating props when setting `propName` on `element`.
  9589. *
  9590. * @param {string} propName The string key within props that was set
  9591. * @param {ReactElement} element
  9592. */
  9593. function warnForPropsMutation(propName, element) {
  9594. var type = element.type;
  9595. var elementName = typeof type === 'string' ? type : type.displayName;
  9596. var ownerName = element._owner ?
  9597. element._owner.getPublicInstance().constructor.displayName : null;
  9598. var warningKey = propName + '|' + elementName + '|' + ownerName;
  9599. if (warnedPropsMutations.hasOwnProperty(warningKey)) {
  9600. return;
  9601. }
  9602. warnedPropsMutations[warningKey] = true;
  9603. var elementInfo = '';
  9604. if (elementName) {
  9605. elementInfo = ' <' + elementName + ' />';
  9606. }
  9607. var ownerInfo = '';
  9608. if (ownerName) {
  9609. ownerInfo = ' The element was created by ' + ownerName + '.';
  9610. }
  9611. ("production" !== "development" ? warning(
  9612. false,
  9613. 'Don\'t set .props.%s of the React component%s. ' +
  9614. 'Instead, specify the correct value when ' +
  9615. 'initially creating the element.%s',
  9616. propName,
  9617. elementInfo,
  9618. ownerInfo
  9619. ) : null);
  9620. }
  9621. // Inline Object.is polyfill
  9622. function is(a, b) {
  9623. if (a !== a) {
  9624. // NaN
  9625. return b !== b;
  9626. }
  9627. if (a === 0 && b === 0) {
  9628. // +-0
  9629. return 1 / a === 1 / b;
  9630. }
  9631. return a === b;
  9632. }
  9633. /**
  9634. * Given an element, check if its props have been mutated since element
  9635. * creation (or the last call to this function). In particular, check if any
  9636. * new props have been added, which we can't directly catch by defining warning
  9637. * properties on the props object.
  9638. *
  9639. * @param {ReactElement} element
  9640. */
  9641. function checkAndWarnForMutatedProps(element) {
  9642. if (!element._store) {
  9643. // Element was created using `new ReactElement` directly or with
  9644. // `ReactElement.createElement`; skip mutation checking
  9645. return;
  9646. }
  9647. var originalProps = element._store.originalProps;
  9648. var props = element.props;
  9649. for (var propName in props) {
  9650. if (props.hasOwnProperty(propName)) {
  9651. if (!originalProps.hasOwnProperty(propName) ||
  9652. !is(originalProps[propName], props[propName])) {
  9653. warnForPropsMutation(propName, element);
  9654. // Copy over the new value so that the two props objects match again
  9655. originalProps[propName] = props[propName];
  9656. }
  9657. }
  9658. }
  9659. }
  9660. /**
  9661. * Given an element, validate that its props follow the propTypes definition,
  9662. * provided by the type.
  9663. *
  9664. * @param {ReactElement} element
  9665. */
  9666. function validatePropTypes(element) {
  9667. if (element.type == null) {
  9668. // This has already warned. Don't throw.
  9669. return;
  9670. }
  9671. // Extract the component class from the element. Converts string types
  9672. // to a composite class which may have propTypes.
  9673. // TODO: Validating a string's propTypes is not decoupled from the
  9674. // rendering target which is problematic.
  9675. var componentClass = ReactNativeComponent.getComponentClassForElement(
  9676. element
  9677. );
  9678. var name = componentClass.displayName || componentClass.name;
  9679. if (componentClass.propTypes) {
  9680. checkPropTypes(
  9681. name,
  9682. componentClass.propTypes,
  9683. element.props,
  9684. ReactPropTypeLocations.prop
  9685. );
  9686. }
  9687. if (typeof componentClass.getDefaultProps === 'function') {
  9688. ("production" !== "development" ? warning(
  9689. componentClass.getDefaultProps.isReactClassApproved,
  9690. 'getDefaultProps is only used on classic React.createClass ' +
  9691. 'definitions. Use a static property named `defaultProps` instead.'
  9692. ) : null);
  9693. }
  9694. }
  9695. var ReactElementValidator = {
  9696. checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,
  9697. createElement: function(type, props, children) {
  9698. // We warn in this case but don't throw. We expect the element creation to
  9699. // succeed and there will likely be errors in render.
  9700. ("production" !== "development" ? warning(
  9701. type != null,
  9702. 'React.createElement: type should not be null or undefined. It should ' +
  9703. 'be a string (for DOM elements) or a ReactClass (for composite ' +
  9704. 'components).'
  9705. ) : null);
  9706. var element = ReactElement.createElement.apply(this, arguments);
  9707. // The result can be nullish if a mock or a custom function is used.
  9708. // TODO: Drop this when these are no longer allowed as the type argument.
  9709. if (element == null) {
  9710. return element;
  9711. }
  9712. for (var i = 2; i < arguments.length; i++) {
  9713. validateChildKeys(arguments[i], type);
  9714. }
  9715. validatePropTypes(element);
  9716. return element;
  9717. },
  9718. createFactory: function(type) {
  9719. var validatedFactory = ReactElementValidator.createElement.bind(
  9720. null,
  9721. type
  9722. );
  9723. // Legacy hook TODO: Warn if this is accessed
  9724. validatedFactory.type = type;
  9725. if ("production" !== "development") {
  9726. try {
  9727. Object.defineProperty(
  9728. validatedFactory,
  9729. 'type',
  9730. {
  9731. enumerable: false,
  9732. get: function() {
  9733. ("production" !== "development" ? warning(
  9734. false,
  9735. 'Factory.type is deprecated. Access the class directly ' +
  9736. 'before passing it to createFactory.'
  9737. ) : null);
  9738. Object.defineProperty(this, 'type', {
  9739. value: type
  9740. });
  9741. return type;
  9742. }
  9743. }
  9744. );
  9745. } catch (x) {
  9746. // IE will fail on defineProperty (es5-shim/sham too)
  9747. }
  9748. }
  9749. return validatedFactory;
  9750. },
  9751. cloneElement: function(element, props, children) {
  9752. var newElement = ReactElement.cloneElement.apply(this, arguments);
  9753. for (var i = 2; i < arguments.length; i++) {
  9754. validateChildKeys(arguments[i], newElement.type);
  9755. }
  9756. validatePropTypes(newElement);
  9757. return newElement;
  9758. }
  9759. };
  9760. module.exports = ReactElementValidator;
  9761. },{"141":141,"150":150,"171":171,"45":45,"63":63,"69":69,"80":80,"84":84,"85":85}],65:[function(_dereq_,module,exports){
  9762. /**
  9763. * Copyright 2014-2015, Facebook, Inc.
  9764. * All rights reserved.
  9765. *
  9766. * This source code is licensed under the BSD-style license found in the
  9767. * LICENSE file in the root directory of this source tree. An additional grant
  9768. * of patent rights can be found in the PATENTS file in the same directory.
  9769. *
  9770. * @providesModule ReactEmptyComponent
  9771. */
  9772. 'use strict';
  9773. var ReactElement = _dereq_(63);
  9774. var ReactInstanceMap = _dereq_(73);
  9775. var invariant = _dereq_(150);
  9776. var component;
  9777. // This registry keeps track of the React IDs of the components that rendered to
  9778. // `null` (in reality a placeholder such as `noscript`)
  9779. var nullComponentIDsRegistry = {};
  9780. var ReactEmptyComponentInjection = {
  9781. injectEmptyComponent: function(emptyComponent) {
  9782. component = ReactElement.createFactory(emptyComponent);
  9783. }
  9784. };
  9785. var ReactEmptyComponentType = function() {};
  9786. ReactEmptyComponentType.prototype.componentDidMount = function() {
  9787. var internalInstance = ReactInstanceMap.get(this);
  9788. // TODO: Make sure we run these methods in the correct order, we shouldn't
  9789. // need this check. We're going to assume if we're here it means we ran
  9790. // componentWillUnmount already so there is no internal instance (it gets
  9791. // removed as part of the unmounting process).
  9792. if (!internalInstance) {
  9793. return;
  9794. }
  9795. registerNullComponentID(internalInstance._rootNodeID);
  9796. };
  9797. ReactEmptyComponentType.prototype.componentWillUnmount = function() {
  9798. var internalInstance = ReactInstanceMap.get(this);
  9799. // TODO: Get rid of this check. See TODO in componentDidMount.
  9800. if (!internalInstance) {
  9801. return;
  9802. }
  9803. deregisterNullComponentID(internalInstance._rootNodeID);
  9804. };
  9805. ReactEmptyComponentType.prototype.render = function() {
  9806. ("production" !== "development" ? invariant(
  9807. component,
  9808. 'Trying to return null from a render, but no null placeholder component ' +
  9809. 'was injected.'
  9810. ) : invariant(component));
  9811. return component();
  9812. };
  9813. var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
  9814. /**
  9815. * Mark the component as having rendered to null.
  9816. * @param {string} id Component's `_rootNodeID`.
  9817. */
  9818. function registerNullComponentID(id) {
  9819. nullComponentIDsRegistry[id] = true;
  9820. }
  9821. /**
  9822. * Unmark the component as having rendered to null: it renders to something now.
  9823. * @param {string} id Component's `_rootNodeID`.
  9824. */
  9825. function deregisterNullComponentID(id) {
  9826. delete nullComponentIDsRegistry[id];
  9827. }
  9828. /**
  9829. * @param {string} id Component's `_rootNodeID`.
  9830. * @return {boolean} True if the component is rendered to null.
  9831. */
  9832. function isNullComponentID(id) {
  9833. return !!nullComponentIDsRegistry[id];
  9834. }
  9835. var ReactEmptyComponent = {
  9836. emptyElement: emptyElement,
  9837. injection: ReactEmptyComponentInjection,
  9838. isNullComponentID: isNullComponentID
  9839. };
  9840. module.exports = ReactEmptyComponent;
  9841. },{"150":150,"63":63,"73":73}],66:[function(_dereq_,module,exports){
  9842. /**
  9843. * Copyright 2013-2015, Facebook, Inc.
  9844. * All rights reserved.
  9845. *
  9846. * This source code is licensed under the BSD-style license found in the
  9847. * LICENSE file in the root directory of this source tree. An additional grant
  9848. * of patent rights can be found in the PATENTS file in the same directory.
  9849. *
  9850. * @providesModule ReactErrorUtils
  9851. * @typechecks
  9852. */
  9853. "use strict";
  9854. var ReactErrorUtils = {
  9855. /**
  9856. * Creates a guarded version of a function. This is supposed to make debugging
  9857. * of event handlers easier. To aid debugging with the browser's debugger,
  9858. * this currently simply returns the original function.
  9859. *
  9860. * @param {function} func Function to be executed
  9861. * @param {string} name The name of the guard
  9862. * @return {function}
  9863. */
  9864. guard: function(func, name) {
  9865. return func;
  9866. }
  9867. };
  9868. module.exports = ReactErrorUtils;
  9869. },{}],67:[function(_dereq_,module,exports){
  9870. /**
  9871. * Copyright 2013-2015, Facebook, Inc.
  9872. * All rights reserved.
  9873. *
  9874. * This source code is licensed under the BSD-style license found in the
  9875. * LICENSE file in the root directory of this source tree. An additional grant
  9876. * of patent rights can be found in the PATENTS file in the same directory.
  9877. *
  9878. * @providesModule ReactEventEmitterMixin
  9879. */
  9880. 'use strict';
  9881. var EventPluginHub = _dereq_(18);
  9882. function runEventQueueInBatch(events) {
  9883. EventPluginHub.enqueueEvents(events);
  9884. EventPluginHub.processEventQueue();
  9885. }
  9886. var ReactEventEmitterMixin = {
  9887. /**
  9888. * Streams a fired top-level event to `EventPluginHub` where plugins have the
  9889. * opportunity to create `ReactEvent`s to be dispatched.
  9890. *
  9891. * @param {string} topLevelType Record from `EventConstants`.
  9892. * @param {object} topLevelTarget The listening component root node.
  9893. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  9894. * @param {object} nativeEvent Native environment event.
  9895. */
  9896. handleTopLevel: function(
  9897. topLevelType,
  9898. topLevelTarget,
  9899. topLevelTargetID,
  9900. nativeEvent) {
  9901. var events = EventPluginHub.extractEvents(
  9902. topLevelType,
  9903. topLevelTarget,
  9904. topLevelTargetID,
  9905. nativeEvent
  9906. );
  9907. runEventQueueInBatch(events);
  9908. }
  9909. };
  9910. module.exports = ReactEventEmitterMixin;
  9911. },{"18":18}],68:[function(_dereq_,module,exports){
  9912. /**
  9913. * Copyright 2013-2015, Facebook, Inc.
  9914. * All rights reserved.
  9915. *
  9916. * This source code is licensed under the BSD-style license found in the
  9917. * LICENSE file in the root directory of this source tree. An additional grant
  9918. * of patent rights can be found in the PATENTS file in the same directory.
  9919. *
  9920. * @providesModule ReactEventListener
  9921. * @typechecks static-only
  9922. */
  9923. 'use strict';
  9924. var EventListener = _dereq_(17);
  9925. var ExecutionEnvironment = _dereq_(22);
  9926. var PooledClass = _dereq_(30);
  9927. var ReactInstanceHandles = _dereq_(72);
  9928. var ReactMount = _dereq_(77);
  9929. var ReactUpdates = _dereq_(100);
  9930. var assign = _dereq_(29);
  9931. var getEventTarget = _dereq_(140);
  9932. var getUnboundedScrollPosition = _dereq_(146);
  9933. /**
  9934. * Finds the parent React component of `node`.
  9935. *
  9936. * @param {*} node
  9937. * @return {?DOMEventTarget} Parent container, or `null` if the specified node
  9938. * is not nested.
  9939. */
  9940. function findParent(node) {
  9941. // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  9942. // traversal, but caching is difficult to do correctly without using a
  9943. // mutation observer to listen for all DOM changes.
  9944. var nodeID = ReactMount.getID(node);
  9945. var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
  9946. var container = ReactMount.findReactContainerForID(rootID);
  9947. var parent = ReactMount.getFirstReactDOM(container);
  9948. return parent;
  9949. }
  9950. // Used to store ancestor hierarchy in top level callback
  9951. function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  9952. this.topLevelType = topLevelType;
  9953. this.nativeEvent = nativeEvent;
  9954. this.ancestors = [];
  9955. }
  9956. assign(TopLevelCallbackBookKeeping.prototype, {
  9957. destructor: function() {
  9958. this.topLevelType = null;
  9959. this.nativeEvent = null;
  9960. this.ancestors.length = 0;
  9961. }
  9962. });
  9963. PooledClass.addPoolingTo(
  9964. TopLevelCallbackBookKeeping,
  9965. PooledClass.twoArgumentPooler
  9966. );
  9967. function handleTopLevelImpl(bookKeeping) {
  9968. var topLevelTarget = ReactMount.getFirstReactDOM(
  9969. getEventTarget(bookKeeping.nativeEvent)
  9970. ) || window;
  9971. // Loop through the hierarchy, in case there's any nested components.
  9972. // It's important that we build the array of ancestors before calling any
  9973. // event handlers, because event handlers can modify the DOM, leading to
  9974. // inconsistencies with ReactMount's node cache. See #1105.
  9975. var ancestor = topLevelTarget;
  9976. while (ancestor) {
  9977. bookKeeping.ancestors.push(ancestor);
  9978. ancestor = findParent(ancestor);
  9979. }
  9980. for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
  9981. topLevelTarget = bookKeeping.ancestors[i];
  9982. var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
  9983. ReactEventListener._handleTopLevel(
  9984. bookKeeping.topLevelType,
  9985. topLevelTarget,
  9986. topLevelTargetID,
  9987. bookKeeping.nativeEvent
  9988. );
  9989. }
  9990. }
  9991. function scrollValueMonitor(cb) {
  9992. var scrollPosition = getUnboundedScrollPosition(window);
  9993. cb(scrollPosition);
  9994. }
  9995. var ReactEventListener = {
  9996. _enabled: true,
  9997. _handleTopLevel: null,
  9998. WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
  9999. setHandleTopLevel: function(handleTopLevel) {
  10000. ReactEventListener._handleTopLevel = handleTopLevel;
  10001. },
  10002. setEnabled: function(enabled) {
  10003. ReactEventListener._enabled = !!enabled;
  10004. },
  10005. isEnabled: function() {
  10006. return ReactEventListener._enabled;
  10007. },
  10008. /**
  10009. * Traps top-level events by using event bubbling.
  10010. *
  10011. * @param {string} topLevelType Record from `EventConstants`.
  10012. * @param {string} handlerBaseName Event name (e.g. "click").
  10013. * @param {object} handle Element on which to attach listener.
  10014. * @return {object} An object with a remove function which will forcefully
  10015. * remove the listener.
  10016. * @internal
  10017. */
  10018. trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
  10019. var element = handle;
  10020. if (!element) {
  10021. return null;
  10022. }
  10023. return EventListener.listen(
  10024. element,
  10025. handlerBaseName,
  10026. ReactEventListener.dispatchEvent.bind(null, topLevelType)
  10027. );
  10028. },
  10029. /**
  10030. * Traps a top-level event by using event capturing.
  10031. *
  10032. * @param {string} topLevelType Record from `EventConstants`.
  10033. * @param {string} handlerBaseName Event name (e.g. "click").
  10034. * @param {object} handle Element on which to attach listener.
  10035. * @return {object} An object with a remove function which will forcefully
  10036. * remove the listener.
  10037. * @internal
  10038. */
  10039. trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
  10040. var element = handle;
  10041. if (!element) {
  10042. return null;
  10043. }
  10044. return EventListener.capture(
  10045. element,
  10046. handlerBaseName,
  10047. ReactEventListener.dispatchEvent.bind(null, topLevelType)
  10048. );
  10049. },
  10050. monitorScrollValue: function(refresh) {
  10051. var callback = scrollValueMonitor.bind(null, refresh);
  10052. EventListener.listen(window, 'scroll', callback);
  10053. },
  10054. dispatchEvent: function(topLevelType, nativeEvent) {
  10055. if (!ReactEventListener._enabled) {
  10056. return;
  10057. }
  10058. var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
  10059. topLevelType,
  10060. nativeEvent
  10061. );
  10062. try {
  10063. // Event queue being processed in the same cycle allows
  10064. // `preventDefault`.
  10065. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
  10066. } finally {
  10067. TopLevelCallbackBookKeeping.release(bookKeeping);
  10068. }
  10069. }
  10070. };
  10071. module.exports = ReactEventListener;
  10072. },{"100":100,"140":140,"146":146,"17":17,"22":22,"29":29,"30":30,"72":72,"77":77}],69:[function(_dereq_,module,exports){
  10073. /**
  10074. * Copyright 2015, Facebook, Inc.
  10075. * All rights reserved.
  10076. *
  10077. * This source code is licensed under the BSD-style license found in the
  10078. * LICENSE file in the root directory of this source tree. An additional grant
  10079. * of patent rights can be found in the PATENTS file in the same directory.
  10080. *
  10081. * @providesModule ReactFragment
  10082. */
  10083. 'use strict';
  10084. var ReactElement = _dereq_(63);
  10085. var warning = _dereq_(171);
  10086. /**
  10087. * We used to allow keyed objects to serve as a collection of ReactElements,
  10088. * or nested sets. This allowed us a way to explicitly key a set a fragment of
  10089. * components. This is now being replaced with an opaque data structure.
  10090. * The upgrade path is to call React.addons.createFragment({ key: value }) to
  10091. * create a keyed fragment. The resulting data structure is opaque, for now.
  10092. */
  10093. if ("production" !== "development") {
  10094. var fragmentKey = '_reactFragment';
  10095. var didWarnKey = '_reactDidWarn';
  10096. var canWarnForReactFragment = false;
  10097. try {
  10098. // Feature test. Don't even try to issue this warning if we can't use
  10099. // enumerable: false.
  10100. var dummy = function() {
  10101. return 1;
  10102. };
  10103. Object.defineProperty(
  10104. {},
  10105. fragmentKey,
  10106. {enumerable: false, value: true}
  10107. );
  10108. Object.defineProperty(
  10109. {},
  10110. 'key',
  10111. {enumerable: true, get: dummy}
  10112. );
  10113. canWarnForReactFragment = true;
  10114. } catch (x) { }
  10115. var proxyPropertyAccessWithWarning = function(obj, key) {
  10116. Object.defineProperty(obj, key, {
  10117. enumerable: true,
  10118. get: function() {
  10119. ("production" !== "development" ? warning(
  10120. this[didWarnKey],
  10121. 'A ReactFragment is an opaque type. Accessing any of its ' +
  10122. 'properties is deprecated. Pass it to one of the React.Children ' +
  10123. 'helpers.'
  10124. ) : null);
  10125. this[didWarnKey] = true;
  10126. return this[fragmentKey][key];
  10127. },
  10128. set: function(value) {
  10129. ("production" !== "development" ? warning(
  10130. this[didWarnKey],
  10131. 'A ReactFragment is an immutable opaque type. Mutating its ' +
  10132. 'properties is deprecated.'
  10133. ) : null);
  10134. this[didWarnKey] = true;
  10135. this[fragmentKey][key] = value;
  10136. }
  10137. });
  10138. };
  10139. var issuedWarnings = {};
  10140. var didWarnForFragment = function(fragment) {
  10141. // We use the keys and the type of the value as a heuristic to dedupe the
  10142. // warning to avoid spamming too much.
  10143. var fragmentCacheKey = '';
  10144. for (var key in fragment) {
  10145. fragmentCacheKey += key + ':' + (typeof fragment[key]) + ',';
  10146. }
  10147. var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
  10148. issuedWarnings[fragmentCacheKey] = true;
  10149. return alreadyWarnedOnce;
  10150. };
  10151. }
  10152. var ReactFragment = {
  10153. // Wrap a keyed object in an opaque proxy that warns you if you access any
  10154. // of its properties.
  10155. create: function(object) {
  10156. if ("production" !== "development") {
  10157. if (typeof object !== 'object' || !object || Array.isArray(object)) {
  10158. ("production" !== "development" ? warning(
  10159. false,
  10160. 'React.addons.createFragment only accepts a single object.',
  10161. object
  10162. ) : null);
  10163. return object;
  10164. }
  10165. if (ReactElement.isValidElement(object)) {
  10166. ("production" !== "development" ? warning(
  10167. false,
  10168. 'React.addons.createFragment does not accept a ReactElement ' +
  10169. 'without a wrapper object.'
  10170. ) : null);
  10171. return object;
  10172. }
  10173. if (canWarnForReactFragment) {
  10174. var proxy = {};
  10175. Object.defineProperty(proxy, fragmentKey, {
  10176. enumerable: false,
  10177. value: object
  10178. });
  10179. Object.defineProperty(proxy, didWarnKey, {
  10180. writable: true,
  10181. enumerable: false,
  10182. value: false
  10183. });
  10184. for (var key in object) {
  10185. proxyPropertyAccessWithWarning(proxy, key);
  10186. }
  10187. Object.preventExtensions(proxy);
  10188. return proxy;
  10189. }
  10190. }
  10191. return object;
  10192. },
  10193. // Extract the original keyed object from the fragment opaque type. Warn if
  10194. // a plain object is passed here.
  10195. extract: function(fragment) {
  10196. if ("production" !== "development") {
  10197. if (canWarnForReactFragment) {
  10198. if (!fragment[fragmentKey]) {
  10199. ("production" !== "development" ? warning(
  10200. didWarnForFragment(fragment),
  10201. 'Any use of a keyed object should be wrapped in ' +
  10202. 'React.addons.createFragment(object) before being passed as a ' +
  10203. 'child.'
  10204. ) : null);
  10205. return fragment;
  10206. }
  10207. return fragment[fragmentKey];
  10208. }
  10209. }
  10210. return fragment;
  10211. },
  10212. // Check if this is a fragment and if so, extract the keyed object. If it
  10213. // is a fragment-like object, warn that it should be wrapped. Ignore if we
  10214. // can't determine what kind of object this is.
  10215. extractIfFragment: function(fragment) {
  10216. if ("production" !== "development") {
  10217. if (canWarnForReactFragment) {
  10218. // If it is the opaque type, return the keyed object.
  10219. if (fragment[fragmentKey]) {
  10220. return fragment[fragmentKey];
  10221. }
  10222. // Otherwise, check each property if it has an element, if it does
  10223. // it is probably meant as a fragment, so we can warn early. Defer,
  10224. // the warning to extract.
  10225. for (var key in fragment) {
  10226. if (fragment.hasOwnProperty(key) &&
  10227. ReactElement.isValidElement(fragment[key])) {
  10228. // This looks like a fragment object, we should provide an
  10229. // early warning.
  10230. return ReactFragment.extract(fragment);
  10231. }
  10232. }
  10233. }
  10234. }
  10235. return fragment;
  10236. }
  10237. };
  10238. module.exports = ReactFragment;
  10239. },{"171":171,"63":63}],70:[function(_dereq_,module,exports){
  10240. /**
  10241. * Copyright 2013-2015, Facebook, Inc.
  10242. * All rights reserved.
  10243. *
  10244. * This source code is licensed under the BSD-style license found in the
  10245. * LICENSE file in the root directory of this source tree. An additional grant
  10246. * of patent rights can be found in the PATENTS file in the same directory.
  10247. *
  10248. * @providesModule ReactInjection
  10249. */
  10250. 'use strict';
  10251. var DOMProperty = _dereq_(11);
  10252. var EventPluginHub = _dereq_(18);
  10253. var ReactComponentEnvironment = _dereq_(41);
  10254. var ReactClass = _dereq_(38);
  10255. var ReactEmptyComponent = _dereq_(65);
  10256. var ReactBrowserEventEmitter = _dereq_(33);
  10257. var ReactNativeComponent = _dereq_(80);
  10258. var ReactDOMComponent = _dereq_(48);
  10259. var ReactPerf = _dereq_(82);
  10260. var ReactRootIndex = _dereq_(91);
  10261. var ReactUpdates = _dereq_(100);
  10262. var ReactInjection = {
  10263. Component: ReactComponentEnvironment.injection,
  10264. Class: ReactClass.injection,
  10265. DOMComponent: ReactDOMComponent.injection,
  10266. DOMProperty: DOMProperty.injection,
  10267. EmptyComponent: ReactEmptyComponent.injection,
  10268. EventPluginHub: EventPluginHub.injection,
  10269. EventEmitter: ReactBrowserEventEmitter.injection,
  10270. NativeComponent: ReactNativeComponent.injection,
  10271. Perf: ReactPerf.injection,
  10272. RootIndex: ReactRootIndex.injection,
  10273. Updates: ReactUpdates.injection
  10274. };
  10275. module.exports = ReactInjection;
  10276. },{"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){
  10277. /**
  10278. * Copyright 2013-2015, Facebook, Inc.
  10279. * All rights reserved.
  10280. *
  10281. * This source code is licensed under the BSD-style license found in the
  10282. * LICENSE file in the root directory of this source tree. An additional grant
  10283. * of patent rights can be found in the PATENTS file in the same directory.
  10284. *
  10285. * @providesModule ReactInputSelection
  10286. */
  10287. 'use strict';
  10288. var ReactDOMSelection = _dereq_(56);
  10289. var containsNode = _dereq_(123);
  10290. var focusNode = _dereq_(134);
  10291. var getActiveElement = _dereq_(136);
  10292. function isInDocument(node) {
  10293. return containsNode(document.documentElement, node);
  10294. }
  10295. /**
  10296. * @ReactInputSelection: React input selection module. Based on Selection.js,
  10297. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  10298. * assume buttons have range selections allowed).
  10299. * Input selection module for React.
  10300. */
  10301. var ReactInputSelection = {
  10302. hasSelectionCapabilities: function(elem) {
  10303. return elem && (
  10304. ((elem.nodeName === 'INPUT' && elem.type === 'text') ||
  10305. elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')
  10306. );
  10307. },
  10308. getSelectionInformation: function() {
  10309. var focusedElem = getActiveElement();
  10310. return {
  10311. focusedElem: focusedElem,
  10312. selectionRange:
  10313. ReactInputSelection.hasSelectionCapabilities(focusedElem) ?
  10314. ReactInputSelection.getSelection(focusedElem) :
  10315. null
  10316. };
  10317. },
  10318. /**
  10319. * @restoreSelection: If any selection information was potentially lost,
  10320. * restore it. This is useful when performing operations that could remove dom
  10321. * nodes and place them back in, resulting in focus being lost.
  10322. */
  10323. restoreSelection: function(priorSelectionInformation) {
  10324. var curFocusedElem = getActiveElement();
  10325. var priorFocusedElem = priorSelectionInformation.focusedElem;
  10326. var priorSelectionRange = priorSelectionInformation.selectionRange;
  10327. if (curFocusedElem !== priorFocusedElem &&
  10328. isInDocument(priorFocusedElem)) {
  10329. if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
  10330. ReactInputSelection.setSelection(
  10331. priorFocusedElem,
  10332. priorSelectionRange
  10333. );
  10334. }
  10335. focusNode(priorFocusedElem);
  10336. }
  10337. },
  10338. /**
  10339. * @getSelection: Gets the selection bounds of a focused textarea, input or
  10340. * contentEditable node.
  10341. * -@input: Look up selection bounds of this input
  10342. * -@return {start: selectionStart, end: selectionEnd}
  10343. */
  10344. getSelection: function(input) {
  10345. var selection;
  10346. if ('selectionStart' in input) {
  10347. // Modern browser with input or textarea.
  10348. selection = {
  10349. start: input.selectionStart,
  10350. end: input.selectionEnd
  10351. };
  10352. } else if (document.selection && input.nodeName === 'INPUT') {
  10353. // IE8 input.
  10354. var range = document.selection.createRange();
  10355. // There can only be one selection per document in IE, so it must
  10356. // be in our element.
  10357. if (range.parentElement() === input) {
  10358. selection = {
  10359. start: -range.moveStart('character', -input.value.length),
  10360. end: -range.moveEnd('character', -input.value.length)
  10361. };
  10362. }
  10363. } else {
  10364. // Content editable or old IE textarea.
  10365. selection = ReactDOMSelection.getOffsets(input);
  10366. }
  10367. return selection || {start: 0, end: 0};
  10368. },
  10369. /**
  10370. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  10371. * the input.
  10372. * -@input Set selection bounds of this input or textarea
  10373. * -@offsets Object of same form that is returned from get*
  10374. */
  10375. setSelection: function(input, offsets) {
  10376. var start = offsets.start;
  10377. var end = offsets.end;
  10378. if (typeof end === 'undefined') {
  10379. end = start;
  10380. }
  10381. if ('selectionStart' in input) {
  10382. input.selectionStart = start;
  10383. input.selectionEnd = Math.min(end, input.value.length);
  10384. } else if (document.selection && input.nodeName === 'INPUT') {
  10385. var range = input.createTextRange();
  10386. range.collapse(true);
  10387. range.moveStart('character', start);
  10388. range.moveEnd('character', end - start);
  10389. range.select();
  10390. } else {
  10391. ReactDOMSelection.setOffsets(input, offsets);
  10392. }
  10393. }
  10394. };
  10395. module.exports = ReactInputSelection;
  10396. },{"123":123,"134":134,"136":136,"56":56}],72:[function(_dereq_,module,exports){
  10397. /**
  10398. * Copyright 2013-2015, Facebook, Inc.
  10399. * All rights reserved.
  10400. *
  10401. * This source code is licensed under the BSD-style license found in the
  10402. * LICENSE file in the root directory of this source tree. An additional grant
  10403. * of patent rights can be found in the PATENTS file in the same directory.
  10404. *
  10405. * @providesModule ReactInstanceHandles
  10406. * @typechecks static-only
  10407. */
  10408. 'use strict';
  10409. var ReactRootIndex = _dereq_(91);
  10410. var invariant = _dereq_(150);
  10411. var SEPARATOR = '.';
  10412. var SEPARATOR_LENGTH = SEPARATOR.length;
  10413. /**
  10414. * Maximum depth of traversals before we consider the possibility of a bad ID.
  10415. */
  10416. var MAX_TREE_DEPTH = 100;
  10417. /**
  10418. * Creates a DOM ID prefix to use when mounting React components.
  10419. *
  10420. * @param {number} index A unique integer
  10421. * @return {string} React root ID.
  10422. * @internal
  10423. */
  10424. function getReactRootIDString(index) {
  10425. return SEPARATOR + index.toString(36);
  10426. }
  10427. /**
  10428. * Checks if a character in the supplied ID is a separator or the end.
  10429. *
  10430. * @param {string} id A React DOM ID.
  10431. * @param {number} index Index of the character to check.
  10432. * @return {boolean} True if the character is a separator or end of the ID.
  10433. * @private
  10434. */
  10435. function isBoundary(id, index) {
  10436. return id.charAt(index) === SEPARATOR || index === id.length;
  10437. }
  10438. /**
  10439. * Checks if the supplied string is a valid React DOM ID.
  10440. *
  10441. * @param {string} id A React DOM ID, maybe.
  10442. * @return {boolean} True if the string is a valid React DOM ID.
  10443. * @private
  10444. */
  10445. function isValidID(id) {
  10446. return id === '' || (
  10447. id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
  10448. );
  10449. }
  10450. /**
  10451. * Checks if the first ID is an ancestor of or equal to the second ID.
  10452. *
  10453. * @param {string} ancestorID
  10454. * @param {string} descendantID
  10455. * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
  10456. * @internal
  10457. */
  10458. function isAncestorIDOf(ancestorID, descendantID) {
  10459. return (
  10460. descendantID.indexOf(ancestorID) === 0 &&
  10461. isBoundary(descendantID, ancestorID.length)
  10462. );
  10463. }
  10464. /**
  10465. * Gets the parent ID of the supplied React DOM ID, `id`.
  10466. *
  10467. * @param {string} id ID of a component.
  10468. * @return {string} ID of the parent, or an empty string.
  10469. * @private
  10470. */
  10471. function getParentID(id) {
  10472. return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
  10473. }
  10474. /**
  10475. * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
  10476. * supplied `destinationID`. If they are equal, the ID is returned.
  10477. *
  10478. * @param {string} ancestorID ID of an ancestor node of `destinationID`.
  10479. * @param {string} destinationID ID of the destination node.
  10480. * @return {string} Next ID on the path from `ancestorID` to `destinationID`.
  10481. * @private
  10482. */
  10483. function getNextDescendantID(ancestorID, destinationID) {
  10484. ("production" !== "development" ? invariant(
  10485. isValidID(ancestorID) && isValidID(destinationID),
  10486. 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
  10487. ancestorID,
  10488. destinationID
  10489. ) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
  10490. ("production" !== "development" ? invariant(
  10491. isAncestorIDOf(ancestorID, destinationID),
  10492. 'getNextDescendantID(...): React has made an invalid assumption about ' +
  10493. 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
  10494. ancestorID,
  10495. destinationID
  10496. ) : invariant(isAncestorIDOf(ancestorID, destinationID)));
  10497. if (ancestorID === destinationID) {
  10498. return ancestorID;
  10499. }
  10500. // Skip over the ancestor and the immediate separator. Traverse until we hit
  10501. // another separator or we reach the end of `destinationID`.
  10502. var start = ancestorID.length + SEPARATOR_LENGTH;
  10503. var i;
  10504. for (i = start; i < destinationID.length; i++) {
  10505. if (isBoundary(destinationID, i)) {
  10506. break;
  10507. }
  10508. }
  10509. return destinationID.substr(0, i);
  10510. }
  10511. /**
  10512. * Gets the nearest common ancestor ID of two IDs.
  10513. *
  10514. * Using this ID scheme, the nearest common ancestor ID is the longest common
  10515. * prefix of the two IDs that immediately preceded a "marker" in both strings.
  10516. *
  10517. * @param {string} oneID
  10518. * @param {string} twoID
  10519. * @return {string} Nearest common ancestor ID, or the empty string if none.
  10520. * @private
  10521. */
  10522. function getFirstCommonAncestorID(oneID, twoID) {
  10523. var minLength = Math.min(oneID.length, twoID.length);
  10524. if (minLength === 0) {
  10525. return '';
  10526. }
  10527. var lastCommonMarkerIndex = 0;
  10528. // Use `<=` to traverse until the "EOL" of the shorter string.
  10529. for (var i = 0; i <= minLength; i++) {
  10530. if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
  10531. lastCommonMarkerIndex = i;
  10532. } else if (oneID.charAt(i) !== twoID.charAt(i)) {
  10533. break;
  10534. }
  10535. }
  10536. var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
  10537. ("production" !== "development" ? invariant(
  10538. isValidID(longestCommonID),
  10539. 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
  10540. oneID,
  10541. twoID,
  10542. longestCommonID
  10543. ) : invariant(isValidID(longestCommonID)));
  10544. return longestCommonID;
  10545. }
  10546. /**
  10547. * Traverses the parent path between two IDs (either up or down). The IDs must
  10548. * not be the same, and there must exist a parent path between them. If the
  10549. * callback returns `false`, traversal is stopped.
  10550. *
  10551. * @param {?string} start ID at which to start traversal.
  10552. * @param {?string} stop ID at which to end traversal.
  10553. * @param {function} cb Callback to invoke each ID with.
  10554. * @param {?boolean} skipFirst Whether or not to skip the first node.
  10555. * @param {?boolean} skipLast Whether or not to skip the last node.
  10556. * @private
  10557. */
  10558. function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
  10559. start = start || '';
  10560. stop = stop || '';
  10561. ("production" !== "development" ? invariant(
  10562. start !== stop,
  10563. 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
  10564. start
  10565. ) : invariant(start !== stop));
  10566. var traverseUp = isAncestorIDOf(stop, start);
  10567. ("production" !== "development" ? invariant(
  10568. traverseUp || isAncestorIDOf(start, stop),
  10569. 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
  10570. 'not have a parent path.',
  10571. start,
  10572. stop
  10573. ) : invariant(traverseUp || isAncestorIDOf(start, stop)));
  10574. // Traverse from `start` to `stop` one depth at a time.
  10575. var depth = 0;
  10576. var traverse = traverseUp ? getParentID : getNextDescendantID;
  10577. for (var id = start; /* until break */; id = traverse(id, stop)) {
  10578. var ret;
  10579. if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
  10580. ret = cb(id, traverseUp, arg);
  10581. }
  10582. if (ret === false || id === stop) {
  10583. // Only break //after// visiting `stop`.
  10584. break;
  10585. }
  10586. ("production" !== "development" ? invariant(
  10587. depth++ < MAX_TREE_DEPTH,
  10588. 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
  10589. 'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
  10590. start, stop
  10591. ) : invariant(depth++ < MAX_TREE_DEPTH));
  10592. }
  10593. }
  10594. /**
  10595. * Manages the IDs assigned to DOM representations of React components. This
  10596. * uses a specific scheme in order to traverse the DOM efficiently (e.g. in
  10597. * order to simulate events).
  10598. *
  10599. * @internal
  10600. */
  10601. var ReactInstanceHandles = {
  10602. /**
  10603. * Constructs a React root ID
  10604. * @return {string} A React root ID.
  10605. */
  10606. createReactRootID: function() {
  10607. return getReactRootIDString(ReactRootIndex.createReactRootIndex());
  10608. },
  10609. /**
  10610. * Constructs a React ID by joining a root ID with a name.
  10611. *
  10612. * @param {string} rootID Root ID of a parent component.
  10613. * @param {string} name A component's name (as flattened children).
  10614. * @return {string} A React ID.
  10615. * @internal
  10616. */
  10617. createReactID: function(rootID, name) {
  10618. return rootID + name;
  10619. },
  10620. /**
  10621. * Gets the DOM ID of the React component that is the root of the tree that
  10622. * contains the React component with the supplied DOM ID.
  10623. *
  10624. * @param {string} id DOM ID of a React component.
  10625. * @return {?string} DOM ID of the React component that is the root.
  10626. * @internal
  10627. */
  10628. getReactRootIDFromNodeID: function(id) {
  10629. if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
  10630. var index = id.indexOf(SEPARATOR, 1);
  10631. return index > -1 ? id.substr(0, index) : id;
  10632. }
  10633. return null;
  10634. },
  10635. /**
  10636. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  10637. * should would receive a `mouseEnter` or `mouseLeave` event.
  10638. *
  10639. * NOTE: Does not invoke the callback on the nearest common ancestor because
  10640. * nothing "entered" or "left" that element.
  10641. *
  10642. * @param {string} leaveID ID being left.
  10643. * @param {string} enterID ID being entered.
  10644. * @param {function} cb Callback to invoke on each entered/left ID.
  10645. * @param {*} upArg Argument to invoke the callback with on left IDs.
  10646. * @param {*} downArg Argument to invoke the callback with on entered IDs.
  10647. * @internal
  10648. */
  10649. traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
  10650. var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
  10651. if (ancestorID !== leaveID) {
  10652. traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
  10653. }
  10654. if (ancestorID !== enterID) {
  10655. traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
  10656. }
  10657. },
  10658. /**
  10659. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  10660. *
  10661. * NOTE: This traversal happens on IDs without touching the DOM.
  10662. *
  10663. * @param {string} targetID ID of the target node.
  10664. * @param {function} cb Callback to invoke.
  10665. * @param {*} arg Argument to invoke the callback with.
  10666. * @internal
  10667. */
  10668. traverseTwoPhase: function(targetID, cb, arg) {
  10669. if (targetID) {
  10670. traverseParentPath('', targetID, cb, arg, true, false);
  10671. traverseParentPath(targetID, '', cb, arg, false, true);
  10672. }
  10673. },
  10674. /**
  10675. * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
  10676. * example, passing `.0.$row-0.1` would result in `cb` getting called
  10677. * with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
  10678. *
  10679. * NOTE: This traversal happens on IDs without touching the DOM.
  10680. *
  10681. * @param {string} targetID ID of the target node.
  10682. * @param {function} cb Callback to invoke.
  10683. * @param {*} arg Argument to invoke the callback with.
  10684. * @internal
  10685. */
  10686. traverseAncestors: function(targetID, cb, arg) {
  10687. traverseParentPath('', targetID, cb, arg, true, false);
  10688. },
  10689. /**
  10690. * Exposed for unit testing.
  10691. * @private
  10692. */
  10693. _getFirstCommonAncestorID: getFirstCommonAncestorID,
  10694. /**
  10695. * Exposed for unit testing.
  10696. * @private
  10697. */
  10698. _getNextDescendantID: getNextDescendantID,
  10699. isAncestorIDOf: isAncestorIDOf,
  10700. SEPARATOR: SEPARATOR
  10701. };
  10702. module.exports = ReactInstanceHandles;
  10703. },{"150":150,"91":91}],73:[function(_dereq_,module,exports){
  10704. /**
  10705. * Copyright 2013-2015, Facebook, Inc.
  10706. * All rights reserved.
  10707. *
  10708. * This source code is licensed under the BSD-style license found in the
  10709. * LICENSE file in the root directory of this source tree. An additional grant
  10710. * of patent rights can be found in the PATENTS file in the same directory.
  10711. *
  10712. * @providesModule ReactInstanceMap
  10713. */
  10714. 'use strict';
  10715. /**
  10716. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  10717. * instance (key) and the internal representation (value). This allows public
  10718. * methods to accept the user facing instance as an argument and map them back
  10719. * to internal methods.
  10720. */
  10721. // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
  10722. var ReactInstanceMap = {
  10723. /**
  10724. * This API should be called `delete` but we'd have to make sure to always
  10725. * transform these to strings for IE support. When this transform is fully
  10726. * supported we can rename it.
  10727. */
  10728. remove: function(key) {
  10729. key._reactInternalInstance = undefined;
  10730. },
  10731. get: function(key) {
  10732. return key._reactInternalInstance;
  10733. },
  10734. has: function(key) {
  10735. return key._reactInternalInstance !== undefined;
  10736. },
  10737. set: function(key, value) {
  10738. key._reactInternalInstance = value;
  10739. }
  10740. };
  10741. module.exports = ReactInstanceMap;
  10742. },{}],74:[function(_dereq_,module,exports){
  10743. /**
  10744. * Copyright 2015, Facebook, Inc.
  10745. * All rights reserved.
  10746. *
  10747. * This source code is licensed under the BSD-style license found in the
  10748. * LICENSE file in the root directory of this source tree. An additional grant
  10749. * of patent rights can be found in the PATENTS file in the same directory.
  10750. *
  10751. * @providesModule ReactLifeCycle
  10752. */
  10753. 'use strict';
  10754. /**
  10755. * This module manages the bookkeeping when a component is in the process
  10756. * of being mounted or being unmounted. This is used as a way to enforce
  10757. * invariants (or warnings) when it is not recommended to call
  10758. * setState/forceUpdate.
  10759. *
  10760. * currentlyMountingInstance: During the construction phase, it is not possible
  10761. * to trigger an update since the instance is not fully mounted yet. However, we
  10762. * currently allow this as a convenience for mutating the initial state.
  10763. *
  10764. * currentlyUnmountingInstance: During the unmounting phase, the instance is
  10765. * still mounted and can therefore schedule an update. However, this is not
  10766. * recommended and probably an error since it's about to be unmounted.
  10767. * Therefore we still want to trigger in an error for that case.
  10768. */
  10769. var ReactLifeCycle = {
  10770. currentlyMountingInstance: null,
  10771. currentlyUnmountingInstance: null
  10772. };
  10773. module.exports = ReactLifeCycle;
  10774. },{}],75:[function(_dereq_,module,exports){
  10775. /**
  10776. * Copyright 2013-2015, Facebook, Inc.
  10777. * All rights reserved.
  10778. *
  10779. * This source code is licensed under the BSD-style license found in the
  10780. * LICENSE file in the root directory of this source tree. An additional grant
  10781. * of patent rights can be found in the PATENTS file in the same directory.
  10782. *
  10783. * @providesModule ReactLink
  10784. * @typechecks static-only
  10785. */
  10786. 'use strict';
  10787. /**
  10788. * ReactLink encapsulates a common pattern in which a component wants to modify
  10789. * a prop received from its parent. ReactLink allows the parent to pass down a
  10790. * value coupled with a callback that, when invoked, expresses an intent to
  10791. * modify that value. For example:
  10792. *
  10793. * React.createClass({
  10794. * getInitialState: function() {
  10795. * return {value: ''};
  10796. * },
  10797. * render: function() {
  10798. * var valueLink = new ReactLink(this.state.value, this._handleValueChange);
  10799. * return <input valueLink={valueLink} />;
  10800. * },
  10801. * this._handleValueChange: function(newValue) {
  10802. * this.setState({value: newValue});
  10803. * }
  10804. * });
  10805. *
  10806. * We have provided some sugary mixins to make the creation and
  10807. * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
  10808. */
  10809. var React = _dereq_(31);
  10810. /**
  10811. * @param {*} value current value of the link
  10812. * @param {function} requestChange callback to request a change
  10813. */
  10814. function ReactLink(value, requestChange) {
  10815. this.value = value;
  10816. this.requestChange = requestChange;
  10817. }
  10818. /**
  10819. * Creates a PropType that enforces the ReactLink API and optionally checks the
  10820. * type of the value being passed inside the link. Example:
  10821. *
  10822. * MyComponent.propTypes = {
  10823. * tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number)
  10824. * }
  10825. */
  10826. function createLinkTypeChecker(linkType) {
  10827. var shapes = {
  10828. value: typeof linkType === 'undefined' ?
  10829. React.PropTypes.any.isRequired :
  10830. linkType.isRequired,
  10831. requestChange: React.PropTypes.func.isRequired
  10832. };
  10833. return React.PropTypes.shape(shapes);
  10834. }
  10835. ReactLink.PropTypes = {
  10836. link: createLinkTypeChecker
  10837. };
  10838. module.exports = ReactLink;
  10839. },{"31":31}],76:[function(_dereq_,module,exports){
  10840. /**
  10841. * Copyright 2013-2015, Facebook, Inc.
  10842. * All rights reserved.
  10843. *
  10844. * This source code is licensed under the BSD-style license found in the
  10845. * LICENSE file in the root directory of this source tree. An additional grant
  10846. * of patent rights can be found in the PATENTS file in the same directory.
  10847. *
  10848. * @providesModule ReactMarkupChecksum
  10849. */
  10850. 'use strict';
  10851. var adler32 = _dereq_(119);
  10852. var ReactMarkupChecksum = {
  10853. CHECKSUM_ATTR_NAME: 'data-react-checksum',
  10854. /**
  10855. * @param {string} markup Markup string
  10856. * @return {string} Markup string with checksum attribute attached
  10857. */
  10858. addChecksumToMarkup: function(markup) {
  10859. var checksum = adler32(markup);
  10860. return markup.replace(
  10861. '>',
  10862. ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
  10863. );
  10864. },
  10865. /**
  10866. * @param {string} markup to use
  10867. * @param {DOMElement} element root React element
  10868. * @returns {boolean} whether or not the markup is the same
  10869. */
  10870. canReuseMarkup: function(markup, element) {
  10871. var existingChecksum = element.getAttribute(
  10872. ReactMarkupChecksum.CHECKSUM_ATTR_NAME
  10873. );
  10874. existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
  10875. var markupChecksum = adler32(markup);
  10876. return markupChecksum === existingChecksum;
  10877. }
  10878. };
  10879. module.exports = ReactMarkupChecksum;
  10880. },{"119":119}],77:[function(_dereq_,module,exports){
  10881. /**
  10882. * Copyright 2013-2015, Facebook, Inc.
  10883. * All rights reserved.
  10884. *
  10885. * This source code is licensed under the BSD-style license found in the
  10886. * LICENSE file in the root directory of this source tree. An additional grant
  10887. * of patent rights can be found in the PATENTS file in the same directory.
  10888. *
  10889. * @providesModule ReactMount
  10890. */
  10891. 'use strict';
  10892. var DOMProperty = _dereq_(11);
  10893. var ReactBrowserEventEmitter = _dereq_(33);
  10894. var ReactCurrentOwner = _dereq_(45);
  10895. var ReactElement = _dereq_(63);
  10896. var ReactElementValidator = _dereq_(64);
  10897. var ReactEmptyComponent = _dereq_(65);
  10898. var ReactInstanceHandles = _dereq_(72);
  10899. var ReactInstanceMap = _dereq_(73);
  10900. var ReactMarkupChecksum = _dereq_(76);
  10901. var ReactPerf = _dereq_(82);
  10902. var ReactReconciler = _dereq_(89);
  10903. var ReactUpdateQueue = _dereq_(99);
  10904. var ReactUpdates = _dereq_(100);
  10905. var emptyObject = _dereq_(130);
  10906. var containsNode = _dereq_(123);
  10907. var getReactRootElementInContainer = _dereq_(144);
  10908. var instantiateReactComponent = _dereq_(149);
  10909. var invariant = _dereq_(150);
  10910. var setInnerHTML = _dereq_(164);
  10911. var shouldUpdateReactComponent = _dereq_(167);
  10912. var warning = _dereq_(171);
  10913. var SEPARATOR = ReactInstanceHandles.SEPARATOR;
  10914. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  10915. var nodeCache = {};
  10916. var ELEMENT_NODE_TYPE = 1;
  10917. var DOC_NODE_TYPE = 9;
  10918. /** Mapping from reactRootID to React component instance. */
  10919. var instancesByReactRootID = {};
  10920. /** Mapping from reactRootID to `container` nodes. */
  10921. var containersByReactRootID = {};
  10922. if ("production" !== "development") {
  10923. /** __DEV__-only mapping from reactRootID to root elements. */
  10924. var rootElementsByReactRootID = {};
  10925. }
  10926. // Used to store breadth-first search state in findComponentRoot.
  10927. var findComponentRootReusableArray = [];
  10928. /**
  10929. * Finds the index of the first character
  10930. * that's not common between the two given strings.
  10931. *
  10932. * @return {number} the index of the character where the strings diverge
  10933. */
  10934. function firstDifferenceIndex(string1, string2) {
  10935. var minLen = Math.min(string1.length, string2.length);
  10936. for (var i = 0; i < minLen; i++) {
  10937. if (string1.charAt(i) !== string2.charAt(i)) {
  10938. return i;
  10939. }
  10940. }
  10941. return string1.length === string2.length ? -1 : minLen;
  10942. }
  10943. /**
  10944. * @param {DOMElement} container DOM element that may contain a React component.
  10945. * @return {?string} A "reactRoot" ID, if a React component is rendered.
  10946. */
  10947. function getReactRootID(container) {
  10948. var rootElement = getReactRootElementInContainer(container);
  10949. return rootElement && ReactMount.getID(rootElement);
  10950. }
  10951. /**
  10952. * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
  10953. * element can return its control whose name or ID equals ATTR_NAME. All
  10954. * DOM nodes support `getAttributeNode` but this can also get called on
  10955. * other objects so just return '' if we're given something other than a
  10956. * DOM node (such as window).
  10957. *
  10958. * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
  10959. * @return {string} ID of the supplied `domNode`.
  10960. */
  10961. function getID(node) {
  10962. var id = internalGetID(node);
  10963. if (id) {
  10964. if (nodeCache.hasOwnProperty(id)) {
  10965. var cached = nodeCache[id];
  10966. if (cached !== node) {
  10967. ("production" !== "development" ? invariant(
  10968. !isValid(cached, id),
  10969. 'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
  10970. ATTR_NAME, id
  10971. ) : invariant(!isValid(cached, id)));
  10972. nodeCache[id] = node;
  10973. }
  10974. } else {
  10975. nodeCache[id] = node;
  10976. }
  10977. }
  10978. return id;
  10979. }
  10980. function internalGetID(node) {
  10981. // If node is something like a window, document, or text node, none of
  10982. // which support attributes or a .getAttribute method, gracefully return
  10983. // the empty string, as if the attribute were missing.
  10984. return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
  10985. }
  10986. /**
  10987. * Sets the React-specific ID of the given node.
  10988. *
  10989. * @param {DOMElement} node The DOM node whose ID will be set.
  10990. * @param {string} id The value of the ID attribute.
  10991. */
  10992. function setID(node, id) {
  10993. var oldID = internalGetID(node);
  10994. if (oldID !== id) {
  10995. delete nodeCache[oldID];
  10996. }
  10997. node.setAttribute(ATTR_NAME, id);
  10998. nodeCache[id] = node;
  10999. }
  11000. /**
  11001. * Finds the node with the supplied React-generated DOM ID.
  11002. *
  11003. * @param {string} id A React-generated DOM ID.
  11004. * @return {DOMElement} DOM node with the suppled `id`.
  11005. * @internal
  11006. */
  11007. function getNode(id) {
  11008. if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
  11009. nodeCache[id] = ReactMount.findReactNodeByID(id);
  11010. }
  11011. return nodeCache[id];
  11012. }
  11013. /**
  11014. * Finds the node with the supplied public React instance.
  11015. *
  11016. * @param {*} instance A public React instance.
  11017. * @return {?DOMElement} DOM node with the suppled `id`.
  11018. * @internal
  11019. */
  11020. function getNodeFromInstance(instance) {
  11021. var id = ReactInstanceMap.get(instance)._rootNodeID;
  11022. if (ReactEmptyComponent.isNullComponentID(id)) {
  11023. return null;
  11024. }
  11025. if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
  11026. nodeCache[id] = ReactMount.findReactNodeByID(id);
  11027. }
  11028. return nodeCache[id];
  11029. }
  11030. /**
  11031. * A node is "valid" if it is contained by a currently mounted container.
  11032. *
  11033. * This means that the node does not have to be contained by a document in
  11034. * order to be considered valid.
  11035. *
  11036. * @param {?DOMElement} node The candidate DOM node.
  11037. * @param {string} id The expected ID of the node.
  11038. * @return {boolean} Whether the node is contained by a mounted container.
  11039. */
  11040. function isValid(node, id) {
  11041. if (node) {
  11042. ("production" !== "development" ? invariant(
  11043. internalGetID(node) === id,
  11044. 'ReactMount: Unexpected modification of `%s`',
  11045. ATTR_NAME
  11046. ) : invariant(internalGetID(node) === id));
  11047. var container = ReactMount.findReactContainerForID(id);
  11048. if (container && containsNode(container, node)) {
  11049. return true;
  11050. }
  11051. }
  11052. return false;
  11053. }
  11054. /**
  11055. * Causes the cache to forget about one React-specific ID.
  11056. *
  11057. * @param {string} id The ID to forget.
  11058. */
  11059. function purgeID(id) {
  11060. delete nodeCache[id];
  11061. }
  11062. var deepestNodeSoFar = null;
  11063. function findDeepestCachedAncestorImpl(ancestorID) {
  11064. var ancestor = nodeCache[ancestorID];
  11065. if (ancestor && isValid(ancestor, ancestorID)) {
  11066. deepestNodeSoFar = ancestor;
  11067. } else {
  11068. // This node isn't populated in the cache, so presumably none of its
  11069. // descendants are. Break out of the loop.
  11070. return false;
  11071. }
  11072. }
  11073. /**
  11074. * Return the deepest cached node whose ID is a prefix of `targetID`.
  11075. */
  11076. function findDeepestCachedAncestor(targetID) {
  11077. deepestNodeSoFar = null;
  11078. ReactInstanceHandles.traverseAncestors(
  11079. targetID,
  11080. findDeepestCachedAncestorImpl
  11081. );
  11082. var foundNode = deepestNodeSoFar;
  11083. deepestNodeSoFar = null;
  11084. return foundNode;
  11085. }
  11086. /**
  11087. * Mounts this component and inserts it into the DOM.
  11088. *
  11089. * @param {ReactComponent} componentInstance The instance to mount.
  11090. * @param {string} rootID DOM ID of the root node.
  11091. * @param {DOMElement} container DOM element to mount into.
  11092. * @param {ReactReconcileTransaction} transaction
  11093. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  11094. */
  11095. function mountComponentIntoNode(
  11096. componentInstance,
  11097. rootID,
  11098. container,
  11099. transaction,
  11100. shouldReuseMarkup) {
  11101. var markup = ReactReconciler.mountComponent(
  11102. componentInstance, rootID, transaction, emptyObject
  11103. );
  11104. componentInstance._isTopLevel = true;
  11105. ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
  11106. }
  11107. /**
  11108. * Batched mount.
  11109. *
  11110. * @param {ReactComponent} componentInstance The instance to mount.
  11111. * @param {string} rootID DOM ID of the root node.
  11112. * @param {DOMElement} container DOM element to mount into.
  11113. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  11114. */
  11115. function batchedMountComponentIntoNode(
  11116. componentInstance,
  11117. rootID,
  11118. container,
  11119. shouldReuseMarkup) {
  11120. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
  11121. transaction.perform(
  11122. mountComponentIntoNode,
  11123. null,
  11124. componentInstance,
  11125. rootID,
  11126. container,
  11127. transaction,
  11128. shouldReuseMarkup
  11129. );
  11130. ReactUpdates.ReactReconcileTransaction.release(transaction);
  11131. }
  11132. /**
  11133. * Mounting is the process of initializing a React component by creating its
  11134. * representative DOM elements and inserting them into a supplied `container`.
  11135. * Any prior content inside `container` is destroyed in the process.
  11136. *
  11137. * ReactMount.render(
  11138. * component,
  11139. * document.getElementById('container')
  11140. * );
  11141. *
  11142. * <div id="container"> <-- Supplied `container`.
  11143. * <div data-reactid=".3"> <-- Rendered reactRoot of React
  11144. * // ... component.
  11145. * </div>
  11146. * </div>
  11147. *
  11148. * Inside of `container`, the first element rendered is the "reactRoot".
  11149. */
  11150. var ReactMount = {
  11151. /** Exposed for debugging purposes **/
  11152. _instancesByReactRootID: instancesByReactRootID,
  11153. /**
  11154. * This is a hook provided to support rendering React components while
  11155. * ensuring that the apparent scroll position of its `container` does not
  11156. * change.
  11157. *
  11158. * @param {DOMElement} container The `container` being rendered into.
  11159. * @param {function} renderCallback This must be called once to do the render.
  11160. */
  11161. scrollMonitor: function(container, renderCallback) {
  11162. renderCallback();
  11163. },
  11164. /**
  11165. * Take a component that's already mounted into the DOM and replace its props
  11166. * @param {ReactComponent} prevComponent component instance already in the DOM
  11167. * @param {ReactElement} nextElement component instance to render
  11168. * @param {DOMElement} container container to render into
  11169. * @param {?function} callback function triggered on completion
  11170. */
  11171. _updateRootComponent: function(
  11172. prevComponent,
  11173. nextElement,
  11174. container,
  11175. callback) {
  11176. if ("production" !== "development") {
  11177. ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
  11178. }
  11179. ReactMount.scrollMonitor(container, function() {
  11180. ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
  11181. if (callback) {
  11182. ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
  11183. }
  11184. });
  11185. if ("production" !== "development") {
  11186. // Record the root element in case it later gets transplanted.
  11187. rootElementsByReactRootID[getReactRootID(container)] =
  11188. getReactRootElementInContainer(container);
  11189. }
  11190. return prevComponent;
  11191. },
  11192. /**
  11193. * Register a component into the instance map and starts scroll value
  11194. * monitoring
  11195. * @param {ReactComponent} nextComponent component instance to render
  11196. * @param {DOMElement} container container to render into
  11197. * @return {string} reactRoot ID prefix
  11198. */
  11199. _registerComponent: function(nextComponent, container) {
  11200. ("production" !== "development" ? invariant(
  11201. container && (
  11202. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11203. ),
  11204. '_registerComponent(...): Target container is not a DOM element.'
  11205. ) : invariant(container && (
  11206. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11207. )));
  11208. ReactBrowserEventEmitter.ensureScrollValueMonitoring();
  11209. var reactRootID = ReactMount.registerContainer(container);
  11210. instancesByReactRootID[reactRootID] = nextComponent;
  11211. return reactRootID;
  11212. },
  11213. /**
  11214. * Render a new component into the DOM.
  11215. * @param {ReactElement} nextElement element to render
  11216. * @param {DOMElement} container container to render into
  11217. * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
  11218. * @return {ReactComponent} nextComponent
  11219. */
  11220. _renderNewRootComponent: function(
  11221. nextElement,
  11222. container,
  11223. shouldReuseMarkup
  11224. ) {
  11225. // Various parts of our code (such as ReactCompositeComponent's
  11226. // _renderValidatedComponent) assume that calls to render aren't nested;
  11227. // verify that that's the case.
  11228. ("production" !== "development" ? warning(
  11229. ReactCurrentOwner.current == null,
  11230. '_renderNewRootComponent(): Render methods should be a pure function ' +
  11231. 'of props and state; triggering nested component updates from ' +
  11232. 'render is not allowed. If necessary, trigger nested updates in ' +
  11233. 'componentDidUpdate.'
  11234. ) : null);
  11235. var componentInstance = instantiateReactComponent(nextElement, null);
  11236. var reactRootID = ReactMount._registerComponent(
  11237. componentInstance,
  11238. container
  11239. );
  11240. // The initial render is synchronous but any updates that happen during
  11241. // rendering, in componentWillMount or componentDidMount, will be batched
  11242. // according to the current batching strategy.
  11243. ReactUpdates.batchedUpdates(
  11244. batchedMountComponentIntoNode,
  11245. componentInstance,
  11246. reactRootID,
  11247. container,
  11248. shouldReuseMarkup
  11249. );
  11250. if ("production" !== "development") {
  11251. // Record the root element in case it later gets transplanted.
  11252. rootElementsByReactRootID[reactRootID] =
  11253. getReactRootElementInContainer(container);
  11254. }
  11255. return componentInstance;
  11256. },
  11257. /**
  11258. * Renders a React component into the DOM in the supplied `container`.
  11259. *
  11260. * If the React component was previously rendered into `container`, this will
  11261. * perform an update on it and only mutate the DOM as necessary to reflect the
  11262. * latest React component.
  11263. *
  11264. * @param {ReactElement} nextElement Component element to render.
  11265. * @param {DOMElement} container DOM element to render into.
  11266. * @param {?function} callback function triggered on completion
  11267. * @return {ReactComponent} Component instance rendered in `container`.
  11268. */
  11269. render: function(nextElement, container, callback) {
  11270. ("production" !== "development" ? invariant(
  11271. ReactElement.isValidElement(nextElement),
  11272. 'React.render(): Invalid component element.%s',
  11273. (
  11274. typeof nextElement === 'string' ?
  11275. ' Instead of passing an element string, make sure to instantiate ' +
  11276. 'it by passing it to React.createElement.' :
  11277. typeof nextElement === 'function' ?
  11278. ' Instead of passing a component class, make sure to instantiate ' +
  11279. 'it by passing it to React.createElement.' :
  11280. // Check if it quacks like an element
  11281. nextElement != null && nextElement.props !== undefined ?
  11282. ' This may be caused by unintentionally loading two independent ' +
  11283. 'copies of React.' :
  11284. ''
  11285. )
  11286. ) : invariant(ReactElement.isValidElement(nextElement)));
  11287. var prevComponent = instancesByReactRootID[getReactRootID(container)];
  11288. if (prevComponent) {
  11289. var prevElement = prevComponent._currentElement;
  11290. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  11291. return ReactMount._updateRootComponent(
  11292. prevComponent,
  11293. nextElement,
  11294. container,
  11295. callback
  11296. ).getPublicInstance();
  11297. } else {
  11298. ReactMount.unmountComponentAtNode(container);
  11299. }
  11300. }
  11301. var reactRootElement = getReactRootElementInContainer(container);
  11302. var containerHasReactMarkup =
  11303. reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
  11304. if ("production" !== "development") {
  11305. if (!containerHasReactMarkup || reactRootElement.nextSibling) {
  11306. var rootElementSibling = reactRootElement;
  11307. while (rootElementSibling) {
  11308. if (ReactMount.isRenderedByReact(rootElementSibling)) {
  11309. ("production" !== "development" ? warning(
  11310. false,
  11311. 'render(): Target node has markup rendered by React, but there ' +
  11312. 'are unrelated nodes as well. This is most commonly caused by ' +
  11313. 'white-space inserted around server-rendered markup.'
  11314. ) : null);
  11315. break;
  11316. }
  11317. rootElementSibling = rootElementSibling.nextSibling;
  11318. }
  11319. }
  11320. }
  11321. var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
  11322. var component = ReactMount._renderNewRootComponent(
  11323. nextElement,
  11324. container,
  11325. shouldReuseMarkup
  11326. ).getPublicInstance();
  11327. if (callback) {
  11328. callback.call(component);
  11329. }
  11330. return component;
  11331. },
  11332. /**
  11333. * Constructs a component instance of `constructor` with `initialProps` and
  11334. * renders it into the supplied `container`.
  11335. *
  11336. * @param {function} constructor React component constructor.
  11337. * @param {?object} props Initial props of the component instance.
  11338. * @param {DOMElement} container DOM element to render into.
  11339. * @return {ReactComponent} Component instance rendered in `container`.
  11340. */
  11341. constructAndRenderComponent: function(constructor, props, container) {
  11342. var element = ReactElement.createElement(constructor, props);
  11343. return ReactMount.render(element, container);
  11344. },
  11345. /**
  11346. * Constructs a component instance of `constructor` with `initialProps` and
  11347. * renders it into a container node identified by supplied `id`.
  11348. *
  11349. * @param {function} componentConstructor React component constructor
  11350. * @param {?object} props Initial props of the component instance.
  11351. * @param {string} id ID of the DOM element to render into.
  11352. * @return {ReactComponent} Component instance rendered in the container node.
  11353. */
  11354. constructAndRenderComponentByID: function(constructor, props, id) {
  11355. var domNode = document.getElementById(id);
  11356. ("production" !== "development" ? invariant(
  11357. domNode,
  11358. 'Tried to get element with id of "%s" but it is not present on the page.',
  11359. id
  11360. ) : invariant(domNode));
  11361. return ReactMount.constructAndRenderComponent(constructor, props, domNode);
  11362. },
  11363. /**
  11364. * Registers a container node into which React components will be rendered.
  11365. * This also creates the "reactRoot" ID that will be assigned to the element
  11366. * rendered within.
  11367. *
  11368. * @param {DOMElement} container DOM element to register as a container.
  11369. * @return {string} The "reactRoot" ID of elements rendered within.
  11370. */
  11371. registerContainer: function(container) {
  11372. var reactRootID = getReactRootID(container);
  11373. if (reactRootID) {
  11374. // If one exists, make sure it is a valid "reactRoot" ID.
  11375. reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
  11376. }
  11377. if (!reactRootID) {
  11378. // No valid "reactRoot" ID found, create one.
  11379. reactRootID = ReactInstanceHandles.createReactRootID();
  11380. }
  11381. containersByReactRootID[reactRootID] = container;
  11382. return reactRootID;
  11383. },
  11384. /**
  11385. * Unmounts and destroys the React component rendered in the `container`.
  11386. *
  11387. * @param {DOMElement} container DOM element containing a React component.
  11388. * @return {boolean} True if a component was found in and unmounted from
  11389. * `container`
  11390. */
  11391. unmountComponentAtNode: function(container) {
  11392. // Various parts of our code (such as ReactCompositeComponent's
  11393. // _renderValidatedComponent) assume that calls to render aren't nested;
  11394. // verify that that's the case. (Strictly speaking, unmounting won't cause a
  11395. // render but we still don't expect to be in a render call here.)
  11396. ("production" !== "development" ? warning(
  11397. ReactCurrentOwner.current == null,
  11398. 'unmountComponentAtNode(): Render methods should be a pure function of ' +
  11399. 'props and state; triggering nested component updates from render is ' +
  11400. 'not allowed. If necessary, trigger nested updates in ' +
  11401. 'componentDidUpdate.'
  11402. ) : null);
  11403. ("production" !== "development" ? invariant(
  11404. container && (
  11405. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11406. ),
  11407. 'unmountComponentAtNode(...): Target container is not a DOM element.'
  11408. ) : invariant(container && (
  11409. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11410. )));
  11411. var reactRootID = getReactRootID(container);
  11412. var component = instancesByReactRootID[reactRootID];
  11413. if (!component) {
  11414. return false;
  11415. }
  11416. ReactMount.unmountComponentFromNode(component, container);
  11417. delete instancesByReactRootID[reactRootID];
  11418. delete containersByReactRootID[reactRootID];
  11419. if ("production" !== "development") {
  11420. delete rootElementsByReactRootID[reactRootID];
  11421. }
  11422. return true;
  11423. },
  11424. /**
  11425. * Unmounts a component and removes it from the DOM.
  11426. *
  11427. * @param {ReactComponent} instance React component instance.
  11428. * @param {DOMElement} container DOM element to unmount from.
  11429. * @final
  11430. * @internal
  11431. * @see {ReactMount.unmountComponentAtNode}
  11432. */
  11433. unmountComponentFromNode: function(instance, container) {
  11434. ReactReconciler.unmountComponent(instance);
  11435. if (container.nodeType === DOC_NODE_TYPE) {
  11436. container = container.documentElement;
  11437. }
  11438. // http://jsperf.com/emptying-a-node
  11439. while (container.lastChild) {
  11440. container.removeChild(container.lastChild);
  11441. }
  11442. },
  11443. /**
  11444. * Finds the container DOM element that contains React component to which the
  11445. * supplied DOM `id` belongs.
  11446. *
  11447. * @param {string} id The ID of an element rendered by a React component.
  11448. * @return {?DOMElement} DOM element that contains the `id`.
  11449. */
  11450. findReactContainerForID: function(id) {
  11451. var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
  11452. var container = containersByReactRootID[reactRootID];
  11453. if ("production" !== "development") {
  11454. var rootElement = rootElementsByReactRootID[reactRootID];
  11455. if (rootElement && rootElement.parentNode !== container) {
  11456. ("production" !== "development" ? invariant(
  11457. // Call internalGetID here because getID calls isValid which calls
  11458. // findReactContainerForID (this function).
  11459. internalGetID(rootElement) === reactRootID,
  11460. 'ReactMount: Root element ID differed from reactRootID.'
  11461. ) : invariant(// Call internalGetID here because getID calls isValid which calls
  11462. // findReactContainerForID (this function).
  11463. internalGetID(rootElement) === reactRootID));
  11464. var containerChild = container.firstChild;
  11465. if (containerChild &&
  11466. reactRootID === internalGetID(containerChild)) {
  11467. // If the container has a new child with the same ID as the old
  11468. // root element, then rootElementsByReactRootID[reactRootID] is
  11469. // just stale and needs to be updated. The case that deserves a
  11470. // warning is when the container is empty.
  11471. rootElementsByReactRootID[reactRootID] = containerChild;
  11472. } else {
  11473. ("production" !== "development" ? warning(
  11474. false,
  11475. 'ReactMount: Root element has been removed from its original ' +
  11476. 'container. New container:', rootElement.parentNode
  11477. ) : null);
  11478. }
  11479. }
  11480. }
  11481. return container;
  11482. },
  11483. /**
  11484. * Finds an element rendered by React with the supplied ID.
  11485. *
  11486. * @param {string} id ID of a DOM node in the React component.
  11487. * @return {DOMElement} Root DOM node of the React component.
  11488. */
  11489. findReactNodeByID: function(id) {
  11490. var reactRoot = ReactMount.findReactContainerForID(id);
  11491. return ReactMount.findComponentRoot(reactRoot, id);
  11492. },
  11493. /**
  11494. * True if the supplied `node` is rendered by React.
  11495. *
  11496. * @param {*} node DOM Element to check.
  11497. * @return {boolean} True if the DOM Element appears to be rendered by React.
  11498. * @internal
  11499. */
  11500. isRenderedByReact: function(node) {
  11501. if (node.nodeType !== 1) {
  11502. // Not a DOMElement, therefore not a React component
  11503. return false;
  11504. }
  11505. var id = ReactMount.getID(node);
  11506. return id ? id.charAt(0) === SEPARATOR : false;
  11507. },
  11508. /**
  11509. * Traverses up the ancestors of the supplied node to find a node that is a
  11510. * DOM representation of a React component.
  11511. *
  11512. * @param {*} node
  11513. * @return {?DOMEventTarget}
  11514. * @internal
  11515. */
  11516. getFirstReactDOM: function(node) {
  11517. var current = node;
  11518. while (current && current.parentNode !== current) {
  11519. if (ReactMount.isRenderedByReact(current)) {
  11520. return current;
  11521. }
  11522. current = current.parentNode;
  11523. }
  11524. return null;
  11525. },
  11526. /**
  11527. * Finds a node with the supplied `targetID` inside of the supplied
  11528. * `ancestorNode`. Exploits the ID naming scheme to perform the search
  11529. * quickly.
  11530. *
  11531. * @param {DOMEventTarget} ancestorNode Search from this root.
  11532. * @pararm {string} targetID ID of the DOM representation of the component.
  11533. * @return {DOMEventTarget} DOM node with the supplied `targetID`.
  11534. * @internal
  11535. */
  11536. findComponentRoot: function(ancestorNode, targetID) {
  11537. var firstChildren = findComponentRootReusableArray;
  11538. var childIndex = 0;
  11539. var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
  11540. firstChildren[0] = deepestAncestor.firstChild;
  11541. firstChildren.length = 1;
  11542. while (childIndex < firstChildren.length) {
  11543. var child = firstChildren[childIndex++];
  11544. var targetChild;
  11545. while (child) {
  11546. var childID = ReactMount.getID(child);
  11547. if (childID) {
  11548. // Even if we find the node we're looking for, we finish looping
  11549. // through its siblings to ensure they're cached so that we don't have
  11550. // to revisit this node again. Otherwise, we make n^2 calls to getID
  11551. // when visiting the many children of a single node in order.
  11552. if (targetID === childID) {
  11553. targetChild = child;
  11554. } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
  11555. // If we find a child whose ID is an ancestor of the given ID,
  11556. // then we can be sure that we only want to search the subtree
  11557. // rooted at this child, so we can throw out the rest of the
  11558. // search state.
  11559. firstChildren.length = childIndex = 0;
  11560. firstChildren.push(child.firstChild);
  11561. }
  11562. } else {
  11563. // If this child had no ID, then there's a chance that it was
  11564. // injected automatically by the browser, as when a `<table>`
  11565. // element sprouts an extra `<tbody>` child as a side effect of
  11566. // `.innerHTML` parsing. Optimistically continue down this
  11567. // branch, but not before examining the other siblings.
  11568. firstChildren.push(child.firstChild);
  11569. }
  11570. child = child.nextSibling;
  11571. }
  11572. if (targetChild) {
  11573. // Emptying firstChildren/findComponentRootReusableArray is
  11574. // not necessary for correctness, but it helps the GC reclaim
  11575. // any nodes that were left at the end of the search.
  11576. firstChildren.length = 0;
  11577. return targetChild;
  11578. }
  11579. }
  11580. firstChildren.length = 0;
  11581. ("production" !== "development" ? invariant(
  11582. false,
  11583. 'findComponentRoot(..., %s): Unable to find element. This probably ' +
  11584. 'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
  11585. 'usually due to forgetting a <tbody> when using tables, nesting tags ' +
  11586. 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
  11587. 'parent. ' +
  11588. 'Try inspecting the child nodes of the element with React ID `%s`.',
  11589. targetID,
  11590. ReactMount.getID(ancestorNode)
  11591. ) : invariant(false));
  11592. },
  11593. _mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
  11594. ("production" !== "development" ? invariant(
  11595. container && (
  11596. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11597. ),
  11598. 'mountComponentIntoNode(...): Target container is not valid.'
  11599. ) : invariant(container && (
  11600. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11601. )));
  11602. if (shouldReuseMarkup) {
  11603. var rootElement = getReactRootElementInContainer(container);
  11604. if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
  11605. return;
  11606. } else {
  11607. var checksum = rootElement.getAttribute(
  11608. ReactMarkupChecksum.CHECKSUM_ATTR_NAME
  11609. );
  11610. rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  11611. var rootMarkup = rootElement.outerHTML;
  11612. rootElement.setAttribute(
  11613. ReactMarkupChecksum.CHECKSUM_ATTR_NAME,
  11614. checksum
  11615. );
  11616. var diffIndex = firstDifferenceIndex(markup, rootMarkup);
  11617. var difference = ' (client) ' +
  11618. markup.substring(diffIndex - 20, diffIndex + 20) +
  11619. '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
  11620. ("production" !== "development" ? invariant(
  11621. container.nodeType !== DOC_NODE_TYPE,
  11622. 'You\'re trying to render a component to the document using ' +
  11623. 'server rendering but the checksum was invalid. This usually ' +
  11624. 'means you rendered a different component type or props on ' +
  11625. 'the client from the one on the server, or your render() ' +
  11626. 'methods are impure. React cannot handle this case due to ' +
  11627. 'cross-browser quirks by rendering at the document root. You ' +
  11628. 'should look for environment dependent code in your components ' +
  11629. 'and ensure the props are the same client and server side:\n%s',
  11630. difference
  11631. ) : invariant(container.nodeType !== DOC_NODE_TYPE));
  11632. if ("production" !== "development") {
  11633. ("production" !== "development" ? warning(
  11634. false,
  11635. 'React attempted to reuse markup in a container but the ' +
  11636. 'checksum was invalid. This generally means that you are ' +
  11637. 'using server rendering and the markup generated on the ' +
  11638. 'server was not what the client was expecting. React injected ' +
  11639. 'new markup to compensate which works but you have lost many ' +
  11640. 'of the benefits of server rendering. Instead, figure out ' +
  11641. 'why the markup being generated is different on the client ' +
  11642. 'or server:\n%s',
  11643. difference
  11644. ) : null);
  11645. }
  11646. }
  11647. }
  11648. ("production" !== "development" ? invariant(
  11649. container.nodeType !== DOC_NODE_TYPE,
  11650. 'You\'re trying to render a component to the document but ' +
  11651. 'you didn\'t use server rendering. We can\'t do this ' +
  11652. 'without using server rendering due to cross-browser quirks. ' +
  11653. 'See React.renderToString() for server rendering.'
  11654. ) : invariant(container.nodeType !== DOC_NODE_TYPE));
  11655. setInnerHTML(container, markup);
  11656. },
  11657. /**
  11658. * React ID utilities.
  11659. */
  11660. getReactRootID: getReactRootID,
  11661. getID: getID,
  11662. setID: setID,
  11663. getNode: getNode,
  11664. getNodeFromInstance: getNodeFromInstance,
  11665. purgeID: purgeID
  11666. };
  11667. ReactPerf.measureMethods(ReactMount, 'ReactMount', {
  11668. _renderNewRootComponent: '_renderNewRootComponent',
  11669. _mountImageIntoNode: '_mountImageIntoNode'
  11670. });
  11671. module.exports = ReactMount;
  11672. },{"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){
  11673. /**
  11674. * Copyright 2013-2015, Facebook, Inc.
  11675. * All rights reserved.
  11676. *
  11677. * This source code is licensed under the BSD-style license found in the
  11678. * LICENSE file in the root directory of this source tree. An additional grant
  11679. * of patent rights can be found in the PATENTS file in the same directory.
  11680. *
  11681. * @providesModule ReactMultiChild
  11682. * @typechecks static-only
  11683. */
  11684. 'use strict';
  11685. var ReactComponentEnvironment = _dereq_(41);
  11686. var ReactMultiChildUpdateTypes = _dereq_(79);
  11687. var ReactReconciler = _dereq_(89);
  11688. var ReactChildReconciler = _dereq_(36);
  11689. /**
  11690. * Updating children of a component may trigger recursive updates. The depth is
  11691. * used to batch recursive updates to render markup more efficiently.
  11692. *
  11693. * @type {number}
  11694. * @private
  11695. */
  11696. var updateDepth = 0;
  11697. /**
  11698. * Queue of update configuration objects.
  11699. *
  11700. * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
  11701. *
  11702. * @type {array<object>}
  11703. * @private
  11704. */
  11705. var updateQueue = [];
  11706. /**
  11707. * Queue of markup to be rendered.
  11708. *
  11709. * @type {array<string>}
  11710. * @private
  11711. */
  11712. var markupQueue = [];
  11713. /**
  11714. * Enqueues markup to be rendered and inserted at a supplied index.
  11715. *
  11716. * @param {string} parentID ID of the parent component.
  11717. * @param {string} markup Markup that renders into an element.
  11718. * @param {number} toIndex Destination index.
  11719. * @private
  11720. */
  11721. function enqueueMarkup(parentID, markup, toIndex) {
  11722. // NOTE: Null values reduce hidden classes.
  11723. updateQueue.push({
  11724. parentID: parentID,
  11725. parentNode: null,
  11726. type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
  11727. markupIndex: markupQueue.push(markup) - 1,
  11728. textContent: null,
  11729. fromIndex: null,
  11730. toIndex: toIndex
  11731. });
  11732. }
  11733. /**
  11734. * Enqueues moving an existing element to another index.
  11735. *
  11736. * @param {string} parentID ID of the parent component.
  11737. * @param {number} fromIndex Source index of the existing element.
  11738. * @param {number} toIndex Destination index of the element.
  11739. * @private
  11740. */
  11741. function enqueueMove(parentID, fromIndex, toIndex) {
  11742. // NOTE: Null values reduce hidden classes.
  11743. updateQueue.push({
  11744. parentID: parentID,
  11745. parentNode: null,
  11746. type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
  11747. markupIndex: null,
  11748. textContent: null,
  11749. fromIndex: fromIndex,
  11750. toIndex: toIndex
  11751. });
  11752. }
  11753. /**
  11754. * Enqueues removing an element at an index.
  11755. *
  11756. * @param {string} parentID ID of the parent component.
  11757. * @param {number} fromIndex Index of the element to remove.
  11758. * @private
  11759. */
  11760. function enqueueRemove(parentID, fromIndex) {
  11761. // NOTE: Null values reduce hidden classes.
  11762. updateQueue.push({
  11763. parentID: parentID,
  11764. parentNode: null,
  11765. type: ReactMultiChildUpdateTypes.REMOVE_NODE,
  11766. markupIndex: null,
  11767. textContent: null,
  11768. fromIndex: fromIndex,
  11769. toIndex: null
  11770. });
  11771. }
  11772. /**
  11773. * Enqueues setting the text content.
  11774. *
  11775. * @param {string} parentID ID of the parent component.
  11776. * @param {string} textContent Text content to set.
  11777. * @private
  11778. */
  11779. function enqueueTextContent(parentID, textContent) {
  11780. // NOTE: Null values reduce hidden classes.
  11781. updateQueue.push({
  11782. parentID: parentID,
  11783. parentNode: null,
  11784. type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
  11785. markupIndex: null,
  11786. textContent: textContent,
  11787. fromIndex: null,
  11788. toIndex: null
  11789. });
  11790. }
  11791. /**
  11792. * Processes any enqueued updates.
  11793. *
  11794. * @private
  11795. */
  11796. function processQueue() {
  11797. if (updateQueue.length) {
  11798. ReactComponentEnvironment.processChildrenUpdates(
  11799. updateQueue,
  11800. markupQueue
  11801. );
  11802. clearQueue();
  11803. }
  11804. }
  11805. /**
  11806. * Clears any enqueued updates.
  11807. *
  11808. * @private
  11809. */
  11810. function clearQueue() {
  11811. updateQueue.length = 0;
  11812. markupQueue.length = 0;
  11813. }
  11814. /**
  11815. * ReactMultiChild are capable of reconciling multiple children.
  11816. *
  11817. * @class ReactMultiChild
  11818. * @internal
  11819. */
  11820. var ReactMultiChild = {
  11821. /**
  11822. * Provides common functionality for components that must reconcile multiple
  11823. * children. This is used by `ReactDOMComponent` to mount, update, and
  11824. * unmount child components.
  11825. *
  11826. * @lends {ReactMultiChild.prototype}
  11827. */
  11828. Mixin: {
  11829. /**
  11830. * Generates a "mount image" for each of the supplied children. In the case
  11831. * of `ReactDOMComponent`, a mount image is a string of markup.
  11832. *
  11833. * @param {?object} nestedChildren Nested child maps.
  11834. * @return {array} An array of mounted representations.
  11835. * @internal
  11836. */
  11837. mountChildren: function(nestedChildren, transaction, context) {
  11838. var children = ReactChildReconciler.instantiateChildren(
  11839. nestedChildren, transaction, context
  11840. );
  11841. this._renderedChildren = children;
  11842. var mountImages = [];
  11843. var index = 0;
  11844. for (var name in children) {
  11845. if (children.hasOwnProperty(name)) {
  11846. var child = children[name];
  11847. // Inlined for performance, see `ReactInstanceHandles.createReactID`.
  11848. var rootID = this._rootNodeID + name;
  11849. var mountImage = ReactReconciler.mountComponent(
  11850. child,
  11851. rootID,
  11852. transaction,
  11853. context
  11854. );
  11855. child._mountIndex = index;
  11856. mountImages.push(mountImage);
  11857. index++;
  11858. }
  11859. }
  11860. return mountImages;
  11861. },
  11862. /**
  11863. * Replaces any rendered children with a text content string.
  11864. *
  11865. * @param {string} nextContent String of content.
  11866. * @internal
  11867. */
  11868. updateTextContent: function(nextContent) {
  11869. updateDepth++;
  11870. var errorThrown = true;
  11871. try {
  11872. var prevChildren = this._renderedChildren;
  11873. // Remove any rendered children.
  11874. ReactChildReconciler.unmountChildren(prevChildren);
  11875. // TODO: The setTextContent operation should be enough
  11876. for (var name in prevChildren) {
  11877. if (prevChildren.hasOwnProperty(name)) {
  11878. this._unmountChildByName(prevChildren[name], name);
  11879. }
  11880. }
  11881. // Set new text content.
  11882. this.setTextContent(nextContent);
  11883. errorThrown = false;
  11884. } finally {
  11885. updateDepth--;
  11886. if (!updateDepth) {
  11887. if (errorThrown) {
  11888. clearQueue();
  11889. } else {
  11890. processQueue();
  11891. }
  11892. }
  11893. }
  11894. },
  11895. /**
  11896. * Updates the rendered children with new children.
  11897. *
  11898. * @param {?object} nextNestedChildren Nested child maps.
  11899. * @param {ReactReconcileTransaction} transaction
  11900. * @internal
  11901. */
  11902. updateChildren: function(nextNestedChildren, transaction, context) {
  11903. updateDepth++;
  11904. var errorThrown = true;
  11905. try {
  11906. this._updateChildren(nextNestedChildren, transaction, context);
  11907. errorThrown = false;
  11908. } finally {
  11909. updateDepth--;
  11910. if (!updateDepth) {
  11911. if (errorThrown) {
  11912. clearQueue();
  11913. } else {
  11914. processQueue();
  11915. }
  11916. }
  11917. }
  11918. },
  11919. /**
  11920. * Improve performance by isolating this hot code path from the try/catch
  11921. * block in `updateChildren`.
  11922. *
  11923. * @param {?object} nextNestedChildren Nested child maps.
  11924. * @param {ReactReconcileTransaction} transaction
  11925. * @final
  11926. * @protected
  11927. */
  11928. _updateChildren: function(nextNestedChildren, transaction, context) {
  11929. var prevChildren = this._renderedChildren;
  11930. var nextChildren = ReactChildReconciler.updateChildren(
  11931. prevChildren, nextNestedChildren, transaction, context
  11932. );
  11933. this._renderedChildren = nextChildren;
  11934. if (!nextChildren && !prevChildren) {
  11935. return;
  11936. }
  11937. var name;
  11938. // `nextIndex` will increment for each child in `nextChildren`, but
  11939. // `lastIndex` will be the last index visited in `prevChildren`.
  11940. var lastIndex = 0;
  11941. var nextIndex = 0;
  11942. for (name in nextChildren) {
  11943. if (!nextChildren.hasOwnProperty(name)) {
  11944. continue;
  11945. }
  11946. var prevChild = prevChildren && prevChildren[name];
  11947. var nextChild = nextChildren[name];
  11948. if (prevChild === nextChild) {
  11949. this.moveChild(prevChild, nextIndex, lastIndex);
  11950. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  11951. prevChild._mountIndex = nextIndex;
  11952. } else {
  11953. if (prevChild) {
  11954. // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
  11955. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  11956. this._unmountChildByName(prevChild, name);
  11957. }
  11958. // The child must be instantiated before it's mounted.
  11959. this._mountChildByNameAtIndex(
  11960. nextChild, name, nextIndex, transaction, context
  11961. );
  11962. }
  11963. nextIndex++;
  11964. }
  11965. // Remove children that are no longer present.
  11966. for (name in prevChildren) {
  11967. if (prevChildren.hasOwnProperty(name) &&
  11968. !(nextChildren && nextChildren.hasOwnProperty(name))) {
  11969. this._unmountChildByName(prevChildren[name], name);
  11970. }
  11971. }
  11972. },
  11973. /**
  11974. * Unmounts all rendered children. This should be used to clean up children
  11975. * when this component is unmounted.
  11976. *
  11977. * @internal
  11978. */
  11979. unmountChildren: function() {
  11980. var renderedChildren = this._renderedChildren;
  11981. ReactChildReconciler.unmountChildren(renderedChildren);
  11982. this._renderedChildren = null;
  11983. },
  11984. /**
  11985. * Moves a child component to the supplied index.
  11986. *
  11987. * @param {ReactComponent} child Component to move.
  11988. * @param {number} toIndex Destination index of the element.
  11989. * @param {number} lastIndex Last index visited of the siblings of `child`.
  11990. * @protected
  11991. */
  11992. moveChild: function(child, toIndex, lastIndex) {
  11993. // If the index of `child` is less than `lastIndex`, then it needs to
  11994. // be moved. Otherwise, we do not need to move it because a child will be
  11995. // inserted or moved before `child`.
  11996. if (child._mountIndex < lastIndex) {
  11997. enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
  11998. }
  11999. },
  12000. /**
  12001. * Creates a child component.
  12002. *
  12003. * @param {ReactComponent} child Component to create.
  12004. * @param {string} mountImage Markup to insert.
  12005. * @protected
  12006. */
  12007. createChild: function(child, mountImage) {
  12008. enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
  12009. },
  12010. /**
  12011. * Removes a child component.
  12012. *
  12013. * @param {ReactComponent} child Child to remove.
  12014. * @protected
  12015. */
  12016. removeChild: function(child) {
  12017. enqueueRemove(this._rootNodeID, child._mountIndex);
  12018. },
  12019. /**
  12020. * Sets this text content string.
  12021. *
  12022. * @param {string} textContent Text content to set.
  12023. * @protected
  12024. */
  12025. setTextContent: function(textContent) {
  12026. enqueueTextContent(this._rootNodeID, textContent);
  12027. },
  12028. /**
  12029. * Mounts a child with the supplied name.
  12030. *
  12031. * NOTE: This is part of `updateChildren` and is here for readability.
  12032. *
  12033. * @param {ReactComponent} child Component to mount.
  12034. * @param {string} name Name of the child.
  12035. * @param {number} index Index at which to insert the child.
  12036. * @param {ReactReconcileTransaction} transaction
  12037. * @private
  12038. */
  12039. _mountChildByNameAtIndex: function(
  12040. child,
  12041. name,
  12042. index,
  12043. transaction,
  12044. context) {
  12045. // Inlined for performance, see `ReactInstanceHandles.createReactID`.
  12046. var rootID = this._rootNodeID + name;
  12047. var mountImage = ReactReconciler.mountComponent(
  12048. child,
  12049. rootID,
  12050. transaction,
  12051. context
  12052. );
  12053. child._mountIndex = index;
  12054. this.createChild(child, mountImage);
  12055. },
  12056. /**
  12057. * Unmounts a rendered child by name.
  12058. *
  12059. * NOTE: This is part of `updateChildren` and is here for readability.
  12060. *
  12061. * @param {ReactComponent} child Component to unmount.
  12062. * @param {string} name Name of the child in `this._renderedChildren`.
  12063. * @private
  12064. */
  12065. _unmountChildByName: function(child, name) {
  12066. this.removeChild(child);
  12067. child._mountIndex = null;
  12068. }
  12069. }
  12070. };
  12071. module.exports = ReactMultiChild;
  12072. },{"36":36,"41":41,"79":79,"89":89}],79:[function(_dereq_,module,exports){
  12073. /**
  12074. * Copyright 2013-2015, Facebook, Inc.
  12075. * All rights reserved.
  12076. *
  12077. * This source code is licensed under the BSD-style license found in the
  12078. * LICENSE file in the root directory of this source tree. An additional grant
  12079. * of patent rights can be found in the PATENTS file in the same directory.
  12080. *
  12081. * @providesModule ReactMultiChildUpdateTypes
  12082. */
  12083. 'use strict';
  12084. var keyMirror = _dereq_(156);
  12085. /**
  12086. * When a component's children are updated, a series of update configuration
  12087. * objects are created in order to batch and serialize the required changes.
  12088. *
  12089. * Enumerates all the possible types of update configurations.
  12090. *
  12091. * @internal
  12092. */
  12093. var ReactMultiChildUpdateTypes = keyMirror({
  12094. INSERT_MARKUP: null,
  12095. MOVE_EXISTING: null,
  12096. REMOVE_NODE: null,
  12097. TEXT_CONTENT: null
  12098. });
  12099. module.exports = ReactMultiChildUpdateTypes;
  12100. },{"156":156}],80:[function(_dereq_,module,exports){
  12101. /**
  12102. * Copyright 2014-2015, Facebook, Inc.
  12103. * All rights reserved.
  12104. *
  12105. * This source code is licensed under the BSD-style license found in the
  12106. * LICENSE file in the root directory of this source tree. An additional grant
  12107. * of patent rights can be found in the PATENTS file in the same directory.
  12108. *
  12109. * @providesModule ReactNativeComponent
  12110. */
  12111. 'use strict';
  12112. var assign = _dereq_(29);
  12113. var invariant = _dereq_(150);
  12114. var autoGenerateWrapperClass = null;
  12115. var genericComponentClass = null;
  12116. // This registry keeps track of wrapper classes around native tags
  12117. var tagToComponentClass = {};
  12118. var textComponentClass = null;
  12119. var ReactNativeComponentInjection = {
  12120. // This accepts a class that receives the tag string. This is a catch all
  12121. // that can render any kind of tag.
  12122. injectGenericComponentClass: function(componentClass) {
  12123. genericComponentClass = componentClass;
  12124. },
  12125. // This accepts a text component class that takes the text string to be
  12126. // rendered as props.
  12127. injectTextComponentClass: function(componentClass) {
  12128. textComponentClass = componentClass;
  12129. },
  12130. // This accepts a keyed object with classes as values. Each key represents a
  12131. // tag. That particular tag will use this class instead of the generic one.
  12132. injectComponentClasses: function(componentClasses) {
  12133. assign(tagToComponentClass, componentClasses);
  12134. },
  12135. // Temporary hack since we expect DOM refs to behave like composites,
  12136. // for this release.
  12137. injectAutoWrapper: function(wrapperFactory) {
  12138. autoGenerateWrapperClass = wrapperFactory;
  12139. }
  12140. };
  12141. /**
  12142. * Get a composite component wrapper class for a specific tag.
  12143. *
  12144. * @param {ReactElement} element The tag for which to get the class.
  12145. * @return {function} The React class constructor function.
  12146. */
  12147. function getComponentClassForElement(element) {
  12148. if (typeof element.type === 'function') {
  12149. return element.type;
  12150. }
  12151. var tag = element.type;
  12152. var componentClass = tagToComponentClass[tag];
  12153. if (componentClass == null) {
  12154. tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
  12155. }
  12156. return componentClass;
  12157. }
  12158. /**
  12159. * Get a native internal component class for a specific tag.
  12160. *
  12161. * @param {ReactElement} element The element to create.
  12162. * @return {function} The internal class constructor function.
  12163. */
  12164. function createInternalComponent(element) {
  12165. ("production" !== "development" ? invariant(
  12166. genericComponentClass,
  12167. 'There is no registered component for the tag %s',
  12168. element.type
  12169. ) : invariant(genericComponentClass));
  12170. return new genericComponentClass(element.type, element.props);
  12171. }
  12172. /**
  12173. * @param {ReactText} text
  12174. * @return {ReactComponent}
  12175. */
  12176. function createInstanceForText(text) {
  12177. return new textComponentClass(text);
  12178. }
  12179. /**
  12180. * @param {ReactComponent} component
  12181. * @return {boolean}
  12182. */
  12183. function isTextComponent(component) {
  12184. return component instanceof textComponentClass;
  12185. }
  12186. var ReactNativeComponent = {
  12187. getComponentClassForElement: getComponentClassForElement,
  12188. createInternalComponent: createInternalComponent,
  12189. createInstanceForText: createInstanceForText,
  12190. isTextComponent: isTextComponent,
  12191. injection: ReactNativeComponentInjection
  12192. };
  12193. module.exports = ReactNativeComponent;
  12194. },{"150":150,"29":29}],81:[function(_dereq_,module,exports){
  12195. /**
  12196. * Copyright 2013-2015, Facebook, Inc.
  12197. * All rights reserved.
  12198. *
  12199. * This source code is licensed under the BSD-style license found in the
  12200. * LICENSE file in the root directory of this source tree. An additional grant
  12201. * of patent rights can be found in the PATENTS file in the same directory.
  12202. *
  12203. * @providesModule ReactOwner
  12204. */
  12205. 'use strict';
  12206. var invariant = _dereq_(150);
  12207. /**
  12208. * ReactOwners are capable of storing references to owned components.
  12209. *
  12210. * All components are capable of //being// referenced by owner components, but
  12211. * only ReactOwner components are capable of //referencing// owned components.
  12212. * The named reference is known as a "ref".
  12213. *
  12214. * Refs are available when mounted and updated during reconciliation.
  12215. *
  12216. * var MyComponent = React.createClass({
  12217. * render: function() {
  12218. * return (
  12219. * <div onClick={this.handleClick}>
  12220. * <CustomComponent ref="custom" />
  12221. * </div>
  12222. * );
  12223. * },
  12224. * handleClick: function() {
  12225. * this.refs.custom.handleClick();
  12226. * },
  12227. * componentDidMount: function() {
  12228. * this.refs.custom.initialize();
  12229. * }
  12230. * });
  12231. *
  12232. * Refs should rarely be used. When refs are used, they should only be done to
  12233. * control data that is not handled by React's data flow.
  12234. *
  12235. * @class ReactOwner
  12236. */
  12237. var ReactOwner = {
  12238. /**
  12239. * @param {?object} object
  12240. * @return {boolean} True if `object` is a valid owner.
  12241. * @final
  12242. */
  12243. isValidOwner: function(object) {
  12244. return !!(
  12245. (object &&
  12246. typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
  12247. );
  12248. },
  12249. /**
  12250. * Adds a component by ref to an owner component.
  12251. *
  12252. * @param {ReactComponent} component Component to reference.
  12253. * @param {string} ref Name by which to refer to the component.
  12254. * @param {ReactOwner} owner Component on which to record the ref.
  12255. * @final
  12256. * @internal
  12257. */
  12258. addComponentAsRefTo: function(component, ref, owner) {
  12259. ("production" !== "development" ? invariant(
  12260. ReactOwner.isValidOwner(owner),
  12261. 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
  12262. 'usually means that you\'re trying to add a ref to a component that ' +
  12263. 'doesn\'t have an owner (that is, was not created inside of another ' +
  12264. 'component\'s `render` method). Try rendering this component inside of ' +
  12265. 'a new top-level component which will hold the ref.'
  12266. ) : invariant(ReactOwner.isValidOwner(owner)));
  12267. owner.attachRef(ref, component);
  12268. },
  12269. /**
  12270. * Removes a component by ref from an owner component.
  12271. *
  12272. * @param {ReactComponent} component Component to dereference.
  12273. * @param {string} ref Name of the ref to remove.
  12274. * @param {ReactOwner} owner Component on which the ref is recorded.
  12275. * @final
  12276. * @internal
  12277. */
  12278. removeComponentAsRefFrom: function(component, ref, owner) {
  12279. ("production" !== "development" ? invariant(
  12280. ReactOwner.isValidOwner(owner),
  12281. 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
  12282. 'usually means that you\'re trying to remove a ref to a component that ' +
  12283. 'doesn\'t have an owner (that is, was not created inside of another ' +
  12284. 'component\'s `render` method). Try rendering this component inside of ' +
  12285. 'a new top-level component which will hold the ref.'
  12286. ) : invariant(ReactOwner.isValidOwner(owner)));
  12287. // Check that `component` is still the current ref because we do not want to
  12288. // detach the ref if another component stole it.
  12289. if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
  12290. owner.detachRef(ref);
  12291. }
  12292. }
  12293. };
  12294. module.exports = ReactOwner;
  12295. },{"150":150}],82:[function(_dereq_,module,exports){
  12296. /**
  12297. * Copyright 2013-2015, Facebook, Inc.
  12298. * All rights reserved.
  12299. *
  12300. * This source code is licensed under the BSD-style license found in the
  12301. * LICENSE file in the root directory of this source tree. An additional grant
  12302. * of patent rights can be found in the PATENTS file in the same directory.
  12303. *
  12304. * @providesModule ReactPerf
  12305. * @typechecks static-only
  12306. */
  12307. 'use strict';
  12308. /**
  12309. * ReactPerf is a general AOP system designed to measure performance. This
  12310. * module only has the hooks: see ReactDefaultPerf for the analysis tool.
  12311. */
  12312. var ReactPerf = {
  12313. /**
  12314. * Boolean to enable/disable measurement. Set to false by default to prevent
  12315. * accidental logging and perf loss.
  12316. */
  12317. enableMeasure: false,
  12318. /**
  12319. * Holds onto the measure function in use. By default, don't measure
  12320. * anything, but we'll override this if we inject a measure function.
  12321. */
  12322. storedMeasure: _noMeasure,
  12323. /**
  12324. * @param {object} object
  12325. * @param {string} objectName
  12326. * @param {object<string>} methodNames
  12327. */
  12328. measureMethods: function(object, objectName, methodNames) {
  12329. if ("production" !== "development") {
  12330. for (var key in methodNames) {
  12331. if (!methodNames.hasOwnProperty(key)) {
  12332. continue;
  12333. }
  12334. object[key] = ReactPerf.measure(
  12335. objectName,
  12336. methodNames[key],
  12337. object[key]
  12338. );
  12339. }
  12340. }
  12341. },
  12342. /**
  12343. * Use this to wrap methods you want to measure. Zero overhead in production.
  12344. *
  12345. * @param {string} objName
  12346. * @param {string} fnName
  12347. * @param {function} func
  12348. * @return {function}
  12349. */
  12350. measure: function(objName, fnName, func) {
  12351. if ("production" !== "development") {
  12352. var measuredFunc = null;
  12353. var wrapper = function() {
  12354. if (ReactPerf.enableMeasure) {
  12355. if (!measuredFunc) {
  12356. measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
  12357. }
  12358. return measuredFunc.apply(this, arguments);
  12359. }
  12360. return func.apply(this, arguments);
  12361. };
  12362. wrapper.displayName = objName + '_' + fnName;
  12363. return wrapper;
  12364. }
  12365. return func;
  12366. },
  12367. injection: {
  12368. /**
  12369. * @param {function} measure
  12370. */
  12371. injectMeasure: function(measure) {
  12372. ReactPerf.storedMeasure = measure;
  12373. }
  12374. }
  12375. };
  12376. /**
  12377. * Simply passes through the measured function, without measuring it.
  12378. *
  12379. * @param {string} objName
  12380. * @param {string} fnName
  12381. * @param {function} func
  12382. * @return {function}
  12383. */
  12384. function _noMeasure(objName, fnName, func) {
  12385. return func;
  12386. }
  12387. module.exports = ReactPerf;
  12388. },{}],83:[function(_dereq_,module,exports){
  12389. /**
  12390. * Copyright 2013-2015, Facebook, Inc.
  12391. * All rights reserved.
  12392. *
  12393. * This source code is licensed under the BSD-style license found in the
  12394. * LICENSE file in the root directory of this source tree. An additional grant
  12395. * of patent rights can be found in the PATENTS file in the same directory.
  12396. *
  12397. * @providesModule ReactPropTransferer
  12398. */
  12399. 'use strict';
  12400. var assign = _dereq_(29);
  12401. var emptyFunction = _dereq_(129);
  12402. var joinClasses = _dereq_(155);
  12403. /**
  12404. * Creates a transfer strategy that will merge prop values using the supplied
  12405. * `mergeStrategy`. If a prop was previously unset, this just sets it.
  12406. *
  12407. * @param {function} mergeStrategy
  12408. * @return {function}
  12409. */
  12410. function createTransferStrategy(mergeStrategy) {
  12411. return function(props, key, value) {
  12412. if (!props.hasOwnProperty(key)) {
  12413. props[key] = value;
  12414. } else {
  12415. props[key] = mergeStrategy(props[key], value);
  12416. }
  12417. };
  12418. }
  12419. var transferStrategyMerge = createTransferStrategy(function(a, b) {
  12420. // `merge` overrides the first object's (`props[key]` above) keys using the
  12421. // second object's (`value`) keys. An object's style's existing `propA` would
  12422. // get overridden. Flip the order here.
  12423. return assign({}, b, a);
  12424. });
  12425. /**
  12426. * Transfer strategies dictate how props are transferred by `transferPropsTo`.
  12427. * NOTE: if you add any more exceptions to this list you should be sure to
  12428. * update `cloneWithProps()` accordingly.
  12429. */
  12430. var TransferStrategies = {
  12431. /**
  12432. * Never transfer `children`.
  12433. */
  12434. children: emptyFunction,
  12435. /**
  12436. * Transfer the `className` prop by merging them.
  12437. */
  12438. className: createTransferStrategy(joinClasses),
  12439. /**
  12440. * Transfer the `style` prop (which is an object) by merging them.
  12441. */
  12442. style: transferStrategyMerge
  12443. };
  12444. /**
  12445. * Mutates the first argument by transferring the properties from the second
  12446. * argument.
  12447. *
  12448. * @param {object} props
  12449. * @param {object} newProps
  12450. * @return {object}
  12451. */
  12452. function transferInto(props, newProps) {
  12453. for (var thisKey in newProps) {
  12454. if (!newProps.hasOwnProperty(thisKey)) {
  12455. continue;
  12456. }
  12457. var transferStrategy = TransferStrategies[thisKey];
  12458. if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) {
  12459. transferStrategy(props, thisKey, newProps[thisKey]);
  12460. } else if (!props.hasOwnProperty(thisKey)) {
  12461. props[thisKey] = newProps[thisKey];
  12462. }
  12463. }
  12464. return props;
  12465. }
  12466. /**
  12467. * ReactPropTransferer are capable of transferring props to another component
  12468. * using a `transferPropsTo` method.
  12469. *
  12470. * @class ReactPropTransferer
  12471. */
  12472. var ReactPropTransferer = {
  12473. /**
  12474. * Merge two props objects using TransferStrategies.
  12475. *
  12476. * @param {object} oldProps original props (they take precedence)
  12477. * @param {object} newProps new props to merge in
  12478. * @return {object} a new object containing both sets of props merged.
  12479. */
  12480. mergeProps: function(oldProps, newProps) {
  12481. return transferInto(assign({}, oldProps), newProps);
  12482. }
  12483. };
  12484. module.exports = ReactPropTransferer;
  12485. },{"129":129,"155":155,"29":29}],84:[function(_dereq_,module,exports){
  12486. /**
  12487. * Copyright 2013-2015, Facebook, Inc.
  12488. * All rights reserved.
  12489. *
  12490. * This source code is licensed under the BSD-style license found in the
  12491. * LICENSE file in the root directory of this source tree. An additional grant
  12492. * of patent rights can be found in the PATENTS file in the same directory.
  12493. *
  12494. * @providesModule ReactPropTypeLocationNames
  12495. */
  12496. 'use strict';
  12497. var ReactPropTypeLocationNames = {};
  12498. if ("production" !== "development") {
  12499. ReactPropTypeLocationNames = {
  12500. prop: 'prop',
  12501. context: 'context',
  12502. childContext: 'child context'
  12503. };
  12504. }
  12505. module.exports = ReactPropTypeLocationNames;
  12506. },{}],85:[function(_dereq_,module,exports){
  12507. /**
  12508. * Copyright 2013-2015, Facebook, Inc.
  12509. * All rights reserved.
  12510. *
  12511. * This source code is licensed under the BSD-style license found in the
  12512. * LICENSE file in the root directory of this source tree. An additional grant
  12513. * of patent rights can be found in the PATENTS file in the same directory.
  12514. *
  12515. * @providesModule ReactPropTypeLocations
  12516. */
  12517. 'use strict';
  12518. var keyMirror = _dereq_(156);
  12519. var ReactPropTypeLocations = keyMirror({
  12520. prop: null,
  12521. context: null,
  12522. childContext: null
  12523. });
  12524. module.exports = ReactPropTypeLocations;
  12525. },{"156":156}],86:[function(_dereq_,module,exports){
  12526. /**
  12527. * Copyright 2013-2015, Facebook, Inc.
  12528. * All rights reserved.
  12529. *
  12530. * This source code is licensed under the BSD-style license found in the
  12531. * LICENSE file in the root directory of this source tree. An additional grant
  12532. * of patent rights can be found in the PATENTS file in the same directory.
  12533. *
  12534. * @providesModule ReactPropTypes
  12535. */
  12536. 'use strict';
  12537. var ReactElement = _dereq_(63);
  12538. var ReactFragment = _dereq_(69);
  12539. var ReactPropTypeLocationNames = _dereq_(84);
  12540. var emptyFunction = _dereq_(129);
  12541. /**
  12542. * Collection of methods that allow declaration and validation of props that are
  12543. * supplied to React components. Example usage:
  12544. *
  12545. * var Props = require('ReactPropTypes');
  12546. * var MyArticle = React.createClass({
  12547. * propTypes: {
  12548. * // An optional string prop named "description".
  12549. * description: Props.string,
  12550. *
  12551. * // A required enum prop named "category".
  12552. * category: Props.oneOf(['News','Photos']).isRequired,
  12553. *
  12554. * // A prop named "dialog" that requires an instance of Dialog.
  12555. * dialog: Props.instanceOf(Dialog).isRequired
  12556. * },
  12557. * render: function() { ... }
  12558. * });
  12559. *
  12560. * A more formal specification of how these methods are used:
  12561. *
  12562. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  12563. * decl := ReactPropTypes.{type}(.isRequired)?
  12564. *
  12565. * Each and every declaration produces a function with the same signature. This
  12566. * allows the creation of custom validation functions. For example:
  12567. *
  12568. * var MyLink = React.createClass({
  12569. * propTypes: {
  12570. * // An optional string or URI prop named "href".
  12571. * href: function(props, propName, componentName) {
  12572. * var propValue = props[propName];
  12573. * if (propValue != null && typeof propValue !== 'string' &&
  12574. * !(propValue instanceof URI)) {
  12575. * return new Error(
  12576. * 'Expected a string or an URI for ' + propName + ' in ' +
  12577. * componentName
  12578. * );
  12579. * }
  12580. * }
  12581. * },
  12582. * render: function() {...}
  12583. * });
  12584. *
  12585. * @internal
  12586. */
  12587. var ANONYMOUS = '<<anonymous>>';
  12588. var elementTypeChecker = createElementTypeChecker();
  12589. var nodeTypeChecker = createNodeChecker();
  12590. var ReactPropTypes = {
  12591. array: createPrimitiveTypeChecker('array'),
  12592. bool: createPrimitiveTypeChecker('boolean'),
  12593. func: createPrimitiveTypeChecker('function'),
  12594. number: createPrimitiveTypeChecker('number'),
  12595. object: createPrimitiveTypeChecker('object'),
  12596. string: createPrimitiveTypeChecker('string'),
  12597. any: createAnyTypeChecker(),
  12598. arrayOf: createArrayOfTypeChecker,
  12599. element: elementTypeChecker,
  12600. instanceOf: createInstanceTypeChecker,
  12601. node: nodeTypeChecker,
  12602. objectOf: createObjectOfTypeChecker,
  12603. oneOf: createEnumTypeChecker,
  12604. oneOfType: createUnionTypeChecker,
  12605. shape: createShapeTypeChecker
  12606. };
  12607. function createChainableTypeChecker(validate) {
  12608. function checkType(isRequired, props, propName, componentName, location) {
  12609. componentName = componentName || ANONYMOUS;
  12610. if (props[propName] == null) {
  12611. var locationName = ReactPropTypeLocationNames[location];
  12612. if (isRequired) {
  12613. return new Error(
  12614. ("Required " + locationName + " `" + propName + "` was not specified in ") +
  12615. ("`" + componentName + "`.")
  12616. );
  12617. }
  12618. return null;
  12619. } else {
  12620. return validate(props, propName, componentName, location);
  12621. }
  12622. }
  12623. var chainedCheckType = checkType.bind(null, false);
  12624. chainedCheckType.isRequired = checkType.bind(null, true);
  12625. return chainedCheckType;
  12626. }
  12627. function createPrimitiveTypeChecker(expectedType) {
  12628. function validate(props, propName, componentName, location) {
  12629. var propValue = props[propName];
  12630. var propType = getPropType(propValue);
  12631. if (propType !== expectedType) {
  12632. var locationName = ReactPropTypeLocationNames[location];
  12633. // `propValue` being instance of, say, date/regexp, pass the 'object'
  12634. // check, but we can offer a more precise error message here rather than
  12635. // 'of type `object`'.
  12636. var preciseType = getPreciseType(propValue);
  12637. return new Error(
  12638. ("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") +
  12639. ("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
  12640. );
  12641. }
  12642. return null;
  12643. }
  12644. return createChainableTypeChecker(validate);
  12645. }
  12646. function createAnyTypeChecker() {
  12647. return createChainableTypeChecker(emptyFunction.thatReturns(null));
  12648. }
  12649. function createArrayOfTypeChecker(typeChecker) {
  12650. function validate(props, propName, componentName, location) {
  12651. var propValue = props[propName];
  12652. if (!Array.isArray(propValue)) {
  12653. var locationName = ReactPropTypeLocationNames[location];
  12654. var propType = getPropType(propValue);
  12655. return new Error(
  12656. ("Invalid " + locationName + " `" + propName + "` of type ") +
  12657. ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")
  12658. );
  12659. }
  12660. for (var i = 0; i < propValue.length; i++) {
  12661. var error = typeChecker(propValue, i, componentName, location);
  12662. if (error instanceof Error) {
  12663. return error;
  12664. }
  12665. }
  12666. return null;
  12667. }
  12668. return createChainableTypeChecker(validate);
  12669. }
  12670. function createElementTypeChecker() {
  12671. function validate(props, propName, componentName, location) {
  12672. if (!ReactElement.isValidElement(props[propName])) {
  12673. var locationName = ReactPropTypeLocationNames[location];
  12674. return new Error(
  12675. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12676. ("`" + componentName + "`, expected a ReactElement.")
  12677. );
  12678. }
  12679. return null;
  12680. }
  12681. return createChainableTypeChecker(validate);
  12682. }
  12683. function createInstanceTypeChecker(expectedClass) {
  12684. function validate(props, propName, componentName, location) {
  12685. if (!(props[propName] instanceof expectedClass)) {
  12686. var locationName = ReactPropTypeLocationNames[location];
  12687. var expectedClassName = expectedClass.name || ANONYMOUS;
  12688. return new Error(
  12689. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12690. ("`" + componentName + "`, expected instance of `" + expectedClassName + "`.")
  12691. );
  12692. }
  12693. return null;
  12694. }
  12695. return createChainableTypeChecker(validate);
  12696. }
  12697. function createEnumTypeChecker(expectedValues) {
  12698. function validate(props, propName, componentName, location) {
  12699. var propValue = props[propName];
  12700. for (var i = 0; i < expectedValues.length; i++) {
  12701. if (propValue === expectedValues[i]) {
  12702. return null;
  12703. }
  12704. }
  12705. var locationName = ReactPropTypeLocationNames[location];
  12706. var valuesString = JSON.stringify(expectedValues);
  12707. return new Error(
  12708. ("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") +
  12709. ("supplied to `" + componentName + "`, expected one of " + valuesString + ".")
  12710. );
  12711. }
  12712. return createChainableTypeChecker(validate);
  12713. }
  12714. function createObjectOfTypeChecker(typeChecker) {
  12715. function validate(props, propName, componentName, location) {
  12716. var propValue = props[propName];
  12717. var propType = getPropType(propValue);
  12718. if (propType !== 'object') {
  12719. var locationName = ReactPropTypeLocationNames[location];
  12720. return new Error(
  12721. ("Invalid " + locationName + " `" + propName + "` of type ") +
  12722. ("`" + propType + "` supplied to `" + componentName + "`, expected an object.")
  12723. );
  12724. }
  12725. for (var key in propValue) {
  12726. if (propValue.hasOwnProperty(key)) {
  12727. var error = typeChecker(propValue, key, componentName, location);
  12728. if (error instanceof Error) {
  12729. return error;
  12730. }
  12731. }
  12732. }
  12733. return null;
  12734. }
  12735. return createChainableTypeChecker(validate);
  12736. }
  12737. function createUnionTypeChecker(arrayOfTypeCheckers) {
  12738. function validate(props, propName, componentName, location) {
  12739. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  12740. var checker = arrayOfTypeCheckers[i];
  12741. if (checker(props, propName, componentName, location) == null) {
  12742. return null;
  12743. }
  12744. }
  12745. var locationName = ReactPropTypeLocationNames[location];
  12746. return new Error(
  12747. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12748. ("`" + componentName + "`.")
  12749. );
  12750. }
  12751. return createChainableTypeChecker(validate);
  12752. }
  12753. function createNodeChecker() {
  12754. function validate(props, propName, componentName, location) {
  12755. if (!isNode(props[propName])) {
  12756. var locationName = ReactPropTypeLocationNames[location];
  12757. return new Error(
  12758. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12759. ("`" + componentName + "`, expected a ReactNode.")
  12760. );
  12761. }
  12762. return null;
  12763. }
  12764. return createChainableTypeChecker(validate);
  12765. }
  12766. function createShapeTypeChecker(shapeTypes) {
  12767. function validate(props, propName, componentName, location) {
  12768. var propValue = props[propName];
  12769. var propType = getPropType(propValue);
  12770. if (propType !== 'object') {
  12771. var locationName = ReactPropTypeLocationNames[location];
  12772. return new Error(
  12773. ("Invalid " + locationName + " `" + propName + "` of type `" + propType + "` ") +
  12774. ("supplied to `" + componentName + "`, expected `object`.")
  12775. );
  12776. }
  12777. for (var key in shapeTypes) {
  12778. var checker = shapeTypes[key];
  12779. if (!checker) {
  12780. continue;
  12781. }
  12782. var error = checker(propValue, key, componentName, location);
  12783. if (error) {
  12784. return error;
  12785. }
  12786. }
  12787. return null;
  12788. }
  12789. return createChainableTypeChecker(validate);
  12790. }
  12791. function isNode(propValue) {
  12792. switch (typeof propValue) {
  12793. case 'number':
  12794. case 'string':
  12795. case 'undefined':
  12796. return true;
  12797. case 'boolean':
  12798. return !propValue;
  12799. case 'object':
  12800. if (Array.isArray(propValue)) {
  12801. return propValue.every(isNode);
  12802. }
  12803. if (propValue === null || ReactElement.isValidElement(propValue)) {
  12804. return true;
  12805. }
  12806. propValue = ReactFragment.extractIfFragment(propValue);
  12807. for (var k in propValue) {
  12808. if (!isNode(propValue[k])) {
  12809. return false;
  12810. }
  12811. }
  12812. return true;
  12813. default:
  12814. return false;
  12815. }
  12816. }
  12817. // Equivalent of `typeof` but with special handling for array and regexp.
  12818. function getPropType(propValue) {
  12819. var propType = typeof propValue;
  12820. if (Array.isArray(propValue)) {
  12821. return 'array';
  12822. }
  12823. if (propValue instanceof RegExp) {
  12824. // Old webkits (at least until Android 4.0) return 'function' rather than
  12825. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  12826. // passes PropTypes.object.
  12827. return 'object';
  12828. }
  12829. return propType;
  12830. }
  12831. // This handles more types than `getPropType`. Only used for error messages.
  12832. // See `createPrimitiveTypeChecker`.
  12833. function getPreciseType(propValue) {
  12834. var propType = getPropType(propValue);
  12835. if (propType === 'object') {
  12836. if (propValue instanceof Date) {
  12837. return 'date';
  12838. } else if (propValue instanceof RegExp) {
  12839. return 'regexp';
  12840. }
  12841. }
  12842. return propType;
  12843. }
  12844. module.exports = ReactPropTypes;
  12845. },{"129":129,"63":63,"69":69,"84":84}],87:[function(_dereq_,module,exports){
  12846. /**
  12847. * Copyright 2013-2015, Facebook, Inc.
  12848. * All rights reserved.
  12849. *
  12850. * This source code is licensed under the BSD-style license found in the
  12851. * LICENSE file in the root directory of this source tree. An additional grant
  12852. * of patent rights can be found in the PATENTS file in the same directory.
  12853. *
  12854. * @providesModule ReactPutListenerQueue
  12855. */
  12856. 'use strict';
  12857. var PooledClass = _dereq_(30);
  12858. var ReactBrowserEventEmitter = _dereq_(33);
  12859. var assign = _dereq_(29);
  12860. function ReactPutListenerQueue() {
  12861. this.listenersToPut = [];
  12862. }
  12863. assign(ReactPutListenerQueue.prototype, {
  12864. enqueuePutListener: function(rootNodeID, propKey, propValue) {
  12865. this.listenersToPut.push({
  12866. rootNodeID: rootNodeID,
  12867. propKey: propKey,
  12868. propValue: propValue
  12869. });
  12870. },
  12871. putListeners: function() {
  12872. for (var i = 0; i < this.listenersToPut.length; i++) {
  12873. var listenerToPut = this.listenersToPut[i];
  12874. ReactBrowserEventEmitter.putListener(
  12875. listenerToPut.rootNodeID,
  12876. listenerToPut.propKey,
  12877. listenerToPut.propValue
  12878. );
  12879. }
  12880. },
  12881. reset: function() {
  12882. this.listenersToPut.length = 0;
  12883. },
  12884. destructor: function() {
  12885. this.reset();
  12886. }
  12887. });
  12888. PooledClass.addPoolingTo(ReactPutListenerQueue);
  12889. module.exports = ReactPutListenerQueue;
  12890. },{"29":29,"30":30,"33":33}],88:[function(_dereq_,module,exports){
  12891. /**
  12892. * Copyright 2013-2015, Facebook, Inc.
  12893. * All rights reserved.
  12894. *
  12895. * This source code is licensed under the BSD-style license found in the
  12896. * LICENSE file in the root directory of this source tree. An additional grant
  12897. * of patent rights can be found in the PATENTS file in the same directory.
  12898. *
  12899. * @providesModule ReactReconcileTransaction
  12900. * @typechecks static-only
  12901. */
  12902. 'use strict';
  12903. var CallbackQueue = _dereq_(7);
  12904. var PooledClass = _dereq_(30);
  12905. var ReactBrowserEventEmitter = _dereq_(33);
  12906. var ReactInputSelection = _dereq_(71);
  12907. var ReactPutListenerQueue = _dereq_(87);
  12908. var Transaction = _dereq_(116);
  12909. var assign = _dereq_(29);
  12910. /**
  12911. * Ensures that, when possible, the selection range (currently selected text
  12912. * input) is not disturbed by performing the transaction.
  12913. */
  12914. var SELECTION_RESTORATION = {
  12915. /**
  12916. * @return {Selection} Selection information.
  12917. */
  12918. initialize: ReactInputSelection.getSelectionInformation,
  12919. /**
  12920. * @param {Selection} sel Selection information returned from `initialize`.
  12921. */
  12922. close: ReactInputSelection.restoreSelection
  12923. };
  12924. /**
  12925. * Suppresses events (blur/focus) that could be inadvertently dispatched due to
  12926. * high level DOM manipulations (like temporarily removing a text input from the
  12927. * DOM).
  12928. */
  12929. var EVENT_SUPPRESSION = {
  12930. /**
  12931. * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
  12932. * the reconciliation.
  12933. */
  12934. initialize: function() {
  12935. var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
  12936. ReactBrowserEventEmitter.setEnabled(false);
  12937. return currentlyEnabled;
  12938. },
  12939. /**
  12940. * @param {boolean} previouslyEnabled Enabled status of
  12941. * `ReactBrowserEventEmitter` before the reconciliation occured. `close`
  12942. * restores the previous value.
  12943. */
  12944. close: function(previouslyEnabled) {
  12945. ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
  12946. }
  12947. };
  12948. /**
  12949. * Provides a queue for collecting `componentDidMount` and
  12950. * `componentDidUpdate` callbacks during the the transaction.
  12951. */
  12952. var ON_DOM_READY_QUEUEING = {
  12953. /**
  12954. * Initializes the internal `onDOMReady` queue.
  12955. */
  12956. initialize: function() {
  12957. this.reactMountReady.reset();
  12958. },
  12959. /**
  12960. * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
  12961. */
  12962. close: function() {
  12963. this.reactMountReady.notifyAll();
  12964. }
  12965. };
  12966. var PUT_LISTENER_QUEUEING = {
  12967. initialize: function() {
  12968. this.putListenerQueue.reset();
  12969. },
  12970. close: function() {
  12971. this.putListenerQueue.putListeners();
  12972. }
  12973. };
  12974. /**
  12975. * Executed within the scope of the `Transaction` instance. Consider these as
  12976. * being member methods, but with an implied ordering while being isolated from
  12977. * each other.
  12978. */
  12979. var TRANSACTION_WRAPPERS = [
  12980. PUT_LISTENER_QUEUEING,
  12981. SELECTION_RESTORATION,
  12982. EVENT_SUPPRESSION,
  12983. ON_DOM_READY_QUEUEING
  12984. ];
  12985. /**
  12986. * Currently:
  12987. * - The order that these are listed in the transaction is critical:
  12988. * - Suppresses events.
  12989. * - Restores selection range.
  12990. *
  12991. * Future:
  12992. * - Restore document/overflow scroll positions that were unintentionally
  12993. * modified via DOM insertions above the top viewport boundary.
  12994. * - Implement/integrate with customized constraint based layout system and keep
  12995. * track of which dimensions must be remeasured.
  12996. *
  12997. * @class ReactReconcileTransaction
  12998. */
  12999. function ReactReconcileTransaction() {
  13000. this.reinitializeTransaction();
  13001. // Only server-side rendering really needs this option (see
  13002. // `ReactServerRendering`), but server-side uses
  13003. // `ReactServerRenderingTransaction` instead. This option is here so that it's
  13004. // accessible and defaults to false when `ReactDOMComponent` and
  13005. // `ReactTextComponent` checks it in `mountComponent`.`
  13006. this.renderToStaticMarkup = false;
  13007. this.reactMountReady = CallbackQueue.getPooled(null);
  13008. this.putListenerQueue = ReactPutListenerQueue.getPooled();
  13009. }
  13010. var Mixin = {
  13011. /**
  13012. * @see Transaction
  13013. * @abstract
  13014. * @final
  13015. * @return {array<object>} List of operation wrap proceedures.
  13016. * TODO: convert to array<TransactionWrapper>
  13017. */
  13018. getTransactionWrappers: function() {
  13019. return TRANSACTION_WRAPPERS;
  13020. },
  13021. /**
  13022. * @return {object} The queue to collect `onDOMReady` callbacks with.
  13023. */
  13024. getReactMountReady: function() {
  13025. return this.reactMountReady;
  13026. },
  13027. getPutListenerQueue: function() {
  13028. return this.putListenerQueue;
  13029. },
  13030. /**
  13031. * `PooledClass` looks for this, and will invoke this before allowing this
  13032. * instance to be resused.
  13033. */
  13034. destructor: function() {
  13035. CallbackQueue.release(this.reactMountReady);
  13036. this.reactMountReady = null;
  13037. ReactPutListenerQueue.release(this.putListenerQueue);
  13038. this.putListenerQueue = null;
  13039. }
  13040. };
  13041. assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
  13042. PooledClass.addPoolingTo(ReactReconcileTransaction);
  13043. module.exports = ReactReconcileTransaction;
  13044. },{"116":116,"29":29,"30":30,"33":33,"7":7,"71":71,"87":87}],89:[function(_dereq_,module,exports){
  13045. /**
  13046. * Copyright 2013-2015, Facebook, Inc.
  13047. * All rights reserved.
  13048. *
  13049. * This source code is licensed under the BSD-style license found in the
  13050. * LICENSE file in the root directory of this source tree. An additional grant
  13051. * of patent rights can be found in the PATENTS file in the same directory.
  13052. *
  13053. * @providesModule ReactReconciler
  13054. */
  13055. 'use strict';
  13056. var ReactRef = _dereq_(90);
  13057. var ReactElementValidator = _dereq_(64);
  13058. /**
  13059. * Helper to call ReactRef.attachRefs with this composite component, split out
  13060. * to avoid allocations in the transaction mount-ready queue.
  13061. */
  13062. function attachRefs() {
  13063. ReactRef.attachRefs(this, this._currentElement);
  13064. }
  13065. var ReactReconciler = {
  13066. /**
  13067. * Initializes the component, renders markup, and registers event listeners.
  13068. *
  13069. * @param {ReactComponent} internalInstance
  13070. * @param {string} rootID DOM ID of the root node.
  13071. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  13072. * @return {?string} Rendered markup to be inserted into the DOM.
  13073. * @final
  13074. * @internal
  13075. */
  13076. mountComponent: function(internalInstance, rootID, transaction, context) {
  13077. var markup = internalInstance.mountComponent(rootID, transaction, context);
  13078. if ("production" !== "development") {
  13079. ReactElementValidator.checkAndWarnForMutatedProps(
  13080. internalInstance._currentElement
  13081. );
  13082. }
  13083. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  13084. return markup;
  13085. },
  13086. /**
  13087. * Releases any resources allocated by `mountComponent`.
  13088. *
  13089. * @final
  13090. * @internal
  13091. */
  13092. unmountComponent: function(internalInstance) {
  13093. ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
  13094. internalInstance.unmountComponent();
  13095. },
  13096. /**
  13097. * Update a component using a new element.
  13098. *
  13099. * @param {ReactComponent} internalInstance
  13100. * @param {ReactElement} nextElement
  13101. * @param {ReactReconcileTransaction} transaction
  13102. * @param {object} context
  13103. * @internal
  13104. */
  13105. receiveComponent: function(
  13106. internalInstance, nextElement, transaction, context
  13107. ) {
  13108. var prevElement = internalInstance._currentElement;
  13109. if (nextElement === prevElement && nextElement._owner != null) {
  13110. // Since elements are immutable after the owner is rendered,
  13111. // we can do a cheap identity compare here to determine if this is a
  13112. // superfluous reconcile. It's possible for state to be mutable but such
  13113. // change should trigger an update of the owner which would recreate
  13114. // the element. We explicitly check for the existence of an owner since
  13115. // it's possible for an element created outside a composite to be
  13116. // deeply mutated and reused.
  13117. return;
  13118. }
  13119. if ("production" !== "development") {
  13120. ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
  13121. }
  13122. var refsChanged = ReactRef.shouldUpdateRefs(
  13123. prevElement,
  13124. nextElement
  13125. );
  13126. if (refsChanged) {
  13127. ReactRef.detachRefs(internalInstance, prevElement);
  13128. }
  13129. internalInstance.receiveComponent(nextElement, transaction, context);
  13130. if (refsChanged) {
  13131. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  13132. }
  13133. },
  13134. /**
  13135. * Flush any dirty changes in a component.
  13136. *
  13137. * @param {ReactComponent} internalInstance
  13138. * @param {ReactReconcileTransaction} transaction
  13139. * @internal
  13140. */
  13141. performUpdateIfNecessary: function(
  13142. internalInstance,
  13143. transaction
  13144. ) {
  13145. internalInstance.performUpdateIfNecessary(transaction);
  13146. }
  13147. };
  13148. module.exports = ReactReconciler;
  13149. },{"64":64,"90":90}],90:[function(_dereq_,module,exports){
  13150. /**
  13151. * Copyright 2013-2015, Facebook, Inc.
  13152. * All rights reserved.
  13153. *
  13154. * This source code is licensed under the BSD-style license found in the
  13155. * LICENSE file in the root directory of this source tree. An additional grant
  13156. * of patent rights can be found in the PATENTS file in the same directory.
  13157. *
  13158. * @providesModule ReactRef
  13159. */
  13160. 'use strict';
  13161. var ReactOwner = _dereq_(81);
  13162. var ReactRef = {};
  13163. function attachRef(ref, component, owner) {
  13164. if (typeof ref === 'function') {
  13165. ref(component.getPublicInstance());
  13166. } else {
  13167. // Legacy ref
  13168. ReactOwner.addComponentAsRefTo(component, ref, owner);
  13169. }
  13170. }
  13171. function detachRef(ref, component, owner) {
  13172. if (typeof ref === 'function') {
  13173. ref(null);
  13174. } else {
  13175. // Legacy ref
  13176. ReactOwner.removeComponentAsRefFrom(component, ref, owner);
  13177. }
  13178. }
  13179. ReactRef.attachRefs = function(instance, element) {
  13180. var ref = element.ref;
  13181. if (ref != null) {
  13182. attachRef(ref, instance, element._owner);
  13183. }
  13184. };
  13185. ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
  13186. // If either the owner or a `ref` has changed, make sure the newest owner
  13187. // has stored a reference to `this`, and the previous owner (if different)
  13188. // has forgotten the reference to `this`. We use the element instead
  13189. // of the public this.props because the post processing cannot determine
  13190. // a ref. The ref conceptually lives on the element.
  13191. // TODO: Should this even be possible? The owner cannot change because
  13192. // it's forbidden by shouldUpdateReactComponent. The ref can change
  13193. // if you swap the keys of but not the refs. Reconsider where this check
  13194. // is made. It probably belongs where the key checking and
  13195. // instantiateReactComponent is done.
  13196. return (
  13197. nextElement._owner !== prevElement._owner ||
  13198. nextElement.ref !== prevElement.ref
  13199. );
  13200. };
  13201. ReactRef.detachRefs = function(instance, element) {
  13202. var ref = element.ref;
  13203. if (ref != null) {
  13204. detachRef(ref, instance, element._owner);
  13205. }
  13206. };
  13207. module.exports = ReactRef;
  13208. },{"81":81}],91:[function(_dereq_,module,exports){
  13209. /**
  13210. * Copyright 2013-2015, Facebook, Inc.
  13211. * All rights reserved.
  13212. *
  13213. * This source code is licensed under the BSD-style license found in the
  13214. * LICENSE file in the root directory of this source tree. An additional grant
  13215. * of patent rights can be found in the PATENTS file in the same directory.
  13216. *
  13217. * @providesModule ReactRootIndex
  13218. * @typechecks
  13219. */
  13220. 'use strict';
  13221. var ReactRootIndexInjection = {
  13222. /**
  13223. * @param {function} _createReactRootIndex
  13224. */
  13225. injectCreateReactRootIndex: function(_createReactRootIndex) {
  13226. ReactRootIndex.createReactRootIndex = _createReactRootIndex;
  13227. }
  13228. };
  13229. var ReactRootIndex = {
  13230. createReactRootIndex: null,
  13231. injection: ReactRootIndexInjection
  13232. };
  13233. module.exports = ReactRootIndex;
  13234. },{}],92:[function(_dereq_,module,exports){
  13235. /**
  13236. * Copyright 2013-2015, Facebook, Inc.
  13237. * All rights reserved.
  13238. *
  13239. * This source code is licensed under the BSD-style license found in the
  13240. * LICENSE file in the root directory of this source tree. An additional grant
  13241. * of patent rights can be found in the PATENTS file in the same directory.
  13242. *
  13243. * @typechecks static-only
  13244. * @providesModule ReactServerRendering
  13245. */
  13246. 'use strict';
  13247. var ReactElement = _dereq_(63);
  13248. var ReactInstanceHandles = _dereq_(72);
  13249. var ReactMarkupChecksum = _dereq_(76);
  13250. var ReactServerRenderingTransaction =
  13251. _dereq_(93);
  13252. var emptyObject = _dereq_(130);
  13253. var instantiateReactComponent = _dereq_(149);
  13254. var invariant = _dereq_(150);
  13255. /**
  13256. * @param {ReactElement} element
  13257. * @return {string} the HTML markup
  13258. */
  13259. function renderToString(element) {
  13260. ("production" !== "development" ? invariant(
  13261. ReactElement.isValidElement(element),
  13262. 'renderToString(): You must pass a valid ReactElement.'
  13263. ) : invariant(ReactElement.isValidElement(element)));
  13264. var transaction;
  13265. try {
  13266. var id = ReactInstanceHandles.createReactRootID();
  13267. transaction = ReactServerRenderingTransaction.getPooled(false);
  13268. return transaction.perform(function() {
  13269. var componentInstance = instantiateReactComponent(element, null);
  13270. var markup =
  13271. componentInstance.mountComponent(id, transaction, emptyObject);
  13272. return ReactMarkupChecksum.addChecksumToMarkup(markup);
  13273. }, null);
  13274. } finally {
  13275. ReactServerRenderingTransaction.release(transaction);
  13276. }
  13277. }
  13278. /**
  13279. * @param {ReactElement} element
  13280. * @return {string} the HTML markup, without the extra React ID and checksum
  13281. * (for generating static pages)
  13282. */
  13283. function renderToStaticMarkup(element) {
  13284. ("production" !== "development" ? invariant(
  13285. ReactElement.isValidElement(element),
  13286. 'renderToStaticMarkup(): You must pass a valid ReactElement.'
  13287. ) : invariant(ReactElement.isValidElement(element)));
  13288. var transaction;
  13289. try {
  13290. var id = ReactInstanceHandles.createReactRootID();
  13291. transaction = ReactServerRenderingTransaction.getPooled(true);
  13292. return transaction.perform(function() {
  13293. var componentInstance = instantiateReactComponent(element, null);
  13294. return componentInstance.mountComponent(id, transaction, emptyObject);
  13295. }, null);
  13296. } finally {
  13297. ReactServerRenderingTransaction.release(transaction);
  13298. }
  13299. }
  13300. module.exports = {
  13301. renderToString: renderToString,
  13302. renderToStaticMarkup: renderToStaticMarkup
  13303. };
  13304. },{"130":130,"149":149,"150":150,"63":63,"72":72,"76":76,"93":93}],93:[function(_dereq_,module,exports){
  13305. /**
  13306. * Copyright 2014-2015, Facebook, Inc.
  13307. * All rights reserved.
  13308. *
  13309. * This source code is licensed under the BSD-style license found in the
  13310. * LICENSE file in the root directory of this source tree. An additional grant
  13311. * of patent rights can be found in the PATENTS file in the same directory.
  13312. *
  13313. * @providesModule ReactServerRenderingTransaction
  13314. * @typechecks
  13315. */
  13316. 'use strict';
  13317. var PooledClass = _dereq_(30);
  13318. var CallbackQueue = _dereq_(7);
  13319. var ReactPutListenerQueue = _dereq_(87);
  13320. var Transaction = _dereq_(116);
  13321. var assign = _dereq_(29);
  13322. var emptyFunction = _dereq_(129);
  13323. /**
  13324. * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
  13325. * during the performing of the transaction.
  13326. */
  13327. var ON_DOM_READY_QUEUEING = {
  13328. /**
  13329. * Initializes the internal `onDOMReady` queue.
  13330. */
  13331. initialize: function() {
  13332. this.reactMountReady.reset();
  13333. },
  13334. close: emptyFunction
  13335. };
  13336. var PUT_LISTENER_QUEUEING = {
  13337. initialize: function() {
  13338. this.putListenerQueue.reset();
  13339. },
  13340. close: emptyFunction
  13341. };
  13342. /**
  13343. * Executed within the scope of the `Transaction` instance. Consider these as
  13344. * being member methods, but with an implied ordering while being isolated from
  13345. * each other.
  13346. */
  13347. var TRANSACTION_WRAPPERS = [
  13348. PUT_LISTENER_QUEUEING,
  13349. ON_DOM_READY_QUEUEING
  13350. ];
  13351. /**
  13352. * @class ReactServerRenderingTransaction
  13353. * @param {boolean} renderToStaticMarkup
  13354. */
  13355. function ReactServerRenderingTransaction(renderToStaticMarkup) {
  13356. this.reinitializeTransaction();
  13357. this.renderToStaticMarkup = renderToStaticMarkup;
  13358. this.reactMountReady = CallbackQueue.getPooled(null);
  13359. this.putListenerQueue = ReactPutListenerQueue.getPooled();
  13360. }
  13361. var Mixin = {
  13362. /**
  13363. * @see Transaction
  13364. * @abstract
  13365. * @final
  13366. * @return {array} Empty list of operation wrap proceedures.
  13367. */
  13368. getTransactionWrappers: function() {
  13369. return TRANSACTION_WRAPPERS;
  13370. },
  13371. /**
  13372. * @return {object} The queue to collect `onDOMReady` callbacks with.
  13373. */
  13374. getReactMountReady: function() {
  13375. return this.reactMountReady;
  13376. },
  13377. getPutListenerQueue: function() {
  13378. return this.putListenerQueue;
  13379. },
  13380. /**
  13381. * `PooledClass` looks for this, and will invoke this before allowing this
  13382. * instance to be resused.
  13383. */
  13384. destructor: function() {
  13385. CallbackQueue.release(this.reactMountReady);
  13386. this.reactMountReady = null;
  13387. ReactPutListenerQueue.release(this.putListenerQueue);
  13388. this.putListenerQueue = null;
  13389. }
  13390. };
  13391. assign(
  13392. ReactServerRenderingTransaction.prototype,
  13393. Transaction.Mixin,
  13394. Mixin
  13395. );
  13396. PooledClass.addPoolingTo(ReactServerRenderingTransaction);
  13397. module.exports = ReactServerRenderingTransaction;
  13398. },{"116":116,"129":129,"29":29,"30":30,"7":7,"87":87}],94:[function(_dereq_,module,exports){
  13399. /**
  13400. * Copyright 2013-2015, Facebook, Inc.
  13401. * All rights reserved.
  13402. *
  13403. * This source code is licensed under the BSD-style license found in the
  13404. * LICENSE file in the root directory of this source tree. An additional grant
  13405. * of patent rights can be found in the PATENTS file in the same directory.
  13406. *
  13407. * @providesModule ReactStateSetters
  13408. */
  13409. 'use strict';
  13410. var ReactStateSetters = {
  13411. /**
  13412. * Returns a function that calls the provided function, and uses the result
  13413. * of that to set the component's state.
  13414. *
  13415. * @param {ReactCompositeComponent} component
  13416. * @param {function} funcReturningState Returned callback uses this to
  13417. * determine how to update state.
  13418. * @return {function} callback that when invoked uses funcReturningState to
  13419. * determined the object literal to setState.
  13420. */
  13421. createStateSetter: function(component, funcReturningState) {
  13422. return function(a, b, c, d, e, f) {
  13423. var partialState = funcReturningState.call(component, a, b, c, d, e, f);
  13424. if (partialState) {
  13425. component.setState(partialState);
  13426. }
  13427. };
  13428. },
  13429. /**
  13430. * Returns a single-argument callback that can be used to update a single
  13431. * key in the component's state.
  13432. *
  13433. * Note: this is memoized function, which makes it inexpensive to call.
  13434. *
  13435. * @param {ReactCompositeComponent} component
  13436. * @param {string} key The key in the state that you should update.
  13437. * @return {function} callback of 1 argument which calls setState() with
  13438. * the provided keyName and callback argument.
  13439. */
  13440. createStateKeySetter: function(component, key) {
  13441. // Memoize the setters.
  13442. var cache = component.__keySetters || (component.__keySetters = {});
  13443. return cache[key] || (cache[key] = createStateKeySetter(component, key));
  13444. }
  13445. };
  13446. function createStateKeySetter(component, key) {
  13447. // Partial state is allocated outside of the function closure so it can be
  13448. // reused with every call, avoiding memory allocation when this function
  13449. // is called.
  13450. var partialState = {};
  13451. return function stateKeySetter(value) {
  13452. partialState[key] = value;
  13453. component.setState(partialState);
  13454. };
  13455. }
  13456. ReactStateSetters.Mixin = {
  13457. /**
  13458. * Returns a function that calls the provided function, and uses the result
  13459. * of that to set the component's state.
  13460. *
  13461. * For example, these statements are equivalent:
  13462. *
  13463. * this.setState({x: 1});
  13464. * this.createStateSetter(function(xValue) {
  13465. * return {x: xValue};
  13466. * })(1);
  13467. *
  13468. * @param {function} funcReturningState Returned callback uses this to
  13469. * determine how to update state.
  13470. * @return {function} callback that when invoked uses funcReturningState to
  13471. * determined the object literal to setState.
  13472. */
  13473. createStateSetter: function(funcReturningState) {
  13474. return ReactStateSetters.createStateSetter(this, funcReturningState);
  13475. },
  13476. /**
  13477. * Returns a single-argument callback that can be used to update a single
  13478. * key in the component's state.
  13479. *
  13480. * For example, these statements are equivalent:
  13481. *
  13482. * this.setState({x: 1});
  13483. * this.createStateKeySetter('x')(1);
  13484. *
  13485. * Note: this is memoized function, which makes it inexpensive to call.
  13486. *
  13487. * @param {string} key The key in the state that you should update.
  13488. * @return {function} callback of 1 argument which calls setState() with
  13489. * the provided keyName and callback argument.
  13490. */
  13491. createStateKeySetter: function(key) {
  13492. return ReactStateSetters.createStateKeySetter(this, key);
  13493. }
  13494. };
  13495. module.exports = ReactStateSetters;
  13496. },{}],95:[function(_dereq_,module,exports){
  13497. /**
  13498. * Copyright 2013-2015, Facebook, Inc.
  13499. * All rights reserved.
  13500. *
  13501. * This source code is licensed under the BSD-style license found in the
  13502. * LICENSE file in the root directory of this source tree. An additional grant
  13503. * of patent rights can be found in the PATENTS file in the same directory.
  13504. *
  13505. * @providesModule ReactTestUtils
  13506. */
  13507. 'use strict';
  13508. var EventConstants = _dereq_(16);
  13509. var EventPluginHub = _dereq_(18);
  13510. var EventPropagators = _dereq_(21);
  13511. var React = _dereq_(31);
  13512. var ReactElement = _dereq_(63);
  13513. var ReactEmptyComponent = _dereq_(65);
  13514. var ReactBrowserEventEmitter = _dereq_(33);
  13515. var ReactCompositeComponent = _dereq_(43);
  13516. var ReactInstanceHandles = _dereq_(72);
  13517. var ReactInstanceMap = _dereq_(73);
  13518. var ReactMount = _dereq_(77);
  13519. var ReactUpdates = _dereq_(100);
  13520. var SyntheticEvent = _dereq_(108);
  13521. var assign = _dereq_(29);
  13522. var topLevelTypes = EventConstants.topLevelTypes;
  13523. function Event(suffix) {}
  13524. /**
  13525. * @class ReactTestUtils
  13526. */
  13527. /**
  13528. * Todo: Support the entire DOM.scry query syntax. For now, these simple
  13529. * utilities will suffice for testing purposes.
  13530. * @lends ReactTestUtils
  13531. */
  13532. var ReactTestUtils = {
  13533. renderIntoDocument: function(instance) {
  13534. var div = document.createElement('div');
  13535. // None of our tests actually require attaching the container to the
  13536. // DOM, and doing so creates a mess that we rely on test isolation to
  13537. // clean up, so we're going to stop honoring the name of this method
  13538. // (and probably rename it eventually) if no problems arise.
  13539. // document.documentElement.appendChild(div);
  13540. return React.render(instance, div);
  13541. },
  13542. isElement: function(element) {
  13543. return ReactElement.isValidElement(element);
  13544. },
  13545. isElementOfType: function(inst, convenienceConstructor) {
  13546. return (
  13547. ReactElement.isValidElement(inst) &&
  13548. inst.type === convenienceConstructor
  13549. );
  13550. },
  13551. isDOMComponent: function(inst) {
  13552. // TODO: Fix this heuristic. It's just here because composites can currently
  13553. // pretend to be DOM components.
  13554. return !!(inst && inst.tagName && inst.getDOMNode);
  13555. },
  13556. isDOMComponentElement: function(inst) {
  13557. return !!(inst &&
  13558. ReactElement.isValidElement(inst) &&
  13559. !!inst.tagName);
  13560. },
  13561. isCompositeComponent: function(inst) {
  13562. return typeof inst.render === 'function' &&
  13563. typeof inst.setState === 'function';
  13564. },
  13565. isCompositeComponentWithType: function(inst, type) {
  13566. return !!(ReactTestUtils.isCompositeComponent(inst) &&
  13567. (inst.constructor === type));
  13568. },
  13569. isCompositeComponentElement: function(inst) {
  13570. if (!ReactElement.isValidElement(inst)) {
  13571. return false;
  13572. }
  13573. // We check the prototype of the type that will get mounted, not the
  13574. // instance itself. This is a future proof way of duck typing.
  13575. var prototype = inst.type.prototype;
  13576. return (
  13577. typeof prototype.render === 'function' &&
  13578. typeof prototype.setState === 'function'
  13579. );
  13580. },
  13581. isCompositeComponentElementWithType: function(inst, type) {
  13582. return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
  13583. (inst.constructor === type));
  13584. },
  13585. getRenderedChildOfCompositeComponent: function(inst) {
  13586. if (!ReactTestUtils.isCompositeComponent(inst)) {
  13587. return null;
  13588. }
  13589. var internalInstance = ReactInstanceMap.get(inst);
  13590. return internalInstance._renderedComponent.getPublicInstance();
  13591. },
  13592. findAllInRenderedTree: function(inst, test) {
  13593. if (!inst) {
  13594. return [];
  13595. }
  13596. var ret = test(inst) ? [inst] : [];
  13597. if (ReactTestUtils.isDOMComponent(inst)) {
  13598. var internalInstance = ReactInstanceMap.get(inst);
  13599. var renderedChildren = internalInstance
  13600. ._renderedComponent
  13601. ._renderedChildren;
  13602. var key;
  13603. for (key in renderedChildren) {
  13604. if (!renderedChildren.hasOwnProperty(key)) {
  13605. continue;
  13606. }
  13607. if (!renderedChildren[key].getPublicInstance) {
  13608. continue;
  13609. }
  13610. ret = ret.concat(
  13611. ReactTestUtils.findAllInRenderedTree(
  13612. renderedChildren[key].getPublicInstance(),
  13613. test
  13614. )
  13615. );
  13616. }
  13617. } else if (ReactTestUtils.isCompositeComponent(inst)) {
  13618. ret = ret.concat(
  13619. ReactTestUtils.findAllInRenderedTree(
  13620. ReactTestUtils.getRenderedChildOfCompositeComponent(inst),
  13621. test
  13622. )
  13623. );
  13624. }
  13625. return ret;
  13626. },
  13627. /**
  13628. * Finds all instance of components in the rendered tree that are DOM
  13629. * components with the class name matching `className`.
  13630. * @return an array of all the matches.
  13631. */
  13632. scryRenderedDOMComponentsWithClass: function(root, className) {
  13633. return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
  13634. var instClassName = inst.props.className;
  13635. return ReactTestUtils.isDOMComponent(inst) && (
  13636. (instClassName && (' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1)
  13637. );
  13638. });
  13639. },
  13640. /**
  13641. * Like scryRenderedDOMComponentsWithClass but expects there to be one result,
  13642. * and returns that one result, or throws exception if there is any other
  13643. * number of matches besides one.
  13644. * @return {!ReactDOMComponent} The one match.
  13645. */
  13646. findRenderedDOMComponentWithClass: function(root, className) {
  13647. var all =
  13648. ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
  13649. if (all.length !== 1) {
  13650. throw new Error('Did not find exactly one match ' +
  13651. '(found: ' + all.length + ') for class:' + className
  13652. );
  13653. }
  13654. return all[0];
  13655. },
  13656. /**
  13657. * Finds all instance of components in the rendered tree that are DOM
  13658. * components with the tag name matching `tagName`.
  13659. * @return an array of all the matches.
  13660. */
  13661. scryRenderedDOMComponentsWithTag: function(root, tagName) {
  13662. return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
  13663. return ReactTestUtils.isDOMComponent(inst) &&
  13664. inst.tagName === tagName.toUpperCase();
  13665. });
  13666. },
  13667. /**
  13668. * Like scryRenderedDOMComponentsWithTag but expects there to be one result,
  13669. * and returns that one result, or throws exception if there is any other
  13670. * number of matches besides one.
  13671. * @return {!ReactDOMComponent} The one match.
  13672. */
  13673. findRenderedDOMComponentWithTag: function(root, tagName) {
  13674. var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
  13675. if (all.length !== 1) {
  13676. throw new Error('Did not find exactly one match for tag:' + tagName);
  13677. }
  13678. return all[0];
  13679. },
  13680. /**
  13681. * Finds all instances of components with type equal to `componentType`.
  13682. * @return an array of all the matches.
  13683. */
  13684. scryRenderedComponentsWithType: function(root, componentType) {
  13685. return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
  13686. return ReactTestUtils.isCompositeComponentWithType(
  13687. inst,
  13688. componentType
  13689. );
  13690. });
  13691. },
  13692. /**
  13693. * Same as `scryRenderedComponentsWithType` but expects there to be one result
  13694. * and returns that one result, or throws exception if there is any other
  13695. * number of matches besides one.
  13696. * @return {!ReactComponent} The one match.
  13697. */
  13698. findRenderedComponentWithType: function(root, componentType) {
  13699. var all = ReactTestUtils.scryRenderedComponentsWithType(
  13700. root,
  13701. componentType
  13702. );
  13703. if (all.length !== 1) {
  13704. throw new Error(
  13705. 'Did not find exactly one match for componentType:' + componentType
  13706. );
  13707. }
  13708. return all[0];
  13709. },
  13710. /**
  13711. * Pass a mocked component module to this method to augment it with
  13712. * useful methods that allow it to be used as a dummy React component.
  13713. * Instead of rendering as usual, the component will become a simple
  13714. * <div> containing any provided children.
  13715. *
  13716. * @param {object} module the mock function object exported from a
  13717. * module that defines the component to be mocked
  13718. * @param {?string} mockTagName optional dummy root tag name to return
  13719. * from render method (overrides
  13720. * module.mockTagName if provided)
  13721. * @return {object} the ReactTestUtils object (for chaining)
  13722. */
  13723. mockComponent: function(module, mockTagName) {
  13724. mockTagName = mockTagName || module.mockTagName || "div";
  13725. module.prototype.render.mockImplementation(function() {
  13726. return React.createElement(
  13727. mockTagName,
  13728. null,
  13729. this.props.children
  13730. );
  13731. });
  13732. return this;
  13733. },
  13734. /**
  13735. * Simulates a top level event being dispatched from a raw event that occured
  13736. * on an `Element` node.
  13737. * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`
  13738. * @param {!Element} node The dom to simulate an event occurring on.
  13739. * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
  13740. */
  13741. simulateNativeEventOnNode: function(topLevelType, node, fakeNativeEvent) {
  13742. fakeNativeEvent.target = node;
  13743. ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(
  13744. topLevelType,
  13745. fakeNativeEvent
  13746. );
  13747. },
  13748. /**
  13749. * Simulates a top level event being dispatched from a raw event that occured
  13750. * on the `ReactDOMComponent` `comp`.
  13751. * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.
  13752. * @param comp {!ReactDOMComponent}
  13753. * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
  13754. */
  13755. simulateNativeEventOnDOMComponent: function(
  13756. topLevelType,
  13757. comp,
  13758. fakeNativeEvent) {
  13759. ReactTestUtils.simulateNativeEventOnNode(
  13760. topLevelType,
  13761. comp.getDOMNode(),
  13762. fakeNativeEvent
  13763. );
  13764. },
  13765. nativeTouchData: function(x, y) {
  13766. return {
  13767. touches: [
  13768. {pageX: x, pageY: y}
  13769. ]
  13770. };
  13771. },
  13772. createRenderer: function() {
  13773. return new ReactShallowRenderer();
  13774. },
  13775. Simulate: null,
  13776. SimulateNative: {}
  13777. };
  13778. /**
  13779. * @class ReactShallowRenderer
  13780. */
  13781. var ReactShallowRenderer = function() {
  13782. this._instance = null;
  13783. };
  13784. ReactShallowRenderer.prototype.getRenderOutput = function() {
  13785. return (
  13786. (this._instance && this._instance._renderedComponent &&
  13787. this._instance._renderedComponent._renderedOutput)
  13788. || null
  13789. );
  13790. };
  13791. var NoopInternalComponent = function(element) {
  13792. this._renderedOutput = element;
  13793. this._currentElement = element === null || element === false ?
  13794. ReactEmptyComponent.emptyElement :
  13795. element;
  13796. };
  13797. NoopInternalComponent.prototype = {
  13798. mountComponent: function() {
  13799. },
  13800. receiveComponent: function(element) {
  13801. this._renderedOutput = element;
  13802. this._currentElement = element === null || element === false ?
  13803. ReactEmptyComponent.emptyElement :
  13804. element;
  13805. },
  13806. unmountComponent: function() {
  13807. }
  13808. };
  13809. var ShallowComponentWrapper = function() { };
  13810. assign(
  13811. ShallowComponentWrapper.prototype,
  13812. ReactCompositeComponent.Mixin, {
  13813. _instantiateReactComponent: function(element) {
  13814. return new NoopInternalComponent(element);
  13815. },
  13816. _replaceNodeWithMarkupByID: function() {},
  13817. _renderValidatedComponent:
  13818. ReactCompositeComponent.Mixin.
  13819. _renderValidatedComponentWithoutOwnerOrContext
  13820. }
  13821. );
  13822. ReactShallowRenderer.prototype.render = function(element, context) {
  13823. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
  13824. this._render(element, transaction, context);
  13825. ReactUpdates.ReactReconcileTransaction.release(transaction);
  13826. };
  13827. ReactShallowRenderer.prototype.unmount = function() {
  13828. if (this._instance) {
  13829. this._instance.unmountComponent();
  13830. }
  13831. };
  13832. ReactShallowRenderer.prototype._render = function(element, transaction, context) {
  13833. if (!this._instance) {
  13834. var rootID = ReactInstanceHandles.createReactRootID();
  13835. var instance = new ShallowComponentWrapper(element.type);
  13836. instance.construct(element);
  13837. instance.mountComponent(rootID, transaction, context);
  13838. this._instance = instance;
  13839. } else {
  13840. this._instance.receiveComponent(element, transaction, context);
  13841. }
  13842. };
  13843. /**
  13844. * Exports:
  13845. *
  13846. * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
  13847. * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
  13848. * - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)`
  13849. * - ... (All keys from event plugin `eventTypes` objects)
  13850. */
  13851. function makeSimulator(eventType) {
  13852. return function(domComponentOrNode, eventData) {
  13853. var node;
  13854. if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
  13855. node = domComponentOrNode.getDOMNode();
  13856. } else if (domComponentOrNode.tagName) {
  13857. node = domComponentOrNode;
  13858. }
  13859. var fakeNativeEvent = new Event();
  13860. fakeNativeEvent.target = node;
  13861. // We don't use SyntheticEvent.getPooled in order to not have to worry about
  13862. // properly destroying any properties assigned from `eventData` upon release
  13863. var event = new SyntheticEvent(
  13864. ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType],
  13865. ReactMount.getID(node),
  13866. fakeNativeEvent
  13867. );
  13868. assign(event, eventData);
  13869. EventPropagators.accumulateTwoPhaseDispatches(event);
  13870. ReactUpdates.batchedUpdates(function() {
  13871. EventPluginHub.enqueueEvents(event);
  13872. EventPluginHub.processEventQueue();
  13873. });
  13874. };
  13875. }
  13876. function buildSimulators() {
  13877. ReactTestUtils.Simulate = {};
  13878. var eventType;
  13879. for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
  13880. /**
  13881. * @param {!Element || ReactDOMComponent} domComponentOrNode
  13882. * @param {?object} eventData Fake event data to use in SyntheticEvent.
  13883. */
  13884. ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
  13885. }
  13886. }
  13887. // Rebuild ReactTestUtils.Simulate whenever event plugins are injected
  13888. var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
  13889. EventPluginHub.injection.injectEventPluginOrder = function() {
  13890. oldInjectEventPluginOrder.apply(this, arguments);
  13891. buildSimulators();
  13892. };
  13893. var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
  13894. EventPluginHub.injection.injectEventPluginsByName = function() {
  13895. oldInjectEventPlugins.apply(this, arguments);
  13896. buildSimulators();
  13897. };
  13898. buildSimulators();
  13899. /**
  13900. * Exports:
  13901. *
  13902. * - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
  13903. * - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
  13904. * - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
  13905. * - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
  13906. * - ... (All keys from `EventConstants.topLevelTypes`)
  13907. *
  13908. * Note: Top level event types are a subset of the entire set of handler types
  13909. * (which include a broader set of "synthetic" events). For example, onDragDone
  13910. * is a synthetic event. Except when testing an event plugin or React's event
  13911. * handling code specifically, you probably want to use ReactTestUtils.Simulate
  13912. * to dispatch synthetic events.
  13913. */
  13914. function makeNativeSimulator(eventType) {
  13915. return function(domComponentOrNode, nativeEventData) {
  13916. var fakeNativeEvent = new Event(eventType);
  13917. assign(fakeNativeEvent, nativeEventData);
  13918. if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
  13919. ReactTestUtils.simulateNativeEventOnDOMComponent(
  13920. eventType,
  13921. domComponentOrNode,
  13922. fakeNativeEvent
  13923. );
  13924. } else if (!!domComponentOrNode.tagName) {
  13925. // Will allow on actual dom nodes.
  13926. ReactTestUtils.simulateNativeEventOnNode(
  13927. eventType,
  13928. domComponentOrNode,
  13929. fakeNativeEvent
  13930. );
  13931. }
  13932. };
  13933. }
  13934. var eventType;
  13935. for (eventType in topLevelTypes) {
  13936. // Event type is stored as 'topClick' - we transform that to 'click'
  13937. var convenienceName = eventType.indexOf('top') === 0 ?
  13938. eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
  13939. /**
  13940. * @param {!Element || ReactDOMComponent} domComponentOrNode
  13941. * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
  13942. */
  13943. ReactTestUtils.SimulateNative[convenienceName] =
  13944. makeNativeSimulator(eventType);
  13945. }
  13946. module.exports = ReactTestUtils;
  13947. },{"100":100,"108":108,"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){
  13948. /**
  13949. * Copyright 2013-2015, Facebook, Inc.
  13950. * All rights reserved.
  13951. *
  13952. * This source code is licensed under the BSD-style license found in the
  13953. * LICENSE file in the root directory of this source tree. An additional grant
  13954. * of patent rights can be found in the PATENTS file in the same directory.
  13955. *
  13956. * @typechecks static-only
  13957. * @providesModule ReactTransitionChildMapping
  13958. */
  13959. 'use strict';
  13960. var ReactChildren = _dereq_(37);
  13961. var ReactFragment = _dereq_(69);
  13962. var ReactTransitionChildMapping = {
  13963. /**
  13964. * Given `this.props.children`, return an object mapping key to child. Just
  13965. * simple syntactic sugar around ReactChildren.map().
  13966. *
  13967. * @param {*} children `this.props.children`
  13968. * @return {object} Mapping of key to child
  13969. */
  13970. getChildMapping: function(children) {
  13971. if (!children) {
  13972. return children;
  13973. }
  13974. return ReactFragment.extract(ReactChildren.map(children, function(child) {
  13975. return child;
  13976. }));
  13977. },
  13978. /**
  13979. * When you're adding or removing children some may be added or removed in the
  13980. * same render pass. We want to show *both* since we want to simultaneously
  13981. * animate elements in and out. This function takes a previous set of keys
  13982. * and a new set of keys and merges them with its best guess of the correct
  13983. * ordering. In the future we may expose some of the utilities in
  13984. * ReactMultiChild to make this easy, but for now React itself does not
  13985. * directly have this concept of the union of prevChildren and nextChildren
  13986. * so we implement it here.
  13987. *
  13988. * @param {object} prev prev children as returned from
  13989. * `ReactTransitionChildMapping.getChildMapping()`.
  13990. * @param {object} next next children as returned from
  13991. * `ReactTransitionChildMapping.getChildMapping()`.
  13992. * @return {object} a key set that contains all keys in `prev` and all keys
  13993. * in `next` in a reasonable order.
  13994. */
  13995. mergeChildMappings: function(prev, next) {
  13996. prev = prev || {};
  13997. next = next || {};
  13998. function getValueForKey(key) {
  13999. if (next.hasOwnProperty(key)) {
  14000. return next[key];
  14001. } else {
  14002. return prev[key];
  14003. }
  14004. }
  14005. // For each key of `next`, the list of keys to insert before that key in
  14006. // the combined list
  14007. var nextKeysPending = {};
  14008. var pendingKeys = [];
  14009. for (var prevKey in prev) {
  14010. if (next.hasOwnProperty(prevKey)) {
  14011. if (pendingKeys.length) {
  14012. nextKeysPending[prevKey] = pendingKeys;
  14013. pendingKeys = [];
  14014. }
  14015. } else {
  14016. pendingKeys.push(prevKey);
  14017. }
  14018. }
  14019. var i;
  14020. var childMapping = {};
  14021. for (var nextKey in next) {
  14022. if (nextKeysPending.hasOwnProperty(nextKey)) {
  14023. for (i = 0; i < nextKeysPending[nextKey].length; i++) {
  14024. var pendingNextKey = nextKeysPending[nextKey][i];
  14025. childMapping[nextKeysPending[nextKey][i]] = getValueForKey(
  14026. pendingNextKey
  14027. );
  14028. }
  14029. }
  14030. childMapping[nextKey] = getValueForKey(nextKey);
  14031. }
  14032. // Finally, add the keys which didn't appear before any key in `next`
  14033. for (i = 0; i < pendingKeys.length; i++) {
  14034. childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
  14035. }
  14036. return childMapping;
  14037. }
  14038. };
  14039. module.exports = ReactTransitionChildMapping;
  14040. },{"37":37,"69":69}],97:[function(_dereq_,module,exports){
  14041. /**
  14042. * Copyright 2013-2015, Facebook, Inc.
  14043. * All rights reserved.
  14044. *
  14045. * This source code is licensed under the BSD-style license found in the
  14046. * LICENSE file in the root directory of this source tree. An additional grant
  14047. * of patent rights can be found in the PATENTS file in the same directory.
  14048. *
  14049. * @providesModule ReactTransitionEvents
  14050. */
  14051. 'use strict';
  14052. var ExecutionEnvironment = _dereq_(22);
  14053. /**
  14054. * EVENT_NAME_MAP is used to determine which event fired when a
  14055. * transition/animation ends, based on the style property used to
  14056. * define that event.
  14057. */
  14058. var EVENT_NAME_MAP = {
  14059. transitionend: {
  14060. 'transition': 'transitionend',
  14061. 'WebkitTransition': 'webkitTransitionEnd',
  14062. 'MozTransition': 'mozTransitionEnd',
  14063. 'OTransition': 'oTransitionEnd',
  14064. 'msTransition': 'MSTransitionEnd'
  14065. },
  14066. animationend: {
  14067. 'animation': 'animationend',
  14068. 'WebkitAnimation': 'webkitAnimationEnd',
  14069. 'MozAnimation': 'mozAnimationEnd',
  14070. 'OAnimation': 'oAnimationEnd',
  14071. 'msAnimation': 'MSAnimationEnd'
  14072. }
  14073. };
  14074. var endEvents = [];
  14075. function detectEvents() {
  14076. var testEl = document.createElement('div');
  14077. var style = testEl.style;
  14078. // On some platforms, in particular some releases of Android 4.x,
  14079. // the un-prefixed "animation" and "transition" properties are defined on the
  14080. // style object but the events that fire will still be prefixed, so we need
  14081. // to check if the un-prefixed events are useable, and if not remove them
  14082. // from the map
  14083. if (!('AnimationEvent' in window)) {
  14084. delete EVENT_NAME_MAP.animationend.animation;
  14085. }
  14086. if (!('TransitionEvent' in window)) {
  14087. delete EVENT_NAME_MAP.transitionend.transition;
  14088. }
  14089. for (var baseEventName in EVENT_NAME_MAP) {
  14090. var baseEvents = EVENT_NAME_MAP[baseEventName];
  14091. for (var styleName in baseEvents) {
  14092. if (styleName in style) {
  14093. endEvents.push(baseEvents[styleName]);
  14094. break;
  14095. }
  14096. }
  14097. }
  14098. }
  14099. if (ExecutionEnvironment.canUseDOM) {
  14100. detectEvents();
  14101. }
  14102. // We use the raw {add|remove}EventListener() call because EventListener
  14103. // does not know how to remove event listeners and we really should
  14104. // clean up. Also, these events are not triggered in older browsers
  14105. // so we should be A-OK here.
  14106. function addEventListener(node, eventName, eventListener) {
  14107. node.addEventListener(eventName, eventListener, false);
  14108. }
  14109. function removeEventListener(node, eventName, eventListener) {
  14110. node.removeEventListener(eventName, eventListener, false);
  14111. }
  14112. var ReactTransitionEvents = {
  14113. addEndEventListener: function(node, eventListener) {
  14114. if (endEvents.length === 0) {
  14115. // If CSS transitions are not supported, trigger an "end animation"
  14116. // event immediately.
  14117. window.setTimeout(eventListener, 0);
  14118. return;
  14119. }
  14120. endEvents.forEach(function(endEvent) {
  14121. addEventListener(node, endEvent, eventListener);
  14122. });
  14123. },
  14124. removeEndEventListener: function(node, eventListener) {
  14125. if (endEvents.length === 0) {
  14126. return;
  14127. }
  14128. endEvents.forEach(function(endEvent) {
  14129. removeEventListener(node, endEvent, eventListener);
  14130. });
  14131. }
  14132. };
  14133. module.exports = ReactTransitionEvents;
  14134. },{"22":22}],98:[function(_dereq_,module,exports){
  14135. /**
  14136. * Copyright 2013-2015, Facebook, Inc.
  14137. * All rights reserved.
  14138. *
  14139. * This source code is licensed under the BSD-style license found in the
  14140. * LICENSE file in the root directory of this source tree. An additional grant
  14141. * of patent rights can be found in the PATENTS file in the same directory.
  14142. *
  14143. * @providesModule ReactTransitionGroup
  14144. */
  14145. 'use strict';
  14146. var React = _dereq_(31);
  14147. var ReactTransitionChildMapping = _dereq_(96);
  14148. var assign = _dereq_(29);
  14149. var cloneWithProps = _dereq_(122);
  14150. var emptyFunction = _dereq_(129);
  14151. var ReactTransitionGroup = React.createClass({
  14152. displayName: 'ReactTransitionGroup',
  14153. propTypes: {
  14154. component: React.PropTypes.any,
  14155. childFactory: React.PropTypes.func
  14156. },
  14157. getDefaultProps: function() {
  14158. return {
  14159. component: 'span',
  14160. childFactory: emptyFunction.thatReturnsArgument
  14161. };
  14162. },
  14163. getInitialState: function() {
  14164. return {
  14165. children: ReactTransitionChildMapping.getChildMapping(this.props.children)
  14166. };
  14167. },
  14168. componentWillMount: function() {
  14169. this.currentlyTransitioningKeys = {};
  14170. this.keysToEnter = [];
  14171. this.keysToLeave = [];
  14172. },
  14173. componentDidMount: function() {
  14174. var initialChildMapping = this.state.children;
  14175. for (var key in initialChildMapping) {
  14176. if (initialChildMapping[key]) {
  14177. this.performAppear(key);
  14178. }
  14179. }
  14180. },
  14181. componentWillReceiveProps: function(nextProps) {
  14182. var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
  14183. nextProps.children
  14184. );
  14185. var prevChildMapping = this.state.children;
  14186. this.setState({
  14187. children: ReactTransitionChildMapping.mergeChildMappings(
  14188. prevChildMapping,
  14189. nextChildMapping
  14190. )
  14191. });
  14192. var key;
  14193. for (key in nextChildMapping) {
  14194. var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
  14195. if (nextChildMapping[key] && !hasPrev &&
  14196. !this.currentlyTransitioningKeys[key]) {
  14197. this.keysToEnter.push(key);
  14198. }
  14199. }
  14200. for (key in prevChildMapping) {
  14201. var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
  14202. if (prevChildMapping[key] && !hasNext &&
  14203. !this.currentlyTransitioningKeys[key]) {
  14204. this.keysToLeave.push(key);
  14205. }
  14206. }
  14207. // If we want to someday check for reordering, we could do it here.
  14208. },
  14209. componentDidUpdate: function() {
  14210. var keysToEnter = this.keysToEnter;
  14211. this.keysToEnter = [];
  14212. keysToEnter.forEach(this.performEnter);
  14213. var keysToLeave = this.keysToLeave;
  14214. this.keysToLeave = [];
  14215. keysToLeave.forEach(this.performLeave);
  14216. },
  14217. performAppear: function(key) {
  14218. this.currentlyTransitioningKeys[key] = true;
  14219. var component = this.refs[key];
  14220. if (component.componentWillAppear) {
  14221. component.componentWillAppear(
  14222. this._handleDoneAppearing.bind(this, key)
  14223. );
  14224. } else {
  14225. this._handleDoneAppearing(key);
  14226. }
  14227. },
  14228. _handleDoneAppearing: function(key) {
  14229. var component = this.refs[key];
  14230. if (component.componentDidAppear) {
  14231. component.componentDidAppear();
  14232. }
  14233. delete this.currentlyTransitioningKeys[key];
  14234. var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
  14235. this.props.children
  14236. );
  14237. if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
  14238. // This was removed before it had fully appeared. Remove it.
  14239. this.performLeave(key);
  14240. }
  14241. },
  14242. performEnter: function(key) {
  14243. this.currentlyTransitioningKeys[key] = true;
  14244. var component = this.refs[key];
  14245. if (component.componentWillEnter) {
  14246. component.componentWillEnter(
  14247. this._handleDoneEntering.bind(this, key)
  14248. );
  14249. } else {
  14250. this._handleDoneEntering(key);
  14251. }
  14252. },
  14253. _handleDoneEntering: function(key) {
  14254. var component = this.refs[key];
  14255. if (component.componentDidEnter) {
  14256. component.componentDidEnter();
  14257. }
  14258. delete this.currentlyTransitioningKeys[key];
  14259. var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
  14260. this.props.children
  14261. );
  14262. if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
  14263. // This was removed before it had fully entered. Remove it.
  14264. this.performLeave(key);
  14265. }
  14266. },
  14267. performLeave: function(key) {
  14268. this.currentlyTransitioningKeys[key] = true;
  14269. var component = this.refs[key];
  14270. if (component.componentWillLeave) {
  14271. component.componentWillLeave(this._handleDoneLeaving.bind(this, key));
  14272. } else {
  14273. // Note that this is somewhat dangerous b/c it calls setState()
  14274. // again, effectively mutating the component before all the work
  14275. // is done.
  14276. this._handleDoneLeaving(key);
  14277. }
  14278. },
  14279. _handleDoneLeaving: function(key) {
  14280. var component = this.refs[key];
  14281. if (component.componentDidLeave) {
  14282. component.componentDidLeave();
  14283. }
  14284. delete this.currentlyTransitioningKeys[key];
  14285. var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
  14286. this.props.children
  14287. );
  14288. if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
  14289. // This entered again before it fully left. Add it again.
  14290. this.performEnter(key);
  14291. } else {
  14292. var newChildren = assign({}, this.state.children);
  14293. delete newChildren[key];
  14294. this.setState({children: newChildren});
  14295. }
  14296. },
  14297. render: function() {
  14298. // TODO: we could get rid of the need for the wrapper node
  14299. // by cloning a single child
  14300. var childrenToRender = [];
  14301. for (var key in this.state.children) {
  14302. var child = this.state.children[key];
  14303. if (child) {
  14304. // You may need to apply reactive updates to a child as it is leaving.
  14305. // The normal React way to do it won't work since the child will have
  14306. // already been removed. In case you need this behavior you can provide
  14307. // a childFactory function to wrap every child, even the ones that are
  14308. // leaving.
  14309. childrenToRender.push(cloneWithProps(
  14310. this.props.childFactory(child),
  14311. {ref: key, key: key}
  14312. ));
  14313. }
  14314. }
  14315. return React.createElement(
  14316. this.props.component,
  14317. this.props,
  14318. childrenToRender
  14319. );
  14320. }
  14321. });
  14322. module.exports = ReactTransitionGroup;
  14323. },{"122":122,"129":129,"29":29,"31":31,"96":96}],99:[function(_dereq_,module,exports){
  14324. /**
  14325. * Copyright 2015, Facebook, Inc.
  14326. * All rights reserved.
  14327. *
  14328. * This source code is licensed under the BSD-style license found in the
  14329. * LICENSE file in the root directory of this source tree. An additional grant
  14330. * of patent rights can be found in the PATENTS file in the same directory.
  14331. *
  14332. * @providesModule ReactUpdateQueue
  14333. */
  14334. 'use strict';
  14335. var ReactLifeCycle = _dereq_(74);
  14336. var ReactCurrentOwner = _dereq_(45);
  14337. var ReactElement = _dereq_(63);
  14338. var ReactInstanceMap = _dereq_(73);
  14339. var ReactUpdates = _dereq_(100);
  14340. var assign = _dereq_(29);
  14341. var invariant = _dereq_(150);
  14342. var warning = _dereq_(171);
  14343. function enqueueUpdate(internalInstance) {
  14344. if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {
  14345. // If we're in a componentWillMount handler, don't enqueue a rerender
  14346. // because ReactUpdates assumes we're in a browser context (which is
  14347. // wrong for server rendering) and we're about to do a render anyway.
  14348. // See bug in #1740.
  14349. ReactUpdates.enqueueUpdate(internalInstance);
  14350. }
  14351. }
  14352. function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  14353. ("production" !== "development" ? invariant(
  14354. ReactCurrentOwner.current == null,
  14355. '%s(...): Cannot update during an existing state transition ' +
  14356. '(such as within `render`). Render methods should be a pure function ' +
  14357. 'of props and state.',
  14358. callerName
  14359. ) : invariant(ReactCurrentOwner.current == null));
  14360. var internalInstance = ReactInstanceMap.get(publicInstance);
  14361. if (!internalInstance) {
  14362. if ("production" !== "development") {
  14363. // Only warn when we have a callerName. Otherwise we should be silent.
  14364. // We're probably calling from enqueueCallback. We don't want to warn
  14365. // there because we already warned for the corresponding lifecycle method.
  14366. ("production" !== "development" ? warning(
  14367. !callerName,
  14368. '%s(...): Can only update a mounted or mounting component. ' +
  14369. 'This usually means you called %s() on an unmounted ' +
  14370. 'component. This is a no-op.',
  14371. callerName,
  14372. callerName
  14373. ) : null);
  14374. }
  14375. return null;
  14376. }
  14377. if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {
  14378. return null;
  14379. }
  14380. return internalInstance;
  14381. }
  14382. /**
  14383. * ReactUpdateQueue allows for state updates to be scheduled into a later
  14384. * reconciliation step.
  14385. */
  14386. var ReactUpdateQueue = {
  14387. /**
  14388. * Enqueue a callback that will be executed after all the pending updates
  14389. * have processed.
  14390. *
  14391. * @param {ReactClass} publicInstance The instance to use as `this` context.
  14392. * @param {?function} callback Called after state is updated.
  14393. * @internal
  14394. */
  14395. enqueueCallback: function(publicInstance, callback) {
  14396. ("production" !== "development" ? invariant(
  14397. typeof callback === 'function',
  14398. 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
  14399. '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
  14400. 'isn\'t callable.'
  14401. ) : invariant(typeof callback === 'function'));
  14402. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
  14403. // Previously we would throw an error if we didn't have an internal
  14404. // instance. Since we want to make it a no-op instead, we mirror the same
  14405. // behavior we have in other enqueue* methods.
  14406. // We also need to ignore callbacks in componentWillMount. See
  14407. // enqueueUpdates.
  14408. if (!internalInstance ||
  14409. internalInstance === ReactLifeCycle.currentlyMountingInstance) {
  14410. return null;
  14411. }
  14412. if (internalInstance._pendingCallbacks) {
  14413. internalInstance._pendingCallbacks.push(callback);
  14414. } else {
  14415. internalInstance._pendingCallbacks = [callback];
  14416. }
  14417. // TODO: The callback here is ignored when setState is called from
  14418. // componentWillMount. Either fix it or disallow doing so completely in
  14419. // favor of getInitialState. Alternatively, we can disallow
  14420. // componentWillMount during server-side rendering.
  14421. enqueueUpdate(internalInstance);
  14422. },
  14423. enqueueCallbackInternal: function(internalInstance, callback) {
  14424. ("production" !== "development" ? invariant(
  14425. typeof callback === 'function',
  14426. 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
  14427. '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
  14428. 'isn\'t callable.'
  14429. ) : invariant(typeof callback === 'function'));
  14430. if (internalInstance._pendingCallbacks) {
  14431. internalInstance._pendingCallbacks.push(callback);
  14432. } else {
  14433. internalInstance._pendingCallbacks = [callback];
  14434. }
  14435. enqueueUpdate(internalInstance);
  14436. },
  14437. /**
  14438. * Forces an update. This should only be invoked when it is known with
  14439. * certainty that we are **not** in a DOM transaction.
  14440. *
  14441. * You may want to call this when you know that some deeper aspect of the
  14442. * component's state has changed but `setState` was not called.
  14443. *
  14444. * This will not invoke `shouldUpdateComponent`, but it will invoke
  14445. * `componentWillUpdate` and `componentDidUpdate`.
  14446. *
  14447. * @param {ReactClass} publicInstance The instance that should rerender.
  14448. * @internal
  14449. */
  14450. enqueueForceUpdate: function(publicInstance) {
  14451. var internalInstance = getInternalInstanceReadyForUpdate(
  14452. publicInstance,
  14453. 'forceUpdate'
  14454. );
  14455. if (!internalInstance) {
  14456. return;
  14457. }
  14458. internalInstance._pendingForceUpdate = true;
  14459. enqueueUpdate(internalInstance);
  14460. },
  14461. /**
  14462. * Replaces all of the state. Always use this or `setState` to mutate state.
  14463. * You should treat `this.state` as immutable.
  14464. *
  14465. * There is no guarantee that `this.state` will be immediately updated, so
  14466. * accessing `this.state` after calling this method may return the old value.
  14467. *
  14468. * @param {ReactClass} publicInstance The instance that should rerender.
  14469. * @param {object} completeState Next state.
  14470. * @internal
  14471. */
  14472. enqueueReplaceState: function(publicInstance, completeState) {
  14473. var internalInstance = getInternalInstanceReadyForUpdate(
  14474. publicInstance,
  14475. 'replaceState'
  14476. );
  14477. if (!internalInstance) {
  14478. return;
  14479. }
  14480. internalInstance._pendingStateQueue = [completeState];
  14481. internalInstance._pendingReplaceState = true;
  14482. enqueueUpdate(internalInstance);
  14483. },
  14484. /**
  14485. * Sets a subset of the state. This only exists because _pendingState is
  14486. * internal. This provides a merging strategy that is not available to deep
  14487. * properties which is confusing. TODO: Expose pendingState or don't use it
  14488. * during the merge.
  14489. *
  14490. * @param {ReactClass} publicInstance The instance that should rerender.
  14491. * @param {object} partialState Next partial state to be merged with state.
  14492. * @internal
  14493. */
  14494. enqueueSetState: function(publicInstance, partialState) {
  14495. var internalInstance = getInternalInstanceReadyForUpdate(
  14496. publicInstance,
  14497. 'setState'
  14498. );
  14499. if (!internalInstance) {
  14500. return;
  14501. }
  14502. var queue =
  14503. internalInstance._pendingStateQueue ||
  14504. (internalInstance._pendingStateQueue = []);
  14505. queue.push(partialState);
  14506. enqueueUpdate(internalInstance);
  14507. },
  14508. /**
  14509. * Sets a subset of the props.
  14510. *
  14511. * @param {ReactClass} publicInstance The instance that should rerender.
  14512. * @param {object} partialProps Subset of the next props.
  14513. * @internal
  14514. */
  14515. enqueueSetProps: function(publicInstance, partialProps) {
  14516. var internalInstance = getInternalInstanceReadyForUpdate(
  14517. publicInstance,
  14518. 'setProps'
  14519. );
  14520. if (!internalInstance) {
  14521. return;
  14522. }
  14523. ("production" !== "development" ? invariant(
  14524. internalInstance._isTopLevel,
  14525. 'setProps(...): You called `setProps` on a ' +
  14526. 'component with a parent. This is an anti-pattern since props will ' +
  14527. 'get reactively updated when rendered. Instead, change the owner\'s ' +
  14528. '`render` method to pass the correct value as props to the component ' +
  14529. 'where it is created.'
  14530. ) : invariant(internalInstance._isTopLevel));
  14531. // Merge with the pending element if it exists, otherwise with existing
  14532. // element props.
  14533. var element = internalInstance._pendingElement ||
  14534. internalInstance._currentElement;
  14535. var props = assign({}, element.props, partialProps);
  14536. internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
  14537. element,
  14538. props
  14539. );
  14540. enqueueUpdate(internalInstance);
  14541. },
  14542. /**
  14543. * Replaces all of the props.
  14544. *
  14545. * @param {ReactClass} publicInstance The instance that should rerender.
  14546. * @param {object} props New props.
  14547. * @internal
  14548. */
  14549. enqueueReplaceProps: function(publicInstance, props) {
  14550. var internalInstance = getInternalInstanceReadyForUpdate(
  14551. publicInstance,
  14552. 'replaceProps'
  14553. );
  14554. if (!internalInstance) {
  14555. return;
  14556. }
  14557. ("production" !== "development" ? invariant(
  14558. internalInstance._isTopLevel,
  14559. 'replaceProps(...): You called `replaceProps` on a ' +
  14560. 'component with a parent. This is an anti-pattern since props will ' +
  14561. 'get reactively updated when rendered. Instead, change the owner\'s ' +
  14562. '`render` method to pass the correct value as props to the component ' +
  14563. 'where it is created.'
  14564. ) : invariant(internalInstance._isTopLevel));
  14565. // Merge with the pending element if it exists, otherwise with existing
  14566. // element props.
  14567. var element = internalInstance._pendingElement ||
  14568. internalInstance._currentElement;
  14569. internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
  14570. element,
  14571. props
  14572. );
  14573. enqueueUpdate(internalInstance);
  14574. },
  14575. enqueueElementInternal: function(internalInstance, newElement) {
  14576. internalInstance._pendingElement = newElement;
  14577. enqueueUpdate(internalInstance);
  14578. }
  14579. };
  14580. module.exports = ReactUpdateQueue;
  14581. },{"100":100,"150":150,"171":171,"29":29,"45":45,"63":63,"73":73,"74":74}],100:[function(_dereq_,module,exports){
  14582. /**
  14583. * Copyright 2013-2015, Facebook, Inc.
  14584. * All rights reserved.
  14585. *
  14586. * This source code is licensed under the BSD-style license found in the
  14587. * LICENSE file in the root directory of this source tree. An additional grant
  14588. * of patent rights can be found in the PATENTS file in the same directory.
  14589. *
  14590. * @providesModule ReactUpdates
  14591. */
  14592. 'use strict';
  14593. var CallbackQueue = _dereq_(7);
  14594. var PooledClass = _dereq_(30);
  14595. var ReactCurrentOwner = _dereq_(45);
  14596. var ReactPerf = _dereq_(82);
  14597. var ReactReconciler = _dereq_(89);
  14598. var Transaction = _dereq_(116);
  14599. var assign = _dereq_(29);
  14600. var invariant = _dereq_(150);
  14601. var warning = _dereq_(171);
  14602. var dirtyComponents = [];
  14603. var asapCallbackQueue = CallbackQueue.getPooled();
  14604. var asapEnqueued = false;
  14605. var batchingStrategy = null;
  14606. function ensureInjected() {
  14607. ("production" !== "development" ? invariant(
  14608. ReactUpdates.ReactReconcileTransaction && batchingStrategy,
  14609. 'ReactUpdates: must inject a reconcile transaction class and batching ' +
  14610. 'strategy'
  14611. ) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
  14612. }
  14613. var NESTED_UPDATES = {
  14614. initialize: function() {
  14615. this.dirtyComponentsLength = dirtyComponents.length;
  14616. },
  14617. close: function() {
  14618. if (this.dirtyComponentsLength !== dirtyComponents.length) {
  14619. // Additional updates were enqueued by componentDidUpdate handlers or
  14620. // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
  14621. // these new updates so that if A's componentDidUpdate calls setState on
  14622. // B, B will update before the callback A's updater provided when calling
  14623. // setState.
  14624. dirtyComponents.splice(0, this.dirtyComponentsLength);
  14625. flushBatchedUpdates();
  14626. } else {
  14627. dirtyComponents.length = 0;
  14628. }
  14629. }
  14630. };
  14631. var UPDATE_QUEUEING = {
  14632. initialize: function() {
  14633. this.callbackQueue.reset();
  14634. },
  14635. close: function() {
  14636. this.callbackQueue.notifyAll();
  14637. }
  14638. };
  14639. var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
  14640. function ReactUpdatesFlushTransaction() {
  14641. this.reinitializeTransaction();
  14642. this.dirtyComponentsLength = null;
  14643. this.callbackQueue = CallbackQueue.getPooled();
  14644. this.reconcileTransaction =
  14645. ReactUpdates.ReactReconcileTransaction.getPooled();
  14646. }
  14647. assign(
  14648. ReactUpdatesFlushTransaction.prototype,
  14649. Transaction.Mixin, {
  14650. getTransactionWrappers: function() {
  14651. return TRANSACTION_WRAPPERS;
  14652. },
  14653. destructor: function() {
  14654. this.dirtyComponentsLength = null;
  14655. CallbackQueue.release(this.callbackQueue);
  14656. this.callbackQueue = null;
  14657. ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
  14658. this.reconcileTransaction = null;
  14659. },
  14660. perform: function(method, scope, a) {
  14661. // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
  14662. // with this transaction's wrappers around it.
  14663. return Transaction.Mixin.perform.call(
  14664. this,
  14665. this.reconcileTransaction.perform,
  14666. this.reconcileTransaction,
  14667. method,
  14668. scope,
  14669. a
  14670. );
  14671. }
  14672. });
  14673. PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
  14674. function batchedUpdates(callback, a, b, c, d) {
  14675. ensureInjected();
  14676. batchingStrategy.batchedUpdates(callback, a, b, c, d);
  14677. }
  14678. /**
  14679. * Array comparator for ReactComponents by mount ordering.
  14680. *
  14681. * @param {ReactComponent} c1 first component you're comparing
  14682. * @param {ReactComponent} c2 second component you're comparing
  14683. * @return {number} Return value usable by Array.prototype.sort().
  14684. */
  14685. function mountOrderComparator(c1, c2) {
  14686. return c1._mountOrder - c2._mountOrder;
  14687. }
  14688. function runBatchedUpdates(transaction) {
  14689. var len = transaction.dirtyComponentsLength;
  14690. ("production" !== "development" ? invariant(
  14691. len === dirtyComponents.length,
  14692. 'Expected flush transaction\'s stored dirty-components length (%s) to ' +
  14693. 'match dirty-components array length (%s).',
  14694. len,
  14695. dirtyComponents.length
  14696. ) : invariant(len === dirtyComponents.length));
  14697. // Since reconciling a component higher in the owner hierarchy usually (not
  14698. // always -- see shouldComponentUpdate()) will reconcile children, reconcile
  14699. // them before their children by sorting the array.
  14700. dirtyComponents.sort(mountOrderComparator);
  14701. for (var i = 0; i < len; i++) {
  14702. // If a component is unmounted before pending changes apply, it will still
  14703. // be here, but we assume that it has cleared its _pendingCallbacks and
  14704. // that performUpdateIfNecessary is a noop.
  14705. var component = dirtyComponents[i];
  14706. // If performUpdateIfNecessary happens to enqueue any new updates, we
  14707. // shouldn't execute the callbacks until the next render happens, so
  14708. // stash the callbacks first
  14709. var callbacks = component._pendingCallbacks;
  14710. component._pendingCallbacks = null;
  14711. ReactReconciler.performUpdateIfNecessary(
  14712. component,
  14713. transaction.reconcileTransaction
  14714. );
  14715. if (callbacks) {
  14716. for (var j = 0; j < callbacks.length; j++) {
  14717. transaction.callbackQueue.enqueue(
  14718. callbacks[j],
  14719. component.getPublicInstance()
  14720. );
  14721. }
  14722. }
  14723. }
  14724. }
  14725. var flushBatchedUpdates = function() {
  14726. // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
  14727. // array and perform any updates enqueued by mount-ready handlers (i.e.,
  14728. // componentDidUpdate) but we need to check here too in order to catch
  14729. // updates enqueued by setState callbacks and asap calls.
  14730. while (dirtyComponents.length || asapEnqueued) {
  14731. if (dirtyComponents.length) {
  14732. var transaction = ReactUpdatesFlushTransaction.getPooled();
  14733. transaction.perform(runBatchedUpdates, null, transaction);
  14734. ReactUpdatesFlushTransaction.release(transaction);
  14735. }
  14736. if (asapEnqueued) {
  14737. asapEnqueued = false;
  14738. var queue = asapCallbackQueue;
  14739. asapCallbackQueue = CallbackQueue.getPooled();
  14740. queue.notifyAll();
  14741. CallbackQueue.release(queue);
  14742. }
  14743. }
  14744. };
  14745. flushBatchedUpdates = ReactPerf.measure(
  14746. 'ReactUpdates',
  14747. 'flushBatchedUpdates',
  14748. flushBatchedUpdates
  14749. );
  14750. /**
  14751. * Mark a component as needing a rerender, adding an optional callback to a
  14752. * list of functions which will be executed once the rerender occurs.
  14753. */
  14754. function enqueueUpdate(component) {
  14755. ensureInjected();
  14756. // Various parts of our code (such as ReactCompositeComponent's
  14757. // _renderValidatedComponent) assume that calls to render aren't nested;
  14758. // verify that that's the case. (This is called by each top-level update
  14759. // function, like setProps, setState, forceUpdate, etc.; creation and
  14760. // destruction of top-level components is guarded in ReactMount.)
  14761. ("production" !== "development" ? warning(
  14762. ReactCurrentOwner.current == null,
  14763. 'enqueueUpdate(): Render methods should be a pure function of props ' +
  14764. 'and state; triggering nested component updates from render is not ' +
  14765. 'allowed. If necessary, trigger nested updates in ' +
  14766. 'componentDidUpdate.'
  14767. ) : null);
  14768. if (!batchingStrategy.isBatchingUpdates) {
  14769. batchingStrategy.batchedUpdates(enqueueUpdate, component);
  14770. return;
  14771. }
  14772. dirtyComponents.push(component);
  14773. }
  14774. /**
  14775. * Enqueue a callback to be run at the end of the current batching cycle. Throws
  14776. * if no updates are currently being performed.
  14777. */
  14778. function asap(callback, context) {
  14779. ("production" !== "development" ? invariant(
  14780. batchingStrategy.isBatchingUpdates,
  14781. 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
  14782. 'updates are not being batched.'
  14783. ) : invariant(batchingStrategy.isBatchingUpdates));
  14784. asapCallbackQueue.enqueue(callback, context);
  14785. asapEnqueued = true;
  14786. }
  14787. var ReactUpdatesInjection = {
  14788. injectReconcileTransaction: function(ReconcileTransaction) {
  14789. ("production" !== "development" ? invariant(
  14790. ReconcileTransaction,
  14791. 'ReactUpdates: must provide a reconcile transaction class'
  14792. ) : invariant(ReconcileTransaction));
  14793. ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
  14794. },
  14795. injectBatchingStrategy: function(_batchingStrategy) {
  14796. ("production" !== "development" ? invariant(
  14797. _batchingStrategy,
  14798. 'ReactUpdates: must provide a batching strategy'
  14799. ) : invariant(_batchingStrategy));
  14800. ("production" !== "development" ? invariant(
  14801. typeof _batchingStrategy.batchedUpdates === 'function',
  14802. 'ReactUpdates: must provide a batchedUpdates() function'
  14803. ) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
  14804. ("production" !== "development" ? invariant(
  14805. typeof _batchingStrategy.isBatchingUpdates === 'boolean',
  14806. 'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
  14807. ) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
  14808. batchingStrategy = _batchingStrategy;
  14809. }
  14810. };
  14811. var ReactUpdates = {
  14812. /**
  14813. * React references `ReactReconcileTransaction` using this property in order
  14814. * to allow dependency injection.
  14815. *
  14816. * @internal
  14817. */
  14818. ReactReconcileTransaction: null,
  14819. batchedUpdates: batchedUpdates,
  14820. enqueueUpdate: enqueueUpdate,
  14821. flushBatchedUpdates: flushBatchedUpdates,
  14822. injection: ReactUpdatesInjection,
  14823. asap: asap
  14824. };
  14825. module.exports = ReactUpdates;
  14826. },{"116":116,"150":150,"171":171,"29":29,"30":30,"45":45,"7":7,"82":82,"89":89}],101:[function(_dereq_,module,exports){
  14827. /**
  14828. * Copyright 2013-2015, Facebook, Inc.
  14829. * All rights reserved.
  14830. *
  14831. * This source code is licensed under the BSD-style license found in the
  14832. * LICENSE file in the root directory of this source tree. An additional grant
  14833. * of patent rights can be found in the PATENTS file in the same directory.
  14834. *
  14835. * @providesModule SVGDOMPropertyConfig
  14836. */
  14837. /*jslint bitwise: true*/
  14838. 'use strict';
  14839. var DOMProperty = _dereq_(11);
  14840. var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
  14841. var SVGDOMPropertyConfig = {
  14842. Properties: {
  14843. cx: MUST_USE_ATTRIBUTE,
  14844. cy: MUST_USE_ATTRIBUTE,
  14845. d: MUST_USE_ATTRIBUTE,
  14846. dx: MUST_USE_ATTRIBUTE,
  14847. dy: MUST_USE_ATTRIBUTE,
  14848. fill: MUST_USE_ATTRIBUTE,
  14849. fillOpacity: MUST_USE_ATTRIBUTE,
  14850. fontFamily: MUST_USE_ATTRIBUTE,
  14851. fontSize: MUST_USE_ATTRIBUTE,
  14852. fx: MUST_USE_ATTRIBUTE,
  14853. fy: MUST_USE_ATTRIBUTE,
  14854. gradientTransform: MUST_USE_ATTRIBUTE,
  14855. gradientUnits: MUST_USE_ATTRIBUTE,
  14856. markerEnd: MUST_USE_ATTRIBUTE,
  14857. markerMid: MUST_USE_ATTRIBUTE,
  14858. markerStart: MUST_USE_ATTRIBUTE,
  14859. offset: MUST_USE_ATTRIBUTE,
  14860. opacity: MUST_USE_ATTRIBUTE,
  14861. patternContentUnits: MUST_USE_ATTRIBUTE,
  14862. patternUnits: MUST_USE_ATTRIBUTE,
  14863. points: MUST_USE_ATTRIBUTE,
  14864. preserveAspectRatio: MUST_USE_ATTRIBUTE,
  14865. r: MUST_USE_ATTRIBUTE,
  14866. rx: MUST_USE_ATTRIBUTE,
  14867. ry: MUST_USE_ATTRIBUTE,
  14868. spreadMethod: MUST_USE_ATTRIBUTE,
  14869. stopColor: MUST_USE_ATTRIBUTE,
  14870. stopOpacity: MUST_USE_ATTRIBUTE,
  14871. stroke: MUST_USE_ATTRIBUTE,
  14872. strokeDasharray: MUST_USE_ATTRIBUTE,
  14873. strokeLinecap: MUST_USE_ATTRIBUTE,
  14874. strokeOpacity: MUST_USE_ATTRIBUTE,
  14875. strokeWidth: MUST_USE_ATTRIBUTE,
  14876. textAnchor: MUST_USE_ATTRIBUTE,
  14877. transform: MUST_USE_ATTRIBUTE,
  14878. version: MUST_USE_ATTRIBUTE,
  14879. viewBox: MUST_USE_ATTRIBUTE,
  14880. x1: MUST_USE_ATTRIBUTE,
  14881. x2: MUST_USE_ATTRIBUTE,
  14882. x: MUST_USE_ATTRIBUTE,
  14883. y1: MUST_USE_ATTRIBUTE,
  14884. y2: MUST_USE_ATTRIBUTE,
  14885. y: MUST_USE_ATTRIBUTE
  14886. },
  14887. DOMAttributeNames: {
  14888. fillOpacity: 'fill-opacity',
  14889. fontFamily: 'font-family',
  14890. fontSize: 'font-size',
  14891. gradientTransform: 'gradientTransform',
  14892. gradientUnits: 'gradientUnits',
  14893. markerEnd: 'marker-end',
  14894. markerMid: 'marker-mid',
  14895. markerStart: 'marker-start',
  14896. patternContentUnits: 'patternContentUnits',
  14897. patternUnits: 'patternUnits',
  14898. preserveAspectRatio: 'preserveAspectRatio',
  14899. spreadMethod: 'spreadMethod',
  14900. stopColor: 'stop-color',
  14901. stopOpacity: 'stop-opacity',
  14902. strokeDasharray: 'stroke-dasharray',
  14903. strokeLinecap: 'stroke-linecap',
  14904. strokeOpacity: 'stroke-opacity',
  14905. strokeWidth: 'stroke-width',
  14906. textAnchor: 'text-anchor',
  14907. viewBox: 'viewBox'
  14908. }
  14909. };
  14910. module.exports = SVGDOMPropertyConfig;
  14911. },{"11":11}],102:[function(_dereq_,module,exports){
  14912. /**
  14913. * Copyright 2013-2015, Facebook, Inc.
  14914. * All rights reserved.
  14915. *
  14916. * This source code is licensed under the BSD-style license found in the
  14917. * LICENSE file in the root directory of this source tree. An additional grant
  14918. * of patent rights can be found in the PATENTS file in the same directory.
  14919. *
  14920. * @providesModule SelectEventPlugin
  14921. */
  14922. 'use strict';
  14923. var EventConstants = _dereq_(16);
  14924. var EventPropagators = _dereq_(21);
  14925. var ReactInputSelection = _dereq_(71);
  14926. var SyntheticEvent = _dereq_(108);
  14927. var getActiveElement = _dereq_(136);
  14928. var isTextInputElement = _dereq_(153);
  14929. var keyOf = _dereq_(157);
  14930. var shallowEqual = _dereq_(166);
  14931. var topLevelTypes = EventConstants.topLevelTypes;
  14932. var eventTypes = {
  14933. select: {
  14934. phasedRegistrationNames: {
  14935. bubbled: keyOf({onSelect: null}),
  14936. captured: keyOf({onSelectCapture: null})
  14937. },
  14938. dependencies: [
  14939. topLevelTypes.topBlur,
  14940. topLevelTypes.topContextMenu,
  14941. topLevelTypes.topFocus,
  14942. topLevelTypes.topKeyDown,
  14943. topLevelTypes.topMouseDown,
  14944. topLevelTypes.topMouseUp,
  14945. topLevelTypes.topSelectionChange
  14946. ]
  14947. }
  14948. };
  14949. var activeElement = null;
  14950. var activeElementID = null;
  14951. var lastSelection = null;
  14952. var mouseDown = false;
  14953. /**
  14954. * Get an object which is a unique representation of the current selection.
  14955. *
  14956. * The return value will not be consistent across nodes or browsers, but
  14957. * two identical selections on the same node will return identical objects.
  14958. *
  14959. * @param {DOMElement} node
  14960. * @param {object}
  14961. */
  14962. function getSelection(node) {
  14963. if ('selectionStart' in node &&
  14964. ReactInputSelection.hasSelectionCapabilities(node)) {
  14965. return {
  14966. start: node.selectionStart,
  14967. end: node.selectionEnd
  14968. };
  14969. } else if (window.getSelection) {
  14970. var selection = window.getSelection();
  14971. return {
  14972. anchorNode: selection.anchorNode,
  14973. anchorOffset: selection.anchorOffset,
  14974. focusNode: selection.focusNode,
  14975. focusOffset: selection.focusOffset
  14976. };
  14977. } else if (document.selection) {
  14978. var range = document.selection.createRange();
  14979. return {
  14980. parentElement: range.parentElement(),
  14981. text: range.text,
  14982. top: range.boundingTop,
  14983. left: range.boundingLeft
  14984. };
  14985. }
  14986. }
  14987. /**
  14988. * Poll selection to see whether it's changed.
  14989. *
  14990. * @param {object} nativeEvent
  14991. * @return {?SyntheticEvent}
  14992. */
  14993. function constructSelectEvent(nativeEvent) {
  14994. // Ensure we have the right element, and that the user is not dragging a
  14995. // selection (this matches native `select` event behavior). In HTML5, select
  14996. // fires only on input and textarea thus if there's no focused element we
  14997. // won't dispatch.
  14998. if (mouseDown ||
  14999. activeElement == null ||
  15000. activeElement !== getActiveElement()) {
  15001. return null;
  15002. }
  15003. // Only fire when selection has actually changed.
  15004. var currentSelection = getSelection(activeElement);
  15005. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  15006. lastSelection = currentSelection;
  15007. var syntheticEvent = SyntheticEvent.getPooled(
  15008. eventTypes.select,
  15009. activeElementID,
  15010. nativeEvent
  15011. );
  15012. syntheticEvent.type = 'select';
  15013. syntheticEvent.target = activeElement;
  15014. EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
  15015. return syntheticEvent;
  15016. }
  15017. }
  15018. /**
  15019. * This plugin creates an `onSelect` event that normalizes select events
  15020. * across form elements.
  15021. *
  15022. * Supported elements are:
  15023. * - input (see `isTextInputElement`)
  15024. * - textarea
  15025. * - contentEditable
  15026. *
  15027. * This differs from native browser implementations in the following ways:
  15028. * - Fires on contentEditable fields as well as inputs.
  15029. * - Fires for collapsed selection.
  15030. * - Fires after user input.
  15031. */
  15032. var SelectEventPlugin = {
  15033. eventTypes: eventTypes,
  15034. /**
  15035. * @param {string} topLevelType Record from `EventConstants`.
  15036. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  15037. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  15038. * @param {object} nativeEvent Native browser event.
  15039. * @return {*} An accumulation of synthetic events.
  15040. * @see {EventPluginHub.extractEvents}
  15041. */
  15042. extractEvents: function(
  15043. topLevelType,
  15044. topLevelTarget,
  15045. topLevelTargetID,
  15046. nativeEvent) {
  15047. switch (topLevelType) {
  15048. // Track the input node that has focus.
  15049. case topLevelTypes.topFocus:
  15050. if (isTextInputElement(topLevelTarget) ||
  15051. topLevelTarget.contentEditable === 'true') {
  15052. activeElement = topLevelTarget;
  15053. activeElementID = topLevelTargetID;
  15054. lastSelection = null;
  15055. }
  15056. break;
  15057. case topLevelTypes.topBlur:
  15058. activeElement = null;
  15059. activeElementID = null;
  15060. lastSelection = null;
  15061. break;
  15062. // Don't fire the event while the user is dragging. This matches the
  15063. // semantics of the native select event.
  15064. case topLevelTypes.topMouseDown:
  15065. mouseDown = true;
  15066. break;
  15067. case topLevelTypes.topContextMenu:
  15068. case topLevelTypes.topMouseUp:
  15069. mouseDown = false;
  15070. return constructSelectEvent(nativeEvent);
  15071. // Chrome and IE fire non-standard event when selection is changed (and
  15072. // sometimes when it hasn't).
  15073. // Firefox doesn't support selectionchange, so check selection status
  15074. // after each key entry. The selection changes after keydown and before
  15075. // keyup, but we check on keydown as well in the case of holding down a
  15076. // key, when multiple keydown events are fired but only one keyup is.
  15077. case topLevelTypes.topSelectionChange:
  15078. case topLevelTypes.topKeyDown:
  15079. case topLevelTypes.topKeyUp:
  15080. return constructSelectEvent(nativeEvent);
  15081. }
  15082. }
  15083. };
  15084. module.exports = SelectEventPlugin;
  15085. },{"108":108,"136":136,"153":153,"157":157,"16":16,"166":166,"21":21,"71":71}],103:[function(_dereq_,module,exports){
  15086. /**
  15087. * Copyright 2013-2015, Facebook, Inc.
  15088. * All rights reserved.
  15089. *
  15090. * This source code is licensed under the BSD-style license found in the
  15091. * LICENSE file in the root directory of this source tree. An additional grant
  15092. * of patent rights can be found in the PATENTS file in the same directory.
  15093. *
  15094. * @providesModule ServerReactRootIndex
  15095. * @typechecks
  15096. */
  15097. 'use strict';
  15098. /**
  15099. * Size of the reactRoot ID space. We generate random numbers for React root
  15100. * IDs and if there's a collision the events and DOM update system will
  15101. * get confused. In the future we need a way to generate GUIDs but for
  15102. * now this will work on a smaller scale.
  15103. */
  15104. var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
  15105. var ServerReactRootIndex = {
  15106. createReactRootIndex: function() {
  15107. return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
  15108. }
  15109. };
  15110. module.exports = ServerReactRootIndex;
  15111. },{}],104:[function(_dereq_,module,exports){
  15112. /**
  15113. * Copyright 2013-2015, Facebook, Inc.
  15114. * All rights reserved.
  15115. *
  15116. * This source code is licensed under the BSD-style license found in the
  15117. * LICENSE file in the root directory of this source tree. An additional grant
  15118. * of patent rights can be found in the PATENTS file in the same directory.
  15119. *
  15120. * @providesModule SimpleEventPlugin
  15121. */
  15122. 'use strict';
  15123. var EventConstants = _dereq_(16);
  15124. var EventPluginUtils = _dereq_(20);
  15125. var EventPropagators = _dereq_(21);
  15126. var SyntheticClipboardEvent = _dereq_(105);
  15127. var SyntheticEvent = _dereq_(108);
  15128. var SyntheticFocusEvent = _dereq_(109);
  15129. var SyntheticKeyboardEvent = _dereq_(111);
  15130. var SyntheticMouseEvent = _dereq_(112);
  15131. var SyntheticDragEvent = _dereq_(107);
  15132. var SyntheticTouchEvent = _dereq_(113);
  15133. var SyntheticUIEvent = _dereq_(114);
  15134. var SyntheticWheelEvent = _dereq_(115);
  15135. var getEventCharCode = _dereq_(137);
  15136. var invariant = _dereq_(150);
  15137. var keyOf = _dereq_(157);
  15138. var warning = _dereq_(171);
  15139. var topLevelTypes = EventConstants.topLevelTypes;
  15140. var eventTypes = {
  15141. blur: {
  15142. phasedRegistrationNames: {
  15143. bubbled: keyOf({onBlur: true}),
  15144. captured: keyOf({onBlurCapture: true})
  15145. }
  15146. },
  15147. click: {
  15148. phasedRegistrationNames: {
  15149. bubbled: keyOf({onClick: true}),
  15150. captured: keyOf({onClickCapture: true})
  15151. }
  15152. },
  15153. contextMenu: {
  15154. phasedRegistrationNames: {
  15155. bubbled: keyOf({onContextMenu: true}),
  15156. captured: keyOf({onContextMenuCapture: true})
  15157. }
  15158. },
  15159. copy: {
  15160. phasedRegistrationNames: {
  15161. bubbled: keyOf({onCopy: true}),
  15162. captured: keyOf({onCopyCapture: true})
  15163. }
  15164. },
  15165. cut: {
  15166. phasedRegistrationNames: {
  15167. bubbled: keyOf({onCut: true}),
  15168. captured: keyOf({onCutCapture: true})
  15169. }
  15170. },
  15171. doubleClick: {
  15172. phasedRegistrationNames: {
  15173. bubbled: keyOf({onDoubleClick: true}),
  15174. captured: keyOf({onDoubleClickCapture: true})
  15175. }
  15176. },
  15177. drag: {
  15178. phasedRegistrationNames: {
  15179. bubbled: keyOf({onDrag: true}),
  15180. captured: keyOf({onDragCapture: true})
  15181. }
  15182. },
  15183. dragEnd: {
  15184. phasedRegistrationNames: {
  15185. bubbled: keyOf({onDragEnd: true}),
  15186. captured: keyOf({onDragEndCapture: true})
  15187. }
  15188. },
  15189. dragEnter: {
  15190. phasedRegistrationNames: {
  15191. bubbled: keyOf({onDragEnter: true}),
  15192. captured: keyOf({onDragEnterCapture: true})
  15193. }
  15194. },
  15195. dragExit: {
  15196. phasedRegistrationNames: {
  15197. bubbled: keyOf({onDragExit: true}),
  15198. captured: keyOf({onDragExitCapture: true})
  15199. }
  15200. },
  15201. dragLeave: {
  15202. phasedRegistrationNames: {
  15203. bubbled: keyOf({onDragLeave: true}),
  15204. captured: keyOf({onDragLeaveCapture: true})
  15205. }
  15206. },
  15207. dragOver: {
  15208. phasedRegistrationNames: {
  15209. bubbled: keyOf({onDragOver: true}),
  15210. captured: keyOf({onDragOverCapture: true})
  15211. }
  15212. },
  15213. dragStart: {
  15214. phasedRegistrationNames: {
  15215. bubbled: keyOf({onDragStart: true}),
  15216. captured: keyOf({onDragStartCapture: true})
  15217. }
  15218. },
  15219. drop: {
  15220. phasedRegistrationNames: {
  15221. bubbled: keyOf({onDrop: true}),
  15222. captured: keyOf({onDropCapture: true})
  15223. }
  15224. },
  15225. focus: {
  15226. phasedRegistrationNames: {
  15227. bubbled: keyOf({onFocus: true}),
  15228. captured: keyOf({onFocusCapture: true})
  15229. }
  15230. },
  15231. input: {
  15232. phasedRegistrationNames: {
  15233. bubbled: keyOf({onInput: true}),
  15234. captured: keyOf({onInputCapture: true})
  15235. }
  15236. },
  15237. keyDown: {
  15238. phasedRegistrationNames: {
  15239. bubbled: keyOf({onKeyDown: true}),
  15240. captured: keyOf({onKeyDownCapture: true})
  15241. }
  15242. },
  15243. keyPress: {
  15244. phasedRegistrationNames: {
  15245. bubbled: keyOf({onKeyPress: true}),
  15246. captured: keyOf({onKeyPressCapture: true})
  15247. }
  15248. },
  15249. keyUp: {
  15250. phasedRegistrationNames: {
  15251. bubbled: keyOf({onKeyUp: true}),
  15252. captured: keyOf({onKeyUpCapture: true})
  15253. }
  15254. },
  15255. load: {
  15256. phasedRegistrationNames: {
  15257. bubbled: keyOf({onLoad: true}),
  15258. captured: keyOf({onLoadCapture: true})
  15259. }
  15260. },
  15261. error: {
  15262. phasedRegistrationNames: {
  15263. bubbled: keyOf({onError: true}),
  15264. captured: keyOf({onErrorCapture: true})
  15265. }
  15266. },
  15267. // Note: We do not allow listening to mouseOver events. Instead, use the
  15268. // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
  15269. mouseDown: {
  15270. phasedRegistrationNames: {
  15271. bubbled: keyOf({onMouseDown: true}),
  15272. captured: keyOf({onMouseDownCapture: true})
  15273. }
  15274. },
  15275. mouseMove: {
  15276. phasedRegistrationNames: {
  15277. bubbled: keyOf({onMouseMove: true}),
  15278. captured: keyOf({onMouseMoveCapture: true})
  15279. }
  15280. },
  15281. mouseOut: {
  15282. phasedRegistrationNames: {
  15283. bubbled: keyOf({onMouseOut: true}),
  15284. captured: keyOf({onMouseOutCapture: true})
  15285. }
  15286. },
  15287. mouseOver: {
  15288. phasedRegistrationNames: {
  15289. bubbled: keyOf({onMouseOver: true}),
  15290. captured: keyOf({onMouseOverCapture: true})
  15291. }
  15292. },
  15293. mouseUp: {
  15294. phasedRegistrationNames: {
  15295. bubbled: keyOf({onMouseUp: true}),
  15296. captured: keyOf({onMouseUpCapture: true})
  15297. }
  15298. },
  15299. paste: {
  15300. phasedRegistrationNames: {
  15301. bubbled: keyOf({onPaste: true}),
  15302. captured: keyOf({onPasteCapture: true})
  15303. }
  15304. },
  15305. reset: {
  15306. phasedRegistrationNames: {
  15307. bubbled: keyOf({onReset: true}),
  15308. captured: keyOf({onResetCapture: true})
  15309. }
  15310. },
  15311. scroll: {
  15312. phasedRegistrationNames: {
  15313. bubbled: keyOf({onScroll: true}),
  15314. captured: keyOf({onScrollCapture: true})
  15315. }
  15316. },
  15317. submit: {
  15318. phasedRegistrationNames: {
  15319. bubbled: keyOf({onSubmit: true}),
  15320. captured: keyOf({onSubmitCapture: true})
  15321. }
  15322. },
  15323. touchCancel: {
  15324. phasedRegistrationNames: {
  15325. bubbled: keyOf({onTouchCancel: true}),
  15326. captured: keyOf({onTouchCancelCapture: true})
  15327. }
  15328. },
  15329. touchEnd: {
  15330. phasedRegistrationNames: {
  15331. bubbled: keyOf({onTouchEnd: true}),
  15332. captured: keyOf({onTouchEndCapture: true})
  15333. }
  15334. },
  15335. touchMove: {
  15336. phasedRegistrationNames: {
  15337. bubbled: keyOf({onTouchMove: true}),
  15338. captured: keyOf({onTouchMoveCapture: true})
  15339. }
  15340. },
  15341. touchStart: {
  15342. phasedRegistrationNames: {
  15343. bubbled: keyOf({onTouchStart: true}),
  15344. captured: keyOf({onTouchStartCapture: true})
  15345. }
  15346. },
  15347. wheel: {
  15348. phasedRegistrationNames: {
  15349. bubbled: keyOf({onWheel: true}),
  15350. captured: keyOf({onWheelCapture: true})
  15351. }
  15352. }
  15353. };
  15354. var topLevelEventsToDispatchConfig = {
  15355. topBlur: eventTypes.blur,
  15356. topClick: eventTypes.click,
  15357. topContextMenu: eventTypes.contextMenu,
  15358. topCopy: eventTypes.copy,
  15359. topCut: eventTypes.cut,
  15360. topDoubleClick: eventTypes.doubleClick,
  15361. topDrag: eventTypes.drag,
  15362. topDragEnd: eventTypes.dragEnd,
  15363. topDragEnter: eventTypes.dragEnter,
  15364. topDragExit: eventTypes.dragExit,
  15365. topDragLeave: eventTypes.dragLeave,
  15366. topDragOver: eventTypes.dragOver,
  15367. topDragStart: eventTypes.dragStart,
  15368. topDrop: eventTypes.drop,
  15369. topError: eventTypes.error,
  15370. topFocus: eventTypes.focus,
  15371. topInput: eventTypes.input,
  15372. topKeyDown: eventTypes.keyDown,
  15373. topKeyPress: eventTypes.keyPress,
  15374. topKeyUp: eventTypes.keyUp,
  15375. topLoad: eventTypes.load,
  15376. topMouseDown: eventTypes.mouseDown,
  15377. topMouseMove: eventTypes.mouseMove,
  15378. topMouseOut: eventTypes.mouseOut,
  15379. topMouseOver: eventTypes.mouseOver,
  15380. topMouseUp: eventTypes.mouseUp,
  15381. topPaste: eventTypes.paste,
  15382. topReset: eventTypes.reset,
  15383. topScroll: eventTypes.scroll,
  15384. topSubmit: eventTypes.submit,
  15385. topTouchCancel: eventTypes.touchCancel,
  15386. topTouchEnd: eventTypes.touchEnd,
  15387. topTouchMove: eventTypes.touchMove,
  15388. topTouchStart: eventTypes.touchStart,
  15389. topWheel: eventTypes.wheel
  15390. };
  15391. for (var type in topLevelEventsToDispatchConfig) {
  15392. topLevelEventsToDispatchConfig[type].dependencies = [type];
  15393. }
  15394. var SimpleEventPlugin = {
  15395. eventTypes: eventTypes,
  15396. /**
  15397. * Same as the default implementation, except cancels the event when return
  15398. * value is false. This behavior will be disabled in a future release.
  15399. *
  15400. * @param {object} Event to be dispatched.
  15401. * @param {function} Application-level callback.
  15402. * @param {string} domID DOM ID to pass to the callback.
  15403. */
  15404. executeDispatch: function(event, listener, domID) {
  15405. var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
  15406. ("production" !== "development" ? warning(
  15407. typeof returnValue !== 'boolean',
  15408. 'Returning `false` from an event handler is deprecated and will be ' +
  15409. 'ignored in a future release. Instead, manually call ' +
  15410. 'e.stopPropagation() or e.preventDefault(), as appropriate.'
  15411. ) : null);
  15412. if (returnValue === false) {
  15413. event.stopPropagation();
  15414. event.preventDefault();
  15415. }
  15416. },
  15417. /**
  15418. * @param {string} topLevelType Record from `EventConstants`.
  15419. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  15420. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  15421. * @param {object} nativeEvent Native browser event.
  15422. * @return {*} An accumulation of synthetic events.
  15423. * @see {EventPluginHub.extractEvents}
  15424. */
  15425. extractEvents: function(
  15426. topLevelType,
  15427. topLevelTarget,
  15428. topLevelTargetID,
  15429. nativeEvent) {
  15430. var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  15431. if (!dispatchConfig) {
  15432. return null;
  15433. }
  15434. var EventConstructor;
  15435. switch (topLevelType) {
  15436. case topLevelTypes.topInput:
  15437. case topLevelTypes.topLoad:
  15438. case topLevelTypes.topError:
  15439. case topLevelTypes.topReset:
  15440. case topLevelTypes.topSubmit:
  15441. // HTML Events
  15442. // @see http://www.w3.org/TR/html5/index.html#events-0
  15443. EventConstructor = SyntheticEvent;
  15444. break;
  15445. case topLevelTypes.topKeyPress:
  15446. // FireFox creates a keypress event for function keys too. This removes
  15447. // the unwanted keypress events. Enter is however both printable and
  15448. // non-printable. One would expect Tab to be as well (but it isn't).
  15449. if (getEventCharCode(nativeEvent) === 0) {
  15450. return null;
  15451. }
  15452. /* falls through */
  15453. case topLevelTypes.topKeyDown:
  15454. case topLevelTypes.topKeyUp:
  15455. EventConstructor = SyntheticKeyboardEvent;
  15456. break;
  15457. case topLevelTypes.topBlur:
  15458. case topLevelTypes.topFocus:
  15459. EventConstructor = SyntheticFocusEvent;
  15460. break;
  15461. case topLevelTypes.topClick:
  15462. // Firefox creates a click event on right mouse clicks. This removes the
  15463. // unwanted click events.
  15464. if (nativeEvent.button === 2) {
  15465. return null;
  15466. }
  15467. /* falls through */
  15468. case topLevelTypes.topContextMenu:
  15469. case topLevelTypes.topDoubleClick:
  15470. case topLevelTypes.topMouseDown:
  15471. case topLevelTypes.topMouseMove:
  15472. case topLevelTypes.topMouseOut:
  15473. case topLevelTypes.topMouseOver:
  15474. case topLevelTypes.topMouseUp:
  15475. EventConstructor = SyntheticMouseEvent;
  15476. break;
  15477. case topLevelTypes.topDrag:
  15478. case topLevelTypes.topDragEnd:
  15479. case topLevelTypes.topDragEnter:
  15480. case topLevelTypes.topDragExit:
  15481. case topLevelTypes.topDragLeave:
  15482. case topLevelTypes.topDragOver:
  15483. case topLevelTypes.topDragStart:
  15484. case topLevelTypes.topDrop:
  15485. EventConstructor = SyntheticDragEvent;
  15486. break;
  15487. case topLevelTypes.topTouchCancel:
  15488. case topLevelTypes.topTouchEnd:
  15489. case topLevelTypes.topTouchMove:
  15490. case topLevelTypes.topTouchStart:
  15491. EventConstructor = SyntheticTouchEvent;
  15492. break;
  15493. case topLevelTypes.topScroll:
  15494. EventConstructor = SyntheticUIEvent;
  15495. break;
  15496. case topLevelTypes.topWheel:
  15497. EventConstructor = SyntheticWheelEvent;
  15498. break;
  15499. case topLevelTypes.topCopy:
  15500. case topLevelTypes.topCut:
  15501. case topLevelTypes.topPaste:
  15502. EventConstructor = SyntheticClipboardEvent;
  15503. break;
  15504. }
  15505. ("production" !== "development" ? invariant(
  15506. EventConstructor,
  15507. 'SimpleEventPlugin: Unhandled event type, `%s`.',
  15508. topLevelType
  15509. ) : invariant(EventConstructor));
  15510. var event = EventConstructor.getPooled(
  15511. dispatchConfig,
  15512. topLevelTargetID,
  15513. nativeEvent
  15514. );
  15515. EventPropagators.accumulateTwoPhaseDispatches(event);
  15516. return event;
  15517. }
  15518. };
  15519. module.exports = SimpleEventPlugin;
  15520. },{"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){
  15521. /**
  15522. * Copyright 2013-2015, Facebook, Inc.
  15523. * All rights reserved.
  15524. *
  15525. * This source code is licensed under the BSD-style license found in the
  15526. * LICENSE file in the root directory of this source tree. An additional grant
  15527. * of patent rights can be found in the PATENTS file in the same directory.
  15528. *
  15529. * @providesModule SyntheticClipboardEvent
  15530. * @typechecks static-only
  15531. */
  15532. 'use strict';
  15533. var SyntheticEvent = _dereq_(108);
  15534. /**
  15535. * @interface Event
  15536. * @see http://www.w3.org/TR/clipboard-apis/
  15537. */
  15538. var ClipboardEventInterface = {
  15539. clipboardData: function(event) {
  15540. return (
  15541. 'clipboardData' in event ?
  15542. event.clipboardData :
  15543. window.clipboardData
  15544. );
  15545. }
  15546. };
  15547. /**
  15548. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15549. * @param {string} dispatchMarker Marker identifying the event target.
  15550. * @param {object} nativeEvent Native browser event.
  15551. * @extends {SyntheticUIEvent}
  15552. */
  15553. function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  15554. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15555. }
  15556. SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
  15557. module.exports = SyntheticClipboardEvent;
  15558. },{"108":108}],106:[function(_dereq_,module,exports){
  15559. /**
  15560. * Copyright 2013-2015, Facebook, Inc.
  15561. * All rights reserved.
  15562. *
  15563. * This source code is licensed under the BSD-style license found in the
  15564. * LICENSE file in the root directory of this source tree. An additional grant
  15565. * of patent rights can be found in the PATENTS file in the same directory.
  15566. *
  15567. * @providesModule SyntheticCompositionEvent
  15568. * @typechecks static-only
  15569. */
  15570. 'use strict';
  15571. var SyntheticEvent = _dereq_(108);
  15572. /**
  15573. * @interface Event
  15574. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  15575. */
  15576. var CompositionEventInterface = {
  15577. data: null
  15578. };
  15579. /**
  15580. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15581. * @param {string} dispatchMarker Marker identifying the event target.
  15582. * @param {object} nativeEvent Native browser event.
  15583. * @extends {SyntheticUIEvent}
  15584. */
  15585. function SyntheticCompositionEvent(
  15586. dispatchConfig,
  15587. dispatchMarker,
  15588. nativeEvent) {
  15589. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15590. }
  15591. SyntheticEvent.augmentClass(
  15592. SyntheticCompositionEvent,
  15593. CompositionEventInterface
  15594. );
  15595. module.exports = SyntheticCompositionEvent;
  15596. },{"108":108}],107:[function(_dereq_,module,exports){
  15597. /**
  15598. * Copyright 2013-2015, Facebook, Inc.
  15599. * All rights reserved.
  15600. *
  15601. * This source code is licensed under the BSD-style license found in the
  15602. * LICENSE file in the root directory of this source tree. An additional grant
  15603. * of patent rights can be found in the PATENTS file in the same directory.
  15604. *
  15605. * @providesModule SyntheticDragEvent
  15606. * @typechecks static-only
  15607. */
  15608. 'use strict';
  15609. var SyntheticMouseEvent = _dereq_(112);
  15610. /**
  15611. * @interface DragEvent
  15612. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15613. */
  15614. var DragEventInterface = {
  15615. dataTransfer: null
  15616. };
  15617. /**
  15618. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15619. * @param {string} dispatchMarker Marker identifying the event target.
  15620. * @param {object} nativeEvent Native browser event.
  15621. * @extends {SyntheticUIEvent}
  15622. */
  15623. function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  15624. SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15625. }
  15626. SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
  15627. module.exports = SyntheticDragEvent;
  15628. },{"112":112}],108:[function(_dereq_,module,exports){
  15629. /**
  15630. * Copyright 2013-2015, Facebook, Inc.
  15631. * All rights reserved.
  15632. *
  15633. * This source code is licensed under the BSD-style license found in the
  15634. * LICENSE file in the root directory of this source tree. An additional grant
  15635. * of patent rights can be found in the PATENTS file in the same directory.
  15636. *
  15637. * @providesModule SyntheticEvent
  15638. * @typechecks static-only
  15639. */
  15640. 'use strict';
  15641. var PooledClass = _dereq_(30);
  15642. var assign = _dereq_(29);
  15643. var emptyFunction = _dereq_(129);
  15644. var getEventTarget = _dereq_(140);
  15645. /**
  15646. * @interface Event
  15647. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15648. */
  15649. var EventInterface = {
  15650. type: null,
  15651. target: getEventTarget,
  15652. // currentTarget is set when dispatching; no use in copying it here
  15653. currentTarget: emptyFunction.thatReturnsNull,
  15654. eventPhase: null,
  15655. bubbles: null,
  15656. cancelable: null,
  15657. timeStamp: function(event) {
  15658. return event.timeStamp || Date.now();
  15659. },
  15660. defaultPrevented: null,
  15661. isTrusted: null
  15662. };
  15663. /**
  15664. * Synthetic events are dispatched by event plugins, typically in response to a
  15665. * top-level event delegation handler.
  15666. *
  15667. * These systems should generally use pooling to reduce the frequency of garbage
  15668. * collection. The system should check `isPersistent` to determine whether the
  15669. * event should be released into the pool after being dispatched. Users that
  15670. * need a persisted event should invoke `persist`.
  15671. *
  15672. * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
  15673. * normalizing browser quirks. Subclasses do not necessarily have to implement a
  15674. * DOM interface; custom application-specific events can also subclass this.
  15675. *
  15676. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15677. * @param {string} dispatchMarker Marker identifying the event target.
  15678. * @param {object} nativeEvent Native browser event.
  15679. */
  15680. function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  15681. this.dispatchConfig = dispatchConfig;
  15682. this.dispatchMarker = dispatchMarker;
  15683. this.nativeEvent = nativeEvent;
  15684. var Interface = this.constructor.Interface;
  15685. for (var propName in Interface) {
  15686. if (!Interface.hasOwnProperty(propName)) {
  15687. continue;
  15688. }
  15689. var normalize = Interface[propName];
  15690. if (normalize) {
  15691. this[propName] = normalize(nativeEvent);
  15692. } else {
  15693. this[propName] = nativeEvent[propName];
  15694. }
  15695. }
  15696. var defaultPrevented = nativeEvent.defaultPrevented != null ?
  15697. nativeEvent.defaultPrevented :
  15698. nativeEvent.returnValue === false;
  15699. if (defaultPrevented) {
  15700. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  15701. } else {
  15702. this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
  15703. }
  15704. this.isPropagationStopped = emptyFunction.thatReturnsFalse;
  15705. }
  15706. assign(SyntheticEvent.prototype, {
  15707. preventDefault: function() {
  15708. this.defaultPrevented = true;
  15709. var event = this.nativeEvent;
  15710. if (event.preventDefault) {
  15711. event.preventDefault();
  15712. } else {
  15713. event.returnValue = false;
  15714. }
  15715. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  15716. },
  15717. stopPropagation: function() {
  15718. var event = this.nativeEvent;
  15719. if (event.stopPropagation) {
  15720. event.stopPropagation();
  15721. } else {
  15722. event.cancelBubble = true;
  15723. }
  15724. this.isPropagationStopped = emptyFunction.thatReturnsTrue;
  15725. },
  15726. /**
  15727. * We release all dispatched `SyntheticEvent`s after each event loop, adding
  15728. * them back into the pool. This allows a way to hold onto a reference that
  15729. * won't be added back into the pool.
  15730. */
  15731. persist: function() {
  15732. this.isPersistent = emptyFunction.thatReturnsTrue;
  15733. },
  15734. /**
  15735. * Checks if this event should be released back into the pool.
  15736. *
  15737. * @return {boolean} True if this should not be released, false otherwise.
  15738. */
  15739. isPersistent: emptyFunction.thatReturnsFalse,
  15740. /**
  15741. * `PooledClass` looks for `destructor` on each instance it releases.
  15742. */
  15743. destructor: function() {
  15744. var Interface = this.constructor.Interface;
  15745. for (var propName in Interface) {
  15746. this[propName] = null;
  15747. }
  15748. this.dispatchConfig = null;
  15749. this.dispatchMarker = null;
  15750. this.nativeEvent = null;
  15751. }
  15752. });
  15753. SyntheticEvent.Interface = EventInterface;
  15754. /**
  15755. * Helper to reduce boilerplate when creating subclasses.
  15756. *
  15757. * @param {function} Class
  15758. * @param {?object} Interface
  15759. */
  15760. SyntheticEvent.augmentClass = function(Class, Interface) {
  15761. var Super = this;
  15762. var prototype = Object.create(Super.prototype);
  15763. assign(prototype, Class.prototype);
  15764. Class.prototype = prototype;
  15765. Class.prototype.constructor = Class;
  15766. Class.Interface = assign({}, Super.Interface, Interface);
  15767. Class.augmentClass = Super.augmentClass;
  15768. PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
  15769. };
  15770. PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
  15771. module.exports = SyntheticEvent;
  15772. },{"129":129,"140":140,"29":29,"30":30}],109:[function(_dereq_,module,exports){
  15773. /**
  15774. * Copyright 2013-2015, Facebook, Inc.
  15775. * All rights reserved.
  15776. *
  15777. * This source code is licensed under the BSD-style license found in the
  15778. * LICENSE file in the root directory of this source tree. An additional grant
  15779. * of patent rights can be found in the PATENTS file in the same directory.
  15780. *
  15781. * @providesModule SyntheticFocusEvent
  15782. * @typechecks static-only
  15783. */
  15784. 'use strict';
  15785. var SyntheticUIEvent = _dereq_(114);
  15786. /**
  15787. * @interface FocusEvent
  15788. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15789. */
  15790. var FocusEventInterface = {
  15791. relatedTarget: null
  15792. };
  15793. /**
  15794. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15795. * @param {string} dispatchMarker Marker identifying the event target.
  15796. * @param {object} nativeEvent Native browser event.
  15797. * @extends {SyntheticUIEvent}
  15798. */
  15799. function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  15800. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15801. }
  15802. SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
  15803. module.exports = SyntheticFocusEvent;
  15804. },{"114":114}],110:[function(_dereq_,module,exports){
  15805. /**
  15806. * Copyright 2013-2015, Facebook, Inc.
  15807. * All rights reserved.
  15808. *
  15809. * This source code is licensed under the BSD-style license found in the
  15810. * LICENSE file in the root directory of this source tree. An additional grant
  15811. * of patent rights can be found in the PATENTS file in the same directory.
  15812. *
  15813. * @providesModule SyntheticInputEvent
  15814. * @typechecks static-only
  15815. */
  15816. 'use strict';
  15817. var SyntheticEvent = _dereq_(108);
  15818. /**
  15819. * @interface Event
  15820. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  15821. * /#events-inputevents
  15822. */
  15823. var InputEventInterface = {
  15824. data: null
  15825. };
  15826. /**
  15827. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15828. * @param {string} dispatchMarker Marker identifying the event target.
  15829. * @param {object} nativeEvent Native browser event.
  15830. * @extends {SyntheticUIEvent}
  15831. */
  15832. function SyntheticInputEvent(
  15833. dispatchConfig,
  15834. dispatchMarker,
  15835. nativeEvent) {
  15836. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15837. }
  15838. SyntheticEvent.augmentClass(
  15839. SyntheticInputEvent,
  15840. InputEventInterface
  15841. );
  15842. module.exports = SyntheticInputEvent;
  15843. },{"108":108}],111:[function(_dereq_,module,exports){
  15844. /**
  15845. * Copyright 2013-2015, Facebook, Inc.
  15846. * All rights reserved.
  15847. *
  15848. * This source code is licensed under the BSD-style license found in the
  15849. * LICENSE file in the root directory of this source tree. An additional grant
  15850. * of patent rights can be found in the PATENTS file in the same directory.
  15851. *
  15852. * @providesModule SyntheticKeyboardEvent
  15853. * @typechecks static-only
  15854. */
  15855. 'use strict';
  15856. var SyntheticUIEvent = _dereq_(114);
  15857. var getEventCharCode = _dereq_(137);
  15858. var getEventKey = _dereq_(138);
  15859. var getEventModifierState = _dereq_(139);
  15860. /**
  15861. * @interface KeyboardEvent
  15862. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15863. */
  15864. var KeyboardEventInterface = {
  15865. key: getEventKey,
  15866. location: null,
  15867. ctrlKey: null,
  15868. shiftKey: null,
  15869. altKey: null,
  15870. metaKey: null,
  15871. repeat: null,
  15872. locale: null,
  15873. getModifierState: getEventModifierState,
  15874. // Legacy Interface
  15875. charCode: function(event) {
  15876. // `charCode` is the result of a KeyPress event and represents the value of
  15877. // the actual printable character.
  15878. // KeyPress is deprecated, but its replacement is not yet final and not
  15879. // implemented in any major browser. Only KeyPress has charCode.
  15880. if (event.type === 'keypress') {
  15881. return getEventCharCode(event);
  15882. }
  15883. return 0;
  15884. },
  15885. keyCode: function(event) {
  15886. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  15887. // physical keyboard key.
  15888. // The actual meaning of the value depends on the users' keyboard layout
  15889. // which cannot be detected. Assuming that it is a US keyboard layout
  15890. // provides a surprisingly accurate mapping for US and European users.
  15891. // Due to this, it is left to the user to implement at this time.
  15892. if (event.type === 'keydown' || event.type === 'keyup') {
  15893. return event.keyCode;
  15894. }
  15895. return 0;
  15896. },
  15897. which: function(event) {
  15898. // `which` is an alias for either `keyCode` or `charCode` depending on the
  15899. // type of the event.
  15900. if (event.type === 'keypress') {
  15901. return getEventCharCode(event);
  15902. }
  15903. if (event.type === 'keydown' || event.type === 'keyup') {
  15904. return event.keyCode;
  15905. }
  15906. return 0;
  15907. }
  15908. };
  15909. /**
  15910. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15911. * @param {string} dispatchMarker Marker identifying the event target.
  15912. * @param {object} nativeEvent Native browser event.
  15913. * @extends {SyntheticUIEvent}
  15914. */
  15915. function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  15916. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15917. }
  15918. SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
  15919. module.exports = SyntheticKeyboardEvent;
  15920. },{"114":114,"137":137,"138":138,"139":139}],112:[function(_dereq_,module,exports){
  15921. /**
  15922. * Copyright 2013-2015, Facebook, Inc.
  15923. * All rights reserved.
  15924. *
  15925. * This source code is licensed under the BSD-style license found in the
  15926. * LICENSE file in the root directory of this source tree. An additional grant
  15927. * of patent rights can be found in the PATENTS file in the same directory.
  15928. *
  15929. * @providesModule SyntheticMouseEvent
  15930. * @typechecks static-only
  15931. */
  15932. 'use strict';
  15933. var SyntheticUIEvent = _dereq_(114);
  15934. var ViewportMetrics = _dereq_(117);
  15935. var getEventModifierState = _dereq_(139);
  15936. /**
  15937. * @interface MouseEvent
  15938. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  15939. */
  15940. var MouseEventInterface = {
  15941. screenX: null,
  15942. screenY: null,
  15943. clientX: null,
  15944. clientY: null,
  15945. ctrlKey: null,
  15946. shiftKey: null,
  15947. altKey: null,
  15948. metaKey: null,
  15949. getModifierState: getEventModifierState,
  15950. button: function(event) {
  15951. // Webkit, Firefox, IE9+
  15952. // which: 1 2 3
  15953. // button: 0 1 2 (standard)
  15954. var button = event.button;
  15955. if ('which' in event) {
  15956. return button;
  15957. }
  15958. // IE<9
  15959. // which: undefined
  15960. // button: 0 0 0
  15961. // button: 1 4 2 (onmouseup)
  15962. return button === 2 ? 2 : button === 4 ? 1 : 0;
  15963. },
  15964. buttons: null,
  15965. relatedTarget: function(event) {
  15966. return event.relatedTarget || (
  15967. ((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
  15968. );
  15969. },
  15970. // "Proprietary" Interface.
  15971. pageX: function(event) {
  15972. return 'pageX' in event ?
  15973. event.pageX :
  15974. event.clientX + ViewportMetrics.currentScrollLeft;
  15975. },
  15976. pageY: function(event) {
  15977. return 'pageY' in event ?
  15978. event.pageY :
  15979. event.clientY + ViewportMetrics.currentScrollTop;
  15980. }
  15981. };
  15982. /**
  15983. * @param {object} dispatchConfig Configuration used to dispatch this event.
  15984. * @param {string} dispatchMarker Marker identifying the event target.
  15985. * @param {object} nativeEvent Native browser event.
  15986. * @extends {SyntheticUIEvent}
  15987. */
  15988. function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  15989. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  15990. }
  15991. SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
  15992. module.exports = SyntheticMouseEvent;
  15993. },{"114":114,"117":117,"139":139}],113:[function(_dereq_,module,exports){
  15994. /**
  15995. * Copyright 2013-2015, Facebook, Inc.
  15996. * All rights reserved.
  15997. *
  15998. * This source code is licensed under the BSD-style license found in the
  15999. * LICENSE file in the root directory of this source tree. An additional grant
  16000. * of patent rights can be found in the PATENTS file in the same directory.
  16001. *
  16002. * @providesModule SyntheticTouchEvent
  16003. * @typechecks static-only
  16004. */
  16005. 'use strict';
  16006. var SyntheticUIEvent = _dereq_(114);
  16007. var getEventModifierState = _dereq_(139);
  16008. /**
  16009. * @interface TouchEvent
  16010. * @see http://www.w3.org/TR/touch-events/
  16011. */
  16012. var TouchEventInterface = {
  16013. touches: null,
  16014. targetTouches: null,
  16015. changedTouches: null,
  16016. altKey: null,
  16017. metaKey: null,
  16018. ctrlKey: null,
  16019. shiftKey: null,
  16020. getModifierState: getEventModifierState
  16021. };
  16022. /**
  16023. * @param {object} dispatchConfig Configuration used to dispatch this event.
  16024. * @param {string} dispatchMarker Marker identifying the event target.
  16025. * @param {object} nativeEvent Native browser event.
  16026. * @extends {SyntheticUIEvent}
  16027. */
  16028. function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  16029. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  16030. }
  16031. SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
  16032. module.exports = SyntheticTouchEvent;
  16033. },{"114":114,"139":139}],114:[function(_dereq_,module,exports){
  16034. /**
  16035. * Copyright 2013-2015, Facebook, Inc.
  16036. * All rights reserved.
  16037. *
  16038. * This source code is licensed under the BSD-style license found in the
  16039. * LICENSE file in the root directory of this source tree. An additional grant
  16040. * of patent rights can be found in the PATENTS file in the same directory.
  16041. *
  16042. * @providesModule SyntheticUIEvent
  16043. * @typechecks static-only
  16044. */
  16045. 'use strict';
  16046. var SyntheticEvent = _dereq_(108);
  16047. var getEventTarget = _dereq_(140);
  16048. /**
  16049. * @interface UIEvent
  16050. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  16051. */
  16052. var UIEventInterface = {
  16053. view: function(event) {
  16054. if (event.view) {
  16055. return event.view;
  16056. }
  16057. var target = getEventTarget(event);
  16058. if (target != null && target.window === target) {
  16059. // target is a window object
  16060. return target;
  16061. }
  16062. var doc = target.ownerDocument;
  16063. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  16064. if (doc) {
  16065. return doc.defaultView || doc.parentWindow;
  16066. } else {
  16067. return window;
  16068. }
  16069. },
  16070. detail: function(event) {
  16071. return event.detail || 0;
  16072. }
  16073. };
  16074. /**
  16075. * @param {object} dispatchConfig Configuration used to dispatch this event.
  16076. * @param {string} dispatchMarker Marker identifying the event target.
  16077. * @param {object} nativeEvent Native browser event.
  16078. * @extends {SyntheticEvent}
  16079. */
  16080. function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  16081. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  16082. }
  16083. SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
  16084. module.exports = SyntheticUIEvent;
  16085. },{"108":108,"140":140}],115:[function(_dereq_,module,exports){
  16086. /**
  16087. * Copyright 2013-2015, Facebook, Inc.
  16088. * All rights reserved.
  16089. *
  16090. * This source code is licensed under the BSD-style license found in the
  16091. * LICENSE file in the root directory of this source tree. An additional grant
  16092. * of patent rights can be found in the PATENTS file in the same directory.
  16093. *
  16094. * @providesModule SyntheticWheelEvent
  16095. * @typechecks static-only
  16096. */
  16097. 'use strict';
  16098. var SyntheticMouseEvent = _dereq_(112);
  16099. /**
  16100. * @interface WheelEvent
  16101. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  16102. */
  16103. var WheelEventInterface = {
  16104. deltaX: function(event) {
  16105. return (
  16106. 'deltaX' in event ? event.deltaX :
  16107. // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  16108. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0
  16109. );
  16110. },
  16111. deltaY: function(event) {
  16112. return (
  16113. 'deltaY' in event ? event.deltaY :
  16114. // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  16115. 'wheelDeltaY' in event ? -event.wheelDeltaY :
  16116. // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  16117. 'wheelDelta' in event ? -event.wheelDelta : 0
  16118. );
  16119. },
  16120. deltaZ: null,
  16121. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  16122. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  16123. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  16124. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  16125. deltaMode: null
  16126. };
  16127. /**
  16128. * @param {object} dispatchConfig Configuration used to dispatch this event.
  16129. * @param {string} dispatchMarker Marker identifying the event target.
  16130. * @param {object} nativeEvent Native browser event.
  16131. * @extends {SyntheticMouseEvent}
  16132. */
  16133. function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  16134. SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  16135. }
  16136. SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
  16137. module.exports = SyntheticWheelEvent;
  16138. },{"112":112}],116:[function(_dereq_,module,exports){
  16139. /**
  16140. * Copyright 2013-2015, Facebook, Inc.
  16141. * All rights reserved.
  16142. *
  16143. * This source code is licensed under the BSD-style license found in the
  16144. * LICENSE file in the root directory of this source tree. An additional grant
  16145. * of patent rights can be found in the PATENTS file in the same directory.
  16146. *
  16147. * @providesModule Transaction
  16148. */
  16149. 'use strict';
  16150. var invariant = _dereq_(150);
  16151. /**
  16152. * `Transaction` creates a black box that is able to wrap any method such that
  16153. * certain invariants are maintained before and after the method is invoked
  16154. * (Even if an exception is thrown while invoking the wrapped method). Whoever
  16155. * instantiates a transaction can provide enforcers of the invariants at
  16156. * creation time. The `Transaction` class itself will supply one additional
  16157. * automatic invariant for you - the invariant that any transaction instance
  16158. * should not be run while it is already being run. You would typically create a
  16159. * single instance of a `Transaction` for reuse multiple times, that potentially
  16160. * is used to wrap several different methods. Wrappers are extremely simple -
  16161. * they only require implementing two methods.
  16162. *
  16163. * <pre>
  16164. * wrappers (injected at creation time)
  16165. * + +
  16166. * | |
  16167. * +-----------------|--------|--------------+
  16168. * | v | |
  16169. * | +---------------+ | |
  16170. * | +--| wrapper1 |---|----+ |
  16171. * | | +---------------+ v | |
  16172. * | | +-------------+ | |
  16173. * | | +----| wrapper2 |--------+ |
  16174. * | | | +-------------+ | | |
  16175. * | | | | | |
  16176. * | v v v v | wrapper
  16177. * | +---+ +---+ +---------+ +---+ +---+ | invariants
  16178. * perform(anyMethod) | | | | | | | | | | | | maintained
  16179. * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
  16180. * | | | | | | | | | | | |
  16181. * | | | | | | | | | | | |
  16182. * | | | | | | | | | | | |
  16183. * | +---+ +---+ +---------+ +---+ +---+ |
  16184. * | initialize close |
  16185. * +-----------------------------------------+
  16186. * </pre>
  16187. *
  16188. * Use cases:
  16189. * - Preserving the input selection ranges before/after reconciliation.
  16190. * Restoring selection even in the event of an unexpected error.
  16191. * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
  16192. * while guaranteeing that afterwards, the event system is reactivated.
  16193. * - Flushing a queue of collected DOM mutations to the main UI thread after a
  16194. * reconciliation takes place in a worker thread.
  16195. * - Invoking any collected `componentDidUpdate` callbacks after rendering new
  16196. * content.
  16197. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
  16198. * to preserve the `scrollTop` (an automatic scroll aware DOM).
  16199. * - (Future use case): Layout calculations before and after DOM updates.
  16200. *
  16201. * Transactional plugin API:
  16202. * - A module that has an `initialize` method that returns any precomputation.
  16203. * - and a `close` method that accepts the precomputation. `close` is invoked
  16204. * when the wrapped process is completed, or has failed.
  16205. *
  16206. * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
  16207. * that implement `initialize` and `close`.
  16208. * @return {Transaction} Single transaction for reuse in thread.
  16209. *
  16210. * @class Transaction
  16211. */
  16212. var Mixin = {
  16213. /**
  16214. * Sets up this instance so that it is prepared for collecting metrics. Does
  16215. * so such that this setup method may be used on an instance that is already
  16216. * initialized, in a way that does not consume additional memory upon reuse.
  16217. * That can be useful if you decide to make your subclass of this mixin a
  16218. * "PooledClass".
  16219. */
  16220. reinitializeTransaction: function() {
  16221. this.transactionWrappers = this.getTransactionWrappers();
  16222. if (!this.wrapperInitData) {
  16223. this.wrapperInitData = [];
  16224. } else {
  16225. this.wrapperInitData.length = 0;
  16226. }
  16227. this._isInTransaction = false;
  16228. },
  16229. _isInTransaction: false,
  16230. /**
  16231. * @abstract
  16232. * @return {Array<TransactionWrapper>} Array of transaction wrappers.
  16233. */
  16234. getTransactionWrappers: null,
  16235. isInTransaction: function() {
  16236. return !!this._isInTransaction;
  16237. },
  16238. /**
  16239. * Executes the function within a safety window. Use this for the top level
  16240. * methods that result in large amounts of computation/mutations that would
  16241. * need to be safety checked.
  16242. *
  16243. * @param {function} method Member of scope to call.
  16244. * @param {Object} scope Scope to invoke from.
  16245. * @param {Object?=} args... Arguments to pass to the method (optional).
  16246. * Helps prevent need to bind in many cases.
  16247. * @return Return value from `method`.
  16248. */
  16249. perform: function(method, scope, a, b, c, d, e, f) {
  16250. ("production" !== "development" ? invariant(
  16251. !this.isInTransaction(),
  16252. 'Transaction.perform(...): Cannot initialize a transaction when there ' +
  16253. 'is already an outstanding transaction.'
  16254. ) : invariant(!this.isInTransaction()));
  16255. var errorThrown;
  16256. var ret;
  16257. try {
  16258. this._isInTransaction = true;
  16259. // Catching errors makes debugging more difficult, so we start with
  16260. // errorThrown set to true before setting it to false after calling
  16261. // close -- if it's still set to true in the finally block, it means
  16262. // one of these calls threw.
  16263. errorThrown = true;
  16264. this.initializeAll(0);
  16265. ret = method.call(scope, a, b, c, d, e, f);
  16266. errorThrown = false;
  16267. } finally {
  16268. try {
  16269. if (errorThrown) {
  16270. // If `method` throws, prefer to show that stack trace over any thrown
  16271. // by invoking `closeAll`.
  16272. try {
  16273. this.closeAll(0);
  16274. } catch (err) {
  16275. }
  16276. } else {
  16277. // Since `method` didn't throw, we don't want to silence the exception
  16278. // here.
  16279. this.closeAll(0);
  16280. }
  16281. } finally {
  16282. this._isInTransaction = false;
  16283. }
  16284. }
  16285. return ret;
  16286. },
  16287. initializeAll: function(startIndex) {
  16288. var transactionWrappers = this.transactionWrappers;
  16289. for (var i = startIndex; i < transactionWrappers.length; i++) {
  16290. var wrapper = transactionWrappers[i];
  16291. try {
  16292. // Catching errors makes debugging more difficult, so we start with the
  16293. // OBSERVED_ERROR state before overwriting it with the real return value
  16294. // of initialize -- if it's still set to OBSERVED_ERROR in the finally
  16295. // block, it means wrapper.initialize threw.
  16296. this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
  16297. this.wrapperInitData[i] = wrapper.initialize ?
  16298. wrapper.initialize.call(this) :
  16299. null;
  16300. } finally {
  16301. if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
  16302. // The initializer for wrapper i threw an error; initialize the
  16303. // remaining wrappers but silence any exceptions from them to ensure
  16304. // that the first error is the one to bubble up.
  16305. try {
  16306. this.initializeAll(i + 1);
  16307. } catch (err) {
  16308. }
  16309. }
  16310. }
  16311. }
  16312. },
  16313. /**
  16314. * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
  16315. * them the respective return values of `this.transactionWrappers.init[i]`
  16316. * (`close`rs that correspond to initializers that failed will not be
  16317. * invoked).
  16318. */
  16319. closeAll: function(startIndex) {
  16320. ("production" !== "development" ? invariant(
  16321. this.isInTransaction(),
  16322. 'Transaction.closeAll(): Cannot close transaction when none are open.'
  16323. ) : invariant(this.isInTransaction()));
  16324. var transactionWrappers = this.transactionWrappers;
  16325. for (var i = startIndex; i < transactionWrappers.length; i++) {
  16326. var wrapper = transactionWrappers[i];
  16327. var initData = this.wrapperInitData[i];
  16328. var errorThrown;
  16329. try {
  16330. // Catching errors makes debugging more difficult, so we start with
  16331. // errorThrown set to true before setting it to false after calling
  16332. // close -- if it's still set to true in the finally block, it means
  16333. // wrapper.close threw.
  16334. errorThrown = true;
  16335. if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
  16336. wrapper.close.call(this, initData);
  16337. }
  16338. errorThrown = false;
  16339. } finally {
  16340. if (errorThrown) {
  16341. // The closer for wrapper i threw an error; close the remaining
  16342. // wrappers but silence any exceptions from them to ensure that the
  16343. // first error is the one to bubble up.
  16344. try {
  16345. this.closeAll(i + 1);
  16346. } catch (e) {
  16347. }
  16348. }
  16349. }
  16350. }
  16351. this.wrapperInitData.length = 0;
  16352. }
  16353. };
  16354. var Transaction = {
  16355. Mixin: Mixin,
  16356. /**
  16357. * Token to look for to determine if an error occured.
  16358. */
  16359. OBSERVED_ERROR: {}
  16360. };
  16361. module.exports = Transaction;
  16362. },{"150":150}],117:[function(_dereq_,module,exports){
  16363. /**
  16364. * Copyright 2013-2015, Facebook, Inc.
  16365. * All rights reserved.
  16366. *
  16367. * This source code is licensed under the BSD-style license found in the
  16368. * LICENSE file in the root directory of this source tree. An additional grant
  16369. * of patent rights can be found in the PATENTS file in the same directory.
  16370. *
  16371. * @providesModule ViewportMetrics
  16372. */
  16373. 'use strict';
  16374. var ViewportMetrics = {
  16375. currentScrollLeft: 0,
  16376. currentScrollTop: 0,
  16377. refreshScrollValues: function(scrollPosition) {
  16378. ViewportMetrics.currentScrollLeft = scrollPosition.x;
  16379. ViewportMetrics.currentScrollTop = scrollPosition.y;
  16380. }
  16381. };
  16382. module.exports = ViewportMetrics;
  16383. },{}],118:[function(_dereq_,module,exports){
  16384. /**
  16385. * Copyright 2014-2015, Facebook, Inc.
  16386. * All rights reserved.
  16387. *
  16388. * This source code is licensed under the BSD-style license found in the
  16389. * LICENSE file in the root directory of this source tree. An additional grant
  16390. * of patent rights can be found in the PATENTS file in the same directory.
  16391. *
  16392. * @providesModule accumulateInto
  16393. */
  16394. 'use strict';
  16395. var invariant = _dereq_(150);
  16396. /**
  16397. *
  16398. * Accumulates items that must not be null or undefined into the first one. This
  16399. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  16400. * API cleanness. Since `current` can be null before being passed in and not
  16401. * null after this function, make sure to assign it back to `current`:
  16402. *
  16403. * `a = accumulateInto(a, b);`
  16404. *
  16405. * This API should be sparingly used. Try `accumulate` for something cleaner.
  16406. *
  16407. * @return {*|array<*>} An accumulation of items.
  16408. */
  16409. function accumulateInto(current, next) {
  16410. ("production" !== "development" ? invariant(
  16411. next != null,
  16412. 'accumulateInto(...): Accumulated items must not be null or undefined.'
  16413. ) : invariant(next != null));
  16414. if (current == null) {
  16415. return next;
  16416. }
  16417. // Both are not empty. Warning: Never call x.concat(y) when you are not
  16418. // certain that x is an Array (x could be a string with concat method).
  16419. var currentIsArray = Array.isArray(current);
  16420. var nextIsArray = Array.isArray(next);
  16421. if (currentIsArray && nextIsArray) {
  16422. current.push.apply(current, next);
  16423. return current;
  16424. }
  16425. if (currentIsArray) {
  16426. current.push(next);
  16427. return current;
  16428. }
  16429. if (nextIsArray) {
  16430. // A bit too dangerous to mutate `next`.
  16431. return [current].concat(next);
  16432. }
  16433. return [current, next];
  16434. }
  16435. module.exports = accumulateInto;
  16436. },{"150":150}],119:[function(_dereq_,module,exports){
  16437. /**
  16438. * Copyright 2013-2015, Facebook, Inc.
  16439. * All rights reserved.
  16440. *
  16441. * This source code is licensed under the BSD-style license found in the
  16442. * LICENSE file in the root directory of this source tree. An additional grant
  16443. * of patent rights can be found in the PATENTS file in the same directory.
  16444. *
  16445. * @providesModule adler32
  16446. */
  16447. /* jslint bitwise:true */
  16448. 'use strict';
  16449. var MOD = 65521;
  16450. // This is a clean-room implementation of adler32 designed for detecting
  16451. // if markup is not what we expect it to be. It does not need to be
  16452. // cryptographically strong, only reasonably good at detecting if markup
  16453. // generated on the server is different than that on the client.
  16454. function adler32(data) {
  16455. var a = 1;
  16456. var b = 0;
  16457. for (var i = 0; i < data.length; i++) {
  16458. a = (a + data.charCodeAt(i)) % MOD;
  16459. b = (b + a) % MOD;
  16460. }
  16461. return a | (b << 16);
  16462. }
  16463. module.exports = adler32;
  16464. },{}],120:[function(_dereq_,module,exports){
  16465. /**
  16466. * Copyright 2013-2015, Facebook, Inc.
  16467. * All rights reserved.
  16468. *
  16469. * This source code is licensed under the BSD-style license found in the
  16470. * LICENSE file in the root directory of this source tree. An additional grant
  16471. * of patent rights can be found in the PATENTS file in the same directory.
  16472. *
  16473. * @providesModule camelize
  16474. * @typechecks
  16475. */
  16476. var _hyphenPattern = /-(.)/g;
  16477. /**
  16478. * Camelcases a hyphenated string, for example:
  16479. *
  16480. * > camelize('background-color')
  16481. * < "backgroundColor"
  16482. *
  16483. * @param {string} string
  16484. * @return {string}
  16485. */
  16486. function camelize(string) {
  16487. return string.replace(_hyphenPattern, function(_, character) {
  16488. return character.toUpperCase();
  16489. });
  16490. }
  16491. module.exports = camelize;
  16492. },{}],121:[function(_dereq_,module,exports){
  16493. /**
  16494. * Copyright 2014-2015, Facebook, Inc.
  16495. * All rights reserved.
  16496. *
  16497. * This source code is licensed under the BSD-style license found in the
  16498. * LICENSE file in the root directory of this source tree. An additional grant
  16499. * of patent rights can be found in the PATENTS file in the same directory.
  16500. *
  16501. * @providesModule camelizeStyleName
  16502. * @typechecks
  16503. */
  16504. "use strict";
  16505. var camelize = _dereq_(120);
  16506. var msPattern = /^-ms-/;
  16507. /**
  16508. * Camelcases a hyphenated CSS property name, for example:
  16509. *
  16510. * > camelizeStyleName('background-color')
  16511. * < "backgroundColor"
  16512. * > camelizeStyleName('-moz-transition')
  16513. * < "MozTransition"
  16514. * > camelizeStyleName('-ms-transition')
  16515. * < "msTransition"
  16516. *
  16517. * As Andi Smith suggests
  16518. * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  16519. * is converted to lowercase `ms`.
  16520. *
  16521. * @param {string} string
  16522. * @return {string}
  16523. */
  16524. function camelizeStyleName(string) {
  16525. return camelize(string.replace(msPattern, 'ms-'));
  16526. }
  16527. module.exports = camelizeStyleName;
  16528. },{"120":120}],122:[function(_dereq_,module,exports){
  16529. /**
  16530. * Copyright 2013-2015, Facebook, Inc.
  16531. * All rights reserved.
  16532. *
  16533. * This source code is licensed under the BSD-style license found in the
  16534. * LICENSE file in the root directory of this source tree. An additional grant
  16535. * of patent rights can be found in the PATENTS file in the same directory.
  16536. *
  16537. * @typechecks static-only
  16538. * @providesModule cloneWithProps
  16539. */
  16540. 'use strict';
  16541. var ReactElement = _dereq_(63);
  16542. var ReactPropTransferer = _dereq_(83);
  16543. var keyOf = _dereq_(157);
  16544. var warning = _dereq_(171);
  16545. var CHILDREN_PROP = keyOf({children: null});
  16546. /**
  16547. * Sometimes you want to change the props of a child passed to you. Usually
  16548. * this is to add a CSS class.
  16549. *
  16550. * @param {ReactElement} child child element you'd like to clone
  16551. * @param {object} props props you'd like to modify. className and style will be
  16552. * merged automatically.
  16553. * @return {ReactElement} a clone of child with props merged in.
  16554. */
  16555. function cloneWithProps(child, props) {
  16556. if ("production" !== "development") {
  16557. ("production" !== "development" ? warning(
  16558. !child.ref,
  16559. 'You are calling cloneWithProps() on a child with a ref. This is ' +
  16560. 'dangerous because you\'re creating a new child which will not be ' +
  16561. 'added as a ref to its parent.'
  16562. ) : null);
  16563. }
  16564. var newProps = ReactPropTransferer.mergeProps(props, child.props);
  16565. // Use `child.props.children` if it is provided.
  16566. if (!newProps.hasOwnProperty(CHILDREN_PROP) &&
  16567. child.props.hasOwnProperty(CHILDREN_PROP)) {
  16568. newProps.children = child.props.children;
  16569. }
  16570. // The current API doesn't retain _owner and _context, which is why this
  16571. // doesn't use ReactElement.cloneAndReplaceProps.
  16572. return ReactElement.createElement(child.type, newProps);
  16573. }
  16574. module.exports = cloneWithProps;
  16575. },{"157":157,"171":171,"63":63,"83":83}],123:[function(_dereq_,module,exports){
  16576. /**
  16577. * Copyright 2013-2015, Facebook, Inc.
  16578. * All rights reserved.
  16579. *
  16580. * This source code is licensed under the BSD-style license found in the
  16581. * LICENSE file in the root directory of this source tree. An additional grant
  16582. * of patent rights can be found in the PATENTS file in the same directory.
  16583. *
  16584. * @providesModule containsNode
  16585. * @typechecks
  16586. */
  16587. var isTextNode = _dereq_(154);
  16588. /*jslint bitwise:true */
  16589. /**
  16590. * Checks if a given DOM node contains or is another DOM node.
  16591. *
  16592. * @param {?DOMNode} outerNode Outer DOM node.
  16593. * @param {?DOMNode} innerNode Inner DOM node.
  16594. * @return {boolean} True if `outerNode` contains or is `innerNode`.
  16595. */
  16596. function containsNode(outerNode, innerNode) {
  16597. if (!outerNode || !innerNode) {
  16598. return false;
  16599. } else if (outerNode === innerNode) {
  16600. return true;
  16601. } else if (isTextNode(outerNode)) {
  16602. return false;
  16603. } else if (isTextNode(innerNode)) {
  16604. return containsNode(outerNode, innerNode.parentNode);
  16605. } else if (outerNode.contains) {
  16606. return outerNode.contains(innerNode);
  16607. } else if (outerNode.compareDocumentPosition) {
  16608. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  16609. } else {
  16610. return false;
  16611. }
  16612. }
  16613. module.exports = containsNode;
  16614. },{"154":154}],124:[function(_dereq_,module,exports){
  16615. /**
  16616. * Copyright 2013-2015, Facebook, Inc.
  16617. * All rights reserved.
  16618. *
  16619. * This source code is licensed under the BSD-style license found in the
  16620. * LICENSE file in the root directory of this source tree. An additional grant
  16621. * of patent rights can be found in the PATENTS file in the same directory.
  16622. *
  16623. * @providesModule createArrayFromMixed
  16624. * @typechecks
  16625. */
  16626. var toArray = _dereq_(168);
  16627. /**
  16628. * Perform a heuristic test to determine if an object is "array-like".
  16629. *
  16630. * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
  16631. * Joshu replied: "Mu."
  16632. *
  16633. * This function determines if its argument has "array nature": it returns
  16634. * true if the argument is an actual array, an `arguments' object, or an
  16635. * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
  16636. *
  16637. * It will return false for other array-like objects like Filelist.
  16638. *
  16639. * @param {*} obj
  16640. * @return {boolean}
  16641. */
  16642. function hasArrayNature(obj) {
  16643. return (
  16644. // not null/false
  16645. !!obj &&
  16646. // arrays are objects, NodeLists are functions in Safari
  16647. (typeof obj == 'object' || typeof obj == 'function') &&
  16648. // quacks like an array
  16649. ('length' in obj) &&
  16650. // not window
  16651. !('setInterval' in obj) &&
  16652. // no DOM node should be considered an array-like
  16653. // a 'select' element has 'length' and 'item' properties on IE8
  16654. (typeof obj.nodeType != 'number') &&
  16655. (
  16656. // a real array
  16657. (// HTMLCollection/NodeList
  16658. (Array.isArray(obj) ||
  16659. // arguments
  16660. ('callee' in obj) || 'item' in obj))
  16661. )
  16662. );
  16663. }
  16664. /**
  16665. * Ensure that the argument is an array by wrapping it in an array if it is not.
  16666. * Creates a copy of the argument if it is already an array.
  16667. *
  16668. * This is mostly useful idiomatically:
  16669. *
  16670. * var createArrayFromMixed = require('createArrayFromMixed');
  16671. *
  16672. * function takesOneOrMoreThings(things) {
  16673. * things = createArrayFromMixed(things);
  16674. * ...
  16675. * }
  16676. *
  16677. * This allows you to treat `things' as an array, but accept scalars in the API.
  16678. *
  16679. * If you need to convert an array-like object, like `arguments`, into an array
  16680. * use toArray instead.
  16681. *
  16682. * @param {*} obj
  16683. * @return {array}
  16684. */
  16685. function createArrayFromMixed(obj) {
  16686. if (!hasArrayNature(obj)) {
  16687. return [obj];
  16688. } else if (Array.isArray(obj)) {
  16689. return obj.slice();
  16690. } else {
  16691. return toArray(obj);
  16692. }
  16693. }
  16694. module.exports = createArrayFromMixed;
  16695. },{"168":168}],125:[function(_dereq_,module,exports){
  16696. /**
  16697. * Copyright 2013-2015, Facebook, Inc.
  16698. * All rights reserved.
  16699. *
  16700. * This source code is licensed under the BSD-style license found in the
  16701. * LICENSE file in the root directory of this source tree. An additional grant
  16702. * of patent rights can be found in the PATENTS file in the same directory.
  16703. *
  16704. * @providesModule createFullPageComponent
  16705. * @typechecks
  16706. */
  16707. 'use strict';
  16708. // Defeat circular references by requiring this directly.
  16709. var ReactClass = _dereq_(38);
  16710. var ReactElement = _dereq_(63);
  16711. var invariant = _dereq_(150);
  16712. /**
  16713. * Create a component that will throw an exception when unmounted.
  16714. *
  16715. * Components like <html> <head> and <body> can't be removed or added
  16716. * easily in a cross-browser way, however it's valuable to be able to
  16717. * take advantage of React's reconciliation for styling and <title>
  16718. * management. So we just document it and throw in dangerous cases.
  16719. *
  16720. * @param {string} tag The tag to wrap
  16721. * @return {function} convenience constructor of new component
  16722. */
  16723. function createFullPageComponent(tag) {
  16724. var elementFactory = ReactElement.createFactory(tag);
  16725. var FullPageComponent = ReactClass.createClass({
  16726. tagName: tag.toUpperCase(),
  16727. displayName: 'ReactFullPageComponent' + tag,
  16728. componentWillUnmount: function() {
  16729. ("production" !== "development" ? invariant(
  16730. false,
  16731. '%s tried to unmount. Because of cross-browser quirks it is ' +
  16732. 'impossible to unmount some top-level components (eg <html>, <head>, ' +
  16733. 'and <body>) reliably and efficiently. To fix this, have a single ' +
  16734. 'top-level component that never unmounts render these elements.',
  16735. this.constructor.displayName
  16736. ) : invariant(false));
  16737. },
  16738. render: function() {
  16739. return elementFactory(this.props);
  16740. }
  16741. });
  16742. return FullPageComponent;
  16743. }
  16744. module.exports = createFullPageComponent;
  16745. },{"150":150,"38":38,"63":63}],126:[function(_dereq_,module,exports){
  16746. /**
  16747. * Copyright 2013-2015, Facebook, Inc.
  16748. * All rights reserved.
  16749. *
  16750. * This source code is licensed under the BSD-style license found in the
  16751. * LICENSE file in the root directory of this source tree. An additional grant
  16752. * of patent rights can be found in the PATENTS file in the same directory.
  16753. *
  16754. * @providesModule createNodesFromMarkup
  16755. * @typechecks
  16756. */
  16757. /*jslint evil: true, sub: true */
  16758. var ExecutionEnvironment = _dereq_(22);
  16759. var createArrayFromMixed = _dereq_(124);
  16760. var getMarkupWrap = _dereq_(142);
  16761. var invariant = _dereq_(150);
  16762. /**
  16763. * Dummy container used to render all markup.
  16764. */
  16765. var dummyNode =
  16766. ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  16767. /**
  16768. * Pattern used by `getNodeName`.
  16769. */
  16770. var nodeNamePattern = /^\s*<(\w+)/;
  16771. /**
  16772. * Extracts the `nodeName` of the first element in a string of markup.
  16773. *
  16774. * @param {string} markup String of markup.
  16775. * @return {?string} Node name of the supplied markup.
  16776. */
  16777. function getNodeName(markup) {
  16778. var nodeNameMatch = markup.match(nodeNamePattern);
  16779. return nodeNameMatch && nodeNameMatch[1].toLowerCase();
  16780. }
  16781. /**
  16782. * Creates an array containing the nodes rendered from the supplied markup. The
  16783. * optionally supplied `handleScript` function will be invoked once for each
  16784. * <script> element that is rendered. If no `handleScript` function is supplied,
  16785. * an exception is thrown if any <script> elements are rendered.
  16786. *
  16787. * @param {string} markup A string of valid HTML markup.
  16788. * @param {?function} handleScript Invoked once for each rendered <script>.
  16789. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
  16790. */
  16791. function createNodesFromMarkup(markup, handleScript) {
  16792. var node = dummyNode;
  16793. ("production" !== "development" ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));
  16794. var nodeName = getNodeName(markup);
  16795. var wrap = nodeName && getMarkupWrap(nodeName);
  16796. if (wrap) {
  16797. node.innerHTML = wrap[1] + markup + wrap[2];
  16798. var wrapDepth = wrap[0];
  16799. while (wrapDepth--) {
  16800. node = node.lastChild;
  16801. }
  16802. } else {
  16803. node.innerHTML = markup;
  16804. }
  16805. var scripts = node.getElementsByTagName('script');
  16806. if (scripts.length) {
  16807. ("production" !== "development" ? invariant(
  16808. handleScript,
  16809. 'createNodesFromMarkup(...): Unexpected <script> element rendered.'
  16810. ) : invariant(handleScript));
  16811. createArrayFromMixed(scripts).forEach(handleScript);
  16812. }
  16813. var nodes = createArrayFromMixed(node.childNodes);
  16814. while (node.lastChild) {
  16815. node.removeChild(node.lastChild);
  16816. }
  16817. return nodes;
  16818. }
  16819. module.exports = createNodesFromMarkup;
  16820. },{"124":124,"142":142,"150":150,"22":22}],127:[function(_dereq_,module,exports){
  16821. /**
  16822. * Copyright 2013-2015, Facebook, Inc.
  16823. * All rights reserved.
  16824. *
  16825. * This source code is licensed under the BSD-style license found in the
  16826. * LICENSE file in the root directory of this source tree. An additional grant
  16827. * of patent rights can be found in the PATENTS file in the same directory.
  16828. *
  16829. * @providesModule cx
  16830. */
  16831. /**
  16832. * This function is used to mark string literals representing CSS class names
  16833. * so that they can be transformed statically. This allows for modularization
  16834. * and minification of CSS class names.
  16835. *
  16836. * In static_upstream, this function is actually implemented, but it should
  16837. * eventually be replaced with something more descriptive, and the transform
  16838. * that is used in the main stack should be ported for use elsewhere.
  16839. *
  16840. * @param string|object className to modularize, or an object of key/values.
  16841. * In the object case, the values are conditions that
  16842. * determine if the className keys should be included.
  16843. * @param [string ...] Variable list of classNames in the string case.
  16844. * @return string Renderable space-separated CSS className.
  16845. */
  16846. 'use strict';
  16847. var warning = _dereq_(171);
  16848. var warned = false;
  16849. function cx(classNames) {
  16850. if ("production" !== "development") {
  16851. ("production" !== "development" ? warning(
  16852. warned,
  16853. 'React.addons.classSet will be deprecated in a future version. See ' +
  16854. 'http://fb.me/react-addons-classset'
  16855. ) : null);
  16856. warned = true;
  16857. }
  16858. if (typeof classNames == 'object') {
  16859. return Object.keys(classNames).filter(function(className) {
  16860. return classNames[className];
  16861. }).join(' ');
  16862. } else {
  16863. return Array.prototype.join.call(arguments, ' ');
  16864. }
  16865. }
  16866. module.exports = cx;
  16867. },{"171":171}],128:[function(_dereq_,module,exports){
  16868. /**
  16869. * Copyright 2013-2015, Facebook, Inc.
  16870. * All rights reserved.
  16871. *
  16872. * This source code is licensed under the BSD-style license found in the
  16873. * LICENSE file in the root directory of this source tree. An additional grant
  16874. * of patent rights can be found in the PATENTS file in the same directory.
  16875. *
  16876. * @providesModule dangerousStyleValue
  16877. * @typechecks static-only
  16878. */
  16879. 'use strict';
  16880. var CSSProperty = _dereq_(5);
  16881. var isUnitlessNumber = CSSProperty.isUnitlessNumber;
  16882. /**
  16883. * Convert a value into the proper css writable value. The style name `name`
  16884. * should be logical (no hyphens), as specified
  16885. * in `CSSProperty.isUnitlessNumber`.
  16886. *
  16887. * @param {string} name CSS property name such as `topMargin`.
  16888. * @param {*} value CSS property value such as `10px`.
  16889. * @return {string} Normalized style value with dimensions applied.
  16890. */
  16891. function dangerousStyleValue(name, value) {
  16892. // Note that we've removed escapeTextForBrowser() calls here since the
  16893. // whole string will be escaped when the attribute is injected into
  16894. // the markup. If you provide unsafe user data here they can inject
  16895. // arbitrary CSS which may be problematic (I couldn't repro this):
  16896. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  16897. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  16898. // This is not an XSS hole but instead a potential CSS injection issue
  16899. // which has lead to a greater discussion about how we're going to
  16900. // trust URLs moving forward. See #2115901
  16901. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  16902. if (isEmpty) {
  16903. return '';
  16904. }
  16905. var isNonNumeric = isNaN(value);
  16906. if (isNonNumeric || value === 0 ||
  16907. isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
  16908. return '' + value; // cast to string
  16909. }
  16910. if (typeof value === 'string') {
  16911. value = value.trim();
  16912. }
  16913. return value + 'px';
  16914. }
  16915. module.exports = dangerousStyleValue;
  16916. },{"5":5}],129:[function(_dereq_,module,exports){
  16917. /**
  16918. * Copyright 2013-2015, Facebook, Inc.
  16919. * All rights reserved.
  16920. *
  16921. * This source code is licensed under the BSD-style license found in the
  16922. * LICENSE file in the root directory of this source tree. An additional grant
  16923. * of patent rights can be found in the PATENTS file in the same directory.
  16924. *
  16925. * @providesModule emptyFunction
  16926. */
  16927. function makeEmptyFunction(arg) {
  16928. return function() {
  16929. return arg;
  16930. };
  16931. }
  16932. /**
  16933. * This function accepts and discards inputs; it has no side effects. This is
  16934. * primarily useful idiomatically for overridable function endpoints which
  16935. * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
  16936. */
  16937. function emptyFunction() {}
  16938. emptyFunction.thatReturns = makeEmptyFunction;
  16939. emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
  16940. emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
  16941. emptyFunction.thatReturnsNull = makeEmptyFunction(null);
  16942. emptyFunction.thatReturnsThis = function() { return this; };
  16943. emptyFunction.thatReturnsArgument = function(arg) { return arg; };
  16944. module.exports = emptyFunction;
  16945. },{}],130:[function(_dereq_,module,exports){
  16946. /**
  16947. * Copyright 2013-2015, Facebook, Inc.
  16948. * All rights reserved.
  16949. *
  16950. * This source code is licensed under the BSD-style license found in the
  16951. * LICENSE file in the root directory of this source tree. An additional grant
  16952. * of patent rights can be found in the PATENTS file in the same directory.
  16953. *
  16954. * @providesModule emptyObject
  16955. */
  16956. "use strict";
  16957. var emptyObject = {};
  16958. if ("production" !== "development") {
  16959. Object.freeze(emptyObject);
  16960. }
  16961. module.exports = emptyObject;
  16962. },{}],131:[function(_dereq_,module,exports){
  16963. /**
  16964. * Copyright 2013-2015, Facebook, Inc.
  16965. * All rights reserved.
  16966. *
  16967. * This source code is licensed under the BSD-style license found in the
  16968. * LICENSE file in the root directory of this source tree. An additional grant
  16969. * of patent rights can be found in the PATENTS file in the same directory.
  16970. *
  16971. * @providesModule escapeTextContentForBrowser
  16972. */
  16973. 'use strict';
  16974. var ESCAPE_LOOKUP = {
  16975. '&': '&amp;',
  16976. '>': '&gt;',
  16977. '<': '&lt;',
  16978. '"': '&quot;',
  16979. '\'': '&#x27;'
  16980. };
  16981. var ESCAPE_REGEX = /[&><"']/g;
  16982. function escaper(match) {
  16983. return ESCAPE_LOOKUP[match];
  16984. }
  16985. /**
  16986. * Escapes text to prevent scripting attacks.
  16987. *
  16988. * @param {*} text Text value to escape.
  16989. * @return {string} An escaped string.
  16990. */
  16991. function escapeTextContentForBrowser(text) {
  16992. return ('' + text).replace(ESCAPE_REGEX, escaper);
  16993. }
  16994. module.exports = escapeTextContentForBrowser;
  16995. },{}],132:[function(_dereq_,module,exports){
  16996. /**
  16997. * Copyright 2013-2015, Facebook, Inc.
  16998. * All rights reserved.
  16999. *
  17000. * This source code is licensed under the BSD-style license found in the
  17001. * LICENSE file in the root directory of this source tree. An additional grant
  17002. * of patent rights can be found in the PATENTS file in the same directory.
  17003. *
  17004. * @providesModule findDOMNode
  17005. * @typechecks static-only
  17006. */
  17007. 'use strict';
  17008. var ReactCurrentOwner = _dereq_(45);
  17009. var ReactInstanceMap = _dereq_(73);
  17010. var ReactMount = _dereq_(77);
  17011. var invariant = _dereq_(150);
  17012. var isNode = _dereq_(152);
  17013. var warning = _dereq_(171);
  17014. /**
  17015. * Returns the DOM node rendered by this element.
  17016. *
  17017. * @param {ReactComponent|DOMElement} componentOrElement
  17018. * @return {DOMElement} The root node of this element.
  17019. */
  17020. function findDOMNode(componentOrElement) {
  17021. if ("production" !== "development") {
  17022. var owner = ReactCurrentOwner.current;
  17023. if (owner !== null) {
  17024. ("production" !== "development" ? warning(
  17025. owner._warnedAboutRefsInRender,
  17026. '%s is accessing getDOMNode or findDOMNode inside its render(). ' +
  17027. 'render() should be a pure function of props and state. It should ' +
  17028. 'never access something that requires stale data from the previous ' +
  17029. 'render, such as refs. Move this logic to componentDidMount and ' +
  17030. 'componentDidUpdate instead.',
  17031. owner.getName() || 'A component'
  17032. ) : null);
  17033. owner._warnedAboutRefsInRender = true;
  17034. }
  17035. }
  17036. if (componentOrElement == null) {
  17037. return null;
  17038. }
  17039. if (isNode(componentOrElement)) {
  17040. return componentOrElement;
  17041. }
  17042. if (ReactInstanceMap.has(componentOrElement)) {
  17043. return ReactMount.getNodeFromInstance(componentOrElement);
  17044. }
  17045. ("production" !== "development" ? invariant(
  17046. componentOrElement.render == null ||
  17047. typeof componentOrElement.render !== 'function',
  17048. 'Component (with keys: %s) contains `render` method ' +
  17049. 'but is not mounted in the DOM',
  17050. Object.keys(componentOrElement)
  17051. ) : invariant(componentOrElement.render == null ||
  17052. typeof componentOrElement.render !== 'function'));
  17053. ("production" !== "development" ? invariant(
  17054. false,
  17055. 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
  17056. Object.keys(componentOrElement)
  17057. ) : invariant(false));
  17058. }
  17059. module.exports = findDOMNode;
  17060. },{"150":150,"152":152,"171":171,"45":45,"73":73,"77":77}],133:[function(_dereq_,module,exports){
  17061. /**
  17062. * Copyright 2013-2015, Facebook, Inc.
  17063. * All rights reserved.
  17064. *
  17065. * This source code is licensed under the BSD-style license found in the
  17066. * LICENSE file in the root directory of this source tree. An additional grant
  17067. * of patent rights can be found in the PATENTS file in the same directory.
  17068. *
  17069. * @providesModule flattenChildren
  17070. */
  17071. 'use strict';
  17072. var traverseAllChildren = _dereq_(169);
  17073. var warning = _dereq_(171);
  17074. /**
  17075. * @param {function} traverseContext Context passed through traversal.
  17076. * @param {?ReactComponent} child React child component.
  17077. * @param {!string} name String name of key path to child.
  17078. */
  17079. function flattenSingleChildIntoContext(traverseContext, child, name) {
  17080. // We found a component instance.
  17081. var result = traverseContext;
  17082. var keyUnique = !result.hasOwnProperty(name);
  17083. if ("production" !== "development") {
  17084. ("production" !== "development" ? warning(
  17085. keyUnique,
  17086. 'flattenChildren(...): Encountered two children with the same key, ' +
  17087. '`%s`. Child keys must be unique; when two children share a key, only ' +
  17088. 'the first child will be used.',
  17089. name
  17090. ) : null);
  17091. }
  17092. if (keyUnique && child != null) {
  17093. result[name] = child;
  17094. }
  17095. }
  17096. /**
  17097. * Flattens children that are typically specified as `props.children`. Any null
  17098. * children will not be included in the resulting object.
  17099. * @return {!object} flattened children keyed by name.
  17100. */
  17101. function flattenChildren(children) {
  17102. if (children == null) {
  17103. return children;
  17104. }
  17105. var result = {};
  17106. traverseAllChildren(children, flattenSingleChildIntoContext, result);
  17107. return result;
  17108. }
  17109. module.exports = flattenChildren;
  17110. },{"169":169,"171":171}],134:[function(_dereq_,module,exports){
  17111. /**
  17112. * Copyright 2014-2015, Facebook, Inc.
  17113. * All rights reserved.
  17114. *
  17115. * This source code is licensed under the BSD-style license found in the
  17116. * LICENSE file in the root directory of this source tree. An additional grant
  17117. * of patent rights can be found in the PATENTS file in the same directory.
  17118. *
  17119. * @providesModule focusNode
  17120. */
  17121. "use strict";
  17122. /**
  17123. * @param {DOMElement} node input/textarea to focus
  17124. */
  17125. function focusNode(node) {
  17126. // IE8 can throw "Can't move focus to the control because it is invisible,
  17127. // not enabled, or of a type that does not accept the focus." for all kinds of
  17128. // reasons that are too expensive and fragile to test.
  17129. try {
  17130. node.focus();
  17131. } catch(e) {
  17132. }
  17133. }
  17134. module.exports = focusNode;
  17135. },{}],135:[function(_dereq_,module,exports){
  17136. /**
  17137. * Copyright 2013-2015, Facebook, Inc.
  17138. * All rights reserved.
  17139. *
  17140. * This source code is licensed under the BSD-style license found in the
  17141. * LICENSE file in the root directory of this source tree. An additional grant
  17142. * of patent rights can be found in the PATENTS file in the same directory.
  17143. *
  17144. * @providesModule forEachAccumulated
  17145. */
  17146. 'use strict';
  17147. /**
  17148. * @param {array} an "accumulation" of items which is either an Array or
  17149. * a single item. Useful when paired with the `accumulate` module. This is a
  17150. * simple utility that allows us to reason about a collection of items, but
  17151. * handling the case when there is exactly one item (and we do not need to
  17152. * allocate an array).
  17153. */
  17154. var forEachAccumulated = function(arr, cb, scope) {
  17155. if (Array.isArray(arr)) {
  17156. arr.forEach(cb, scope);
  17157. } else if (arr) {
  17158. cb.call(scope, arr);
  17159. }
  17160. };
  17161. module.exports = forEachAccumulated;
  17162. },{}],136:[function(_dereq_,module,exports){
  17163. /**
  17164. * Copyright 2013-2015, Facebook, Inc.
  17165. * All rights reserved.
  17166. *
  17167. * This source code is licensed under the BSD-style license found in the
  17168. * LICENSE file in the root directory of this source tree. An additional grant
  17169. * of patent rights can be found in the PATENTS file in the same directory.
  17170. *
  17171. * @providesModule getActiveElement
  17172. * @typechecks
  17173. */
  17174. /**
  17175. * Same as document.activeElement but wraps in a try-catch block. In IE it is
  17176. * not safe to call document.activeElement if there is nothing focused.
  17177. *
  17178. * The activeElement will be null only if the document body is not yet defined.
  17179. */
  17180. function getActiveElement() /*?DOMElement*/ {
  17181. try {
  17182. return document.activeElement || document.body;
  17183. } catch (e) {
  17184. return document.body;
  17185. }
  17186. }
  17187. module.exports = getActiveElement;
  17188. },{}],137:[function(_dereq_,module,exports){
  17189. /**
  17190. * Copyright 2013-2015, Facebook, Inc.
  17191. * All rights reserved.
  17192. *
  17193. * This source code is licensed under the BSD-style license found in the
  17194. * LICENSE file in the root directory of this source tree. An additional grant
  17195. * of patent rights can be found in the PATENTS file in the same directory.
  17196. *
  17197. * @providesModule getEventCharCode
  17198. * @typechecks static-only
  17199. */
  17200. 'use strict';
  17201. /**
  17202. * `charCode` represents the actual "character code" and is safe to use with
  17203. * `String.fromCharCode`. As such, only keys that correspond to printable
  17204. * characters produce a valid `charCode`, the only exception to this is Enter.
  17205. * The Tab-key is considered non-printable and does not have a `charCode`,
  17206. * presumably because it does not produce a tab-character in browsers.
  17207. *
  17208. * @param {object} nativeEvent Native browser event.
  17209. * @return {string} Normalized `charCode` property.
  17210. */
  17211. function getEventCharCode(nativeEvent) {
  17212. var charCode;
  17213. var keyCode = nativeEvent.keyCode;
  17214. if ('charCode' in nativeEvent) {
  17215. charCode = nativeEvent.charCode;
  17216. // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  17217. if (charCode === 0 && keyCode === 13) {
  17218. charCode = 13;
  17219. }
  17220. } else {
  17221. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  17222. charCode = keyCode;
  17223. }
  17224. // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  17225. // Must not discard the (non-)printable Enter-key.
  17226. if (charCode >= 32 || charCode === 13) {
  17227. return charCode;
  17228. }
  17229. return 0;
  17230. }
  17231. module.exports = getEventCharCode;
  17232. },{}],138:[function(_dereq_,module,exports){
  17233. /**
  17234. * Copyright 2013-2015, Facebook, Inc.
  17235. * All rights reserved.
  17236. *
  17237. * This source code is licensed under the BSD-style license found in the
  17238. * LICENSE file in the root directory of this source tree. An additional grant
  17239. * of patent rights can be found in the PATENTS file in the same directory.
  17240. *
  17241. * @providesModule getEventKey
  17242. * @typechecks static-only
  17243. */
  17244. 'use strict';
  17245. var getEventCharCode = _dereq_(137);
  17246. /**
  17247. * Normalization of deprecated HTML5 `key` values
  17248. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  17249. */
  17250. var normalizeKey = {
  17251. 'Esc': 'Escape',
  17252. 'Spacebar': ' ',
  17253. 'Left': 'ArrowLeft',
  17254. 'Up': 'ArrowUp',
  17255. 'Right': 'ArrowRight',
  17256. 'Down': 'ArrowDown',
  17257. 'Del': 'Delete',
  17258. 'Win': 'OS',
  17259. 'Menu': 'ContextMenu',
  17260. 'Apps': 'ContextMenu',
  17261. 'Scroll': 'ScrollLock',
  17262. 'MozPrintableKey': 'Unidentified'
  17263. };
  17264. /**
  17265. * Translation from legacy `keyCode` to HTML5 `key`
  17266. * Only special keys supported, all others depend on keyboard layout or browser
  17267. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  17268. */
  17269. var translateToKey = {
  17270. 8: 'Backspace',
  17271. 9: 'Tab',
  17272. 12: 'Clear',
  17273. 13: 'Enter',
  17274. 16: 'Shift',
  17275. 17: 'Control',
  17276. 18: 'Alt',
  17277. 19: 'Pause',
  17278. 20: 'CapsLock',
  17279. 27: 'Escape',
  17280. 32: ' ',
  17281. 33: 'PageUp',
  17282. 34: 'PageDown',
  17283. 35: 'End',
  17284. 36: 'Home',
  17285. 37: 'ArrowLeft',
  17286. 38: 'ArrowUp',
  17287. 39: 'ArrowRight',
  17288. 40: 'ArrowDown',
  17289. 45: 'Insert',
  17290. 46: 'Delete',
  17291. 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
  17292. 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
  17293. 144: 'NumLock',
  17294. 145: 'ScrollLock',
  17295. 224: 'Meta'
  17296. };
  17297. /**
  17298. * @param {object} nativeEvent Native browser event.
  17299. * @return {string} Normalized `key` property.
  17300. */
  17301. function getEventKey(nativeEvent) {
  17302. if (nativeEvent.key) {
  17303. // Normalize inconsistent values reported by browsers due to
  17304. // implementations of a working draft specification.
  17305. // FireFox implements `key` but returns `MozPrintableKey` for all
  17306. // printable characters (normalized to `Unidentified`), ignore it.
  17307. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  17308. if (key !== 'Unidentified') {
  17309. return key;
  17310. }
  17311. }
  17312. // Browser does not implement `key`, polyfill as much of it as we can.
  17313. if (nativeEvent.type === 'keypress') {
  17314. var charCode = getEventCharCode(nativeEvent);
  17315. // The enter-key is technically both printable and non-printable and can
  17316. // thus be captured by `keypress`, no other non-printable key should.
  17317. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  17318. }
  17319. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  17320. // While user keyboard layout determines the actual meaning of each
  17321. // `keyCode` value, almost all function keys have a universal value.
  17322. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  17323. }
  17324. return '';
  17325. }
  17326. module.exports = getEventKey;
  17327. },{"137":137}],139:[function(_dereq_,module,exports){
  17328. /**
  17329. * Copyright 2013-2015, Facebook, Inc.
  17330. * All rights reserved.
  17331. *
  17332. * This source code is licensed under the BSD-style license found in the
  17333. * LICENSE file in the root directory of this source tree. An additional grant
  17334. * of patent rights can be found in the PATENTS file in the same directory.
  17335. *
  17336. * @providesModule getEventModifierState
  17337. * @typechecks static-only
  17338. */
  17339. 'use strict';
  17340. /**
  17341. * Translation from modifier key to the associated property in the event.
  17342. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  17343. */
  17344. var modifierKeyToProp = {
  17345. 'Alt': 'altKey',
  17346. 'Control': 'ctrlKey',
  17347. 'Meta': 'metaKey',
  17348. 'Shift': 'shiftKey'
  17349. };
  17350. // IE8 does not implement getModifierState so we simply map it to the only
  17351. // modifier keys exposed by the event itself, does not support Lock-keys.
  17352. // Currently, all major browsers except Chrome seems to support Lock-keys.
  17353. function modifierStateGetter(keyArg) {
  17354. /*jshint validthis:true */
  17355. var syntheticEvent = this;
  17356. var nativeEvent = syntheticEvent.nativeEvent;
  17357. if (nativeEvent.getModifierState) {
  17358. return nativeEvent.getModifierState(keyArg);
  17359. }
  17360. var keyProp = modifierKeyToProp[keyArg];
  17361. return keyProp ? !!nativeEvent[keyProp] : false;
  17362. }
  17363. function getEventModifierState(nativeEvent) {
  17364. return modifierStateGetter;
  17365. }
  17366. module.exports = getEventModifierState;
  17367. },{}],140:[function(_dereq_,module,exports){
  17368. /**
  17369. * Copyright 2013-2015, Facebook, Inc.
  17370. * All rights reserved.
  17371. *
  17372. * This source code is licensed under the BSD-style license found in the
  17373. * LICENSE file in the root directory of this source tree. An additional grant
  17374. * of patent rights can be found in the PATENTS file in the same directory.
  17375. *
  17376. * @providesModule getEventTarget
  17377. * @typechecks static-only
  17378. */
  17379. 'use strict';
  17380. /**
  17381. * Gets the target node from a native browser event by accounting for
  17382. * inconsistencies in browser DOM APIs.
  17383. *
  17384. * @param {object} nativeEvent Native browser event.
  17385. * @return {DOMEventTarget} Target node.
  17386. */
  17387. function getEventTarget(nativeEvent) {
  17388. var target = nativeEvent.target || nativeEvent.srcElement || window;
  17389. // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  17390. // @see http://www.quirksmode.org/js/events_properties.html
  17391. return target.nodeType === 3 ? target.parentNode : target;
  17392. }
  17393. module.exports = getEventTarget;
  17394. },{}],141:[function(_dereq_,module,exports){
  17395. /**
  17396. * Copyright 2013-2015, Facebook, Inc.
  17397. * All rights reserved.
  17398. *
  17399. * This source code is licensed under the BSD-style license found in the
  17400. * LICENSE file in the root directory of this source tree. An additional grant
  17401. * of patent rights can be found in the PATENTS file in the same directory.
  17402. *
  17403. * @providesModule getIteratorFn
  17404. * @typechecks static-only
  17405. */
  17406. 'use strict';
  17407. /* global Symbol */
  17408. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  17409. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  17410. /**
  17411. * Returns the iterator method function contained on the iterable object.
  17412. *
  17413. * Be sure to invoke the function with the iterable as context:
  17414. *
  17415. * var iteratorFn = getIteratorFn(myIterable);
  17416. * if (iteratorFn) {
  17417. * var iterator = iteratorFn.call(myIterable);
  17418. * ...
  17419. * }
  17420. *
  17421. * @param {?object} maybeIterable
  17422. * @return {?function}
  17423. */
  17424. function getIteratorFn(maybeIterable) {
  17425. var iteratorFn = maybeIterable && (
  17426. (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL])
  17427. );
  17428. if (typeof iteratorFn === 'function') {
  17429. return iteratorFn;
  17430. }
  17431. }
  17432. module.exports = getIteratorFn;
  17433. },{}],142:[function(_dereq_,module,exports){
  17434. /**
  17435. * Copyright 2013-2015, Facebook, Inc.
  17436. * All rights reserved.
  17437. *
  17438. * This source code is licensed under the BSD-style license found in the
  17439. * LICENSE file in the root directory of this source tree. An additional grant
  17440. * of patent rights can be found in the PATENTS file in the same directory.
  17441. *
  17442. * @providesModule getMarkupWrap
  17443. */
  17444. var ExecutionEnvironment = _dereq_(22);
  17445. var invariant = _dereq_(150);
  17446. /**
  17447. * Dummy container used to detect which wraps are necessary.
  17448. */
  17449. var dummyNode =
  17450. ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  17451. /**
  17452. * Some browsers cannot use `innerHTML` to render certain elements standalone,
  17453. * so we wrap them, render the wrapped nodes, then extract the desired node.
  17454. *
  17455. * In IE8, certain elements cannot render alone, so wrap all elements ('*').
  17456. */
  17457. var shouldWrap = {
  17458. // Force wrapping for SVG elements because if they get created inside a <div>,
  17459. // they will be initialized in the wrong namespace (and will not display).
  17460. 'circle': true,
  17461. 'defs': true,
  17462. 'ellipse': true,
  17463. 'g': true,
  17464. 'line': true,
  17465. 'linearGradient': true,
  17466. 'path': true,
  17467. 'polygon': true,
  17468. 'polyline': true,
  17469. 'radialGradient': true,
  17470. 'rect': true,
  17471. 'stop': true,
  17472. 'text': true
  17473. };
  17474. var selectWrap = [1, '<select multiple="true">', '</select>'];
  17475. var tableWrap = [1, '<table>', '</table>'];
  17476. var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  17477. var svgWrap = [1, '<svg>', '</svg>'];
  17478. var markupWrap = {
  17479. '*': [1, '?<div>', '</div>'],
  17480. 'area': [1, '<map>', '</map>'],
  17481. 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
  17482. 'legend': [1, '<fieldset>', '</fieldset>'],
  17483. 'param': [1, '<object>', '</object>'],
  17484. 'tr': [2, '<table><tbody>', '</tbody></table>'],
  17485. 'optgroup': selectWrap,
  17486. 'option': selectWrap,
  17487. 'caption': tableWrap,
  17488. 'colgroup': tableWrap,
  17489. 'tbody': tableWrap,
  17490. 'tfoot': tableWrap,
  17491. 'thead': tableWrap,
  17492. 'td': trWrap,
  17493. 'th': trWrap,
  17494. 'circle': svgWrap,
  17495. 'defs': svgWrap,
  17496. 'ellipse': svgWrap,
  17497. 'g': svgWrap,
  17498. 'line': svgWrap,
  17499. 'linearGradient': svgWrap,
  17500. 'path': svgWrap,
  17501. 'polygon': svgWrap,
  17502. 'polyline': svgWrap,
  17503. 'radialGradient': svgWrap,
  17504. 'rect': svgWrap,
  17505. 'stop': svgWrap,
  17506. 'text': svgWrap
  17507. };
  17508. /**
  17509. * Gets the markup wrap configuration for the supplied `nodeName`.
  17510. *
  17511. * NOTE: This lazily detects which wraps are necessary for the current browser.
  17512. *
  17513. * @param {string} nodeName Lowercase `nodeName`.
  17514. * @return {?array} Markup wrap configuration, if applicable.
  17515. */
  17516. function getMarkupWrap(nodeName) {
  17517. ("production" !== "development" ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));
  17518. if (!markupWrap.hasOwnProperty(nodeName)) {
  17519. nodeName = '*';
  17520. }
  17521. if (!shouldWrap.hasOwnProperty(nodeName)) {
  17522. if (nodeName === '*') {
  17523. dummyNode.innerHTML = '<link />';
  17524. } else {
  17525. dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
  17526. }
  17527. shouldWrap[nodeName] = !dummyNode.firstChild;
  17528. }
  17529. return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
  17530. }
  17531. module.exports = getMarkupWrap;
  17532. },{"150":150,"22":22}],143:[function(_dereq_,module,exports){
  17533. /**
  17534. * Copyright 2013-2015, Facebook, Inc.
  17535. * All rights reserved.
  17536. *
  17537. * This source code is licensed under the BSD-style license found in the
  17538. * LICENSE file in the root directory of this source tree. An additional grant
  17539. * of patent rights can be found in the PATENTS file in the same directory.
  17540. *
  17541. * @providesModule getNodeForCharacterOffset
  17542. */
  17543. 'use strict';
  17544. /**
  17545. * Given any node return the first leaf node without children.
  17546. *
  17547. * @param {DOMElement|DOMTextNode} node
  17548. * @return {DOMElement|DOMTextNode}
  17549. */
  17550. function getLeafNode(node) {
  17551. while (node && node.firstChild) {
  17552. node = node.firstChild;
  17553. }
  17554. return node;
  17555. }
  17556. /**
  17557. * Get the next sibling within a container. This will walk up the
  17558. * DOM if a node's siblings have been exhausted.
  17559. *
  17560. * @param {DOMElement|DOMTextNode} node
  17561. * @return {?DOMElement|DOMTextNode}
  17562. */
  17563. function getSiblingNode(node) {
  17564. while (node) {
  17565. if (node.nextSibling) {
  17566. return node.nextSibling;
  17567. }
  17568. node = node.parentNode;
  17569. }
  17570. }
  17571. /**
  17572. * Get object describing the nodes which contain characters at offset.
  17573. *
  17574. * @param {DOMElement|DOMTextNode} root
  17575. * @param {number} offset
  17576. * @return {?object}
  17577. */
  17578. function getNodeForCharacterOffset(root, offset) {
  17579. var node = getLeafNode(root);
  17580. var nodeStart = 0;
  17581. var nodeEnd = 0;
  17582. while (node) {
  17583. if (node.nodeType === 3) {
  17584. nodeEnd = nodeStart + node.textContent.length;
  17585. if (nodeStart <= offset && nodeEnd >= offset) {
  17586. return {
  17587. node: node,
  17588. offset: offset - nodeStart
  17589. };
  17590. }
  17591. nodeStart = nodeEnd;
  17592. }
  17593. node = getLeafNode(getSiblingNode(node));
  17594. }
  17595. }
  17596. module.exports = getNodeForCharacterOffset;
  17597. },{}],144:[function(_dereq_,module,exports){
  17598. /**
  17599. * Copyright 2013-2015, Facebook, Inc.
  17600. * All rights reserved.
  17601. *
  17602. * This source code is licensed under the BSD-style license found in the
  17603. * LICENSE file in the root directory of this source tree. An additional grant
  17604. * of patent rights can be found in the PATENTS file in the same directory.
  17605. *
  17606. * @providesModule getReactRootElementInContainer
  17607. */
  17608. 'use strict';
  17609. var DOC_NODE_TYPE = 9;
  17610. /**
  17611. * @param {DOMElement|DOMDocument} container DOM element that may contain
  17612. * a React component
  17613. * @return {?*} DOM element that may have the reactRoot ID, or null.
  17614. */
  17615. function getReactRootElementInContainer(container) {
  17616. if (!container) {
  17617. return null;
  17618. }
  17619. if (container.nodeType === DOC_NODE_TYPE) {
  17620. return container.documentElement;
  17621. } else {
  17622. return container.firstChild;
  17623. }
  17624. }
  17625. module.exports = getReactRootElementInContainer;
  17626. },{}],145:[function(_dereq_,module,exports){
  17627. /**
  17628. * Copyright 2013-2015, Facebook, Inc.
  17629. * All rights reserved.
  17630. *
  17631. * This source code is licensed under the BSD-style license found in the
  17632. * LICENSE file in the root directory of this source tree. An additional grant
  17633. * of patent rights can be found in the PATENTS file in the same directory.
  17634. *
  17635. * @providesModule getTextContentAccessor
  17636. */
  17637. 'use strict';
  17638. var ExecutionEnvironment = _dereq_(22);
  17639. var contentKey = null;
  17640. /**
  17641. * Gets the key used to access text content on a DOM node.
  17642. *
  17643. * @return {?string} Key used to access text content.
  17644. * @internal
  17645. */
  17646. function getTextContentAccessor() {
  17647. if (!contentKey && ExecutionEnvironment.canUseDOM) {
  17648. // Prefer textContent to innerText because many browsers support both but
  17649. // SVG <text> elements don't support innerText even when <div> does.
  17650. contentKey = 'textContent' in document.documentElement ?
  17651. 'textContent' :
  17652. 'innerText';
  17653. }
  17654. return contentKey;
  17655. }
  17656. module.exports = getTextContentAccessor;
  17657. },{"22":22}],146:[function(_dereq_,module,exports){
  17658. /**
  17659. * Copyright 2013-2015, Facebook, Inc.
  17660. * All rights reserved.
  17661. *
  17662. * This source code is licensed under the BSD-style license found in the
  17663. * LICENSE file in the root directory of this source tree. An additional grant
  17664. * of patent rights can be found in the PATENTS file in the same directory.
  17665. *
  17666. * @providesModule getUnboundedScrollPosition
  17667. * @typechecks
  17668. */
  17669. "use strict";
  17670. /**
  17671. * Gets the scroll position of the supplied element or window.
  17672. *
  17673. * The return values are unbounded, unlike `getScrollPosition`. This means they
  17674. * may be negative or exceed the element boundaries (which is possible using
  17675. * inertial scrolling).
  17676. *
  17677. * @param {DOMWindow|DOMElement} scrollable
  17678. * @return {object} Map with `x` and `y` keys.
  17679. */
  17680. function getUnboundedScrollPosition(scrollable) {
  17681. if (scrollable === window) {
  17682. return {
  17683. x: window.pageXOffset || document.documentElement.scrollLeft,
  17684. y: window.pageYOffset || document.documentElement.scrollTop
  17685. };
  17686. }
  17687. return {
  17688. x: scrollable.scrollLeft,
  17689. y: scrollable.scrollTop
  17690. };
  17691. }
  17692. module.exports = getUnboundedScrollPosition;
  17693. },{}],147:[function(_dereq_,module,exports){
  17694. /**
  17695. * Copyright 2013-2015, Facebook, Inc.
  17696. * All rights reserved.
  17697. *
  17698. * This source code is licensed under the BSD-style license found in the
  17699. * LICENSE file in the root directory of this source tree. An additional grant
  17700. * of patent rights can be found in the PATENTS file in the same directory.
  17701. *
  17702. * @providesModule hyphenate
  17703. * @typechecks
  17704. */
  17705. var _uppercasePattern = /([A-Z])/g;
  17706. /**
  17707. * Hyphenates a camelcased string, for example:
  17708. *
  17709. * > hyphenate('backgroundColor')
  17710. * < "background-color"
  17711. *
  17712. * For CSS style names, use `hyphenateStyleName` instead which works properly
  17713. * with all vendor prefixes, including `ms`.
  17714. *
  17715. * @param {string} string
  17716. * @return {string}
  17717. */
  17718. function hyphenate(string) {
  17719. return string.replace(_uppercasePattern, '-$1').toLowerCase();
  17720. }
  17721. module.exports = hyphenate;
  17722. },{}],148:[function(_dereq_,module,exports){
  17723. /**
  17724. * Copyright 2013-2015, Facebook, Inc.
  17725. * All rights reserved.
  17726. *
  17727. * This source code is licensed under the BSD-style license found in the
  17728. * LICENSE file in the root directory of this source tree. An additional grant
  17729. * of patent rights can be found in the PATENTS file in the same directory.
  17730. *
  17731. * @providesModule hyphenateStyleName
  17732. * @typechecks
  17733. */
  17734. "use strict";
  17735. var hyphenate = _dereq_(147);
  17736. var msPattern = /^ms-/;
  17737. /**
  17738. * Hyphenates a camelcased CSS property name, for example:
  17739. *
  17740. * > hyphenateStyleName('backgroundColor')
  17741. * < "background-color"
  17742. * > hyphenateStyleName('MozTransition')
  17743. * < "-moz-transition"
  17744. * > hyphenateStyleName('msTransition')
  17745. * < "-ms-transition"
  17746. *
  17747. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  17748. * is converted to `-ms-`.
  17749. *
  17750. * @param {string} string
  17751. * @return {string}
  17752. */
  17753. function hyphenateStyleName(string) {
  17754. return hyphenate(string).replace(msPattern, '-ms-');
  17755. }
  17756. module.exports = hyphenateStyleName;
  17757. },{"147":147}],149:[function(_dereq_,module,exports){
  17758. /**
  17759. * Copyright 2013-2015, Facebook, Inc.
  17760. * All rights reserved.
  17761. *
  17762. * This source code is licensed under the BSD-style license found in the
  17763. * LICENSE file in the root directory of this source tree. An additional grant
  17764. * of patent rights can be found in the PATENTS file in the same directory.
  17765. *
  17766. * @providesModule instantiateReactComponent
  17767. * @typechecks static-only
  17768. */
  17769. 'use strict';
  17770. var ReactCompositeComponent = _dereq_(43);
  17771. var ReactEmptyComponent = _dereq_(65);
  17772. var ReactNativeComponent = _dereq_(80);
  17773. var assign = _dereq_(29);
  17774. var invariant = _dereq_(150);
  17775. var warning = _dereq_(171);
  17776. // To avoid a cyclic dependency, we create the final class in this module
  17777. var ReactCompositeComponentWrapper = function() { };
  17778. assign(
  17779. ReactCompositeComponentWrapper.prototype,
  17780. ReactCompositeComponent.Mixin,
  17781. {
  17782. _instantiateReactComponent: instantiateReactComponent
  17783. }
  17784. );
  17785. /**
  17786. * Check if the type reference is a known internal type. I.e. not a user
  17787. * provided composite type.
  17788. *
  17789. * @param {function} type
  17790. * @return {boolean} Returns true if this is a valid internal type.
  17791. */
  17792. function isInternalComponentType(type) {
  17793. return (
  17794. typeof type === 'function' &&
  17795. typeof type.prototype.mountComponent === 'function' &&
  17796. typeof type.prototype.receiveComponent === 'function'
  17797. );
  17798. }
  17799. /**
  17800. * Given a ReactNode, create an instance that will actually be mounted.
  17801. *
  17802. * @param {ReactNode} node
  17803. * @param {*} parentCompositeType The composite type that resolved this.
  17804. * @return {object} A new instance of the element's constructor.
  17805. * @protected
  17806. */
  17807. function instantiateReactComponent(node, parentCompositeType) {
  17808. var instance;
  17809. if (node === null || node === false) {
  17810. node = ReactEmptyComponent.emptyElement;
  17811. }
  17812. if (typeof node === 'object') {
  17813. var element = node;
  17814. if ("production" !== "development") {
  17815. ("production" !== "development" ? warning(
  17816. element && (typeof element.type === 'function' ||
  17817. typeof element.type === 'string'),
  17818. 'Only functions or strings can be mounted as React components.'
  17819. ) : null);
  17820. }
  17821. // Special case string values
  17822. if (parentCompositeType === element.type &&
  17823. typeof element.type === 'string') {
  17824. // Avoid recursion if the wrapper renders itself.
  17825. instance = ReactNativeComponent.createInternalComponent(element);
  17826. // All native components are currently wrapped in a composite so we're
  17827. // safe to assume that this is what we should instantiate.
  17828. } else if (isInternalComponentType(element.type)) {
  17829. // This is temporarily available for custom components that are not string
  17830. // represenations. I.e. ART. Once those are updated to use the string
  17831. // representation, we can drop this code path.
  17832. instance = new element.type(element);
  17833. } else {
  17834. instance = new ReactCompositeComponentWrapper();
  17835. }
  17836. } else if (typeof node === 'string' || typeof node === 'number') {
  17837. instance = ReactNativeComponent.createInstanceForText(node);
  17838. } else {
  17839. ("production" !== "development" ? invariant(
  17840. false,
  17841. 'Encountered invalid React node of type %s',
  17842. typeof node
  17843. ) : invariant(false));
  17844. }
  17845. if ("production" !== "development") {
  17846. ("production" !== "development" ? warning(
  17847. typeof instance.construct === 'function' &&
  17848. typeof instance.mountComponent === 'function' &&
  17849. typeof instance.receiveComponent === 'function' &&
  17850. typeof instance.unmountComponent === 'function',
  17851. 'Only React Components can be mounted.'
  17852. ) : null);
  17853. }
  17854. // Sets up the instance. This can probably just move into the constructor now.
  17855. instance.construct(node);
  17856. // These two fields are used by the DOM and ART diffing algorithms
  17857. // respectively. Instead of using expandos on components, we should be
  17858. // storing the state needed by the diffing algorithms elsewhere.
  17859. instance._mountIndex = 0;
  17860. instance._mountImage = null;
  17861. if ("production" !== "development") {
  17862. instance._isOwnerNecessary = false;
  17863. instance._warnedAboutRefsInRender = false;
  17864. }
  17865. // Internal instances should fully constructed at this point, so they should
  17866. // not get any new fields added to them at this point.
  17867. if ("production" !== "development") {
  17868. if (Object.preventExtensions) {
  17869. Object.preventExtensions(instance);
  17870. }
  17871. }
  17872. return instance;
  17873. }
  17874. module.exports = instantiateReactComponent;
  17875. },{"150":150,"171":171,"29":29,"43":43,"65":65,"80":80}],150:[function(_dereq_,module,exports){
  17876. /**
  17877. * Copyright 2013-2015, Facebook, Inc.
  17878. * All rights reserved.
  17879. *
  17880. * This source code is licensed under the BSD-style license found in the
  17881. * LICENSE file in the root directory of this source tree. An additional grant
  17882. * of patent rights can be found in the PATENTS file in the same directory.
  17883. *
  17884. * @providesModule invariant
  17885. */
  17886. "use strict";
  17887. /**
  17888. * Use invariant() to assert state which your program assumes to be true.
  17889. *
  17890. * Provide sprintf-style format (only %s is supported) and arguments
  17891. * to provide information about what broke and what you were
  17892. * expecting.
  17893. *
  17894. * The invariant message will be stripped in production, but the invariant
  17895. * will remain to ensure logic does not differ in production.
  17896. */
  17897. var invariant = function(condition, format, a, b, c, d, e, f) {
  17898. if ("production" !== "development") {
  17899. if (format === undefined) {
  17900. throw new Error('invariant requires an error message argument');
  17901. }
  17902. }
  17903. if (!condition) {
  17904. var error;
  17905. if (format === undefined) {
  17906. error = new Error(
  17907. 'Minified exception occurred; use the non-minified dev environment ' +
  17908. 'for the full error message and additional helpful warnings.'
  17909. );
  17910. } else {
  17911. var args = [a, b, c, d, e, f];
  17912. var argIndex = 0;
  17913. error = new Error(
  17914. 'Invariant Violation: ' +
  17915. format.replace(/%s/g, function() { return args[argIndex++]; })
  17916. );
  17917. }
  17918. error.framesToPop = 1; // we don't care about invariant's own frame
  17919. throw error;
  17920. }
  17921. };
  17922. module.exports = invariant;
  17923. },{}],151:[function(_dereq_,module,exports){
  17924. /**
  17925. * Copyright 2013-2015, Facebook, Inc.
  17926. * All rights reserved.
  17927. *
  17928. * This source code is licensed under the BSD-style license found in the
  17929. * LICENSE file in the root directory of this source tree. An additional grant
  17930. * of patent rights can be found in the PATENTS file in the same directory.
  17931. *
  17932. * @providesModule isEventSupported
  17933. */
  17934. 'use strict';
  17935. var ExecutionEnvironment = _dereq_(22);
  17936. var useHasFeature;
  17937. if (ExecutionEnvironment.canUseDOM) {
  17938. useHasFeature =
  17939. document.implementation &&
  17940. document.implementation.hasFeature &&
  17941. // always returns true in newer browsers as per the standard.
  17942. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  17943. document.implementation.hasFeature('', '') !== true;
  17944. }
  17945. /**
  17946. * Checks if an event is supported in the current execution environment.
  17947. *
  17948. * NOTE: This will not work correctly for non-generic events such as `change`,
  17949. * `reset`, `load`, `error`, and `select`.
  17950. *
  17951. * Borrows from Modernizr.
  17952. *
  17953. * @param {string} eventNameSuffix Event name, e.g. "click".
  17954. * @param {?boolean} capture Check if the capture phase is supported.
  17955. * @return {boolean} True if the event is supported.
  17956. * @internal
  17957. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  17958. */
  17959. function isEventSupported(eventNameSuffix, capture) {
  17960. if (!ExecutionEnvironment.canUseDOM ||
  17961. capture && !('addEventListener' in document)) {
  17962. return false;
  17963. }
  17964. var eventName = 'on' + eventNameSuffix;
  17965. var isSupported = eventName in document;
  17966. if (!isSupported) {
  17967. var element = document.createElement('div');
  17968. element.setAttribute(eventName, 'return;');
  17969. isSupported = typeof element[eventName] === 'function';
  17970. }
  17971. if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
  17972. // This is the only way to test support for the `wheel` event in IE9+.
  17973. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  17974. }
  17975. return isSupported;
  17976. }
  17977. module.exports = isEventSupported;
  17978. },{"22":22}],152:[function(_dereq_,module,exports){
  17979. /**
  17980. * Copyright 2013-2015, Facebook, Inc.
  17981. * All rights reserved.
  17982. *
  17983. * This source code is licensed under the BSD-style license found in the
  17984. * LICENSE file in the root directory of this source tree. An additional grant
  17985. * of patent rights can be found in the PATENTS file in the same directory.
  17986. *
  17987. * @providesModule isNode
  17988. * @typechecks
  17989. */
  17990. /**
  17991. * @param {*} object The object to check.
  17992. * @return {boolean} Whether or not the object is a DOM node.
  17993. */
  17994. function isNode(object) {
  17995. return !!(object && (
  17996. ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
  17997. typeof object.nodeType === 'number' &&
  17998. typeof object.nodeName === 'string'))
  17999. ));
  18000. }
  18001. module.exports = isNode;
  18002. },{}],153:[function(_dereq_,module,exports){
  18003. /**
  18004. * Copyright 2013-2015, Facebook, Inc.
  18005. * All rights reserved.
  18006. *
  18007. * This source code is licensed under the BSD-style license found in the
  18008. * LICENSE file in the root directory of this source tree. An additional grant
  18009. * of patent rights can be found in the PATENTS file in the same directory.
  18010. *
  18011. * @providesModule isTextInputElement
  18012. */
  18013. 'use strict';
  18014. /**
  18015. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  18016. */
  18017. var supportedInputTypes = {
  18018. 'color': true,
  18019. 'date': true,
  18020. 'datetime': true,
  18021. 'datetime-local': true,
  18022. 'email': true,
  18023. 'month': true,
  18024. 'number': true,
  18025. 'password': true,
  18026. 'range': true,
  18027. 'search': true,
  18028. 'tel': true,
  18029. 'text': true,
  18030. 'time': true,
  18031. 'url': true,
  18032. 'week': true
  18033. };
  18034. function isTextInputElement(elem) {
  18035. return elem && (
  18036. (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')
  18037. );
  18038. }
  18039. module.exports = isTextInputElement;
  18040. },{}],154:[function(_dereq_,module,exports){
  18041. /**
  18042. * Copyright 2013-2015, Facebook, Inc.
  18043. * All rights reserved.
  18044. *
  18045. * This source code is licensed under the BSD-style license found in the
  18046. * LICENSE file in the root directory of this source tree. An additional grant
  18047. * of patent rights can be found in the PATENTS file in the same directory.
  18048. *
  18049. * @providesModule isTextNode
  18050. * @typechecks
  18051. */
  18052. var isNode = _dereq_(152);
  18053. /**
  18054. * @param {*} object The object to check.
  18055. * @return {boolean} Whether or not the object is a DOM text node.
  18056. */
  18057. function isTextNode(object) {
  18058. return isNode(object) && object.nodeType == 3;
  18059. }
  18060. module.exports = isTextNode;
  18061. },{"152":152}],155:[function(_dereq_,module,exports){
  18062. /**
  18063. * Copyright 2013-2015, Facebook, Inc.
  18064. * All rights reserved.
  18065. *
  18066. * This source code is licensed under the BSD-style license found in the
  18067. * LICENSE file in the root directory of this source tree. An additional grant
  18068. * of patent rights can be found in the PATENTS file in the same directory.
  18069. *
  18070. * @providesModule joinClasses
  18071. * @typechecks static-only
  18072. */
  18073. 'use strict';
  18074. /**
  18075. * Combines multiple className strings into one.
  18076. * http://jsperf.com/joinclasses-args-vs-array
  18077. *
  18078. * @param {...?string} classes
  18079. * @return {string}
  18080. */
  18081. function joinClasses(className/*, ... */) {
  18082. if (!className) {
  18083. className = '';
  18084. }
  18085. var nextClass;
  18086. var argLength = arguments.length;
  18087. if (argLength > 1) {
  18088. for (var ii = 1; ii < argLength; ii++) {
  18089. nextClass = arguments[ii];
  18090. if (nextClass) {
  18091. className = (className ? className + ' ' : '') + nextClass;
  18092. }
  18093. }
  18094. }
  18095. return className;
  18096. }
  18097. module.exports = joinClasses;
  18098. },{}],156:[function(_dereq_,module,exports){
  18099. /**
  18100. * Copyright 2013-2015, Facebook, Inc.
  18101. * All rights reserved.
  18102. *
  18103. * This source code is licensed under the BSD-style license found in the
  18104. * LICENSE file in the root directory of this source tree. An additional grant
  18105. * of patent rights can be found in the PATENTS file in the same directory.
  18106. *
  18107. * @providesModule keyMirror
  18108. * @typechecks static-only
  18109. */
  18110. 'use strict';
  18111. var invariant = _dereq_(150);
  18112. /**
  18113. * Constructs an enumeration with keys equal to their value.
  18114. *
  18115. * For example:
  18116. *
  18117. * var COLORS = keyMirror({blue: null, red: null});
  18118. * var myColor = COLORS.blue;
  18119. * var isColorValid = !!COLORS[myColor];
  18120. *
  18121. * The last line could not be performed if the values of the generated enum were
  18122. * not equal to their keys.
  18123. *
  18124. * Input: {key1: val1, key2: val2}
  18125. * Output: {key1: key1, key2: key2}
  18126. *
  18127. * @param {object} obj
  18128. * @return {object}
  18129. */
  18130. var keyMirror = function(obj) {
  18131. var ret = {};
  18132. var key;
  18133. ("production" !== "development" ? invariant(
  18134. obj instanceof Object && !Array.isArray(obj),
  18135. 'keyMirror(...): Argument must be an object.'
  18136. ) : invariant(obj instanceof Object && !Array.isArray(obj)));
  18137. for (key in obj) {
  18138. if (!obj.hasOwnProperty(key)) {
  18139. continue;
  18140. }
  18141. ret[key] = key;
  18142. }
  18143. return ret;
  18144. };
  18145. module.exports = keyMirror;
  18146. },{"150":150}],157:[function(_dereq_,module,exports){
  18147. /**
  18148. * Copyright 2013-2015, Facebook, Inc.
  18149. * All rights reserved.
  18150. *
  18151. * This source code is licensed under the BSD-style license found in the
  18152. * LICENSE file in the root directory of this source tree. An additional grant
  18153. * of patent rights can be found in the PATENTS file in the same directory.
  18154. *
  18155. * @providesModule keyOf
  18156. */
  18157. /**
  18158. * Allows extraction of a minified key. Let's the build system minify keys
  18159. * without loosing the ability to dynamically use key strings as values
  18160. * themselves. Pass in an object with a single key/val pair and it will return
  18161. * you the string key of that single record. Suppose you want to grab the
  18162. * value for a key 'className' inside of an object. Key/val minification may
  18163. * have aliased that key to be 'xa12'. keyOf({className: null}) will return
  18164. * 'xa12' in that case. Resolve keys you want to use once at startup time, then
  18165. * reuse those resolutions.
  18166. */
  18167. var keyOf = function(oneKeyObj) {
  18168. var key;
  18169. for (key in oneKeyObj) {
  18170. if (!oneKeyObj.hasOwnProperty(key)) {
  18171. continue;
  18172. }
  18173. return key;
  18174. }
  18175. return null;
  18176. };
  18177. module.exports = keyOf;
  18178. },{}],158:[function(_dereq_,module,exports){
  18179. /**
  18180. * Copyright 2013-2015, Facebook, Inc.
  18181. * All rights reserved.
  18182. *
  18183. * This source code is licensed under the BSD-style license found in the
  18184. * LICENSE file in the root directory of this source tree. An additional grant
  18185. * of patent rights can be found in the PATENTS file in the same directory.
  18186. *
  18187. * @providesModule mapObject
  18188. */
  18189. 'use strict';
  18190. var hasOwnProperty = Object.prototype.hasOwnProperty;
  18191. /**
  18192. * Executes the provided `callback` once for each enumerable own property in the
  18193. * object and constructs a new object from the results. The `callback` is
  18194. * invoked with three arguments:
  18195. *
  18196. * - the property value
  18197. * - the property name
  18198. * - the object being traversed
  18199. *
  18200. * Properties that are added after the call to `mapObject` will not be visited
  18201. * by `callback`. If the values of existing properties are changed, the value
  18202. * passed to `callback` will be the value at the time `mapObject` visits them.
  18203. * Properties that are deleted before being visited are not visited.
  18204. *
  18205. * @grep function objectMap()
  18206. * @grep function objMap()
  18207. *
  18208. * @param {?object} object
  18209. * @param {function} callback
  18210. * @param {*} context
  18211. * @return {?object}
  18212. */
  18213. function mapObject(object, callback, context) {
  18214. if (!object) {
  18215. return null;
  18216. }
  18217. var result = {};
  18218. for (var name in object) {
  18219. if (hasOwnProperty.call(object, name)) {
  18220. result[name] = callback.call(context, object[name], name, object);
  18221. }
  18222. }
  18223. return result;
  18224. }
  18225. module.exports = mapObject;
  18226. },{}],159:[function(_dereq_,module,exports){
  18227. /**
  18228. * Copyright 2013-2015, Facebook, Inc.
  18229. * All rights reserved.
  18230. *
  18231. * This source code is licensed under the BSD-style license found in the
  18232. * LICENSE file in the root directory of this source tree. An additional grant
  18233. * of patent rights can be found in the PATENTS file in the same directory.
  18234. *
  18235. * @providesModule memoizeStringOnly
  18236. * @typechecks static-only
  18237. */
  18238. 'use strict';
  18239. /**
  18240. * Memoizes the return value of a function that accepts one string argument.
  18241. *
  18242. * @param {function} callback
  18243. * @return {function}
  18244. */
  18245. function memoizeStringOnly(callback) {
  18246. var cache = {};
  18247. return function(string) {
  18248. if (!cache.hasOwnProperty(string)) {
  18249. cache[string] = callback.call(this, string);
  18250. }
  18251. return cache[string];
  18252. };
  18253. }
  18254. module.exports = memoizeStringOnly;
  18255. },{}],160:[function(_dereq_,module,exports){
  18256. /**
  18257. * Copyright 2013-2015, Facebook, Inc.
  18258. * All rights reserved.
  18259. *
  18260. * This source code is licensed under the BSD-style license found in the
  18261. * LICENSE file in the root directory of this source tree. An additional grant
  18262. * of patent rights can be found in the PATENTS file in the same directory.
  18263. *
  18264. * @providesModule onlyChild
  18265. */
  18266. 'use strict';
  18267. var ReactElement = _dereq_(63);
  18268. var invariant = _dereq_(150);
  18269. /**
  18270. * Returns the first child in a collection of children and verifies that there
  18271. * is only one child in the collection. The current implementation of this
  18272. * function assumes that a single child gets passed without a wrapper, but the
  18273. * purpose of this helper function is to abstract away the particular structure
  18274. * of children.
  18275. *
  18276. * @param {?object} children Child collection structure.
  18277. * @return {ReactComponent} The first and only `ReactComponent` contained in the
  18278. * structure.
  18279. */
  18280. function onlyChild(children) {
  18281. ("production" !== "development" ? invariant(
  18282. ReactElement.isValidElement(children),
  18283. 'onlyChild must be passed a children with exactly one child.'
  18284. ) : invariant(ReactElement.isValidElement(children)));
  18285. return children;
  18286. }
  18287. module.exports = onlyChild;
  18288. },{"150":150,"63":63}],161:[function(_dereq_,module,exports){
  18289. /**
  18290. * Copyright 2013-2015, Facebook, Inc.
  18291. * All rights reserved.
  18292. *
  18293. * This source code is licensed under the BSD-style license found in the
  18294. * LICENSE file in the root directory of this source tree. An additional grant
  18295. * of patent rights can be found in the PATENTS file in the same directory.
  18296. *
  18297. * @providesModule performance
  18298. * @typechecks
  18299. */
  18300. "use strict";
  18301. var ExecutionEnvironment = _dereq_(22);
  18302. var performance;
  18303. if (ExecutionEnvironment.canUseDOM) {
  18304. performance =
  18305. window.performance ||
  18306. window.msPerformance ||
  18307. window.webkitPerformance;
  18308. }
  18309. module.exports = performance || {};
  18310. },{"22":22}],162:[function(_dereq_,module,exports){
  18311. /**
  18312. * Copyright 2013-2015, Facebook, Inc.
  18313. * All rights reserved.
  18314. *
  18315. * This source code is licensed under the BSD-style license found in the
  18316. * LICENSE file in the root directory of this source tree. An additional grant
  18317. * of patent rights can be found in the PATENTS file in the same directory.
  18318. *
  18319. * @providesModule performanceNow
  18320. * @typechecks
  18321. */
  18322. var performance = _dereq_(161);
  18323. /**
  18324. * Detect if we can use `window.performance.now()` and gracefully fallback to
  18325. * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
  18326. * because of Facebook's testing infrastructure.
  18327. */
  18328. if (!performance || !performance.now) {
  18329. performance = Date;
  18330. }
  18331. var performanceNow = performance.now.bind(performance);
  18332. module.exports = performanceNow;
  18333. },{"161":161}],163:[function(_dereq_,module,exports){
  18334. /**
  18335. * Copyright 2013-2015, Facebook, Inc.
  18336. * All rights reserved.
  18337. *
  18338. * This source code is licensed under the BSD-style license found in the
  18339. * LICENSE file in the root directory of this source tree. An additional grant
  18340. * of patent rights can be found in the PATENTS file in the same directory.
  18341. *
  18342. * @providesModule quoteAttributeValueForBrowser
  18343. */
  18344. 'use strict';
  18345. var escapeTextContentForBrowser = _dereq_(131);
  18346. /**
  18347. * Escapes attribute value to prevent scripting attacks.
  18348. *
  18349. * @param {*} value Value to escape.
  18350. * @return {string} An escaped string.
  18351. */
  18352. function quoteAttributeValueForBrowser(value) {
  18353. return '"' + escapeTextContentForBrowser(value) + '"';
  18354. }
  18355. module.exports = quoteAttributeValueForBrowser;
  18356. },{"131":131}],164:[function(_dereq_,module,exports){
  18357. /**
  18358. * Copyright 2013-2015, Facebook, Inc.
  18359. * All rights reserved.
  18360. *
  18361. * This source code is licensed under the BSD-style license found in the
  18362. * LICENSE file in the root directory of this source tree. An additional grant
  18363. * of patent rights can be found in the PATENTS file in the same directory.
  18364. *
  18365. * @providesModule setInnerHTML
  18366. */
  18367. /* globals MSApp */
  18368. 'use strict';
  18369. var ExecutionEnvironment = _dereq_(22);
  18370. var WHITESPACE_TEST = /^[ \r\n\t\f]/;
  18371. var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
  18372. /**
  18373. * Set the innerHTML property of a node, ensuring that whitespace is preserved
  18374. * even in IE8.
  18375. *
  18376. * @param {DOMElement} node
  18377. * @param {string} html
  18378. * @internal
  18379. */
  18380. var setInnerHTML = function(node, html) {
  18381. node.innerHTML = html;
  18382. };
  18383. // Win8 apps: Allow all html to be inserted
  18384. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  18385. setInnerHTML = function(node, html) {
  18386. MSApp.execUnsafeLocalFunction(function() {
  18387. node.innerHTML = html;
  18388. });
  18389. };
  18390. }
  18391. if (ExecutionEnvironment.canUseDOM) {
  18392. // IE8: When updating a just created node with innerHTML only leading
  18393. // whitespace is removed. When updating an existing node with innerHTML
  18394. // whitespace in root TextNodes is also collapsed.
  18395. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
  18396. // Feature detection; only IE8 is known to behave improperly like this.
  18397. var testElement = document.createElement('div');
  18398. testElement.innerHTML = ' ';
  18399. if (testElement.innerHTML === '') {
  18400. setInnerHTML = function(node, html) {
  18401. // Magic theory: IE8 supposedly differentiates between added and updated
  18402. // nodes when processing innerHTML, innerHTML on updated nodes suffers
  18403. // from worse whitespace behavior. Re-adding a node like this triggers
  18404. // the initial and more favorable whitespace behavior.
  18405. // TODO: What to do on a detached node?
  18406. if (node.parentNode) {
  18407. node.parentNode.replaceChild(node, node);
  18408. }
  18409. // We also implement a workaround for non-visible tags disappearing into
  18410. // thin air on IE8, this only happens if there is no visible text
  18411. // in-front of the non-visible tags. Piggyback on the whitespace fix
  18412. // and simply check if any non-visible tags appear in the source.
  18413. if (WHITESPACE_TEST.test(html) ||
  18414. html[0] === '<' && NONVISIBLE_TEST.test(html)) {
  18415. // Recover leading whitespace by temporarily prepending any character.
  18416. // \uFEFF has the potential advantage of being zero-width/invisible.
  18417. node.innerHTML = '\uFEFF' + html;
  18418. // deleteData leaves an empty `TextNode` which offsets the index of all
  18419. // children. Definitely want to avoid this.
  18420. var textNode = node.firstChild;
  18421. if (textNode.data.length === 1) {
  18422. node.removeChild(textNode);
  18423. } else {
  18424. textNode.deleteData(0, 1);
  18425. }
  18426. } else {
  18427. node.innerHTML = html;
  18428. }
  18429. };
  18430. }
  18431. }
  18432. module.exports = setInnerHTML;
  18433. },{"22":22}],165:[function(_dereq_,module,exports){
  18434. /**
  18435. * Copyright 2013-2015, Facebook, Inc.
  18436. * All rights reserved.
  18437. *
  18438. * This source code is licensed under the BSD-style license found in the
  18439. * LICENSE file in the root directory of this source tree. An additional grant
  18440. * of patent rights can be found in the PATENTS file in the same directory.
  18441. *
  18442. * @providesModule setTextContent
  18443. */
  18444. 'use strict';
  18445. var ExecutionEnvironment = _dereq_(22);
  18446. var escapeTextContentForBrowser = _dereq_(131);
  18447. var setInnerHTML = _dereq_(164);
  18448. /**
  18449. * Set the textContent property of a node, ensuring that whitespace is preserved
  18450. * even in IE8. innerText is a poor substitute for textContent and, among many
  18451. * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
  18452. * as it should.
  18453. *
  18454. * @param {DOMElement} node
  18455. * @param {string} text
  18456. * @internal
  18457. */
  18458. var setTextContent = function(node, text) {
  18459. node.textContent = text;
  18460. };
  18461. if (ExecutionEnvironment.canUseDOM) {
  18462. if (!('textContent' in document.documentElement)) {
  18463. setTextContent = function(node, text) {
  18464. setInnerHTML(node, escapeTextContentForBrowser(text));
  18465. };
  18466. }
  18467. }
  18468. module.exports = setTextContent;
  18469. },{"131":131,"164":164,"22":22}],166:[function(_dereq_,module,exports){
  18470. /**
  18471. * Copyright 2013-2015, Facebook, Inc.
  18472. * All rights reserved.
  18473. *
  18474. * This source code is licensed under the BSD-style license found in the
  18475. * LICENSE file in the root directory of this source tree. An additional grant
  18476. * of patent rights can be found in the PATENTS file in the same directory.
  18477. *
  18478. * @providesModule shallowEqual
  18479. */
  18480. 'use strict';
  18481. /**
  18482. * Performs equality by iterating through keys on an object and returning
  18483. * false when any key has values which are not strictly equal between
  18484. * objA and objB. Returns true when the values of all keys are strictly equal.
  18485. *
  18486. * @return {boolean}
  18487. */
  18488. function shallowEqual(objA, objB) {
  18489. if (objA === objB) {
  18490. return true;
  18491. }
  18492. var key;
  18493. // Test for A's keys different from B.
  18494. for (key in objA) {
  18495. if (objA.hasOwnProperty(key) &&
  18496. (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
  18497. return false;
  18498. }
  18499. }
  18500. // Test for B's keys missing from A.
  18501. for (key in objB) {
  18502. if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
  18503. return false;
  18504. }
  18505. }
  18506. return true;
  18507. }
  18508. module.exports = shallowEqual;
  18509. },{}],167:[function(_dereq_,module,exports){
  18510. /**
  18511. * Copyright 2013-2015, Facebook, Inc.
  18512. * All rights reserved.
  18513. *
  18514. * This source code is licensed under the BSD-style license found in the
  18515. * LICENSE file in the root directory of this source tree. An additional grant
  18516. * of patent rights can be found in the PATENTS file in the same directory.
  18517. *
  18518. * @providesModule shouldUpdateReactComponent
  18519. * @typechecks static-only
  18520. */
  18521. 'use strict';
  18522. var warning = _dereq_(171);
  18523. /**
  18524. * Given a `prevElement` and `nextElement`, determines if the existing
  18525. * instance should be updated as opposed to being destroyed or replaced by a new
  18526. * instance. Both arguments are elements. This ensures that this logic can
  18527. * operate on stateless trees without any backing instance.
  18528. *
  18529. * @param {?object} prevElement
  18530. * @param {?object} nextElement
  18531. * @return {boolean} True if the existing instance should be updated.
  18532. * @protected
  18533. */
  18534. function shouldUpdateReactComponent(prevElement, nextElement) {
  18535. if (prevElement != null && nextElement != null) {
  18536. var prevType = typeof prevElement;
  18537. var nextType = typeof nextElement;
  18538. if (prevType === 'string' || prevType === 'number') {
  18539. return (nextType === 'string' || nextType === 'number');
  18540. } else {
  18541. if (nextType === 'object' &&
  18542. prevElement.type === nextElement.type &&
  18543. prevElement.key === nextElement.key) {
  18544. var ownersMatch = prevElement._owner === nextElement._owner;
  18545. var prevName = null;
  18546. var nextName = null;
  18547. var nextDisplayName = null;
  18548. if ("production" !== "development") {
  18549. if (!ownersMatch) {
  18550. if (prevElement._owner != null &&
  18551. prevElement._owner.getPublicInstance() != null &&
  18552. prevElement._owner.getPublicInstance().constructor != null) {
  18553. prevName =
  18554. prevElement._owner.getPublicInstance().constructor.displayName;
  18555. }
  18556. if (nextElement._owner != null &&
  18557. nextElement._owner.getPublicInstance() != null &&
  18558. nextElement._owner.getPublicInstance().constructor != null) {
  18559. nextName =
  18560. nextElement._owner.getPublicInstance().constructor.displayName;
  18561. }
  18562. if (nextElement.type != null &&
  18563. nextElement.type.displayName != null) {
  18564. nextDisplayName = nextElement.type.displayName;
  18565. }
  18566. if (nextElement.type != null && typeof nextElement.type === 'string') {
  18567. nextDisplayName = nextElement.type;
  18568. }
  18569. if (typeof nextElement.type !== 'string' ||
  18570. nextElement.type === 'input' ||
  18571. nextElement.type === 'textarea') {
  18572. if ((prevElement._owner != null &&
  18573. prevElement._owner._isOwnerNecessary === false) ||
  18574. (nextElement._owner != null &&
  18575. nextElement._owner._isOwnerNecessary === false)) {
  18576. if (prevElement._owner != null) {
  18577. prevElement._owner._isOwnerNecessary = true;
  18578. }
  18579. if (nextElement._owner != null) {
  18580. nextElement._owner._isOwnerNecessary = true;
  18581. }
  18582. ("production" !== "development" ? warning(
  18583. false,
  18584. '<%s /> is being rendered by both %s and %s using the same ' +
  18585. 'key (%s) in the same place. Currently, this means that ' +
  18586. 'they don\'t preserve state. This behavior should be very ' +
  18587. 'rare so we\'re considering deprecating it. Please contact ' +
  18588. 'the React team and explain your use case so that we can ' +
  18589. 'take that into consideration.',
  18590. nextDisplayName || 'Unknown Component',
  18591. prevName || '[Unknown]',
  18592. nextName || '[Unknown]',
  18593. prevElement.key
  18594. ) : null);
  18595. }
  18596. }
  18597. }
  18598. }
  18599. return ownersMatch;
  18600. }
  18601. }
  18602. }
  18603. return false;
  18604. }
  18605. module.exports = shouldUpdateReactComponent;
  18606. },{"171":171}],168:[function(_dereq_,module,exports){
  18607. /**
  18608. * Copyright 2014-2015, Facebook, Inc.
  18609. * All rights reserved.
  18610. *
  18611. * This source code is licensed under the BSD-style license found in the
  18612. * LICENSE file in the root directory of this source tree. An additional grant
  18613. * of patent rights can be found in the PATENTS file in the same directory.
  18614. *
  18615. * @providesModule toArray
  18616. * @typechecks
  18617. */
  18618. var invariant = _dereq_(150);
  18619. /**
  18620. * Convert array-like objects to arrays.
  18621. *
  18622. * This API assumes the caller knows the contents of the data type. For less
  18623. * well defined inputs use createArrayFromMixed.
  18624. *
  18625. * @param {object|function|filelist} obj
  18626. * @return {array}
  18627. */
  18628. function toArray(obj) {
  18629. var length = obj.length;
  18630. // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
  18631. // old versions of Safari).
  18632. ("production" !== "development" ? invariant(
  18633. !Array.isArray(obj) &&
  18634. (typeof obj === 'object' || typeof obj === 'function'),
  18635. 'toArray: Array-like object expected'
  18636. ) : invariant(!Array.isArray(obj) &&
  18637. (typeof obj === 'object' || typeof obj === 'function')));
  18638. ("production" !== "development" ? invariant(
  18639. typeof length === 'number',
  18640. 'toArray: Object needs a length property'
  18641. ) : invariant(typeof length === 'number'));
  18642. ("production" !== "development" ? invariant(
  18643. length === 0 ||
  18644. (length - 1) in obj,
  18645. 'toArray: Object should have keys for indices'
  18646. ) : invariant(length === 0 ||
  18647. (length - 1) in obj));
  18648. // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
  18649. // without method will throw during the slice call and skip straight to the
  18650. // fallback.
  18651. if (obj.hasOwnProperty) {
  18652. try {
  18653. return Array.prototype.slice.call(obj);
  18654. } catch (e) {
  18655. // IE < 9 does not support Array#slice on collections objects
  18656. }
  18657. }
  18658. // Fall back to copying key by key. This assumes all keys have a value,
  18659. // so will not preserve sparsely populated inputs.
  18660. var ret = Array(length);
  18661. for (var ii = 0; ii < length; ii++) {
  18662. ret[ii] = obj[ii];
  18663. }
  18664. return ret;
  18665. }
  18666. module.exports = toArray;
  18667. },{"150":150}],169:[function(_dereq_,module,exports){
  18668. /**
  18669. * Copyright 2013-2015, Facebook, Inc.
  18670. * All rights reserved.
  18671. *
  18672. * This source code is licensed under the BSD-style license found in the
  18673. * LICENSE file in the root directory of this source tree. An additional grant
  18674. * of patent rights can be found in the PATENTS file in the same directory.
  18675. *
  18676. * @providesModule traverseAllChildren
  18677. */
  18678. 'use strict';
  18679. var ReactElement = _dereq_(63);
  18680. var ReactFragment = _dereq_(69);
  18681. var ReactInstanceHandles = _dereq_(72);
  18682. var getIteratorFn = _dereq_(141);
  18683. var invariant = _dereq_(150);
  18684. var warning = _dereq_(171);
  18685. var SEPARATOR = ReactInstanceHandles.SEPARATOR;
  18686. var SUBSEPARATOR = ':';
  18687. /**
  18688. * TODO: Test that a single child and an array with one item have the same key
  18689. * pattern.
  18690. */
  18691. var userProvidedKeyEscaperLookup = {
  18692. '=': '=0',
  18693. '.': '=1',
  18694. ':': '=2'
  18695. };
  18696. var userProvidedKeyEscapeRegex = /[=.:]/g;
  18697. var didWarnAboutMaps = false;
  18698. function userProvidedKeyEscaper(match) {
  18699. return userProvidedKeyEscaperLookup[match];
  18700. }
  18701. /**
  18702. * Generate a key string that identifies a component within a set.
  18703. *
  18704. * @param {*} component A component that could contain a manual key.
  18705. * @param {number} index Index that is used if a manual key is not provided.
  18706. * @return {string}
  18707. */
  18708. function getComponentKey(component, index) {
  18709. if (component && component.key != null) {
  18710. // Explicit key
  18711. return wrapUserProvidedKey(component.key);
  18712. }
  18713. // Implicit key determined by the index in the set
  18714. return index.toString(36);
  18715. }
  18716. /**
  18717. * Escape a component key so that it is safe to use in a reactid.
  18718. *
  18719. * @param {*} key Component key to be escaped.
  18720. * @return {string} An escaped string.
  18721. */
  18722. function escapeUserProvidedKey(text) {
  18723. return ('' + text).replace(
  18724. userProvidedKeyEscapeRegex,
  18725. userProvidedKeyEscaper
  18726. );
  18727. }
  18728. /**
  18729. * Wrap a `key` value explicitly provided by the user to distinguish it from
  18730. * implicitly-generated keys generated by a component's index in its parent.
  18731. *
  18732. * @param {string} key Value of a user-provided `key` attribute
  18733. * @return {string}
  18734. */
  18735. function wrapUserProvidedKey(key) {
  18736. return '$' + escapeUserProvidedKey(key);
  18737. }
  18738. /**
  18739. * @param {?*} children Children tree container.
  18740. * @param {!string} nameSoFar Name of the key path so far.
  18741. * @param {!number} indexSoFar Number of children encountered until this point.
  18742. * @param {!function} callback Callback to invoke with each child found.
  18743. * @param {?*} traverseContext Used to pass information throughout the traversal
  18744. * process.
  18745. * @return {!number} The number of children in this subtree.
  18746. */
  18747. function traverseAllChildrenImpl(
  18748. children,
  18749. nameSoFar,
  18750. indexSoFar,
  18751. callback,
  18752. traverseContext
  18753. ) {
  18754. var type = typeof children;
  18755. if (type === 'undefined' || type === 'boolean') {
  18756. // All of the above are perceived as null.
  18757. children = null;
  18758. }
  18759. if (children === null ||
  18760. type === 'string' ||
  18761. type === 'number' ||
  18762. ReactElement.isValidElement(children)) {
  18763. callback(
  18764. traverseContext,
  18765. children,
  18766. // If it's the only child, treat the name as if it was wrapped in an array
  18767. // so that it's consistent if the number of children grows.
  18768. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar,
  18769. indexSoFar
  18770. );
  18771. return 1;
  18772. }
  18773. var child, nextName, nextIndex;
  18774. var subtreeCount = 0; // Count of children found in the current subtree.
  18775. if (Array.isArray(children)) {
  18776. for (var i = 0; i < children.length; i++) {
  18777. child = children[i];
  18778. nextName = (
  18779. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  18780. getComponentKey(child, i)
  18781. );
  18782. nextIndex = indexSoFar + subtreeCount;
  18783. subtreeCount += traverseAllChildrenImpl(
  18784. child,
  18785. nextName,
  18786. nextIndex,
  18787. callback,
  18788. traverseContext
  18789. );
  18790. }
  18791. } else {
  18792. var iteratorFn = getIteratorFn(children);
  18793. if (iteratorFn) {
  18794. var iterator = iteratorFn.call(children);
  18795. var step;
  18796. if (iteratorFn !== children.entries) {
  18797. var ii = 0;
  18798. while (!(step = iterator.next()).done) {
  18799. child = step.value;
  18800. nextName = (
  18801. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  18802. getComponentKey(child, ii++)
  18803. );
  18804. nextIndex = indexSoFar + subtreeCount;
  18805. subtreeCount += traverseAllChildrenImpl(
  18806. child,
  18807. nextName,
  18808. nextIndex,
  18809. callback,
  18810. traverseContext
  18811. );
  18812. }
  18813. } else {
  18814. if ("production" !== "development") {
  18815. ("production" !== "development" ? warning(
  18816. didWarnAboutMaps,
  18817. 'Using Maps as children is not yet fully supported. It is an ' +
  18818. 'experimental feature that might be removed. Convert it to a ' +
  18819. 'sequence / iterable of keyed ReactElements instead.'
  18820. ) : null);
  18821. didWarnAboutMaps = true;
  18822. }
  18823. // Iterator will provide entry [k,v] tuples rather than values.
  18824. while (!(step = iterator.next()).done) {
  18825. var entry = step.value;
  18826. if (entry) {
  18827. child = entry[1];
  18828. nextName = (
  18829. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  18830. wrapUserProvidedKey(entry[0]) + SUBSEPARATOR +
  18831. getComponentKey(child, 0)
  18832. );
  18833. nextIndex = indexSoFar + subtreeCount;
  18834. subtreeCount += traverseAllChildrenImpl(
  18835. child,
  18836. nextName,
  18837. nextIndex,
  18838. callback,
  18839. traverseContext
  18840. );
  18841. }
  18842. }
  18843. }
  18844. } else if (type === 'object') {
  18845. ("production" !== "development" ? invariant(
  18846. children.nodeType !== 1,
  18847. 'traverseAllChildren(...): Encountered an invalid child; DOM ' +
  18848. 'elements are not valid children of React components.'
  18849. ) : invariant(children.nodeType !== 1));
  18850. var fragment = ReactFragment.extract(children);
  18851. for (var key in fragment) {
  18852. if (fragment.hasOwnProperty(key)) {
  18853. child = fragment[key];
  18854. nextName = (
  18855. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  18856. wrapUserProvidedKey(key) + SUBSEPARATOR +
  18857. getComponentKey(child, 0)
  18858. );
  18859. nextIndex = indexSoFar + subtreeCount;
  18860. subtreeCount += traverseAllChildrenImpl(
  18861. child,
  18862. nextName,
  18863. nextIndex,
  18864. callback,
  18865. traverseContext
  18866. );
  18867. }
  18868. }
  18869. }
  18870. }
  18871. return subtreeCount;
  18872. }
  18873. /**
  18874. * Traverses children that are typically specified as `props.children`, but
  18875. * might also be specified through attributes:
  18876. *
  18877. * - `traverseAllChildren(this.props.children, ...)`
  18878. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  18879. *
  18880. * The `traverseContext` is an optional argument that is passed through the
  18881. * entire traversal. It can be used to store accumulations or anything else that
  18882. * the callback might find relevant.
  18883. *
  18884. * @param {?*} children Children tree object.
  18885. * @param {!function} callback To invoke upon traversing each child.
  18886. * @param {?*} traverseContext Context for traversal.
  18887. * @return {!number} The number of children in this subtree.
  18888. */
  18889. function traverseAllChildren(children, callback, traverseContext) {
  18890. if (children == null) {
  18891. return 0;
  18892. }
  18893. return traverseAllChildrenImpl(children, '', 0, callback, traverseContext);
  18894. }
  18895. module.exports = traverseAllChildren;
  18896. },{"141":141,"150":150,"171":171,"63":63,"69":69,"72":72}],170:[function(_dereq_,module,exports){
  18897. /**
  18898. * Copyright 2013-2015, Facebook, Inc.
  18899. * All rights reserved.
  18900. *
  18901. * This source code is licensed under the BSD-style license found in the
  18902. * LICENSE file in the root directory of this source tree. An additional grant
  18903. * of patent rights can be found in the PATENTS file in the same directory.
  18904. *
  18905. * @providesModule update
  18906. */
  18907. 'use strict';
  18908. var assign = _dereq_(29);
  18909. var keyOf = _dereq_(157);
  18910. var invariant = _dereq_(150);
  18911. function shallowCopy(x) {
  18912. if (Array.isArray(x)) {
  18913. return x.concat();
  18914. } else if (x && typeof x === 'object') {
  18915. return assign(new x.constructor(), x);
  18916. } else {
  18917. return x;
  18918. }
  18919. }
  18920. var COMMAND_PUSH = keyOf({$push: null});
  18921. var COMMAND_UNSHIFT = keyOf({$unshift: null});
  18922. var COMMAND_SPLICE = keyOf({$splice: null});
  18923. var COMMAND_SET = keyOf({$set: null});
  18924. var COMMAND_MERGE = keyOf({$merge: null});
  18925. var COMMAND_APPLY = keyOf({$apply: null});
  18926. var ALL_COMMANDS_LIST = [
  18927. COMMAND_PUSH,
  18928. COMMAND_UNSHIFT,
  18929. COMMAND_SPLICE,
  18930. COMMAND_SET,
  18931. COMMAND_MERGE,
  18932. COMMAND_APPLY
  18933. ];
  18934. var ALL_COMMANDS_SET = {};
  18935. ALL_COMMANDS_LIST.forEach(function(command) {
  18936. ALL_COMMANDS_SET[command] = true;
  18937. });
  18938. function invariantArrayCase(value, spec, command) {
  18939. ("production" !== "development" ? invariant(
  18940. Array.isArray(value),
  18941. 'update(): expected target of %s to be an array; got %s.',
  18942. command,
  18943. value
  18944. ) : invariant(Array.isArray(value)));
  18945. var specValue = spec[command];
  18946. ("production" !== "development" ? invariant(
  18947. Array.isArray(specValue),
  18948. 'update(): expected spec of %s to be an array; got %s. ' +
  18949. 'Did you forget to wrap your parameter in an array?',
  18950. command,
  18951. specValue
  18952. ) : invariant(Array.isArray(specValue)));
  18953. }
  18954. function update(value, spec) {
  18955. ("production" !== "development" ? invariant(
  18956. typeof spec === 'object',
  18957. 'update(): You provided a key path to update() that did not contain one ' +
  18958. 'of %s. Did you forget to include {%s: ...}?',
  18959. ALL_COMMANDS_LIST.join(', '),
  18960. COMMAND_SET
  18961. ) : invariant(typeof spec === 'object'));
  18962. if (spec.hasOwnProperty(COMMAND_SET)) {
  18963. ("production" !== "development" ? invariant(
  18964. Object.keys(spec).length === 1,
  18965. 'Cannot have more than one key in an object with %s',
  18966. COMMAND_SET
  18967. ) : invariant(Object.keys(spec).length === 1));
  18968. return spec[COMMAND_SET];
  18969. }
  18970. var nextValue = shallowCopy(value);
  18971. if (spec.hasOwnProperty(COMMAND_MERGE)) {
  18972. var mergeObj = spec[COMMAND_MERGE];
  18973. ("production" !== "development" ? invariant(
  18974. mergeObj && typeof mergeObj === 'object',
  18975. 'update(): %s expects a spec of type \'object\'; got %s',
  18976. COMMAND_MERGE,
  18977. mergeObj
  18978. ) : invariant(mergeObj && typeof mergeObj === 'object'));
  18979. ("production" !== "development" ? invariant(
  18980. nextValue && typeof nextValue === 'object',
  18981. 'update(): %s expects a target of type \'object\'; got %s',
  18982. COMMAND_MERGE,
  18983. nextValue
  18984. ) : invariant(nextValue && typeof nextValue === 'object'));
  18985. assign(nextValue, spec[COMMAND_MERGE]);
  18986. }
  18987. if (spec.hasOwnProperty(COMMAND_PUSH)) {
  18988. invariantArrayCase(value, spec, COMMAND_PUSH);
  18989. spec[COMMAND_PUSH].forEach(function(item) {
  18990. nextValue.push(item);
  18991. });
  18992. }
  18993. if (spec.hasOwnProperty(COMMAND_UNSHIFT)) {
  18994. invariantArrayCase(value, spec, COMMAND_UNSHIFT);
  18995. spec[COMMAND_UNSHIFT].forEach(function(item) {
  18996. nextValue.unshift(item);
  18997. });
  18998. }
  18999. if (spec.hasOwnProperty(COMMAND_SPLICE)) {
  19000. ("production" !== "development" ? invariant(
  19001. Array.isArray(value),
  19002. 'Expected %s target to be an array; got %s',
  19003. COMMAND_SPLICE,
  19004. value
  19005. ) : invariant(Array.isArray(value)));
  19006. ("production" !== "development" ? invariant(
  19007. Array.isArray(spec[COMMAND_SPLICE]),
  19008. 'update(): expected spec of %s to be an array of arrays; got %s. ' +
  19009. 'Did you forget to wrap your parameters in an array?',
  19010. COMMAND_SPLICE,
  19011. spec[COMMAND_SPLICE]
  19012. ) : invariant(Array.isArray(spec[COMMAND_SPLICE])));
  19013. spec[COMMAND_SPLICE].forEach(function(args) {
  19014. ("production" !== "development" ? invariant(
  19015. Array.isArray(args),
  19016. 'update(): expected spec of %s to be an array of arrays; got %s. ' +
  19017. 'Did you forget to wrap your parameters in an array?',
  19018. COMMAND_SPLICE,
  19019. spec[COMMAND_SPLICE]
  19020. ) : invariant(Array.isArray(args)));
  19021. nextValue.splice.apply(nextValue, args);
  19022. });
  19023. }
  19024. if (spec.hasOwnProperty(COMMAND_APPLY)) {
  19025. ("production" !== "development" ? invariant(
  19026. typeof spec[COMMAND_APPLY] === 'function',
  19027. 'update(): expected spec of %s to be a function; got %s.',
  19028. COMMAND_APPLY,
  19029. spec[COMMAND_APPLY]
  19030. ) : invariant(typeof spec[COMMAND_APPLY] === 'function'));
  19031. nextValue = spec[COMMAND_APPLY](nextValue);
  19032. }
  19033. for (var k in spec) {
  19034. if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {
  19035. nextValue[k] = update(value[k], spec[k]);
  19036. }
  19037. }
  19038. return nextValue;
  19039. }
  19040. module.exports = update;
  19041. },{"150":150,"157":157,"29":29}],171:[function(_dereq_,module,exports){
  19042. /**
  19043. * Copyright 2014-2015, Facebook, Inc.
  19044. * All rights reserved.
  19045. *
  19046. * This source code is licensed under the BSD-style license found in the
  19047. * LICENSE file in the root directory of this source tree. An additional grant
  19048. * of patent rights can be found in the PATENTS file in the same directory.
  19049. *
  19050. * @providesModule warning
  19051. */
  19052. "use strict";
  19053. var emptyFunction = _dereq_(129);
  19054. /**
  19055. * Similar to invariant but only logs a warning if the condition is not met.
  19056. * This can be used to log issues in development environments in critical
  19057. * paths. Removing the logging code for production environments will keep the
  19058. * same logic and follow the same code paths.
  19059. */
  19060. var warning = emptyFunction;
  19061. if ("production" !== "development") {
  19062. warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  19063. if (format === undefined) {
  19064. throw new Error(
  19065. '`warning(condition, format, ...args)` requires a warning ' +
  19066. 'message argument'
  19067. );
  19068. }
  19069. if (format.length < 10 || /^[s\W]*$/.test(format)) {
  19070. throw new Error(
  19071. 'The warning format should be able to uniquely identify this ' +
  19072. 'warning. Please, use a more descriptive format than: ' + format
  19073. );
  19074. }
  19075. if (format.indexOf('Failed Composite propType: ') === 0) {
  19076. return; // Ignore CompositeComponent proptype check.
  19077. }
  19078. if (!condition) {
  19079. var argIndex = 0;
  19080. var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];});
  19081. console.warn(message);
  19082. try {
  19083. // --- Welcome to debugging React ---
  19084. // This error was thrown as a convenience so that you can use this stack
  19085. // to find the callsite that caused this warning to fire.
  19086. throw new Error(message);
  19087. } catch(x) {}
  19088. }
  19089. };
  19090. }
  19091. module.exports = warning;
  19092. },{"129":129}]},{},[1])(1)
  19093. });