Nenhuma descrição
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

react.js 586KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602
  1. /**
  2. * React v0.13.3
  3. */
  4. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
  5. /**
  6. * Copyright 2013-2015, Facebook, Inc.
  7. * All rights reserved.
  8. *
  9. * This source code is licensed under the BSD-style license found in the
  10. * LICENSE file in the root directory of this source tree. An additional grant
  11. * of patent rights can be found in the PATENTS file in the same directory.
  12. *
  13. * @providesModule React
  14. */
  15. /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
  16. 'use strict';
  17. var EventPluginUtils = _dereq_(19);
  18. var ReactChildren = _dereq_(32);
  19. var ReactComponent = _dereq_(34);
  20. var ReactClass = _dereq_(33);
  21. var ReactContext = _dereq_(38);
  22. var ReactCurrentOwner = _dereq_(39);
  23. var ReactElement = _dereq_(57);
  24. var ReactElementValidator = _dereq_(58);
  25. var ReactDOM = _dereq_(40);
  26. var ReactDOMTextComponent = _dereq_(51);
  27. var ReactDefaultInjection = _dereq_(54);
  28. var ReactInstanceHandles = _dereq_(66);
  29. var ReactMount = _dereq_(70);
  30. var ReactPerf = _dereq_(75);
  31. var ReactPropTypes = _dereq_(78);
  32. var ReactReconciler = _dereq_(81);
  33. var ReactServerRendering = _dereq_(84);
  34. var assign = _dereq_(27);
  35. var findDOMNode = _dereq_(117);
  36. var onlyChild = _dereq_(144);
  37. ReactDefaultInjection.inject();
  38. var createElement = ReactElement.createElement;
  39. var createFactory = ReactElement.createFactory;
  40. var cloneElement = ReactElement.cloneElement;
  41. if ("production" !== "development") {
  42. createElement = ReactElementValidator.createElement;
  43. createFactory = ReactElementValidator.createFactory;
  44. cloneElement = ReactElementValidator.cloneElement;
  45. }
  46. var render = ReactPerf.measure('React', 'render', ReactMount.render);
  47. var React = {
  48. Children: {
  49. map: ReactChildren.map,
  50. forEach: ReactChildren.forEach,
  51. count: ReactChildren.count,
  52. only: onlyChild
  53. },
  54. Component: ReactComponent,
  55. DOM: ReactDOM,
  56. PropTypes: ReactPropTypes,
  57. initializeTouchEvents: function(shouldUseTouch) {
  58. EventPluginUtils.useTouchEvents = shouldUseTouch;
  59. },
  60. createClass: ReactClass.createClass,
  61. createElement: createElement,
  62. cloneElement: cloneElement,
  63. createFactory: createFactory,
  64. createMixin: function(mixin) {
  65. // Currently a noop. Will be used to validate and trace mixins.
  66. return mixin;
  67. },
  68. constructAndRenderComponent: ReactMount.constructAndRenderComponent,
  69. constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
  70. findDOMNode: findDOMNode,
  71. render: render,
  72. renderToString: ReactServerRendering.renderToString,
  73. renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
  74. unmountComponentAtNode: ReactMount.unmountComponentAtNode,
  75. isValidElement: ReactElement.isValidElement,
  76. withContext: ReactContext.withContext,
  77. // Hook for JSX spread, don't use this for anything else.
  78. __spread: assign
  79. };
  80. // Inject the runtime into a devtools global hook regardless of browser.
  81. // Allows for debugging when the hook is injected on the page.
  82. if (
  83. typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
  84. typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
  85. __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
  86. CurrentOwner: ReactCurrentOwner,
  87. InstanceHandles: ReactInstanceHandles,
  88. Mount: ReactMount,
  89. Reconciler: ReactReconciler,
  90. TextComponent: ReactDOMTextComponent
  91. });
  92. }
  93. if ("production" !== "development") {
  94. var ExecutionEnvironment = _dereq_(21);
  95. if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
  96. // If we're in Chrome, look for the devtools marker and provide a download
  97. // link if not installed.
  98. if (navigator.userAgent.indexOf('Chrome') > -1) {
  99. if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
  100. console.debug(
  101. 'Download the React DevTools for a better development experience: ' +
  102. 'https://fb.me/react-devtools'
  103. );
  104. }
  105. }
  106. var expectedFeatures = [
  107. // shims
  108. Array.isArray,
  109. Array.prototype.every,
  110. Array.prototype.forEach,
  111. Array.prototype.indexOf,
  112. Array.prototype.map,
  113. Date.now,
  114. Function.prototype.bind,
  115. Object.keys,
  116. String.prototype.split,
  117. String.prototype.trim,
  118. // shams
  119. Object.create,
  120. Object.freeze
  121. ];
  122. for (var i = 0; i < expectedFeatures.length; i++) {
  123. if (!expectedFeatures[i]) {
  124. console.error(
  125. 'One or more ES5 shim/shams expected by React are not available: ' +
  126. 'https://fb.me/react-warning-polyfills'
  127. );
  128. break;
  129. }
  130. }
  131. }
  132. }
  133. React.version = '0.13.3';
  134. module.exports = React;
  135. },{"117":117,"144":144,"19":19,"21":21,"27":27,"32":32,"33":33,"34":34,"38":38,"39":39,"40":40,"51":51,"54":54,"57":57,"58":58,"66":66,"70":70,"75":75,"78":78,"81":81,"84":84}],2:[function(_dereq_,module,exports){
  136. /**
  137. * Copyright 2013-2015, Facebook, Inc.
  138. * All rights reserved.
  139. *
  140. * This source code is licensed under the BSD-style license found in the
  141. * LICENSE file in the root directory of this source tree. An additional grant
  142. * of patent rights can be found in the PATENTS file in the same directory.
  143. *
  144. * @providesModule AutoFocusMixin
  145. * @typechecks static-only
  146. */
  147. 'use strict';
  148. var focusNode = _dereq_(119);
  149. var AutoFocusMixin = {
  150. componentDidMount: function() {
  151. if (this.props.autoFocus) {
  152. focusNode(this.getDOMNode());
  153. }
  154. }
  155. };
  156. module.exports = AutoFocusMixin;
  157. },{"119":119}],3:[function(_dereq_,module,exports){
  158. /**
  159. * Copyright 2013-2015 Facebook, Inc.
  160. * All rights reserved.
  161. *
  162. * This source code is licensed under the BSD-style license found in the
  163. * LICENSE file in the root directory of this source tree. An additional grant
  164. * of patent rights can be found in the PATENTS file in the same directory.
  165. *
  166. * @providesModule BeforeInputEventPlugin
  167. * @typechecks static-only
  168. */
  169. 'use strict';
  170. var EventConstants = _dereq_(15);
  171. var EventPropagators = _dereq_(20);
  172. var ExecutionEnvironment = _dereq_(21);
  173. var FallbackCompositionState = _dereq_(22);
  174. var SyntheticCompositionEvent = _dereq_(93);
  175. var SyntheticInputEvent = _dereq_(97);
  176. var keyOf = _dereq_(141);
  177. var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
  178. var START_KEYCODE = 229;
  179. var canUseCompositionEvent = (
  180. ExecutionEnvironment.canUseDOM &&
  181. 'CompositionEvent' in window
  182. );
  183. var documentMode = null;
  184. if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
  185. documentMode = document.documentMode;
  186. }
  187. // Webkit offers a very useful `textInput` event that can be used to
  188. // directly represent `beforeInput`. The IE `textinput` event is not as
  189. // useful, so we don't use it.
  190. var canUseTextInputEvent = (
  191. ExecutionEnvironment.canUseDOM &&
  192. 'TextEvent' in window &&
  193. !documentMode &&
  194. !isPresto()
  195. );
  196. // In IE9+, we have access to composition events, but the data supplied
  197. // by the native compositionend event may be incorrect. Japanese ideographic
  198. // spaces, for instance (\u3000) are not recorded correctly.
  199. var useFallbackCompositionData = (
  200. ExecutionEnvironment.canUseDOM &&
  201. (
  202. (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
  203. )
  204. );
  205. /**
  206. * Opera <= 12 includes TextEvent in window, but does not fire
  207. * text input events. Rely on keypress instead.
  208. */
  209. function isPresto() {
  210. var opera = window.opera;
  211. return (
  212. typeof opera === 'object' &&
  213. typeof opera.version === 'function' &&
  214. parseInt(opera.version(), 10) <= 12
  215. );
  216. }
  217. var SPACEBAR_CODE = 32;
  218. var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
  219. var topLevelTypes = EventConstants.topLevelTypes;
  220. // Events and their corresponding property names.
  221. var eventTypes = {
  222. beforeInput: {
  223. phasedRegistrationNames: {
  224. bubbled: keyOf({onBeforeInput: null}),
  225. captured: keyOf({onBeforeInputCapture: null})
  226. },
  227. dependencies: [
  228. topLevelTypes.topCompositionEnd,
  229. topLevelTypes.topKeyPress,
  230. topLevelTypes.topTextInput,
  231. topLevelTypes.topPaste
  232. ]
  233. },
  234. compositionEnd: {
  235. phasedRegistrationNames: {
  236. bubbled: keyOf({onCompositionEnd: null}),
  237. captured: keyOf({onCompositionEndCapture: null})
  238. },
  239. dependencies: [
  240. topLevelTypes.topBlur,
  241. topLevelTypes.topCompositionEnd,
  242. topLevelTypes.topKeyDown,
  243. topLevelTypes.topKeyPress,
  244. topLevelTypes.topKeyUp,
  245. topLevelTypes.topMouseDown
  246. ]
  247. },
  248. compositionStart: {
  249. phasedRegistrationNames: {
  250. bubbled: keyOf({onCompositionStart: null}),
  251. captured: keyOf({onCompositionStartCapture: null})
  252. },
  253. dependencies: [
  254. topLevelTypes.topBlur,
  255. topLevelTypes.topCompositionStart,
  256. topLevelTypes.topKeyDown,
  257. topLevelTypes.topKeyPress,
  258. topLevelTypes.topKeyUp,
  259. topLevelTypes.topMouseDown
  260. ]
  261. },
  262. compositionUpdate: {
  263. phasedRegistrationNames: {
  264. bubbled: keyOf({onCompositionUpdate: null}),
  265. captured: keyOf({onCompositionUpdateCapture: null})
  266. },
  267. dependencies: [
  268. topLevelTypes.topBlur,
  269. topLevelTypes.topCompositionUpdate,
  270. topLevelTypes.topKeyDown,
  271. topLevelTypes.topKeyPress,
  272. topLevelTypes.topKeyUp,
  273. topLevelTypes.topMouseDown
  274. ]
  275. }
  276. };
  277. // Track whether we've ever handled a keypress on the space key.
  278. var hasSpaceKeypress = false;
  279. /**
  280. * Return whether a native keypress event is assumed to be a command.
  281. * This is required because Firefox fires `keypress` events for key commands
  282. * (cut, copy, select-all, etc.) even though no character is inserted.
  283. */
  284. function isKeypressCommand(nativeEvent) {
  285. return (
  286. (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
  287. // ctrlKey && altKey is equivalent to AltGr, and is not a command.
  288. !(nativeEvent.ctrlKey && nativeEvent.altKey)
  289. );
  290. }
  291. /**
  292. * Translate native top level events into event types.
  293. *
  294. * @param {string} topLevelType
  295. * @return {object}
  296. */
  297. function getCompositionEventType(topLevelType) {
  298. switch (topLevelType) {
  299. case topLevelTypes.topCompositionStart:
  300. return eventTypes.compositionStart;
  301. case topLevelTypes.topCompositionEnd:
  302. return eventTypes.compositionEnd;
  303. case topLevelTypes.topCompositionUpdate:
  304. return eventTypes.compositionUpdate;
  305. }
  306. }
  307. /**
  308. * Does our fallback best-guess model think this event signifies that
  309. * composition has begun?
  310. *
  311. * @param {string} topLevelType
  312. * @param {object} nativeEvent
  313. * @return {boolean}
  314. */
  315. function isFallbackCompositionStart(topLevelType, nativeEvent) {
  316. return (
  317. topLevelType === topLevelTypes.topKeyDown &&
  318. nativeEvent.keyCode === START_KEYCODE
  319. );
  320. }
  321. /**
  322. * Does our fallback mode think that this event is the end of composition?
  323. *
  324. * @param {string} topLevelType
  325. * @param {object} nativeEvent
  326. * @return {boolean}
  327. */
  328. function isFallbackCompositionEnd(topLevelType, nativeEvent) {
  329. switch (topLevelType) {
  330. case topLevelTypes.topKeyUp:
  331. // Command keys insert or clear IME input.
  332. return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
  333. case topLevelTypes.topKeyDown:
  334. // Expect IME keyCode on each keydown. If we get any other
  335. // code we must have exited earlier.
  336. return (nativeEvent.keyCode !== START_KEYCODE);
  337. case topLevelTypes.topKeyPress:
  338. case topLevelTypes.topMouseDown:
  339. case topLevelTypes.topBlur:
  340. // Events are not possible without cancelling IME.
  341. return true;
  342. default:
  343. return false;
  344. }
  345. }
  346. /**
  347. * Google Input Tools provides composition data via a CustomEvent,
  348. * with the `data` property populated in the `detail` object. If this
  349. * is available on the event object, use it. If not, this is a plain
  350. * composition event and we have nothing special to extract.
  351. *
  352. * @param {object} nativeEvent
  353. * @return {?string}
  354. */
  355. function getDataFromCustomEvent(nativeEvent) {
  356. var detail = nativeEvent.detail;
  357. if (typeof detail === 'object' && 'data' in detail) {
  358. return detail.data;
  359. }
  360. return null;
  361. }
  362. // Track the current IME composition fallback object, if any.
  363. var currentComposition = null;
  364. /**
  365. * @param {string} topLevelType Record from `EventConstants`.
  366. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  367. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  368. * @param {object} nativeEvent Native browser event.
  369. * @return {?object} A SyntheticCompositionEvent.
  370. */
  371. function extractCompositionEvent(
  372. topLevelType,
  373. topLevelTarget,
  374. topLevelTargetID,
  375. nativeEvent
  376. ) {
  377. var eventType;
  378. var fallbackData;
  379. if (canUseCompositionEvent) {
  380. eventType = getCompositionEventType(topLevelType);
  381. } else if (!currentComposition) {
  382. if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
  383. eventType = eventTypes.compositionStart;
  384. }
  385. } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
  386. eventType = eventTypes.compositionEnd;
  387. }
  388. if (!eventType) {
  389. return null;
  390. }
  391. if (useFallbackCompositionData) {
  392. // The current composition is stored statically and must not be
  393. // overwritten while composition continues.
  394. if (!currentComposition && eventType === eventTypes.compositionStart) {
  395. currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
  396. } else if (eventType === eventTypes.compositionEnd) {
  397. if (currentComposition) {
  398. fallbackData = currentComposition.getData();
  399. }
  400. }
  401. }
  402. var event = SyntheticCompositionEvent.getPooled(
  403. eventType,
  404. topLevelTargetID,
  405. nativeEvent
  406. );
  407. if (fallbackData) {
  408. // Inject data generated from fallback path into the synthetic event.
  409. // This matches the property of native CompositionEventInterface.
  410. event.data = fallbackData;
  411. } else {
  412. var customData = getDataFromCustomEvent(nativeEvent);
  413. if (customData !== null) {
  414. event.data = customData;
  415. }
  416. }
  417. EventPropagators.accumulateTwoPhaseDispatches(event);
  418. return event;
  419. }
  420. /**
  421. * @param {string} topLevelType Record from `EventConstants`.
  422. * @param {object} nativeEvent Native browser event.
  423. * @return {?string} The string corresponding to this `beforeInput` event.
  424. */
  425. function getNativeBeforeInputChars(topLevelType, nativeEvent) {
  426. switch (topLevelType) {
  427. case topLevelTypes.topCompositionEnd:
  428. return getDataFromCustomEvent(nativeEvent);
  429. case topLevelTypes.topKeyPress:
  430. /**
  431. * If native `textInput` events are available, our goal is to make
  432. * use of them. However, there is a special case: the spacebar key.
  433. * In Webkit, preventing default on a spacebar `textInput` event
  434. * cancels character insertion, but it *also* causes the browser
  435. * to fall back to its default spacebar behavior of scrolling the
  436. * page.
  437. *
  438. * Tracking at:
  439. * https://code.google.com/p/chromium/issues/detail?id=355103
  440. *
  441. * To avoid this issue, use the keypress event as if no `textInput`
  442. * event is available.
  443. */
  444. var which = nativeEvent.which;
  445. if (which !== SPACEBAR_CODE) {
  446. return null;
  447. }
  448. hasSpaceKeypress = true;
  449. return SPACEBAR_CHAR;
  450. case topLevelTypes.topTextInput:
  451. // Record the characters to be added to the DOM.
  452. var chars = nativeEvent.data;
  453. // If it's a spacebar character, assume that we have already handled
  454. // it at the keypress level and bail immediately. Android Chrome
  455. // doesn't give us keycodes, so we need to blacklist it.
  456. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
  457. return null;
  458. }
  459. return chars;
  460. default:
  461. // For other native event types, do nothing.
  462. return null;
  463. }
  464. }
  465. /**
  466. * For browsers that do not provide the `textInput` event, extract the
  467. * appropriate string to use for SyntheticInputEvent.
  468. *
  469. * @param {string} topLevelType Record from `EventConstants`.
  470. * @param {object} nativeEvent Native browser event.
  471. * @return {?string} The fallback string for this `beforeInput` event.
  472. */
  473. function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
  474. // If we are currently composing (IME) and using a fallback to do so,
  475. // try to extract the composed characters from the fallback object.
  476. if (currentComposition) {
  477. if (
  478. topLevelType === topLevelTypes.topCompositionEnd ||
  479. isFallbackCompositionEnd(topLevelType, nativeEvent)
  480. ) {
  481. var chars = currentComposition.getData();
  482. FallbackCompositionState.release(currentComposition);
  483. currentComposition = null;
  484. return chars;
  485. }
  486. return null;
  487. }
  488. switch (topLevelType) {
  489. case topLevelTypes.topPaste:
  490. // If a paste event occurs after a keypress, throw out the input
  491. // chars. Paste events should not lead to BeforeInput events.
  492. return null;
  493. case topLevelTypes.topKeyPress:
  494. /**
  495. * As of v27, Firefox may fire keypress events even when no character
  496. * will be inserted. A few possibilities:
  497. *
  498. * - `which` is `0`. Arrow keys, Esc key, etc.
  499. *
  500. * - `which` is the pressed key code, but no char is available.
  501. * Ex: 'AltGr + d` in Polish. There is no modified character for
  502. * this key combination and no character is inserted into the
  503. * document, but FF fires the keypress for char code `100` anyway.
  504. * No `input` event will occur.
  505. *
  506. * - `which` is the pressed key code, but a command combination is
  507. * being used. Ex: `Cmd+C`. No character is inserted, and no
  508. * `input` event will occur.
  509. */
  510. if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
  511. return String.fromCharCode(nativeEvent.which);
  512. }
  513. return null;
  514. case topLevelTypes.topCompositionEnd:
  515. return useFallbackCompositionData ? null : nativeEvent.data;
  516. default:
  517. return null;
  518. }
  519. }
  520. /**
  521. * Extract a SyntheticInputEvent for `beforeInput`, based on either native
  522. * `textInput` or fallback behavior.
  523. *
  524. * @param {string} topLevelType Record from `EventConstants`.
  525. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  526. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  527. * @param {object} nativeEvent Native browser event.
  528. * @return {?object} A SyntheticInputEvent.
  529. */
  530. function extractBeforeInputEvent(
  531. topLevelType,
  532. topLevelTarget,
  533. topLevelTargetID,
  534. nativeEvent
  535. ) {
  536. var chars;
  537. if (canUseTextInputEvent) {
  538. chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
  539. } else {
  540. chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
  541. }
  542. // If no characters are being inserted, no BeforeInput event should
  543. // be fired.
  544. if (!chars) {
  545. return null;
  546. }
  547. var event = SyntheticInputEvent.getPooled(
  548. eventTypes.beforeInput,
  549. topLevelTargetID,
  550. nativeEvent
  551. );
  552. event.data = chars;
  553. EventPropagators.accumulateTwoPhaseDispatches(event);
  554. return event;
  555. }
  556. /**
  557. * Create an `onBeforeInput` event to match
  558. * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
  559. *
  560. * This event plugin is based on the native `textInput` event
  561. * available in Chrome, Safari, Opera, and IE. This event fires after
  562. * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
  563. *
  564. * `beforeInput` is spec'd but not implemented in any browsers, and
  565. * the `input` event does not provide any useful information about what has
  566. * actually been added, contrary to the spec. Thus, `textInput` is the best
  567. * available event to identify the characters that have actually been inserted
  568. * into the target node.
  569. *
  570. * This plugin is also responsible for emitting `composition` events, thus
  571. * allowing us to share composition fallback code for both `beforeInput` and
  572. * `composition` event types.
  573. */
  574. var BeforeInputEventPlugin = {
  575. eventTypes: eventTypes,
  576. /**
  577. * @param {string} topLevelType Record from `EventConstants`.
  578. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  579. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  580. * @param {object} nativeEvent Native browser event.
  581. * @return {*} An accumulation of synthetic events.
  582. * @see {EventPluginHub.extractEvents}
  583. */
  584. extractEvents: function(
  585. topLevelType,
  586. topLevelTarget,
  587. topLevelTargetID,
  588. nativeEvent
  589. ) {
  590. return [
  591. extractCompositionEvent(
  592. topLevelType,
  593. topLevelTarget,
  594. topLevelTargetID,
  595. nativeEvent
  596. ),
  597. extractBeforeInputEvent(
  598. topLevelType,
  599. topLevelTarget,
  600. topLevelTargetID,
  601. nativeEvent
  602. )
  603. ];
  604. }
  605. };
  606. module.exports = BeforeInputEventPlugin;
  607. },{"141":141,"15":15,"20":20,"21":21,"22":22,"93":93,"97":97}],4:[function(_dereq_,module,exports){
  608. /**
  609. * Copyright 2013-2015, Facebook, Inc.
  610. * All rights reserved.
  611. *
  612. * This source code is licensed under the BSD-style license found in the
  613. * LICENSE file in the root directory of this source tree. An additional grant
  614. * of patent rights can be found in the PATENTS file in the same directory.
  615. *
  616. * @providesModule CSSProperty
  617. */
  618. 'use strict';
  619. /**
  620. * CSS properties which accept numbers but are not in units of "px".
  621. */
  622. var isUnitlessNumber = {
  623. boxFlex: true,
  624. boxFlexGroup: true,
  625. columnCount: true,
  626. flex: true,
  627. flexGrow: true,
  628. flexPositive: true,
  629. flexShrink: true,
  630. flexNegative: true,
  631. fontWeight: true,
  632. lineClamp: true,
  633. lineHeight: true,
  634. opacity: true,
  635. order: true,
  636. orphans: true,
  637. widows: true,
  638. zIndex: true,
  639. zoom: true,
  640. // SVG-related properties
  641. fillOpacity: true,
  642. strokeDashoffset: true,
  643. strokeOpacity: true,
  644. strokeWidth: true
  645. };
  646. /**
  647. * @param {string} prefix vendor-specific prefix, eg: Webkit
  648. * @param {string} key style name, eg: transitionDuration
  649. * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
  650. * WebkitTransitionDuration
  651. */
  652. function prefixKey(prefix, key) {
  653. return prefix + key.charAt(0).toUpperCase() + key.substring(1);
  654. }
  655. /**
  656. * Support style names that may come passed in prefixed by adding permutations
  657. * of vendor prefixes.
  658. */
  659. var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
  660. // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
  661. // infinite loop, because it iterates over the newly added props too.
  662. Object.keys(isUnitlessNumber).forEach(function(prop) {
  663. prefixes.forEach(function(prefix) {
  664. isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
  665. });
  666. });
  667. /**
  668. * Most style properties can be unset by doing .style[prop] = '' but IE8
  669. * doesn't like doing that with shorthand properties so for the properties that
  670. * IE8 breaks on, which are listed here, we instead unset each of the
  671. * individual properties. See http://bugs.jquery.com/ticket/12385.
  672. * The 4-value 'clock' properties like margin, padding, border-width seem to
  673. * behave without any problems. Curiously, list-style works too without any
  674. * special prodding.
  675. */
  676. var shorthandPropertyExpansions = {
  677. background: {
  678. backgroundImage: true,
  679. backgroundPosition: true,
  680. backgroundRepeat: true,
  681. backgroundColor: true
  682. },
  683. border: {
  684. borderWidth: true,
  685. borderStyle: true,
  686. borderColor: true
  687. },
  688. borderBottom: {
  689. borderBottomWidth: true,
  690. borderBottomStyle: true,
  691. borderBottomColor: true
  692. },
  693. borderLeft: {
  694. borderLeftWidth: true,
  695. borderLeftStyle: true,
  696. borderLeftColor: true
  697. },
  698. borderRight: {
  699. borderRightWidth: true,
  700. borderRightStyle: true,
  701. borderRightColor: true
  702. },
  703. borderTop: {
  704. borderTopWidth: true,
  705. borderTopStyle: true,
  706. borderTopColor: true
  707. },
  708. font: {
  709. fontStyle: true,
  710. fontVariant: true,
  711. fontWeight: true,
  712. fontSize: true,
  713. lineHeight: true,
  714. fontFamily: true
  715. }
  716. };
  717. var CSSProperty = {
  718. isUnitlessNumber: isUnitlessNumber,
  719. shorthandPropertyExpansions: shorthandPropertyExpansions
  720. };
  721. module.exports = CSSProperty;
  722. },{}],5:[function(_dereq_,module,exports){
  723. /**
  724. * Copyright 2013-2015, Facebook, Inc.
  725. * All rights reserved.
  726. *
  727. * This source code is licensed under the BSD-style license found in the
  728. * LICENSE file in the root directory of this source tree. An additional grant
  729. * of patent rights can be found in the PATENTS file in the same directory.
  730. *
  731. * @providesModule CSSPropertyOperations
  732. * @typechecks static-only
  733. */
  734. 'use strict';
  735. var CSSProperty = _dereq_(4);
  736. var ExecutionEnvironment = _dereq_(21);
  737. var camelizeStyleName = _dereq_(108);
  738. var dangerousStyleValue = _dereq_(113);
  739. var hyphenateStyleName = _dereq_(133);
  740. var memoizeStringOnly = _dereq_(143);
  741. var warning = _dereq_(154);
  742. var processStyleName = memoizeStringOnly(function(styleName) {
  743. return hyphenateStyleName(styleName);
  744. });
  745. var styleFloatAccessor = 'cssFloat';
  746. if (ExecutionEnvironment.canUseDOM) {
  747. // IE8 only supports accessing cssFloat (standard) as styleFloat
  748. if (document.documentElement.style.cssFloat === undefined) {
  749. styleFloatAccessor = 'styleFloat';
  750. }
  751. }
  752. if ("production" !== "development") {
  753. // 'msTransform' is correct, but the other prefixes should be capitalized
  754. var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
  755. // style values shouldn't contain a semicolon
  756. var badStyleValueWithSemicolonPattern = /;\s*$/;
  757. var warnedStyleNames = {};
  758. var warnedStyleValues = {};
  759. var warnHyphenatedStyleName = function(name) {
  760. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  761. return;
  762. }
  763. warnedStyleNames[name] = true;
  764. ("production" !== "development" ? warning(
  765. false,
  766. 'Unsupported style property %s. Did you mean %s?',
  767. name,
  768. camelizeStyleName(name)
  769. ) : null);
  770. };
  771. var warnBadVendoredStyleName = function(name) {
  772. if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
  773. return;
  774. }
  775. warnedStyleNames[name] = true;
  776. ("production" !== "development" ? warning(
  777. false,
  778. 'Unsupported vendor-prefixed style property %s. Did you mean %s?',
  779. name,
  780. name.charAt(0).toUpperCase() + name.slice(1)
  781. ) : null);
  782. };
  783. var warnStyleValueWithSemicolon = function(name, value) {
  784. if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
  785. return;
  786. }
  787. warnedStyleValues[value] = true;
  788. ("production" !== "development" ? warning(
  789. false,
  790. 'Style property values shouldn\'t contain a semicolon. ' +
  791. 'Try "%s: %s" instead.',
  792. name,
  793. value.replace(badStyleValueWithSemicolonPattern, '')
  794. ) : null);
  795. };
  796. /**
  797. * @param {string} name
  798. * @param {*} value
  799. */
  800. var warnValidStyle = function(name, value) {
  801. if (name.indexOf('-') > -1) {
  802. warnHyphenatedStyleName(name);
  803. } else if (badVendoredStyleNamePattern.test(name)) {
  804. warnBadVendoredStyleName(name);
  805. } else if (badStyleValueWithSemicolonPattern.test(value)) {
  806. warnStyleValueWithSemicolon(name, value);
  807. }
  808. };
  809. }
  810. /**
  811. * Operations for dealing with CSS properties.
  812. */
  813. var CSSPropertyOperations = {
  814. /**
  815. * Serializes a mapping of style properties for use as inline styles:
  816. *
  817. * > createMarkupForStyles({width: '200px', height: 0})
  818. * "width:200px;height:0;"
  819. *
  820. * Undefined values are ignored so that declarative programming is easier.
  821. * The result should be HTML-escaped before insertion into the DOM.
  822. *
  823. * @param {object} styles
  824. * @return {?string}
  825. */
  826. createMarkupForStyles: function(styles) {
  827. var serialized = '';
  828. for (var styleName in styles) {
  829. if (!styles.hasOwnProperty(styleName)) {
  830. continue;
  831. }
  832. var styleValue = styles[styleName];
  833. if ("production" !== "development") {
  834. warnValidStyle(styleName, styleValue);
  835. }
  836. if (styleValue != null) {
  837. serialized += processStyleName(styleName) + ':';
  838. serialized += dangerousStyleValue(styleName, styleValue) + ';';
  839. }
  840. }
  841. return serialized || null;
  842. },
  843. /**
  844. * Sets the value for multiple styles on a node. If a value is specified as
  845. * '' (empty string), the corresponding style property will be unset.
  846. *
  847. * @param {DOMElement} node
  848. * @param {object} styles
  849. */
  850. setValueForStyles: function(node, styles) {
  851. var style = node.style;
  852. for (var styleName in styles) {
  853. if (!styles.hasOwnProperty(styleName)) {
  854. continue;
  855. }
  856. if ("production" !== "development") {
  857. warnValidStyle(styleName, styles[styleName]);
  858. }
  859. var styleValue = dangerousStyleValue(styleName, styles[styleName]);
  860. if (styleName === 'float') {
  861. styleName = styleFloatAccessor;
  862. }
  863. if (styleValue) {
  864. style[styleName] = styleValue;
  865. } else {
  866. var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
  867. if (expansion) {
  868. // Shorthand property that IE8 won't like unsetting, so unset each
  869. // component to placate it
  870. for (var individualStyleName in expansion) {
  871. style[individualStyleName] = '';
  872. }
  873. } else {
  874. style[styleName] = '';
  875. }
  876. }
  877. }
  878. }
  879. };
  880. module.exports = CSSPropertyOperations;
  881. },{"108":108,"113":113,"133":133,"143":143,"154":154,"21":21,"4":4}],6:[function(_dereq_,module,exports){
  882. /**
  883. * Copyright 2013-2015, Facebook, Inc.
  884. * All rights reserved.
  885. *
  886. * This source code is licensed under the BSD-style license found in the
  887. * LICENSE file in the root directory of this source tree. An additional grant
  888. * of patent rights can be found in the PATENTS file in the same directory.
  889. *
  890. * @providesModule CallbackQueue
  891. */
  892. 'use strict';
  893. var PooledClass = _dereq_(28);
  894. var assign = _dereq_(27);
  895. var invariant = _dereq_(135);
  896. /**
  897. * A specialized pseudo-event module to help keep track of components waiting to
  898. * be notified when their DOM representations are available for use.
  899. *
  900. * This implements `PooledClass`, so you should never need to instantiate this.
  901. * Instead, use `CallbackQueue.getPooled()`.
  902. *
  903. * @class ReactMountReady
  904. * @implements PooledClass
  905. * @internal
  906. */
  907. function CallbackQueue() {
  908. this._callbacks = null;
  909. this._contexts = null;
  910. }
  911. assign(CallbackQueue.prototype, {
  912. /**
  913. * Enqueues a callback to be invoked when `notifyAll` is invoked.
  914. *
  915. * @param {function} callback Invoked when `notifyAll` is invoked.
  916. * @param {?object} context Context to call `callback` with.
  917. * @internal
  918. */
  919. enqueue: function(callback, context) {
  920. this._callbacks = this._callbacks || [];
  921. this._contexts = this._contexts || [];
  922. this._callbacks.push(callback);
  923. this._contexts.push(context);
  924. },
  925. /**
  926. * Invokes all enqueued callbacks and clears the queue. This is invoked after
  927. * the DOM representation of a component has been created or updated.
  928. *
  929. * @internal
  930. */
  931. notifyAll: function() {
  932. var callbacks = this._callbacks;
  933. var contexts = this._contexts;
  934. if (callbacks) {
  935. ("production" !== "development" ? invariant(
  936. callbacks.length === contexts.length,
  937. 'Mismatched list of contexts in callback queue'
  938. ) : invariant(callbacks.length === contexts.length));
  939. this._callbacks = null;
  940. this._contexts = null;
  941. for (var i = 0, l = callbacks.length; i < l; i++) {
  942. callbacks[i].call(contexts[i]);
  943. }
  944. callbacks.length = 0;
  945. contexts.length = 0;
  946. }
  947. },
  948. /**
  949. * Resets the internal queue.
  950. *
  951. * @internal
  952. */
  953. reset: function() {
  954. this._callbacks = null;
  955. this._contexts = null;
  956. },
  957. /**
  958. * `PooledClass` looks for this.
  959. */
  960. destructor: function() {
  961. this.reset();
  962. }
  963. });
  964. PooledClass.addPoolingTo(CallbackQueue);
  965. module.exports = CallbackQueue;
  966. },{"135":135,"27":27,"28":28}],7:[function(_dereq_,module,exports){
  967. /**
  968. * Copyright 2013-2015, Facebook, Inc.
  969. * All rights reserved.
  970. *
  971. * This source code is licensed under the BSD-style license found in the
  972. * LICENSE file in the root directory of this source tree. An additional grant
  973. * of patent rights can be found in the PATENTS file in the same directory.
  974. *
  975. * @providesModule ChangeEventPlugin
  976. */
  977. 'use strict';
  978. var EventConstants = _dereq_(15);
  979. var EventPluginHub = _dereq_(17);
  980. var EventPropagators = _dereq_(20);
  981. var ExecutionEnvironment = _dereq_(21);
  982. var ReactUpdates = _dereq_(87);
  983. var SyntheticEvent = _dereq_(95);
  984. var isEventSupported = _dereq_(136);
  985. var isTextInputElement = _dereq_(138);
  986. var keyOf = _dereq_(141);
  987. var topLevelTypes = EventConstants.topLevelTypes;
  988. var eventTypes = {
  989. change: {
  990. phasedRegistrationNames: {
  991. bubbled: keyOf({onChange: null}),
  992. captured: keyOf({onChangeCapture: null})
  993. },
  994. dependencies: [
  995. topLevelTypes.topBlur,
  996. topLevelTypes.topChange,
  997. topLevelTypes.topClick,
  998. topLevelTypes.topFocus,
  999. topLevelTypes.topInput,
  1000. topLevelTypes.topKeyDown,
  1001. topLevelTypes.topKeyUp,
  1002. topLevelTypes.topSelectionChange
  1003. ]
  1004. }
  1005. };
  1006. /**
  1007. * For IE shims
  1008. */
  1009. var activeElement = null;
  1010. var activeElementID = null;
  1011. var activeElementValue = null;
  1012. var activeElementValueProp = null;
  1013. /**
  1014. * SECTION: handle `change` event
  1015. */
  1016. function shouldUseChangeEvent(elem) {
  1017. return (
  1018. elem.nodeName === 'SELECT' ||
  1019. (elem.nodeName === 'INPUT' && elem.type === 'file')
  1020. );
  1021. }
  1022. var doesChangeEventBubble = false;
  1023. if (ExecutionEnvironment.canUseDOM) {
  1024. // See `handleChange` comment below
  1025. doesChangeEventBubble = isEventSupported('change') && (
  1026. (!('documentMode' in document) || document.documentMode > 8)
  1027. );
  1028. }
  1029. function manualDispatchChangeEvent(nativeEvent) {
  1030. var event = SyntheticEvent.getPooled(
  1031. eventTypes.change,
  1032. activeElementID,
  1033. nativeEvent
  1034. );
  1035. EventPropagators.accumulateTwoPhaseDispatches(event);
  1036. // If change and propertychange bubbled, we'd just bind to it like all the
  1037. // other events and have it go through ReactBrowserEventEmitter. Since it
  1038. // doesn't, we manually listen for the events and so we have to enqueue and
  1039. // process the abstract event manually.
  1040. //
  1041. // Batching is necessary here in order to ensure that all event handlers run
  1042. // before the next rerender (including event handlers attached to ancestor
  1043. // elements instead of directly on the input). Without this, controlled
  1044. // components don't work properly in conjunction with event bubbling because
  1045. // the component is rerendered and the value reverted before all the event
  1046. // handlers can run. See https://github.com/facebook/react/issues/708.
  1047. ReactUpdates.batchedUpdates(runEventInBatch, event);
  1048. }
  1049. function runEventInBatch(event) {
  1050. EventPluginHub.enqueueEvents(event);
  1051. EventPluginHub.processEventQueue();
  1052. }
  1053. function startWatchingForChangeEventIE8(target, targetID) {
  1054. activeElement = target;
  1055. activeElementID = targetID;
  1056. activeElement.attachEvent('onchange', manualDispatchChangeEvent);
  1057. }
  1058. function stopWatchingForChangeEventIE8() {
  1059. if (!activeElement) {
  1060. return;
  1061. }
  1062. activeElement.detachEvent('onchange', manualDispatchChangeEvent);
  1063. activeElement = null;
  1064. activeElementID = null;
  1065. }
  1066. function getTargetIDForChangeEvent(
  1067. topLevelType,
  1068. topLevelTarget,
  1069. topLevelTargetID) {
  1070. if (topLevelType === topLevelTypes.topChange) {
  1071. return topLevelTargetID;
  1072. }
  1073. }
  1074. function handleEventsForChangeEventIE8(
  1075. topLevelType,
  1076. topLevelTarget,
  1077. topLevelTargetID) {
  1078. if (topLevelType === topLevelTypes.topFocus) {
  1079. // stopWatching() should be a noop here but we call it just in case we
  1080. // missed a blur event somehow.
  1081. stopWatchingForChangeEventIE8();
  1082. startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
  1083. } else if (topLevelType === topLevelTypes.topBlur) {
  1084. stopWatchingForChangeEventIE8();
  1085. }
  1086. }
  1087. /**
  1088. * SECTION: handle `input` event
  1089. */
  1090. var isInputEventSupported = false;
  1091. if (ExecutionEnvironment.canUseDOM) {
  1092. // IE9 claims to support the input event but fails to trigger it when
  1093. // deleting text, so we ignore its input events
  1094. isInputEventSupported = isEventSupported('input') && (
  1095. (!('documentMode' in document) || document.documentMode > 9)
  1096. );
  1097. }
  1098. /**
  1099. * (For old IE.) Replacement getter/setter for the `value` property that gets
  1100. * set on the active element.
  1101. */
  1102. var newValueProp = {
  1103. get: function() {
  1104. return activeElementValueProp.get.call(this);
  1105. },
  1106. set: function(val) {
  1107. // Cast to a string so we can do equality checks.
  1108. activeElementValue = '' + val;
  1109. activeElementValueProp.set.call(this, val);
  1110. }
  1111. };
  1112. /**
  1113. * (For old IE.) Starts tracking propertychange events on the passed-in element
  1114. * and override the value property so that we can distinguish user events from
  1115. * value changes in JS.
  1116. */
  1117. function startWatchingForValueChange(target, targetID) {
  1118. activeElement = target;
  1119. activeElementID = targetID;
  1120. activeElementValue = target.value;
  1121. activeElementValueProp = Object.getOwnPropertyDescriptor(
  1122. target.constructor.prototype,
  1123. 'value'
  1124. );
  1125. Object.defineProperty(activeElement, 'value', newValueProp);
  1126. activeElement.attachEvent('onpropertychange', handlePropertyChange);
  1127. }
  1128. /**
  1129. * (For old IE.) Removes the event listeners from the currently-tracked element,
  1130. * if any exists.
  1131. */
  1132. function stopWatchingForValueChange() {
  1133. if (!activeElement) {
  1134. return;
  1135. }
  1136. // delete restores the original property definition
  1137. delete activeElement.value;
  1138. activeElement.detachEvent('onpropertychange', handlePropertyChange);
  1139. activeElement = null;
  1140. activeElementID = null;
  1141. activeElementValue = null;
  1142. activeElementValueProp = null;
  1143. }
  1144. /**
  1145. * (For old IE.) Handles a propertychange event, sending a `change` event if
  1146. * the value of the active element has changed.
  1147. */
  1148. function handlePropertyChange(nativeEvent) {
  1149. if (nativeEvent.propertyName !== 'value') {
  1150. return;
  1151. }
  1152. var value = nativeEvent.srcElement.value;
  1153. if (value === activeElementValue) {
  1154. return;
  1155. }
  1156. activeElementValue = value;
  1157. manualDispatchChangeEvent(nativeEvent);
  1158. }
  1159. /**
  1160. * If a `change` event should be fired, returns the target's ID.
  1161. */
  1162. function getTargetIDForInputEvent(
  1163. topLevelType,
  1164. topLevelTarget,
  1165. topLevelTargetID) {
  1166. if (topLevelType === topLevelTypes.topInput) {
  1167. // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
  1168. // what we want so fall through here and trigger an abstract event
  1169. return topLevelTargetID;
  1170. }
  1171. }
  1172. // For IE8 and IE9.
  1173. function handleEventsForInputEventIE(
  1174. topLevelType,
  1175. topLevelTarget,
  1176. topLevelTargetID) {
  1177. if (topLevelType === topLevelTypes.topFocus) {
  1178. // In IE8, we can capture almost all .value changes by adding a
  1179. // propertychange handler and looking for events with propertyName
  1180. // equal to 'value'
  1181. // In IE9, propertychange fires for most input events but is buggy and
  1182. // doesn't fire when text is deleted, but conveniently, selectionchange
  1183. // appears to fire in all of the remaining cases so we catch those and
  1184. // forward the event if the value has changed
  1185. // In either case, we don't want to call the event handler if the value
  1186. // is changed from JS so we redefine a setter for `.value` that updates
  1187. // our activeElementValue variable, allowing us to ignore those changes
  1188. //
  1189. // stopWatching() should be a noop here but we call it just in case we
  1190. // missed a blur event somehow.
  1191. stopWatchingForValueChange();
  1192. startWatchingForValueChange(topLevelTarget, topLevelTargetID);
  1193. } else if (topLevelType === topLevelTypes.topBlur) {
  1194. stopWatchingForValueChange();
  1195. }
  1196. }
  1197. // For IE8 and IE9.
  1198. function getTargetIDForInputEventIE(
  1199. topLevelType,
  1200. topLevelTarget,
  1201. topLevelTargetID) {
  1202. if (topLevelType === topLevelTypes.topSelectionChange ||
  1203. topLevelType === topLevelTypes.topKeyUp ||
  1204. topLevelType === topLevelTypes.topKeyDown) {
  1205. // On the selectionchange event, the target is just document which isn't
  1206. // helpful for us so just check activeElement instead.
  1207. //
  1208. // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
  1209. // propertychange on the first input event after setting `value` from a
  1210. // script and fires only keydown, keypress, keyup. Catching keyup usually
  1211. // gets it and catching keydown lets us fire an event for the first
  1212. // keystroke if user does a key repeat (it'll be a little delayed: right
  1213. // before the second keystroke). Other input methods (e.g., paste) seem to
  1214. // fire selectionchange normally.
  1215. if (activeElement && activeElement.value !== activeElementValue) {
  1216. activeElementValue = activeElement.value;
  1217. return activeElementID;
  1218. }
  1219. }
  1220. }
  1221. /**
  1222. * SECTION: handle `click` event
  1223. */
  1224. function shouldUseClickEvent(elem) {
  1225. // Use the `click` event to detect changes to checkbox and radio inputs.
  1226. // This approach works across all browsers, whereas `change` does not fire
  1227. // until `blur` in IE8.
  1228. return (
  1229. elem.nodeName === 'INPUT' &&
  1230. (elem.type === 'checkbox' || elem.type === 'radio')
  1231. );
  1232. }
  1233. function getTargetIDForClickEvent(
  1234. topLevelType,
  1235. topLevelTarget,
  1236. topLevelTargetID) {
  1237. if (topLevelType === topLevelTypes.topClick) {
  1238. return topLevelTargetID;
  1239. }
  1240. }
  1241. /**
  1242. * This plugin creates an `onChange` event that normalizes change events
  1243. * across form elements. This event fires at a time when it's possible to
  1244. * change the element's value without seeing a flicker.
  1245. *
  1246. * Supported elements are:
  1247. * - input (see `isTextInputElement`)
  1248. * - textarea
  1249. * - select
  1250. */
  1251. var ChangeEventPlugin = {
  1252. eventTypes: eventTypes,
  1253. /**
  1254. * @param {string} topLevelType Record from `EventConstants`.
  1255. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  1256. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  1257. * @param {object} nativeEvent Native browser event.
  1258. * @return {*} An accumulation of synthetic events.
  1259. * @see {EventPluginHub.extractEvents}
  1260. */
  1261. extractEvents: function(
  1262. topLevelType,
  1263. topLevelTarget,
  1264. topLevelTargetID,
  1265. nativeEvent) {
  1266. var getTargetIDFunc, handleEventFunc;
  1267. if (shouldUseChangeEvent(topLevelTarget)) {
  1268. if (doesChangeEventBubble) {
  1269. getTargetIDFunc = getTargetIDForChangeEvent;
  1270. } else {
  1271. handleEventFunc = handleEventsForChangeEventIE8;
  1272. }
  1273. } else if (isTextInputElement(topLevelTarget)) {
  1274. if (isInputEventSupported) {
  1275. getTargetIDFunc = getTargetIDForInputEvent;
  1276. } else {
  1277. getTargetIDFunc = getTargetIDForInputEventIE;
  1278. handleEventFunc = handleEventsForInputEventIE;
  1279. }
  1280. } else if (shouldUseClickEvent(topLevelTarget)) {
  1281. getTargetIDFunc = getTargetIDForClickEvent;
  1282. }
  1283. if (getTargetIDFunc) {
  1284. var targetID = getTargetIDFunc(
  1285. topLevelType,
  1286. topLevelTarget,
  1287. topLevelTargetID
  1288. );
  1289. if (targetID) {
  1290. var event = SyntheticEvent.getPooled(
  1291. eventTypes.change,
  1292. targetID,
  1293. nativeEvent
  1294. );
  1295. EventPropagators.accumulateTwoPhaseDispatches(event);
  1296. return event;
  1297. }
  1298. }
  1299. if (handleEventFunc) {
  1300. handleEventFunc(
  1301. topLevelType,
  1302. topLevelTarget,
  1303. topLevelTargetID
  1304. );
  1305. }
  1306. }
  1307. };
  1308. module.exports = ChangeEventPlugin;
  1309. },{"136":136,"138":138,"141":141,"15":15,"17":17,"20":20,"21":21,"87":87,"95":95}],8:[function(_dereq_,module,exports){
  1310. /**
  1311. * Copyright 2013-2015, Facebook, Inc.
  1312. * All rights reserved.
  1313. *
  1314. * This source code is licensed under the BSD-style license found in the
  1315. * LICENSE file in the root directory of this source tree. An additional grant
  1316. * of patent rights can be found in the PATENTS file in the same directory.
  1317. *
  1318. * @providesModule ClientReactRootIndex
  1319. * @typechecks
  1320. */
  1321. 'use strict';
  1322. var nextReactRootIndex = 0;
  1323. var ClientReactRootIndex = {
  1324. createReactRootIndex: function() {
  1325. return nextReactRootIndex++;
  1326. }
  1327. };
  1328. module.exports = ClientReactRootIndex;
  1329. },{}],9:[function(_dereq_,module,exports){
  1330. /**
  1331. * Copyright 2013-2015, Facebook, Inc.
  1332. * All rights reserved.
  1333. *
  1334. * This source code is licensed under the BSD-style license found in the
  1335. * LICENSE file in the root directory of this source tree. An additional grant
  1336. * of patent rights can be found in the PATENTS file in the same directory.
  1337. *
  1338. * @providesModule DOMChildrenOperations
  1339. * @typechecks static-only
  1340. */
  1341. 'use strict';
  1342. var Danger = _dereq_(12);
  1343. var ReactMultiChildUpdateTypes = _dereq_(72);
  1344. var setTextContent = _dereq_(149);
  1345. var invariant = _dereq_(135);
  1346. /**
  1347. * Inserts `childNode` as a child of `parentNode` at the `index`.
  1348. *
  1349. * @param {DOMElement} parentNode Parent node in which to insert.
  1350. * @param {DOMElement} childNode Child node to insert.
  1351. * @param {number} index Index at which to insert the child.
  1352. * @internal
  1353. */
  1354. function insertChildAt(parentNode, childNode, index) {
  1355. // By exploiting arrays returning `undefined` for an undefined index, we can
  1356. // rely exclusively on `insertBefore(node, null)` instead of also using
  1357. // `appendChild(node)`. However, using `undefined` is not allowed by all
  1358. // browsers so we must replace it with `null`.
  1359. parentNode.insertBefore(
  1360. childNode,
  1361. parentNode.childNodes[index] || null
  1362. );
  1363. }
  1364. /**
  1365. * Operations for updating with DOM children.
  1366. */
  1367. var DOMChildrenOperations = {
  1368. dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
  1369. updateTextContent: setTextContent,
  1370. /**
  1371. * Updates a component's children by processing a series of updates. The
  1372. * update configurations are each expected to have a `parentNode` property.
  1373. *
  1374. * @param {array<object>} updates List of update configurations.
  1375. * @param {array<string>} markupList List of markup strings.
  1376. * @internal
  1377. */
  1378. processUpdates: function(updates, markupList) {
  1379. var update;
  1380. // Mapping from parent IDs to initial child orderings.
  1381. var initialChildren = null;
  1382. // List of children that will be moved or removed.
  1383. var updatedChildren = null;
  1384. for (var i = 0; i < updates.length; i++) {
  1385. update = updates[i];
  1386. if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
  1387. update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
  1388. var updatedIndex = update.fromIndex;
  1389. var updatedChild = update.parentNode.childNodes[updatedIndex];
  1390. var parentID = update.parentID;
  1391. ("production" !== "development" ? invariant(
  1392. updatedChild,
  1393. 'processUpdates(): Unable to find child %s of element. This ' +
  1394. 'probably means the DOM was unexpectedly mutated (e.g., by the ' +
  1395. 'browser), usually due to forgetting a <tbody> when using tables, ' +
  1396. 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
  1397. 'in an <svg> parent. Try inspecting the child nodes of the element ' +
  1398. 'with React ID `%s`.',
  1399. updatedIndex,
  1400. parentID
  1401. ) : invariant(updatedChild));
  1402. initialChildren = initialChildren || {};
  1403. initialChildren[parentID] = initialChildren[parentID] || [];
  1404. initialChildren[parentID][updatedIndex] = updatedChild;
  1405. updatedChildren = updatedChildren || [];
  1406. updatedChildren.push(updatedChild);
  1407. }
  1408. }
  1409. var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
  1410. // Remove updated children first so that `toIndex` is consistent.
  1411. if (updatedChildren) {
  1412. for (var j = 0; j < updatedChildren.length; j++) {
  1413. updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
  1414. }
  1415. }
  1416. for (var k = 0; k < updates.length; k++) {
  1417. update = updates[k];
  1418. switch (update.type) {
  1419. case ReactMultiChildUpdateTypes.INSERT_MARKUP:
  1420. insertChildAt(
  1421. update.parentNode,
  1422. renderedMarkup[update.markupIndex],
  1423. update.toIndex
  1424. );
  1425. break;
  1426. case ReactMultiChildUpdateTypes.MOVE_EXISTING:
  1427. insertChildAt(
  1428. update.parentNode,
  1429. initialChildren[update.parentID][update.fromIndex],
  1430. update.toIndex
  1431. );
  1432. break;
  1433. case ReactMultiChildUpdateTypes.TEXT_CONTENT:
  1434. setTextContent(
  1435. update.parentNode,
  1436. update.textContent
  1437. );
  1438. break;
  1439. case ReactMultiChildUpdateTypes.REMOVE_NODE:
  1440. // Already removed by the for-loop above.
  1441. break;
  1442. }
  1443. }
  1444. }
  1445. };
  1446. module.exports = DOMChildrenOperations;
  1447. },{"12":12,"135":135,"149":149,"72":72}],10:[function(_dereq_,module,exports){
  1448. /**
  1449. * Copyright 2013-2015, Facebook, Inc.
  1450. * All rights reserved.
  1451. *
  1452. * This source code is licensed under the BSD-style license found in the
  1453. * LICENSE file in the root directory of this source tree. An additional grant
  1454. * of patent rights can be found in the PATENTS file in the same directory.
  1455. *
  1456. * @providesModule DOMProperty
  1457. * @typechecks static-only
  1458. */
  1459. /*jslint bitwise: true */
  1460. 'use strict';
  1461. var invariant = _dereq_(135);
  1462. function checkMask(value, bitmask) {
  1463. return (value & bitmask) === bitmask;
  1464. }
  1465. var DOMPropertyInjection = {
  1466. /**
  1467. * Mapping from normalized, camelcased property names to a configuration that
  1468. * specifies how the associated DOM property should be accessed or rendered.
  1469. */
  1470. MUST_USE_ATTRIBUTE: 0x1,
  1471. MUST_USE_PROPERTY: 0x2,
  1472. HAS_SIDE_EFFECTS: 0x4,
  1473. HAS_BOOLEAN_VALUE: 0x8,
  1474. HAS_NUMERIC_VALUE: 0x10,
  1475. HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
  1476. HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
  1477. /**
  1478. * Inject some specialized knowledge about the DOM. This takes a config object
  1479. * with the following properties:
  1480. *
  1481. * isCustomAttribute: function that given an attribute name will return true
  1482. * if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
  1483. * attributes where it's impossible to enumerate all of the possible
  1484. * attribute names,
  1485. *
  1486. * Properties: object mapping DOM property name to one of the
  1487. * DOMPropertyInjection constants or null. If your attribute isn't in here,
  1488. * it won't get written to the DOM.
  1489. *
  1490. * DOMAttributeNames: object mapping React attribute name to the DOM
  1491. * attribute name. Attribute names not specified use the **lowercase**
  1492. * normalized name.
  1493. *
  1494. * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
  1495. * Property names not specified use the normalized name.
  1496. *
  1497. * DOMMutationMethods: Properties that require special mutation methods. If
  1498. * `value` is undefined, the mutation method should unset the property.
  1499. *
  1500. * @param {object} domPropertyConfig the config as described above.
  1501. */
  1502. injectDOMPropertyConfig: function(domPropertyConfig) {
  1503. var Properties = domPropertyConfig.Properties || {};
  1504. var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
  1505. var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
  1506. var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
  1507. if (domPropertyConfig.isCustomAttribute) {
  1508. DOMProperty._isCustomAttributeFunctions.push(
  1509. domPropertyConfig.isCustomAttribute
  1510. );
  1511. }
  1512. for (var propName in Properties) {
  1513. ("production" !== "development" ? invariant(
  1514. !DOMProperty.isStandardName.hasOwnProperty(propName),
  1515. 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
  1516. '\'%s\' which has already been injected. You may be accidentally ' +
  1517. 'injecting the same DOM property config twice, or you may be ' +
  1518. 'injecting two configs that have conflicting property names.',
  1519. propName
  1520. ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
  1521. DOMProperty.isStandardName[propName] = true;
  1522. var lowerCased = propName.toLowerCase();
  1523. DOMProperty.getPossibleStandardName[lowerCased] = propName;
  1524. if (DOMAttributeNames.hasOwnProperty(propName)) {
  1525. var attributeName = DOMAttributeNames[propName];
  1526. DOMProperty.getPossibleStandardName[attributeName] = propName;
  1527. DOMProperty.getAttributeName[propName] = attributeName;
  1528. } else {
  1529. DOMProperty.getAttributeName[propName] = lowerCased;
  1530. }
  1531. DOMProperty.getPropertyName[propName] =
  1532. DOMPropertyNames.hasOwnProperty(propName) ?
  1533. DOMPropertyNames[propName] :
  1534. propName;
  1535. if (DOMMutationMethods.hasOwnProperty(propName)) {
  1536. DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
  1537. } else {
  1538. DOMProperty.getMutationMethod[propName] = null;
  1539. }
  1540. var propConfig = Properties[propName];
  1541. DOMProperty.mustUseAttribute[propName] =
  1542. checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
  1543. DOMProperty.mustUseProperty[propName] =
  1544. checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
  1545. DOMProperty.hasSideEffects[propName] =
  1546. checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
  1547. DOMProperty.hasBooleanValue[propName] =
  1548. checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
  1549. DOMProperty.hasNumericValue[propName] =
  1550. checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
  1551. DOMProperty.hasPositiveNumericValue[propName] =
  1552. checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
  1553. DOMProperty.hasOverloadedBooleanValue[propName] =
  1554. checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
  1555. ("production" !== "development" ? invariant(
  1556. !DOMProperty.mustUseAttribute[propName] ||
  1557. !DOMProperty.mustUseProperty[propName],
  1558. 'DOMProperty: Cannot require using both attribute and property: %s',
  1559. propName
  1560. ) : invariant(!DOMProperty.mustUseAttribute[propName] ||
  1561. !DOMProperty.mustUseProperty[propName]));
  1562. ("production" !== "development" ? invariant(
  1563. DOMProperty.mustUseProperty[propName] ||
  1564. !DOMProperty.hasSideEffects[propName],
  1565. 'DOMProperty: Properties that have side effects must use property: %s',
  1566. propName
  1567. ) : invariant(DOMProperty.mustUseProperty[propName] ||
  1568. !DOMProperty.hasSideEffects[propName]));
  1569. ("production" !== "development" ? invariant(
  1570. !!DOMProperty.hasBooleanValue[propName] +
  1571. !!DOMProperty.hasNumericValue[propName] +
  1572. !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
  1573. 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
  1574. 'numeric value, but not a combination: %s',
  1575. propName
  1576. ) : invariant(!!DOMProperty.hasBooleanValue[propName] +
  1577. !!DOMProperty.hasNumericValue[propName] +
  1578. !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
  1579. }
  1580. }
  1581. };
  1582. var defaultValueCache = {};
  1583. /**
  1584. * DOMProperty exports lookup objects that can be used like functions:
  1585. *
  1586. * > DOMProperty.isValid['id']
  1587. * true
  1588. * > DOMProperty.isValid['foobar']
  1589. * undefined
  1590. *
  1591. * Although this may be confusing, it performs better in general.
  1592. *
  1593. * @see http://jsperf.com/key-exists
  1594. * @see http://jsperf.com/key-missing
  1595. */
  1596. var DOMProperty = {
  1597. ID_ATTRIBUTE_NAME: 'data-reactid',
  1598. /**
  1599. * Checks whether a property name is a standard property.
  1600. * @type {Object}
  1601. */
  1602. isStandardName: {},
  1603. /**
  1604. * Mapping from lowercase property names to the properly cased version, used
  1605. * to warn in the case of missing properties.
  1606. * @type {Object}
  1607. */
  1608. getPossibleStandardName: {},
  1609. /**
  1610. * Mapping from normalized names to attribute names that differ. Attribute
  1611. * names are used when rendering markup or with `*Attribute()`.
  1612. * @type {Object}
  1613. */
  1614. getAttributeName: {},
  1615. /**
  1616. * Mapping from normalized names to properties on DOM node instances.
  1617. * (This includes properties that mutate due to external factors.)
  1618. * @type {Object}
  1619. */
  1620. getPropertyName: {},
  1621. /**
  1622. * Mapping from normalized names to mutation methods. This will only exist if
  1623. * mutation cannot be set simply by the property or `setAttribute()`.
  1624. * @type {Object}
  1625. */
  1626. getMutationMethod: {},
  1627. /**
  1628. * Whether the property must be accessed and mutated as an object property.
  1629. * @type {Object}
  1630. */
  1631. mustUseAttribute: {},
  1632. /**
  1633. * Whether the property must be accessed and mutated using `*Attribute()`.
  1634. * (This includes anything that fails `<propName> in <element>`.)
  1635. * @type {Object}
  1636. */
  1637. mustUseProperty: {},
  1638. /**
  1639. * Whether or not setting a value causes side effects such as triggering
  1640. * resources to be loaded or text selection changes. We must ensure that
  1641. * the value is only set if it has changed.
  1642. * @type {Object}
  1643. */
  1644. hasSideEffects: {},
  1645. /**
  1646. * Whether the property should be removed when set to a falsey value.
  1647. * @type {Object}
  1648. */
  1649. hasBooleanValue: {},
  1650. /**
  1651. * Whether the property must be numeric or parse as a
  1652. * numeric and should be removed when set to a falsey value.
  1653. * @type {Object}
  1654. */
  1655. hasNumericValue: {},
  1656. /**
  1657. * Whether the property must be positive numeric or parse as a positive
  1658. * numeric and should be removed when set to a falsey value.
  1659. * @type {Object}
  1660. */
  1661. hasPositiveNumericValue: {},
  1662. /**
  1663. * Whether the property can be used as a flag as well as with a value. Removed
  1664. * when strictly equal to false; present without a value when strictly equal
  1665. * to true; present with a value otherwise.
  1666. * @type {Object}
  1667. */
  1668. hasOverloadedBooleanValue: {},
  1669. /**
  1670. * All of the isCustomAttribute() functions that have been injected.
  1671. */
  1672. _isCustomAttributeFunctions: [],
  1673. /**
  1674. * Checks whether a property name is a custom attribute.
  1675. * @method
  1676. */
  1677. isCustomAttribute: function(attributeName) {
  1678. for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
  1679. var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
  1680. if (isCustomAttributeFn(attributeName)) {
  1681. return true;
  1682. }
  1683. }
  1684. return false;
  1685. },
  1686. /**
  1687. * Returns the default property value for a DOM property (i.e., not an
  1688. * attribute). Most default values are '' or false, but not all. Worse yet,
  1689. * some (in particular, `type`) vary depending on the type of element.
  1690. *
  1691. * TODO: Is it better to grab all the possible properties when creating an
  1692. * element to avoid having to create the same element twice?
  1693. */
  1694. getDefaultValueForProperty: function(nodeName, prop) {
  1695. var nodeDefaults = defaultValueCache[nodeName];
  1696. var testElement;
  1697. if (!nodeDefaults) {
  1698. defaultValueCache[nodeName] = nodeDefaults = {};
  1699. }
  1700. if (!(prop in nodeDefaults)) {
  1701. testElement = document.createElement(nodeName);
  1702. nodeDefaults[prop] = testElement[prop];
  1703. }
  1704. return nodeDefaults[prop];
  1705. },
  1706. injection: DOMPropertyInjection
  1707. };
  1708. module.exports = DOMProperty;
  1709. },{"135":135}],11:[function(_dereq_,module,exports){
  1710. /**
  1711. * Copyright 2013-2015, Facebook, Inc.
  1712. * All rights reserved.
  1713. *
  1714. * This source code is licensed under the BSD-style license found in the
  1715. * LICENSE file in the root directory of this source tree. An additional grant
  1716. * of patent rights can be found in the PATENTS file in the same directory.
  1717. *
  1718. * @providesModule DOMPropertyOperations
  1719. * @typechecks static-only
  1720. */
  1721. 'use strict';
  1722. var DOMProperty = _dereq_(10);
  1723. var quoteAttributeValueForBrowser = _dereq_(147);
  1724. var warning = _dereq_(154);
  1725. function shouldIgnoreValue(name, value) {
  1726. return value == null ||
  1727. (DOMProperty.hasBooleanValue[name] && !value) ||
  1728. (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
  1729. (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
  1730. (DOMProperty.hasOverloadedBooleanValue[name] && value === false);
  1731. }
  1732. if ("production" !== "development") {
  1733. var reactProps = {
  1734. children: true,
  1735. dangerouslySetInnerHTML: true,
  1736. key: true,
  1737. ref: true
  1738. };
  1739. var warnedProperties = {};
  1740. var warnUnknownProperty = function(name) {
  1741. if (reactProps.hasOwnProperty(name) && reactProps[name] ||
  1742. warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
  1743. return;
  1744. }
  1745. warnedProperties[name] = true;
  1746. var lowerCasedName = name.toLowerCase();
  1747. // data-* attributes should be lowercase; suggest the lowercase version
  1748. var standardName = (
  1749. DOMProperty.isCustomAttribute(lowerCasedName) ?
  1750. lowerCasedName :
  1751. DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
  1752. DOMProperty.getPossibleStandardName[lowerCasedName] :
  1753. null
  1754. );
  1755. // For now, only warn when we have a suggested correction. This prevents
  1756. // logging too much when using transferPropsTo.
  1757. ("production" !== "development" ? warning(
  1758. standardName == null,
  1759. 'Unknown DOM property %s. Did you mean %s?',
  1760. name,
  1761. standardName
  1762. ) : null);
  1763. };
  1764. }
  1765. /**
  1766. * Operations for dealing with DOM properties.
  1767. */
  1768. var DOMPropertyOperations = {
  1769. /**
  1770. * Creates markup for the ID property.
  1771. *
  1772. * @param {string} id Unescaped ID.
  1773. * @return {string} Markup string.
  1774. */
  1775. createMarkupForID: function(id) {
  1776. return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
  1777. quoteAttributeValueForBrowser(id);
  1778. },
  1779. /**
  1780. * Creates markup for a property.
  1781. *
  1782. * @param {string} name
  1783. * @param {*} value
  1784. * @return {?string} Markup string, or null if the property was invalid.
  1785. */
  1786. createMarkupForProperty: function(name, value) {
  1787. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1788. DOMProperty.isStandardName[name]) {
  1789. if (shouldIgnoreValue(name, value)) {
  1790. return '';
  1791. }
  1792. var attributeName = DOMProperty.getAttributeName[name];
  1793. if (DOMProperty.hasBooleanValue[name] ||
  1794. (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
  1795. return attributeName;
  1796. }
  1797. return attributeName + '=' + quoteAttributeValueForBrowser(value);
  1798. } else if (DOMProperty.isCustomAttribute(name)) {
  1799. if (value == null) {
  1800. return '';
  1801. }
  1802. return name + '=' + quoteAttributeValueForBrowser(value);
  1803. } else if ("production" !== "development") {
  1804. warnUnknownProperty(name);
  1805. }
  1806. return null;
  1807. },
  1808. /**
  1809. * Sets the value for a property on a node.
  1810. *
  1811. * @param {DOMElement} node
  1812. * @param {string} name
  1813. * @param {*} value
  1814. */
  1815. setValueForProperty: function(node, name, value) {
  1816. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1817. DOMProperty.isStandardName[name]) {
  1818. var mutationMethod = DOMProperty.getMutationMethod[name];
  1819. if (mutationMethod) {
  1820. mutationMethod(node, value);
  1821. } else if (shouldIgnoreValue(name, value)) {
  1822. this.deleteValueForProperty(node, name);
  1823. } else if (DOMProperty.mustUseAttribute[name]) {
  1824. // `setAttribute` with objects becomes only `[object]` in IE8/9,
  1825. // ('' + value) makes it output the correct toString()-value.
  1826. node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
  1827. } else {
  1828. var propName = DOMProperty.getPropertyName[name];
  1829. // Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
  1830. // property type before comparing; only `value` does and is string.
  1831. if (!DOMProperty.hasSideEffects[name] ||
  1832. ('' + node[propName]) !== ('' + value)) {
  1833. // Contrary to `setAttribute`, object properties are properly
  1834. // `toString`ed by IE8/9.
  1835. node[propName] = value;
  1836. }
  1837. }
  1838. } else if (DOMProperty.isCustomAttribute(name)) {
  1839. if (value == null) {
  1840. node.removeAttribute(name);
  1841. } else {
  1842. node.setAttribute(name, '' + value);
  1843. }
  1844. } else if ("production" !== "development") {
  1845. warnUnknownProperty(name);
  1846. }
  1847. },
  1848. /**
  1849. * Deletes the value for a property on a node.
  1850. *
  1851. * @param {DOMElement} node
  1852. * @param {string} name
  1853. */
  1854. deleteValueForProperty: function(node, name) {
  1855. if (DOMProperty.isStandardName.hasOwnProperty(name) &&
  1856. DOMProperty.isStandardName[name]) {
  1857. var mutationMethod = DOMProperty.getMutationMethod[name];
  1858. if (mutationMethod) {
  1859. mutationMethod(node, undefined);
  1860. } else if (DOMProperty.mustUseAttribute[name]) {
  1861. node.removeAttribute(DOMProperty.getAttributeName[name]);
  1862. } else {
  1863. var propName = DOMProperty.getPropertyName[name];
  1864. var defaultValue = DOMProperty.getDefaultValueForProperty(
  1865. node.nodeName,
  1866. propName
  1867. );
  1868. if (!DOMProperty.hasSideEffects[name] ||
  1869. ('' + node[propName]) !== defaultValue) {
  1870. node[propName] = defaultValue;
  1871. }
  1872. }
  1873. } else if (DOMProperty.isCustomAttribute(name)) {
  1874. node.removeAttribute(name);
  1875. } else if ("production" !== "development") {
  1876. warnUnknownProperty(name);
  1877. }
  1878. }
  1879. };
  1880. module.exports = DOMPropertyOperations;
  1881. },{"10":10,"147":147,"154":154}],12:[function(_dereq_,module,exports){
  1882. /**
  1883. * Copyright 2013-2015, Facebook, Inc.
  1884. * All rights reserved.
  1885. *
  1886. * This source code is licensed under the BSD-style license found in the
  1887. * LICENSE file in the root directory of this source tree. An additional grant
  1888. * of patent rights can be found in the PATENTS file in the same directory.
  1889. *
  1890. * @providesModule Danger
  1891. * @typechecks static-only
  1892. */
  1893. /*jslint evil: true, sub: true */
  1894. 'use strict';
  1895. var ExecutionEnvironment = _dereq_(21);
  1896. var createNodesFromMarkup = _dereq_(112);
  1897. var emptyFunction = _dereq_(114);
  1898. var getMarkupWrap = _dereq_(127);
  1899. var invariant = _dereq_(135);
  1900. var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
  1901. var RESULT_INDEX_ATTR = 'data-danger-index';
  1902. /**
  1903. * Extracts the `nodeName` from a string of markup.
  1904. *
  1905. * NOTE: Extracting the `nodeName` does not require a regular expression match
  1906. * because we make assumptions about React-generated markup (i.e. there are no
  1907. * spaces surrounding the opening tag and there is at least one attribute).
  1908. *
  1909. * @param {string} markup String of markup.
  1910. * @return {string} Node name of the supplied markup.
  1911. * @see http://jsperf.com/extract-nodename
  1912. */
  1913. function getNodeName(markup) {
  1914. return markup.substring(1, markup.indexOf(' '));
  1915. }
  1916. var Danger = {
  1917. /**
  1918. * Renders markup into an array of nodes. The markup is expected to render
  1919. * into a list of root nodes. Also, the length of `resultList` and
  1920. * `markupList` should be the same.
  1921. *
  1922. * @param {array<string>} markupList List of markup strings to render.
  1923. * @return {array<DOMElement>} List of rendered nodes.
  1924. * @internal
  1925. */
  1926. dangerouslyRenderMarkup: function(markupList) {
  1927. ("production" !== "development" ? invariant(
  1928. ExecutionEnvironment.canUseDOM,
  1929. 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
  1930. 'thread. Make sure `window` and `document` are available globally ' +
  1931. 'before requiring React when unit testing or use ' +
  1932. 'React.renderToString for server rendering.'
  1933. ) : invariant(ExecutionEnvironment.canUseDOM));
  1934. var nodeName;
  1935. var markupByNodeName = {};
  1936. // Group markup by `nodeName` if a wrap is necessary, else by '*'.
  1937. for (var i = 0; i < markupList.length; i++) {
  1938. ("production" !== "development" ? invariant(
  1939. markupList[i],
  1940. 'dangerouslyRenderMarkup(...): Missing markup.'
  1941. ) : invariant(markupList[i]));
  1942. nodeName = getNodeName(markupList[i]);
  1943. nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
  1944. markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
  1945. markupByNodeName[nodeName][i] = markupList[i];
  1946. }
  1947. var resultList = [];
  1948. var resultListAssignmentCount = 0;
  1949. for (nodeName in markupByNodeName) {
  1950. if (!markupByNodeName.hasOwnProperty(nodeName)) {
  1951. continue;
  1952. }
  1953. var markupListByNodeName = markupByNodeName[nodeName];
  1954. // This for-in loop skips the holes of the sparse array. The order of
  1955. // iteration should follow the order of assignment, which happens to match
  1956. // numerical index order, but we don't rely on that.
  1957. var resultIndex;
  1958. for (resultIndex in markupListByNodeName) {
  1959. if (markupListByNodeName.hasOwnProperty(resultIndex)) {
  1960. var markup = markupListByNodeName[resultIndex];
  1961. // Push the requested markup with an additional RESULT_INDEX_ATTR
  1962. // attribute. If the markup does not start with a < character, it
  1963. // will be discarded below (with an appropriate console.error).
  1964. markupListByNodeName[resultIndex] = markup.replace(
  1965. OPEN_TAG_NAME_EXP,
  1966. // This index will be parsed back out below.
  1967. '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
  1968. );
  1969. }
  1970. }
  1971. // Render each group of markup with similar wrapping `nodeName`.
  1972. var renderNodes = createNodesFromMarkup(
  1973. markupListByNodeName.join(''),
  1974. emptyFunction // Do nothing special with <script> tags.
  1975. );
  1976. for (var j = 0; j < renderNodes.length; ++j) {
  1977. var renderNode = renderNodes[j];
  1978. if (renderNode.hasAttribute &&
  1979. renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
  1980. resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
  1981. renderNode.removeAttribute(RESULT_INDEX_ATTR);
  1982. ("production" !== "development" ? invariant(
  1983. !resultList.hasOwnProperty(resultIndex),
  1984. 'Danger: Assigning to an already-occupied result index.'
  1985. ) : invariant(!resultList.hasOwnProperty(resultIndex)));
  1986. resultList[resultIndex] = renderNode;
  1987. // This should match resultList.length and markupList.length when
  1988. // we're done.
  1989. resultListAssignmentCount += 1;
  1990. } else if ("production" !== "development") {
  1991. console.error(
  1992. 'Danger: Discarding unexpected node:',
  1993. renderNode
  1994. );
  1995. }
  1996. }
  1997. }
  1998. // Although resultList was populated out of order, it should now be a dense
  1999. // array.
  2000. ("production" !== "development" ? invariant(
  2001. resultListAssignmentCount === resultList.length,
  2002. 'Danger: Did not assign to every index of resultList.'
  2003. ) : invariant(resultListAssignmentCount === resultList.length));
  2004. ("production" !== "development" ? invariant(
  2005. resultList.length === markupList.length,
  2006. 'Danger: Expected markup to render %s nodes, but rendered %s.',
  2007. markupList.length,
  2008. resultList.length
  2009. ) : invariant(resultList.length === markupList.length));
  2010. return resultList;
  2011. },
  2012. /**
  2013. * Replaces a node with a string of markup at its current position within its
  2014. * parent. The markup must render into a single root node.
  2015. *
  2016. * @param {DOMElement} oldChild Child node to replace.
  2017. * @param {string} markup Markup to render in place of the child node.
  2018. * @internal
  2019. */
  2020. dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
  2021. ("production" !== "development" ? invariant(
  2022. ExecutionEnvironment.canUseDOM,
  2023. 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
  2024. 'worker thread. Make sure `window` and `document` are available ' +
  2025. 'globally before requiring React when unit testing or use ' +
  2026. 'React.renderToString for server rendering.'
  2027. ) : invariant(ExecutionEnvironment.canUseDOM));
  2028. ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
  2029. ("production" !== "development" ? invariant(
  2030. oldChild.tagName.toLowerCase() !== 'html',
  2031. 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
  2032. '<html> node. This is because browser quirks make this unreliable ' +
  2033. 'and/or slow. If you want to render to the root you must use ' +
  2034. 'server rendering. See React.renderToString().'
  2035. ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
  2036. var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
  2037. oldChild.parentNode.replaceChild(newChild, oldChild);
  2038. }
  2039. };
  2040. module.exports = Danger;
  2041. },{"112":112,"114":114,"127":127,"135":135,"21":21}],13:[function(_dereq_,module,exports){
  2042. /**
  2043. * Copyright 2013-2015, Facebook, Inc.
  2044. * All rights reserved.
  2045. *
  2046. * This source code is licensed under the BSD-style license found in the
  2047. * LICENSE file in the root directory of this source tree. An additional grant
  2048. * of patent rights can be found in the PATENTS file in the same directory.
  2049. *
  2050. * @providesModule DefaultEventPluginOrder
  2051. */
  2052. 'use strict';
  2053. var keyOf = _dereq_(141);
  2054. /**
  2055. * Module that is injectable into `EventPluginHub`, that specifies a
  2056. * deterministic ordering of `EventPlugin`s. A convenient way to reason about
  2057. * plugins, without having to package every one of them. This is better than
  2058. * having plugins be ordered in the same order that they are injected because
  2059. * that ordering would be influenced by the packaging order.
  2060. * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
  2061. * preventing default on events is convenient in `SimpleEventPlugin` handlers.
  2062. */
  2063. var DefaultEventPluginOrder = [
  2064. keyOf({ResponderEventPlugin: null}),
  2065. keyOf({SimpleEventPlugin: null}),
  2066. keyOf({TapEventPlugin: null}),
  2067. keyOf({EnterLeaveEventPlugin: null}),
  2068. keyOf({ChangeEventPlugin: null}),
  2069. keyOf({SelectEventPlugin: null}),
  2070. keyOf({BeforeInputEventPlugin: null}),
  2071. keyOf({AnalyticsEventPlugin: null}),
  2072. keyOf({MobileSafariClickEventPlugin: null})
  2073. ];
  2074. module.exports = DefaultEventPluginOrder;
  2075. },{"141":141}],14:[function(_dereq_,module,exports){
  2076. /**
  2077. * Copyright 2013-2015, Facebook, Inc.
  2078. * All rights reserved.
  2079. *
  2080. * This source code is licensed under the BSD-style license found in the
  2081. * LICENSE file in the root directory of this source tree. An additional grant
  2082. * of patent rights can be found in the PATENTS file in the same directory.
  2083. *
  2084. * @providesModule EnterLeaveEventPlugin
  2085. * @typechecks static-only
  2086. */
  2087. 'use strict';
  2088. var EventConstants = _dereq_(15);
  2089. var EventPropagators = _dereq_(20);
  2090. var SyntheticMouseEvent = _dereq_(99);
  2091. var ReactMount = _dereq_(70);
  2092. var keyOf = _dereq_(141);
  2093. var topLevelTypes = EventConstants.topLevelTypes;
  2094. var getFirstReactDOM = ReactMount.getFirstReactDOM;
  2095. var eventTypes = {
  2096. mouseEnter: {
  2097. registrationName: keyOf({onMouseEnter: null}),
  2098. dependencies: [
  2099. topLevelTypes.topMouseOut,
  2100. topLevelTypes.topMouseOver
  2101. ]
  2102. },
  2103. mouseLeave: {
  2104. registrationName: keyOf({onMouseLeave: null}),
  2105. dependencies: [
  2106. topLevelTypes.topMouseOut,
  2107. topLevelTypes.topMouseOver
  2108. ]
  2109. }
  2110. };
  2111. var extractedEvents = [null, null];
  2112. var EnterLeaveEventPlugin = {
  2113. eventTypes: eventTypes,
  2114. /**
  2115. * For almost every interaction we care about, there will be both a top-level
  2116. * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
  2117. * we do not extract duplicate events. However, moving the mouse into the
  2118. * browser from outside will not fire a `mouseout` event. In this case, we use
  2119. * the `mouseover` top-level event.
  2120. *
  2121. * @param {string} topLevelType Record from `EventConstants`.
  2122. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  2123. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  2124. * @param {object} nativeEvent Native browser event.
  2125. * @return {*} An accumulation of synthetic events.
  2126. * @see {EventPluginHub.extractEvents}
  2127. */
  2128. extractEvents: function(
  2129. topLevelType,
  2130. topLevelTarget,
  2131. topLevelTargetID,
  2132. nativeEvent) {
  2133. if (topLevelType === topLevelTypes.topMouseOver &&
  2134. (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
  2135. return null;
  2136. }
  2137. if (topLevelType !== topLevelTypes.topMouseOut &&
  2138. topLevelType !== topLevelTypes.topMouseOver) {
  2139. // Must not be a mouse in or mouse out - ignoring.
  2140. return null;
  2141. }
  2142. var win;
  2143. if (topLevelTarget.window === topLevelTarget) {
  2144. // `topLevelTarget` is probably a window object.
  2145. win = topLevelTarget;
  2146. } else {
  2147. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  2148. var doc = topLevelTarget.ownerDocument;
  2149. if (doc) {
  2150. win = doc.defaultView || doc.parentWindow;
  2151. } else {
  2152. win = window;
  2153. }
  2154. }
  2155. var from, to;
  2156. if (topLevelType === topLevelTypes.topMouseOut) {
  2157. from = topLevelTarget;
  2158. to =
  2159. getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
  2160. win;
  2161. } else {
  2162. from = win;
  2163. to = topLevelTarget;
  2164. }
  2165. if (from === to) {
  2166. // Nothing pertains to our managed components.
  2167. return null;
  2168. }
  2169. var fromID = from ? ReactMount.getID(from) : '';
  2170. var toID = to ? ReactMount.getID(to) : '';
  2171. var leave = SyntheticMouseEvent.getPooled(
  2172. eventTypes.mouseLeave,
  2173. fromID,
  2174. nativeEvent
  2175. );
  2176. leave.type = 'mouseleave';
  2177. leave.target = from;
  2178. leave.relatedTarget = to;
  2179. var enter = SyntheticMouseEvent.getPooled(
  2180. eventTypes.mouseEnter,
  2181. toID,
  2182. nativeEvent
  2183. );
  2184. enter.type = 'mouseenter';
  2185. enter.target = to;
  2186. enter.relatedTarget = from;
  2187. EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
  2188. extractedEvents[0] = leave;
  2189. extractedEvents[1] = enter;
  2190. return extractedEvents;
  2191. }
  2192. };
  2193. module.exports = EnterLeaveEventPlugin;
  2194. },{"141":141,"15":15,"20":20,"70":70,"99":99}],15:[function(_dereq_,module,exports){
  2195. /**
  2196. * Copyright 2013-2015, Facebook, Inc.
  2197. * All rights reserved.
  2198. *
  2199. * This source code is licensed under the BSD-style license found in the
  2200. * LICENSE file in the root directory of this source tree. An additional grant
  2201. * of patent rights can be found in the PATENTS file in the same directory.
  2202. *
  2203. * @providesModule EventConstants
  2204. */
  2205. 'use strict';
  2206. var keyMirror = _dereq_(140);
  2207. var PropagationPhases = keyMirror({bubbled: null, captured: null});
  2208. /**
  2209. * Types of raw signals from the browser caught at the top level.
  2210. */
  2211. var topLevelTypes = keyMirror({
  2212. topBlur: null,
  2213. topChange: null,
  2214. topClick: null,
  2215. topCompositionEnd: null,
  2216. topCompositionStart: null,
  2217. topCompositionUpdate: null,
  2218. topContextMenu: null,
  2219. topCopy: null,
  2220. topCut: null,
  2221. topDoubleClick: null,
  2222. topDrag: null,
  2223. topDragEnd: null,
  2224. topDragEnter: null,
  2225. topDragExit: null,
  2226. topDragLeave: null,
  2227. topDragOver: null,
  2228. topDragStart: null,
  2229. topDrop: null,
  2230. topError: null,
  2231. topFocus: null,
  2232. topInput: null,
  2233. topKeyDown: null,
  2234. topKeyPress: null,
  2235. topKeyUp: null,
  2236. topLoad: null,
  2237. topMouseDown: null,
  2238. topMouseMove: null,
  2239. topMouseOut: null,
  2240. topMouseOver: null,
  2241. topMouseUp: null,
  2242. topPaste: null,
  2243. topReset: null,
  2244. topScroll: null,
  2245. topSelectionChange: null,
  2246. topSubmit: null,
  2247. topTextInput: null,
  2248. topTouchCancel: null,
  2249. topTouchEnd: null,
  2250. topTouchMove: null,
  2251. topTouchStart: null,
  2252. topWheel: null
  2253. });
  2254. var EventConstants = {
  2255. topLevelTypes: topLevelTypes,
  2256. PropagationPhases: PropagationPhases
  2257. };
  2258. module.exports = EventConstants;
  2259. },{"140":140}],16:[function(_dereq_,module,exports){
  2260. /**
  2261. * Copyright 2013-2015, Facebook, Inc.
  2262. *
  2263. * Licensed under the Apache License, Version 2.0 (the "License");
  2264. * you may not use this file except in compliance with the License.
  2265. * You may obtain a copy of the License at
  2266. *
  2267. * http://www.apache.org/licenses/LICENSE-2.0
  2268. *
  2269. * Unless required by applicable law or agreed to in writing, software
  2270. * distributed under the License is distributed on an "AS IS" BASIS,
  2271. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  2272. * See the License for the specific language governing permissions and
  2273. * limitations under the License.
  2274. *
  2275. * @providesModule EventListener
  2276. * @typechecks
  2277. */
  2278. var emptyFunction = _dereq_(114);
  2279. /**
  2280. * Upstream version of event listener. Does not take into account specific
  2281. * nature of platform.
  2282. */
  2283. var EventListener = {
  2284. /**
  2285. * Listen to DOM events during the bubble phase.
  2286. *
  2287. * @param {DOMEventTarget} target DOM element to register listener on.
  2288. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  2289. * @param {function} callback Callback function.
  2290. * @return {object} Object with a `remove` method.
  2291. */
  2292. listen: function(target, eventType, callback) {
  2293. if (target.addEventListener) {
  2294. target.addEventListener(eventType, callback, false);
  2295. return {
  2296. remove: function() {
  2297. target.removeEventListener(eventType, callback, false);
  2298. }
  2299. };
  2300. } else if (target.attachEvent) {
  2301. target.attachEvent('on' + eventType, callback);
  2302. return {
  2303. remove: function() {
  2304. target.detachEvent('on' + eventType, callback);
  2305. }
  2306. };
  2307. }
  2308. },
  2309. /**
  2310. * Listen to DOM events during the capture phase.
  2311. *
  2312. * @param {DOMEventTarget} target DOM element to register listener on.
  2313. * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
  2314. * @param {function} callback Callback function.
  2315. * @return {object} Object with a `remove` method.
  2316. */
  2317. capture: function(target, eventType, callback) {
  2318. if (!target.addEventListener) {
  2319. if ("production" !== "development") {
  2320. console.error(
  2321. 'Attempted to listen to events during the capture phase on a ' +
  2322. 'browser that does not support the capture phase. Your application ' +
  2323. 'will not receive some events.'
  2324. );
  2325. }
  2326. return {
  2327. remove: emptyFunction
  2328. };
  2329. } else {
  2330. target.addEventListener(eventType, callback, true);
  2331. return {
  2332. remove: function() {
  2333. target.removeEventListener(eventType, callback, true);
  2334. }
  2335. };
  2336. }
  2337. },
  2338. registerDefault: function() {}
  2339. };
  2340. module.exports = EventListener;
  2341. },{"114":114}],17:[function(_dereq_,module,exports){
  2342. /**
  2343. * Copyright 2013-2015, Facebook, Inc.
  2344. * All rights reserved.
  2345. *
  2346. * This source code is licensed under the BSD-style license found in the
  2347. * LICENSE file in the root directory of this source tree. An additional grant
  2348. * of patent rights can be found in the PATENTS file in the same directory.
  2349. *
  2350. * @providesModule EventPluginHub
  2351. */
  2352. 'use strict';
  2353. var EventPluginRegistry = _dereq_(18);
  2354. var EventPluginUtils = _dereq_(19);
  2355. var accumulateInto = _dereq_(105);
  2356. var forEachAccumulated = _dereq_(120);
  2357. var invariant = _dereq_(135);
  2358. /**
  2359. * Internal store for event listeners
  2360. */
  2361. var listenerBank = {};
  2362. /**
  2363. * Internal queue of events that have accumulated their dispatches and are
  2364. * waiting to have their dispatches executed.
  2365. */
  2366. var eventQueue = null;
  2367. /**
  2368. * Dispatches an event and releases it back into the pool, unless persistent.
  2369. *
  2370. * @param {?object} event Synthetic event to be dispatched.
  2371. * @private
  2372. */
  2373. var executeDispatchesAndRelease = function(event) {
  2374. if (event) {
  2375. var executeDispatch = EventPluginUtils.executeDispatch;
  2376. // Plugins can provide custom behavior when dispatching events.
  2377. var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
  2378. if (PluginModule && PluginModule.executeDispatch) {
  2379. executeDispatch = PluginModule.executeDispatch;
  2380. }
  2381. EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
  2382. if (!event.isPersistent()) {
  2383. event.constructor.release(event);
  2384. }
  2385. }
  2386. };
  2387. /**
  2388. * - `InstanceHandle`: [required] Module that performs logical traversals of DOM
  2389. * hierarchy given ids of the logical DOM elements involved.
  2390. */
  2391. var InstanceHandle = null;
  2392. function validateInstanceHandle() {
  2393. var valid =
  2394. InstanceHandle &&
  2395. InstanceHandle.traverseTwoPhase &&
  2396. InstanceHandle.traverseEnterLeave;
  2397. ("production" !== "development" ? invariant(
  2398. valid,
  2399. 'InstanceHandle not injected before use!'
  2400. ) : invariant(valid));
  2401. }
  2402. /**
  2403. * This is a unified interface for event plugins to be installed and configured.
  2404. *
  2405. * Event plugins can implement the following properties:
  2406. *
  2407. * `extractEvents` {function(string, DOMEventTarget, string, object): *}
  2408. * Required. When a top-level event is fired, this method is expected to
  2409. * extract synthetic events that will in turn be queued and dispatched.
  2410. *
  2411. * `eventTypes` {object}
  2412. * Optional, plugins that fire events must publish a mapping of registration
  2413. * names that are used to register listeners. Values of this mapping must
  2414. * be objects that contain `registrationName` or `phasedRegistrationNames`.
  2415. *
  2416. * `executeDispatch` {function(object, function, string)}
  2417. * Optional, allows plugins to override how an event gets dispatched. By
  2418. * default, the listener is simply invoked.
  2419. *
  2420. * Each plugin that is injected into `EventsPluginHub` is immediately operable.
  2421. *
  2422. * @public
  2423. */
  2424. var EventPluginHub = {
  2425. /**
  2426. * Methods for injecting dependencies.
  2427. */
  2428. injection: {
  2429. /**
  2430. * @param {object} InjectedMount
  2431. * @public
  2432. */
  2433. injectMount: EventPluginUtils.injection.injectMount,
  2434. /**
  2435. * @param {object} InjectedInstanceHandle
  2436. * @public
  2437. */
  2438. injectInstanceHandle: function(InjectedInstanceHandle) {
  2439. InstanceHandle = InjectedInstanceHandle;
  2440. if ("production" !== "development") {
  2441. validateInstanceHandle();
  2442. }
  2443. },
  2444. getInstanceHandle: function() {
  2445. if ("production" !== "development") {
  2446. validateInstanceHandle();
  2447. }
  2448. return InstanceHandle;
  2449. },
  2450. /**
  2451. * @param {array} InjectedEventPluginOrder
  2452. * @public
  2453. */
  2454. injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
  2455. /**
  2456. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2457. */
  2458. injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
  2459. },
  2460. eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
  2461. registrationNameModules: EventPluginRegistry.registrationNameModules,
  2462. /**
  2463. * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
  2464. *
  2465. * @param {string} id ID of the DOM element.
  2466. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2467. * @param {?function} listener The callback to store.
  2468. */
  2469. putListener: function(id, registrationName, listener) {
  2470. ("production" !== "development" ? invariant(
  2471. !listener || typeof listener === 'function',
  2472. 'Expected %s listener to be a function, instead got type %s',
  2473. registrationName, typeof listener
  2474. ) : invariant(!listener || typeof listener === 'function'));
  2475. var bankForRegistrationName =
  2476. listenerBank[registrationName] || (listenerBank[registrationName] = {});
  2477. bankForRegistrationName[id] = listener;
  2478. },
  2479. /**
  2480. * @param {string} id ID of the DOM element.
  2481. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2482. * @return {?function} The stored callback.
  2483. */
  2484. getListener: function(id, registrationName) {
  2485. var bankForRegistrationName = listenerBank[registrationName];
  2486. return bankForRegistrationName && bankForRegistrationName[id];
  2487. },
  2488. /**
  2489. * Deletes a listener from the registration bank.
  2490. *
  2491. * @param {string} id ID of the DOM element.
  2492. * @param {string} registrationName Name of listener (e.g. `onClick`).
  2493. */
  2494. deleteListener: function(id, registrationName) {
  2495. var bankForRegistrationName = listenerBank[registrationName];
  2496. if (bankForRegistrationName) {
  2497. delete bankForRegistrationName[id];
  2498. }
  2499. },
  2500. /**
  2501. * Deletes all listeners for the DOM element with the supplied ID.
  2502. *
  2503. * @param {string} id ID of the DOM element.
  2504. */
  2505. deleteAllListeners: function(id) {
  2506. for (var registrationName in listenerBank) {
  2507. delete listenerBank[registrationName][id];
  2508. }
  2509. },
  2510. /**
  2511. * Allows registered plugins an opportunity to extract events from top-level
  2512. * native browser events.
  2513. *
  2514. * @param {string} topLevelType Record from `EventConstants`.
  2515. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  2516. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  2517. * @param {object} nativeEvent Native browser event.
  2518. * @return {*} An accumulation of synthetic events.
  2519. * @internal
  2520. */
  2521. extractEvents: function(
  2522. topLevelType,
  2523. topLevelTarget,
  2524. topLevelTargetID,
  2525. nativeEvent) {
  2526. var events;
  2527. var plugins = EventPluginRegistry.plugins;
  2528. for (var i = 0, l = plugins.length; i < l; i++) {
  2529. // Not every plugin in the ordering may be loaded at runtime.
  2530. var possiblePlugin = plugins[i];
  2531. if (possiblePlugin) {
  2532. var extractedEvents = possiblePlugin.extractEvents(
  2533. topLevelType,
  2534. topLevelTarget,
  2535. topLevelTargetID,
  2536. nativeEvent
  2537. );
  2538. if (extractedEvents) {
  2539. events = accumulateInto(events, extractedEvents);
  2540. }
  2541. }
  2542. }
  2543. return events;
  2544. },
  2545. /**
  2546. * Enqueues a synthetic event that should be dispatched when
  2547. * `processEventQueue` is invoked.
  2548. *
  2549. * @param {*} events An accumulation of synthetic events.
  2550. * @internal
  2551. */
  2552. enqueueEvents: function(events) {
  2553. if (events) {
  2554. eventQueue = accumulateInto(eventQueue, events);
  2555. }
  2556. },
  2557. /**
  2558. * Dispatches all synthetic events on the event queue.
  2559. *
  2560. * @internal
  2561. */
  2562. processEventQueue: function() {
  2563. // Set `eventQueue` to null before processing it so that we can tell if more
  2564. // events get enqueued while processing.
  2565. var processingEventQueue = eventQueue;
  2566. eventQueue = null;
  2567. forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
  2568. ("production" !== "development" ? invariant(
  2569. !eventQueue,
  2570. 'processEventQueue(): Additional events were enqueued while processing ' +
  2571. 'an event queue. Support for this has not yet been implemented.'
  2572. ) : invariant(!eventQueue));
  2573. },
  2574. /**
  2575. * These are needed for tests only. Do not use!
  2576. */
  2577. __purge: function() {
  2578. listenerBank = {};
  2579. },
  2580. __getListenerBank: function() {
  2581. return listenerBank;
  2582. }
  2583. };
  2584. module.exports = EventPluginHub;
  2585. },{"105":105,"120":120,"135":135,"18":18,"19":19}],18:[function(_dereq_,module,exports){
  2586. /**
  2587. * Copyright 2013-2015, Facebook, Inc.
  2588. * All rights reserved.
  2589. *
  2590. * This source code is licensed under the BSD-style license found in the
  2591. * LICENSE file in the root directory of this source tree. An additional grant
  2592. * of patent rights can be found in the PATENTS file in the same directory.
  2593. *
  2594. * @providesModule EventPluginRegistry
  2595. * @typechecks static-only
  2596. */
  2597. 'use strict';
  2598. var invariant = _dereq_(135);
  2599. /**
  2600. * Injectable ordering of event plugins.
  2601. */
  2602. var EventPluginOrder = null;
  2603. /**
  2604. * Injectable mapping from names to event plugin modules.
  2605. */
  2606. var namesToPlugins = {};
  2607. /**
  2608. * Recomputes the plugin list using the injected plugins and plugin ordering.
  2609. *
  2610. * @private
  2611. */
  2612. function recomputePluginOrdering() {
  2613. if (!EventPluginOrder) {
  2614. // Wait until an `EventPluginOrder` is injected.
  2615. return;
  2616. }
  2617. for (var pluginName in namesToPlugins) {
  2618. var PluginModule = namesToPlugins[pluginName];
  2619. var pluginIndex = EventPluginOrder.indexOf(pluginName);
  2620. ("production" !== "development" ? invariant(
  2621. pluginIndex > -1,
  2622. 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
  2623. 'the plugin ordering, `%s`.',
  2624. pluginName
  2625. ) : invariant(pluginIndex > -1));
  2626. if (EventPluginRegistry.plugins[pluginIndex]) {
  2627. continue;
  2628. }
  2629. ("production" !== "development" ? invariant(
  2630. PluginModule.extractEvents,
  2631. 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
  2632. 'method, but `%s` does not.',
  2633. pluginName
  2634. ) : invariant(PluginModule.extractEvents));
  2635. EventPluginRegistry.plugins[pluginIndex] = PluginModule;
  2636. var publishedEvents = PluginModule.eventTypes;
  2637. for (var eventName in publishedEvents) {
  2638. ("production" !== "development" ? invariant(
  2639. publishEventForPlugin(
  2640. publishedEvents[eventName],
  2641. PluginModule,
  2642. eventName
  2643. ),
  2644. 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
  2645. eventName,
  2646. pluginName
  2647. ) : invariant(publishEventForPlugin(
  2648. publishedEvents[eventName],
  2649. PluginModule,
  2650. eventName
  2651. )));
  2652. }
  2653. }
  2654. }
  2655. /**
  2656. * Publishes an event so that it can be dispatched by the supplied plugin.
  2657. *
  2658. * @param {object} dispatchConfig Dispatch configuration for the event.
  2659. * @param {object} PluginModule Plugin publishing the event.
  2660. * @return {boolean} True if the event was successfully published.
  2661. * @private
  2662. */
  2663. function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
  2664. ("production" !== "development" ? invariant(
  2665. !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
  2666. 'EventPluginHub: More than one plugin attempted to publish the same ' +
  2667. 'event name, `%s`.',
  2668. eventName
  2669. ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
  2670. EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
  2671. var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
  2672. if (phasedRegistrationNames) {
  2673. for (var phaseName in phasedRegistrationNames) {
  2674. if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
  2675. var phasedRegistrationName = phasedRegistrationNames[phaseName];
  2676. publishRegistrationName(
  2677. phasedRegistrationName,
  2678. PluginModule,
  2679. eventName
  2680. );
  2681. }
  2682. }
  2683. return true;
  2684. } else if (dispatchConfig.registrationName) {
  2685. publishRegistrationName(
  2686. dispatchConfig.registrationName,
  2687. PluginModule,
  2688. eventName
  2689. );
  2690. return true;
  2691. }
  2692. return false;
  2693. }
  2694. /**
  2695. * Publishes a registration name that is used to identify dispatched events and
  2696. * can be used with `EventPluginHub.putListener` to register listeners.
  2697. *
  2698. * @param {string} registrationName Registration name to add.
  2699. * @param {object} PluginModule Plugin publishing the event.
  2700. * @private
  2701. */
  2702. function publishRegistrationName(registrationName, PluginModule, eventName) {
  2703. ("production" !== "development" ? invariant(
  2704. !EventPluginRegistry.registrationNameModules[registrationName],
  2705. 'EventPluginHub: More than one plugin attempted to publish the same ' +
  2706. 'registration name, `%s`.',
  2707. registrationName
  2708. ) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
  2709. EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
  2710. EventPluginRegistry.registrationNameDependencies[registrationName] =
  2711. PluginModule.eventTypes[eventName].dependencies;
  2712. }
  2713. /**
  2714. * Registers plugins so that they can extract and dispatch events.
  2715. *
  2716. * @see {EventPluginHub}
  2717. */
  2718. var EventPluginRegistry = {
  2719. /**
  2720. * Ordered list of injected plugins.
  2721. */
  2722. plugins: [],
  2723. /**
  2724. * Mapping from event name to dispatch config
  2725. */
  2726. eventNameDispatchConfigs: {},
  2727. /**
  2728. * Mapping from registration name to plugin module
  2729. */
  2730. registrationNameModules: {},
  2731. /**
  2732. * Mapping from registration name to event name
  2733. */
  2734. registrationNameDependencies: {},
  2735. /**
  2736. * Injects an ordering of plugins (by plugin name). This allows the ordering
  2737. * to be decoupled from injection of the actual plugins so that ordering is
  2738. * always deterministic regardless of packaging, on-the-fly injection, etc.
  2739. *
  2740. * @param {array} InjectedEventPluginOrder
  2741. * @internal
  2742. * @see {EventPluginHub.injection.injectEventPluginOrder}
  2743. */
  2744. injectEventPluginOrder: function(InjectedEventPluginOrder) {
  2745. ("production" !== "development" ? invariant(
  2746. !EventPluginOrder,
  2747. 'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
  2748. 'once. You are likely trying to load more than one copy of React.'
  2749. ) : invariant(!EventPluginOrder));
  2750. // Clone the ordering so it cannot be dynamically mutated.
  2751. EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
  2752. recomputePluginOrdering();
  2753. },
  2754. /**
  2755. * Injects plugins to be used by `EventPluginHub`. The plugin names must be
  2756. * in the ordering injected by `injectEventPluginOrder`.
  2757. *
  2758. * Plugins can be injected as part of page initialization or on-the-fly.
  2759. *
  2760. * @param {object} injectedNamesToPlugins Map from names to plugin modules.
  2761. * @internal
  2762. * @see {EventPluginHub.injection.injectEventPluginsByName}
  2763. */
  2764. injectEventPluginsByName: function(injectedNamesToPlugins) {
  2765. var isOrderingDirty = false;
  2766. for (var pluginName in injectedNamesToPlugins) {
  2767. if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
  2768. continue;
  2769. }
  2770. var PluginModule = injectedNamesToPlugins[pluginName];
  2771. if (!namesToPlugins.hasOwnProperty(pluginName) ||
  2772. namesToPlugins[pluginName] !== PluginModule) {
  2773. ("production" !== "development" ? invariant(
  2774. !namesToPlugins[pluginName],
  2775. 'EventPluginRegistry: Cannot inject two different event plugins ' +
  2776. 'using the same name, `%s`.',
  2777. pluginName
  2778. ) : invariant(!namesToPlugins[pluginName]));
  2779. namesToPlugins[pluginName] = PluginModule;
  2780. isOrderingDirty = true;
  2781. }
  2782. }
  2783. if (isOrderingDirty) {
  2784. recomputePluginOrdering();
  2785. }
  2786. },
  2787. /**
  2788. * Looks up the plugin for the supplied event.
  2789. *
  2790. * @param {object} event A synthetic event.
  2791. * @return {?object} The plugin that created the supplied event.
  2792. * @internal
  2793. */
  2794. getPluginModuleForEvent: function(event) {
  2795. var dispatchConfig = event.dispatchConfig;
  2796. if (dispatchConfig.registrationName) {
  2797. return EventPluginRegistry.registrationNameModules[
  2798. dispatchConfig.registrationName
  2799. ] || null;
  2800. }
  2801. for (var phase in dispatchConfig.phasedRegistrationNames) {
  2802. if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
  2803. continue;
  2804. }
  2805. var PluginModule = EventPluginRegistry.registrationNameModules[
  2806. dispatchConfig.phasedRegistrationNames[phase]
  2807. ];
  2808. if (PluginModule) {
  2809. return PluginModule;
  2810. }
  2811. }
  2812. return null;
  2813. },
  2814. /**
  2815. * Exposed for unit testing.
  2816. * @private
  2817. */
  2818. _resetEventPlugins: function() {
  2819. EventPluginOrder = null;
  2820. for (var pluginName in namesToPlugins) {
  2821. if (namesToPlugins.hasOwnProperty(pluginName)) {
  2822. delete namesToPlugins[pluginName];
  2823. }
  2824. }
  2825. EventPluginRegistry.plugins.length = 0;
  2826. var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
  2827. for (var eventName in eventNameDispatchConfigs) {
  2828. if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
  2829. delete eventNameDispatchConfigs[eventName];
  2830. }
  2831. }
  2832. var registrationNameModules = EventPluginRegistry.registrationNameModules;
  2833. for (var registrationName in registrationNameModules) {
  2834. if (registrationNameModules.hasOwnProperty(registrationName)) {
  2835. delete registrationNameModules[registrationName];
  2836. }
  2837. }
  2838. }
  2839. };
  2840. module.exports = EventPluginRegistry;
  2841. },{"135":135}],19:[function(_dereq_,module,exports){
  2842. /**
  2843. * Copyright 2013-2015, Facebook, Inc.
  2844. * All rights reserved.
  2845. *
  2846. * This source code is licensed under the BSD-style license found in the
  2847. * LICENSE file in the root directory of this source tree. An additional grant
  2848. * of patent rights can be found in the PATENTS file in the same directory.
  2849. *
  2850. * @providesModule EventPluginUtils
  2851. */
  2852. 'use strict';
  2853. var EventConstants = _dereq_(15);
  2854. var invariant = _dereq_(135);
  2855. /**
  2856. * Injected dependencies:
  2857. */
  2858. /**
  2859. * - `Mount`: [required] Module that can convert between React dom IDs and
  2860. * actual node references.
  2861. */
  2862. var injection = {
  2863. Mount: null,
  2864. injectMount: function(InjectedMount) {
  2865. injection.Mount = InjectedMount;
  2866. if ("production" !== "development") {
  2867. ("production" !== "development" ? invariant(
  2868. InjectedMount && InjectedMount.getNode,
  2869. 'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
  2870. 'is missing getNode.'
  2871. ) : invariant(InjectedMount && InjectedMount.getNode));
  2872. }
  2873. }
  2874. };
  2875. var topLevelTypes = EventConstants.topLevelTypes;
  2876. function isEndish(topLevelType) {
  2877. return topLevelType === topLevelTypes.topMouseUp ||
  2878. topLevelType === topLevelTypes.topTouchEnd ||
  2879. topLevelType === topLevelTypes.topTouchCancel;
  2880. }
  2881. function isMoveish(topLevelType) {
  2882. return topLevelType === topLevelTypes.topMouseMove ||
  2883. topLevelType === topLevelTypes.topTouchMove;
  2884. }
  2885. function isStartish(topLevelType) {
  2886. return topLevelType === topLevelTypes.topMouseDown ||
  2887. topLevelType === topLevelTypes.topTouchStart;
  2888. }
  2889. var validateEventDispatches;
  2890. if ("production" !== "development") {
  2891. validateEventDispatches = function(event) {
  2892. var dispatchListeners = event._dispatchListeners;
  2893. var dispatchIDs = event._dispatchIDs;
  2894. var listenersIsArr = Array.isArray(dispatchListeners);
  2895. var idsIsArr = Array.isArray(dispatchIDs);
  2896. var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
  2897. var listenersLen = listenersIsArr ?
  2898. dispatchListeners.length :
  2899. dispatchListeners ? 1 : 0;
  2900. ("production" !== "development" ? invariant(
  2901. idsIsArr === listenersIsArr && IDsLen === listenersLen,
  2902. 'EventPluginUtils: Invalid `event`.'
  2903. ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
  2904. };
  2905. }
  2906. /**
  2907. * Invokes `cb(event, listener, id)`. Avoids using call if no scope is
  2908. * provided. The `(listener,id)` pair effectively forms the "dispatch" but are
  2909. * kept separate to conserve memory.
  2910. */
  2911. function forEachEventDispatch(event, cb) {
  2912. var dispatchListeners = event._dispatchListeners;
  2913. var dispatchIDs = event._dispatchIDs;
  2914. if ("production" !== "development") {
  2915. validateEventDispatches(event);
  2916. }
  2917. if (Array.isArray(dispatchListeners)) {
  2918. for (var i = 0; i < dispatchListeners.length; i++) {
  2919. if (event.isPropagationStopped()) {
  2920. break;
  2921. }
  2922. // Listeners and IDs are two parallel arrays that are always in sync.
  2923. cb(event, dispatchListeners[i], dispatchIDs[i]);
  2924. }
  2925. } else if (dispatchListeners) {
  2926. cb(event, dispatchListeners, dispatchIDs);
  2927. }
  2928. }
  2929. /**
  2930. * Default implementation of PluginModule.executeDispatch().
  2931. * @param {SyntheticEvent} SyntheticEvent to handle
  2932. * @param {function} Application-level callback
  2933. * @param {string} domID DOM id to pass to the callback.
  2934. */
  2935. function executeDispatch(event, listener, domID) {
  2936. event.currentTarget = injection.Mount.getNode(domID);
  2937. var returnValue = listener(event, domID);
  2938. event.currentTarget = null;
  2939. return returnValue;
  2940. }
  2941. /**
  2942. * Standard/simple iteration through an event's collected dispatches.
  2943. */
  2944. function executeDispatchesInOrder(event, cb) {
  2945. forEachEventDispatch(event, cb);
  2946. event._dispatchListeners = null;
  2947. event._dispatchIDs = null;
  2948. }
  2949. /**
  2950. * Standard/simple iteration through an event's collected dispatches, but stops
  2951. * at the first dispatch execution returning true, and returns that id.
  2952. *
  2953. * @return id of the first dispatch execution who's listener returns true, or
  2954. * null if no listener returned true.
  2955. */
  2956. function executeDispatchesInOrderStopAtTrueImpl(event) {
  2957. var dispatchListeners = event._dispatchListeners;
  2958. var dispatchIDs = event._dispatchIDs;
  2959. if ("production" !== "development") {
  2960. validateEventDispatches(event);
  2961. }
  2962. if (Array.isArray(dispatchListeners)) {
  2963. for (var i = 0; i < dispatchListeners.length; i++) {
  2964. if (event.isPropagationStopped()) {
  2965. break;
  2966. }
  2967. // Listeners and IDs are two parallel arrays that are always in sync.
  2968. if (dispatchListeners[i](event, dispatchIDs[i])) {
  2969. return dispatchIDs[i];
  2970. }
  2971. }
  2972. } else if (dispatchListeners) {
  2973. if (dispatchListeners(event, dispatchIDs)) {
  2974. return dispatchIDs;
  2975. }
  2976. }
  2977. return null;
  2978. }
  2979. /**
  2980. * @see executeDispatchesInOrderStopAtTrueImpl
  2981. */
  2982. function executeDispatchesInOrderStopAtTrue(event) {
  2983. var ret = executeDispatchesInOrderStopAtTrueImpl(event);
  2984. event._dispatchIDs = null;
  2985. event._dispatchListeners = null;
  2986. return ret;
  2987. }
  2988. /**
  2989. * Execution of a "direct" dispatch - there must be at most one dispatch
  2990. * accumulated on the event or it is considered an error. It doesn't really make
  2991. * sense for an event with multiple dispatches (bubbled) to keep track of the
  2992. * return values at each dispatch execution, but it does tend to make sense when
  2993. * dealing with "direct" dispatches.
  2994. *
  2995. * @return The return value of executing the single dispatch.
  2996. */
  2997. function executeDirectDispatch(event) {
  2998. if ("production" !== "development") {
  2999. validateEventDispatches(event);
  3000. }
  3001. var dispatchListener = event._dispatchListeners;
  3002. var dispatchID = event._dispatchIDs;
  3003. ("production" !== "development" ? invariant(
  3004. !Array.isArray(dispatchListener),
  3005. 'executeDirectDispatch(...): Invalid `event`.'
  3006. ) : invariant(!Array.isArray(dispatchListener)));
  3007. var res = dispatchListener ?
  3008. dispatchListener(event, dispatchID) :
  3009. null;
  3010. event._dispatchListeners = null;
  3011. event._dispatchIDs = null;
  3012. return res;
  3013. }
  3014. /**
  3015. * @param {SyntheticEvent} event
  3016. * @return {bool} True iff number of dispatches accumulated is greater than 0.
  3017. */
  3018. function hasDispatches(event) {
  3019. return !!event._dispatchListeners;
  3020. }
  3021. /**
  3022. * General utilities that are useful in creating custom Event Plugins.
  3023. */
  3024. var EventPluginUtils = {
  3025. isEndish: isEndish,
  3026. isMoveish: isMoveish,
  3027. isStartish: isStartish,
  3028. executeDirectDispatch: executeDirectDispatch,
  3029. executeDispatch: executeDispatch,
  3030. executeDispatchesInOrder: executeDispatchesInOrder,
  3031. executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
  3032. hasDispatches: hasDispatches,
  3033. injection: injection,
  3034. useTouchEvents: false
  3035. };
  3036. module.exports = EventPluginUtils;
  3037. },{"135":135,"15":15}],20:[function(_dereq_,module,exports){
  3038. /**
  3039. * Copyright 2013-2015, Facebook, Inc.
  3040. * All rights reserved.
  3041. *
  3042. * This source code is licensed under the BSD-style license found in the
  3043. * LICENSE file in the root directory of this source tree. An additional grant
  3044. * of patent rights can be found in the PATENTS file in the same directory.
  3045. *
  3046. * @providesModule EventPropagators
  3047. */
  3048. 'use strict';
  3049. var EventConstants = _dereq_(15);
  3050. var EventPluginHub = _dereq_(17);
  3051. var accumulateInto = _dereq_(105);
  3052. var forEachAccumulated = _dereq_(120);
  3053. var PropagationPhases = EventConstants.PropagationPhases;
  3054. var getListener = EventPluginHub.getListener;
  3055. /**
  3056. * Some event types have a notion of different registration names for different
  3057. * "phases" of propagation. This finds listeners by a given phase.
  3058. */
  3059. function listenerAtPhase(id, event, propagationPhase) {
  3060. var registrationName =
  3061. event.dispatchConfig.phasedRegistrationNames[propagationPhase];
  3062. return getListener(id, registrationName);
  3063. }
  3064. /**
  3065. * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
  3066. * here, allows us to not have to bind or create functions for each event.
  3067. * Mutating the event's members allows us to not have to create a wrapping
  3068. * "dispatch" object that pairs the event with the listener.
  3069. */
  3070. function accumulateDirectionalDispatches(domID, upwards, event) {
  3071. if ("production" !== "development") {
  3072. if (!domID) {
  3073. throw new Error('Dispatching id must not be null');
  3074. }
  3075. }
  3076. var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
  3077. var listener = listenerAtPhase(domID, event, phase);
  3078. if (listener) {
  3079. event._dispatchListeners =
  3080. accumulateInto(event._dispatchListeners, listener);
  3081. event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
  3082. }
  3083. }
  3084. /**
  3085. * Collect dispatches (must be entirely collected before dispatching - see unit
  3086. * tests). Lazily allocate the array to conserve memory. We must loop through
  3087. * each event and perform the traversal for each one. We can not perform a
  3088. * single traversal for the entire collection of events because each event may
  3089. * have a different target.
  3090. */
  3091. function accumulateTwoPhaseDispatchesSingle(event) {
  3092. if (event && event.dispatchConfig.phasedRegistrationNames) {
  3093. EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
  3094. event.dispatchMarker,
  3095. accumulateDirectionalDispatches,
  3096. event
  3097. );
  3098. }
  3099. }
  3100. /**
  3101. * Accumulates without regard to direction, does not look for phased
  3102. * registration names. Same as `accumulateDirectDispatchesSingle` but without
  3103. * requiring that the `dispatchMarker` be the same as the dispatched ID.
  3104. */
  3105. function accumulateDispatches(id, ignoredDirection, event) {
  3106. if (event && event.dispatchConfig.registrationName) {
  3107. var registrationName = event.dispatchConfig.registrationName;
  3108. var listener = getListener(id, registrationName);
  3109. if (listener) {
  3110. event._dispatchListeners =
  3111. accumulateInto(event._dispatchListeners, listener);
  3112. event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
  3113. }
  3114. }
  3115. }
  3116. /**
  3117. * Accumulates dispatches on an `SyntheticEvent`, but only for the
  3118. * `dispatchMarker`.
  3119. * @param {SyntheticEvent} event
  3120. */
  3121. function accumulateDirectDispatchesSingle(event) {
  3122. if (event && event.dispatchConfig.registrationName) {
  3123. accumulateDispatches(event.dispatchMarker, null, event);
  3124. }
  3125. }
  3126. function accumulateTwoPhaseDispatches(events) {
  3127. forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
  3128. }
  3129. function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
  3130. EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
  3131. fromID,
  3132. toID,
  3133. accumulateDispatches,
  3134. leave,
  3135. enter
  3136. );
  3137. }
  3138. function accumulateDirectDispatches(events) {
  3139. forEachAccumulated(events, accumulateDirectDispatchesSingle);
  3140. }
  3141. /**
  3142. * A small set of propagation patterns, each of which will accept a small amount
  3143. * of information, and generate a set of "dispatch ready event objects" - which
  3144. * are sets of events that have already been annotated with a set of dispatched
  3145. * listener functions/ids. The API is designed this way to discourage these
  3146. * propagation strategies from actually executing the dispatches, since we
  3147. * always want to collect the entire set of dispatches before executing event a
  3148. * single one.
  3149. *
  3150. * @constructor EventPropagators
  3151. */
  3152. var EventPropagators = {
  3153. accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
  3154. accumulateDirectDispatches: accumulateDirectDispatches,
  3155. accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
  3156. };
  3157. module.exports = EventPropagators;
  3158. },{"105":105,"120":120,"15":15,"17":17}],21:[function(_dereq_,module,exports){
  3159. /**
  3160. * Copyright 2013-2015, Facebook, Inc.
  3161. * All rights reserved.
  3162. *
  3163. * This source code is licensed under the BSD-style license found in the
  3164. * LICENSE file in the root directory of this source tree. An additional grant
  3165. * of patent rights can be found in the PATENTS file in the same directory.
  3166. *
  3167. * @providesModule ExecutionEnvironment
  3168. */
  3169. /*jslint evil: true */
  3170. "use strict";
  3171. var canUseDOM = !!(
  3172. (typeof window !== 'undefined' &&
  3173. window.document && window.document.createElement)
  3174. );
  3175. /**
  3176. * Simple, lightweight module assisting with the detection and context of
  3177. * Worker. Helps avoid circular dependencies and allows code to reason about
  3178. * whether or not they are in a Worker, even if they never include the main
  3179. * `ReactWorker` dependency.
  3180. */
  3181. var ExecutionEnvironment = {
  3182. canUseDOM: canUseDOM,
  3183. canUseWorkers: typeof Worker !== 'undefined',
  3184. canUseEventListeners:
  3185. canUseDOM && !!(window.addEventListener || window.attachEvent),
  3186. canUseViewport: canUseDOM && !!window.screen,
  3187. isInWorker: !canUseDOM // For now, this is true - might change in the future.
  3188. };
  3189. module.exports = ExecutionEnvironment;
  3190. },{}],22:[function(_dereq_,module,exports){
  3191. /**
  3192. * Copyright 2013-2015, Facebook, Inc.
  3193. * All rights reserved.
  3194. *
  3195. * This source code is licensed under the BSD-style license found in the
  3196. * LICENSE file in the root directory of this source tree. An additional grant
  3197. * of patent rights can be found in the PATENTS file in the same directory.
  3198. *
  3199. * @providesModule FallbackCompositionState
  3200. * @typechecks static-only
  3201. */
  3202. 'use strict';
  3203. var PooledClass = _dereq_(28);
  3204. var assign = _dereq_(27);
  3205. var getTextContentAccessor = _dereq_(130);
  3206. /**
  3207. * This helper class stores information about text content of a target node,
  3208. * allowing comparison of content before and after a given event.
  3209. *
  3210. * Identify the node where selection currently begins, then observe
  3211. * both its text content and its current position in the DOM. Since the
  3212. * browser may natively replace the target node during composition, we can
  3213. * use its position to find its replacement.
  3214. *
  3215. * @param {DOMEventTarget} root
  3216. */
  3217. function FallbackCompositionState(root) {
  3218. this._root = root;
  3219. this._startText = this.getText();
  3220. this._fallbackText = null;
  3221. }
  3222. assign(FallbackCompositionState.prototype, {
  3223. /**
  3224. * Get current text of input.
  3225. *
  3226. * @return {string}
  3227. */
  3228. getText: function() {
  3229. if ('value' in this._root) {
  3230. return this._root.value;
  3231. }
  3232. return this._root[getTextContentAccessor()];
  3233. },
  3234. /**
  3235. * Determine the differing substring between the initially stored
  3236. * text content and the current content.
  3237. *
  3238. * @return {string}
  3239. */
  3240. getData: function() {
  3241. if (this._fallbackText) {
  3242. return this._fallbackText;
  3243. }
  3244. var start;
  3245. var startValue = this._startText;
  3246. var startLength = startValue.length;
  3247. var end;
  3248. var endValue = this.getText();
  3249. var endLength = endValue.length;
  3250. for (start = 0; start < startLength; start++) {
  3251. if (startValue[start] !== endValue[start]) {
  3252. break;
  3253. }
  3254. }
  3255. var minEnd = startLength - start;
  3256. for (end = 1; end <= minEnd; end++) {
  3257. if (startValue[startLength - end] !== endValue[endLength - end]) {
  3258. break;
  3259. }
  3260. }
  3261. var sliceTail = end > 1 ? 1 - end : undefined;
  3262. this._fallbackText = endValue.slice(start, sliceTail);
  3263. return this._fallbackText;
  3264. }
  3265. });
  3266. PooledClass.addPoolingTo(FallbackCompositionState);
  3267. module.exports = FallbackCompositionState;
  3268. },{"130":130,"27":27,"28":28}],23:[function(_dereq_,module,exports){
  3269. /**
  3270. * Copyright 2013-2015, Facebook, Inc.
  3271. * All rights reserved.
  3272. *
  3273. * This source code is licensed under the BSD-style license found in the
  3274. * LICENSE file in the root directory of this source tree. An additional grant
  3275. * of patent rights can be found in the PATENTS file in the same directory.
  3276. *
  3277. * @providesModule HTMLDOMPropertyConfig
  3278. */
  3279. /*jslint bitwise: true*/
  3280. 'use strict';
  3281. var DOMProperty = _dereq_(10);
  3282. var ExecutionEnvironment = _dereq_(21);
  3283. var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
  3284. var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
  3285. var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
  3286. var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
  3287. var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
  3288. var HAS_POSITIVE_NUMERIC_VALUE =
  3289. DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
  3290. var HAS_OVERLOADED_BOOLEAN_VALUE =
  3291. DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
  3292. var hasSVG;
  3293. if (ExecutionEnvironment.canUseDOM) {
  3294. var implementation = document.implementation;
  3295. hasSVG = (
  3296. implementation &&
  3297. implementation.hasFeature &&
  3298. implementation.hasFeature(
  3299. 'http://www.w3.org/TR/SVG11/feature#BasicStructure',
  3300. '1.1'
  3301. )
  3302. );
  3303. }
  3304. var HTMLDOMPropertyConfig = {
  3305. isCustomAttribute: RegExp.prototype.test.bind(
  3306. /^(data|aria)-[a-z_][a-z\d_.\-]*$/
  3307. ),
  3308. Properties: {
  3309. /**
  3310. * Standard Properties
  3311. */
  3312. accept: null,
  3313. acceptCharset: null,
  3314. accessKey: null,
  3315. action: null,
  3316. allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3317. allowTransparency: MUST_USE_ATTRIBUTE,
  3318. alt: null,
  3319. async: HAS_BOOLEAN_VALUE,
  3320. autoComplete: null,
  3321. // autoFocus is polyfilled/normalized by AutoFocusMixin
  3322. // autoFocus: HAS_BOOLEAN_VALUE,
  3323. autoPlay: HAS_BOOLEAN_VALUE,
  3324. cellPadding: null,
  3325. cellSpacing: null,
  3326. charSet: MUST_USE_ATTRIBUTE,
  3327. checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3328. classID: MUST_USE_ATTRIBUTE,
  3329. // To set className on SVG elements, it's necessary to use .setAttribute;
  3330. // this works on HTML elements too in all browsers except IE8. Conveniently,
  3331. // IE8 doesn't support SVG and so we can simply use the attribute in
  3332. // browsers that support SVG and the property in browsers that don't,
  3333. // regardless of whether the element is HTML or SVG.
  3334. className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
  3335. cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3336. colSpan: null,
  3337. content: null,
  3338. contentEditable: null,
  3339. contextMenu: MUST_USE_ATTRIBUTE,
  3340. controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3341. coords: null,
  3342. crossOrigin: null,
  3343. data: null, // For `<object />` acts as `src`.
  3344. dateTime: MUST_USE_ATTRIBUTE,
  3345. defer: HAS_BOOLEAN_VALUE,
  3346. dir: null,
  3347. disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3348. download: HAS_OVERLOADED_BOOLEAN_VALUE,
  3349. draggable: null,
  3350. encType: null,
  3351. form: MUST_USE_ATTRIBUTE,
  3352. formAction: MUST_USE_ATTRIBUTE,
  3353. formEncType: MUST_USE_ATTRIBUTE,
  3354. formMethod: MUST_USE_ATTRIBUTE,
  3355. formNoValidate: HAS_BOOLEAN_VALUE,
  3356. formTarget: MUST_USE_ATTRIBUTE,
  3357. frameBorder: MUST_USE_ATTRIBUTE,
  3358. headers: null,
  3359. height: MUST_USE_ATTRIBUTE,
  3360. hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3361. high: null,
  3362. href: null,
  3363. hrefLang: null,
  3364. htmlFor: null,
  3365. httpEquiv: null,
  3366. icon: null,
  3367. id: MUST_USE_PROPERTY,
  3368. label: null,
  3369. lang: null,
  3370. list: MUST_USE_ATTRIBUTE,
  3371. loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3372. low: null,
  3373. manifest: MUST_USE_ATTRIBUTE,
  3374. marginHeight: null,
  3375. marginWidth: null,
  3376. max: null,
  3377. maxLength: MUST_USE_ATTRIBUTE,
  3378. media: MUST_USE_ATTRIBUTE,
  3379. mediaGroup: null,
  3380. method: null,
  3381. min: null,
  3382. multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3383. muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3384. name: null,
  3385. noValidate: HAS_BOOLEAN_VALUE,
  3386. open: HAS_BOOLEAN_VALUE,
  3387. optimum: null,
  3388. pattern: null,
  3389. placeholder: null,
  3390. poster: null,
  3391. preload: null,
  3392. radioGroup: null,
  3393. readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3394. rel: null,
  3395. required: HAS_BOOLEAN_VALUE,
  3396. role: MUST_USE_ATTRIBUTE,
  3397. rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3398. rowSpan: null,
  3399. sandbox: null,
  3400. scope: null,
  3401. scoped: HAS_BOOLEAN_VALUE,
  3402. scrolling: null,
  3403. seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3404. selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
  3405. shape: null,
  3406. size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
  3407. sizes: MUST_USE_ATTRIBUTE,
  3408. span: HAS_POSITIVE_NUMERIC_VALUE,
  3409. spellCheck: null,
  3410. src: null,
  3411. srcDoc: MUST_USE_PROPERTY,
  3412. srcSet: MUST_USE_ATTRIBUTE,
  3413. start: HAS_NUMERIC_VALUE,
  3414. step: null,
  3415. style: null,
  3416. tabIndex: null,
  3417. target: null,
  3418. title: null,
  3419. type: null,
  3420. useMap: null,
  3421. value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
  3422. width: MUST_USE_ATTRIBUTE,
  3423. wmode: MUST_USE_ATTRIBUTE,
  3424. /**
  3425. * Non-standard Properties
  3426. */
  3427. // autoCapitalize and autoCorrect are supported in Mobile Safari for
  3428. // keyboard hints.
  3429. autoCapitalize: null,
  3430. autoCorrect: null,
  3431. // itemProp, itemScope, itemType are for
  3432. // Microdata support. See http://schema.org/docs/gs.html
  3433. itemProp: MUST_USE_ATTRIBUTE,
  3434. itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
  3435. itemType: MUST_USE_ATTRIBUTE,
  3436. // itemID and itemRef are for Microdata support as well but
  3437. // only specified in the the WHATWG spec document. See
  3438. // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
  3439. itemID: MUST_USE_ATTRIBUTE,
  3440. itemRef: MUST_USE_ATTRIBUTE,
  3441. // property is supported for OpenGraph in meta tags.
  3442. property: null,
  3443. // IE-only attribute that controls focus behavior
  3444. unselectable: MUST_USE_ATTRIBUTE
  3445. },
  3446. DOMAttributeNames: {
  3447. acceptCharset: 'accept-charset',
  3448. className: 'class',
  3449. htmlFor: 'for',
  3450. httpEquiv: 'http-equiv'
  3451. },
  3452. DOMPropertyNames: {
  3453. autoCapitalize: 'autocapitalize',
  3454. autoComplete: 'autocomplete',
  3455. autoCorrect: 'autocorrect',
  3456. autoFocus: 'autofocus',
  3457. autoPlay: 'autoplay',
  3458. // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
  3459. // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
  3460. encType: 'encoding',
  3461. hrefLang: 'hreflang',
  3462. radioGroup: 'radiogroup',
  3463. spellCheck: 'spellcheck',
  3464. srcDoc: 'srcdoc',
  3465. srcSet: 'srcset'
  3466. }
  3467. };
  3468. module.exports = HTMLDOMPropertyConfig;
  3469. },{"10":10,"21":21}],24:[function(_dereq_,module,exports){
  3470. /**
  3471. * Copyright 2013-2015, Facebook, Inc.
  3472. * All rights reserved.
  3473. *
  3474. * This source code is licensed under the BSD-style license found in the
  3475. * LICENSE file in the root directory of this source tree. An additional grant
  3476. * of patent rights can be found in the PATENTS file in the same directory.
  3477. *
  3478. * @providesModule LinkedValueUtils
  3479. * @typechecks static-only
  3480. */
  3481. 'use strict';
  3482. var ReactPropTypes = _dereq_(78);
  3483. var invariant = _dereq_(135);
  3484. var hasReadOnlyValue = {
  3485. 'button': true,
  3486. 'checkbox': true,
  3487. 'image': true,
  3488. 'hidden': true,
  3489. 'radio': true,
  3490. 'reset': true,
  3491. 'submit': true
  3492. };
  3493. function _assertSingleLink(input) {
  3494. ("production" !== "development" ? invariant(
  3495. input.props.checkedLink == null || input.props.valueLink == null,
  3496. 'Cannot provide a checkedLink and a valueLink. If you want to use ' +
  3497. 'checkedLink, you probably don\'t want to use valueLink and vice versa.'
  3498. ) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
  3499. }
  3500. function _assertValueLink(input) {
  3501. _assertSingleLink(input);
  3502. ("production" !== "development" ? invariant(
  3503. input.props.value == null && input.props.onChange == null,
  3504. 'Cannot provide a valueLink and a value or onChange event. If you want ' +
  3505. 'to use value or onChange, you probably don\'t want to use valueLink.'
  3506. ) : invariant(input.props.value == null && input.props.onChange == null));
  3507. }
  3508. function _assertCheckedLink(input) {
  3509. _assertSingleLink(input);
  3510. ("production" !== "development" ? invariant(
  3511. input.props.checked == null && input.props.onChange == null,
  3512. 'Cannot provide a checkedLink and a checked property or onChange event. ' +
  3513. 'If you want to use checked or onChange, you probably don\'t want to ' +
  3514. 'use checkedLink'
  3515. ) : invariant(input.props.checked == null && input.props.onChange == null));
  3516. }
  3517. /**
  3518. * @param {SyntheticEvent} e change event to handle
  3519. */
  3520. function _handleLinkedValueChange(e) {
  3521. /*jshint validthis:true */
  3522. this.props.valueLink.requestChange(e.target.value);
  3523. }
  3524. /**
  3525. * @param {SyntheticEvent} e change event to handle
  3526. */
  3527. function _handleLinkedCheckChange(e) {
  3528. /*jshint validthis:true */
  3529. this.props.checkedLink.requestChange(e.target.checked);
  3530. }
  3531. /**
  3532. * Provide a linked `value` attribute for controlled forms. You should not use
  3533. * this outside of the ReactDOM controlled form components.
  3534. */
  3535. var LinkedValueUtils = {
  3536. Mixin: {
  3537. propTypes: {
  3538. value: function(props, propName, componentName) {
  3539. if (!props[propName] ||
  3540. hasReadOnlyValue[props.type] ||
  3541. props.onChange ||
  3542. props.readOnly ||
  3543. props.disabled) {
  3544. return null;
  3545. }
  3546. return new Error(
  3547. 'You provided a `value` prop to a form field without an ' +
  3548. '`onChange` handler. This will render a read-only field. If ' +
  3549. 'the field should be mutable use `defaultValue`. Otherwise, ' +
  3550. 'set either `onChange` or `readOnly`.'
  3551. );
  3552. },
  3553. checked: function(props, propName, componentName) {
  3554. if (!props[propName] ||
  3555. props.onChange ||
  3556. props.readOnly ||
  3557. props.disabled) {
  3558. return null;
  3559. }
  3560. return new Error(
  3561. 'You provided a `checked` prop to a form field without an ' +
  3562. '`onChange` handler. This will render a read-only field. If ' +
  3563. 'the field should be mutable use `defaultChecked`. Otherwise, ' +
  3564. 'set either `onChange` or `readOnly`.'
  3565. );
  3566. },
  3567. onChange: ReactPropTypes.func
  3568. }
  3569. },
  3570. /**
  3571. * @param {ReactComponent} input Form component
  3572. * @return {*} current value of the input either from value prop or link.
  3573. */
  3574. getValue: function(input) {
  3575. if (input.props.valueLink) {
  3576. _assertValueLink(input);
  3577. return input.props.valueLink.value;
  3578. }
  3579. return input.props.value;
  3580. },
  3581. /**
  3582. * @param {ReactComponent} input Form component
  3583. * @return {*} current checked status of the input either from checked prop
  3584. * or link.
  3585. */
  3586. getChecked: function(input) {
  3587. if (input.props.checkedLink) {
  3588. _assertCheckedLink(input);
  3589. return input.props.checkedLink.value;
  3590. }
  3591. return input.props.checked;
  3592. },
  3593. /**
  3594. * @param {ReactComponent} input Form component
  3595. * @return {function} change callback either from onChange prop or link.
  3596. */
  3597. getOnChange: function(input) {
  3598. if (input.props.valueLink) {
  3599. _assertValueLink(input);
  3600. return _handleLinkedValueChange;
  3601. } else if (input.props.checkedLink) {
  3602. _assertCheckedLink(input);
  3603. return _handleLinkedCheckChange;
  3604. }
  3605. return input.props.onChange;
  3606. }
  3607. };
  3608. module.exports = LinkedValueUtils;
  3609. },{"135":135,"78":78}],25:[function(_dereq_,module,exports){
  3610. /**
  3611. * Copyright 2014-2015, Facebook, Inc.
  3612. * All rights reserved.
  3613. *
  3614. * This source code is licensed under the BSD-style license found in the
  3615. * LICENSE file in the root directory of this source tree. An additional grant
  3616. * of patent rights can be found in the PATENTS file in the same directory.
  3617. *
  3618. * @providesModule LocalEventTrapMixin
  3619. */
  3620. 'use strict';
  3621. var ReactBrowserEventEmitter = _dereq_(30);
  3622. var accumulateInto = _dereq_(105);
  3623. var forEachAccumulated = _dereq_(120);
  3624. var invariant = _dereq_(135);
  3625. function remove(event) {
  3626. event.remove();
  3627. }
  3628. var LocalEventTrapMixin = {
  3629. trapBubbledEvent:function(topLevelType, handlerBaseName) {
  3630. ("production" !== "development" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
  3631. // If a component renders to null or if another component fatals and causes
  3632. // the state of the tree to be corrupted, `node` here can be null.
  3633. var node = this.getDOMNode();
  3634. ("production" !== "development" ? invariant(
  3635. node,
  3636. 'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
  3637. ) : invariant(node));
  3638. var listener = ReactBrowserEventEmitter.trapBubbledEvent(
  3639. topLevelType,
  3640. handlerBaseName,
  3641. node
  3642. );
  3643. this._localEventListeners =
  3644. accumulateInto(this._localEventListeners, listener);
  3645. },
  3646. // trapCapturedEvent would look nearly identical. We don't implement that
  3647. // method because it isn't currently needed.
  3648. componentWillUnmount:function() {
  3649. if (this._localEventListeners) {
  3650. forEachAccumulated(this._localEventListeners, remove);
  3651. }
  3652. }
  3653. };
  3654. module.exports = LocalEventTrapMixin;
  3655. },{"105":105,"120":120,"135":135,"30":30}],26:[function(_dereq_,module,exports){
  3656. /**
  3657. * Copyright 2013-2015, Facebook, Inc.
  3658. * All rights reserved.
  3659. *
  3660. * This source code is licensed under the BSD-style license found in the
  3661. * LICENSE file in the root directory of this source tree. An additional grant
  3662. * of patent rights can be found in the PATENTS file in the same directory.
  3663. *
  3664. * @providesModule MobileSafariClickEventPlugin
  3665. * @typechecks static-only
  3666. */
  3667. 'use strict';
  3668. var EventConstants = _dereq_(15);
  3669. var emptyFunction = _dereq_(114);
  3670. var topLevelTypes = EventConstants.topLevelTypes;
  3671. /**
  3672. * Mobile Safari does not fire properly bubble click events on non-interactive
  3673. * elements, which means delegated click listeners do not fire. The workaround
  3674. * for this bug involves attaching an empty click listener on the target node.
  3675. *
  3676. * This particular plugin works around the bug by attaching an empty click
  3677. * listener on `touchstart` (which does fire on every element).
  3678. */
  3679. var MobileSafariClickEventPlugin = {
  3680. eventTypes: null,
  3681. /**
  3682. * @param {string} topLevelType Record from `EventConstants`.
  3683. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  3684. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  3685. * @param {object} nativeEvent Native browser event.
  3686. * @return {*} An accumulation of synthetic events.
  3687. * @see {EventPluginHub.extractEvents}
  3688. */
  3689. extractEvents: function(
  3690. topLevelType,
  3691. topLevelTarget,
  3692. topLevelTargetID,
  3693. nativeEvent) {
  3694. if (topLevelType === topLevelTypes.topTouchStart) {
  3695. var target = nativeEvent.target;
  3696. if (target && !target.onclick) {
  3697. target.onclick = emptyFunction;
  3698. }
  3699. }
  3700. }
  3701. };
  3702. module.exports = MobileSafariClickEventPlugin;
  3703. },{"114":114,"15":15}],27:[function(_dereq_,module,exports){
  3704. /**
  3705. * Copyright 2014-2015, Facebook, Inc.
  3706. * All rights reserved.
  3707. *
  3708. * This source code is licensed under the BSD-style license found in the
  3709. * LICENSE file in the root directory of this source tree. An additional grant
  3710. * of patent rights can be found in the PATENTS file in the same directory.
  3711. *
  3712. * @providesModule Object.assign
  3713. */
  3714. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
  3715. 'use strict';
  3716. function assign(target, sources) {
  3717. if (target == null) {
  3718. throw new TypeError('Object.assign target cannot be null or undefined');
  3719. }
  3720. var to = Object(target);
  3721. var hasOwnProperty = Object.prototype.hasOwnProperty;
  3722. for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
  3723. var nextSource = arguments[nextIndex];
  3724. if (nextSource == null) {
  3725. continue;
  3726. }
  3727. var from = Object(nextSource);
  3728. // We don't currently support accessors nor proxies. Therefore this
  3729. // copy cannot throw. If we ever supported this then we must handle
  3730. // exceptions and side-effects. We don't support symbols so they won't
  3731. // be transferred.
  3732. for (var key in from) {
  3733. if (hasOwnProperty.call(from, key)) {
  3734. to[key] = from[key];
  3735. }
  3736. }
  3737. }
  3738. return to;
  3739. }
  3740. module.exports = assign;
  3741. },{}],28:[function(_dereq_,module,exports){
  3742. /**
  3743. * Copyright 2013-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 PooledClass
  3751. */
  3752. 'use strict';
  3753. var invariant = _dereq_(135);
  3754. /**
  3755. * Static poolers. Several custom versions for each potential number of
  3756. * arguments. A completely generic pooler is easy to implement, but would
  3757. * require accessing the `arguments` object. In each of these, `this` refers to
  3758. * the Class itself, not an instance. If any others are needed, simply add them
  3759. * here, or in their own files.
  3760. */
  3761. var oneArgumentPooler = function(copyFieldsFrom) {
  3762. var Klass = this;
  3763. if (Klass.instancePool.length) {
  3764. var instance = Klass.instancePool.pop();
  3765. Klass.call(instance, copyFieldsFrom);
  3766. return instance;
  3767. } else {
  3768. return new Klass(copyFieldsFrom);
  3769. }
  3770. };
  3771. var twoArgumentPooler = function(a1, a2) {
  3772. var Klass = this;
  3773. if (Klass.instancePool.length) {
  3774. var instance = Klass.instancePool.pop();
  3775. Klass.call(instance, a1, a2);
  3776. return instance;
  3777. } else {
  3778. return new Klass(a1, a2);
  3779. }
  3780. };
  3781. var threeArgumentPooler = function(a1, a2, a3) {
  3782. var Klass = this;
  3783. if (Klass.instancePool.length) {
  3784. var instance = Klass.instancePool.pop();
  3785. Klass.call(instance, a1, a2, a3);
  3786. return instance;
  3787. } else {
  3788. return new Klass(a1, a2, a3);
  3789. }
  3790. };
  3791. var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
  3792. var Klass = this;
  3793. if (Klass.instancePool.length) {
  3794. var instance = Klass.instancePool.pop();
  3795. Klass.call(instance, a1, a2, a3, a4, a5);
  3796. return instance;
  3797. } else {
  3798. return new Klass(a1, a2, a3, a4, a5);
  3799. }
  3800. };
  3801. var standardReleaser = function(instance) {
  3802. var Klass = this;
  3803. ("production" !== "development" ? invariant(
  3804. instance instanceof Klass,
  3805. 'Trying to release an instance into a pool of a different type.'
  3806. ) : invariant(instance instanceof Klass));
  3807. if (instance.destructor) {
  3808. instance.destructor();
  3809. }
  3810. if (Klass.instancePool.length < Klass.poolSize) {
  3811. Klass.instancePool.push(instance);
  3812. }
  3813. };
  3814. var DEFAULT_POOL_SIZE = 10;
  3815. var DEFAULT_POOLER = oneArgumentPooler;
  3816. /**
  3817. * Augments `CopyConstructor` to be a poolable class, augmenting only the class
  3818. * itself (statically) not adding any prototypical fields. Any CopyConstructor
  3819. * you give this may have a `poolSize` property, and will look for a
  3820. * prototypical `destructor` on instances (optional).
  3821. *
  3822. * @param {Function} CopyConstructor Constructor that can be used to reset.
  3823. * @param {Function} pooler Customizable pooler.
  3824. */
  3825. var addPoolingTo = function(CopyConstructor, pooler) {
  3826. var NewKlass = CopyConstructor;
  3827. NewKlass.instancePool = [];
  3828. NewKlass.getPooled = pooler || DEFAULT_POOLER;
  3829. if (!NewKlass.poolSize) {
  3830. NewKlass.poolSize = DEFAULT_POOL_SIZE;
  3831. }
  3832. NewKlass.release = standardReleaser;
  3833. return NewKlass;
  3834. };
  3835. var PooledClass = {
  3836. addPoolingTo: addPoolingTo,
  3837. oneArgumentPooler: oneArgumentPooler,
  3838. twoArgumentPooler: twoArgumentPooler,
  3839. threeArgumentPooler: threeArgumentPooler,
  3840. fiveArgumentPooler: fiveArgumentPooler
  3841. };
  3842. module.exports = PooledClass;
  3843. },{"135":135}],29:[function(_dereq_,module,exports){
  3844. /**
  3845. * Copyright 2013-2015, Facebook, Inc.
  3846. * All rights reserved.
  3847. *
  3848. * This source code is licensed under the BSD-style license found in the
  3849. * LICENSE file in the root directory of this source tree. An additional grant
  3850. * of patent rights can be found in the PATENTS file in the same directory.
  3851. *
  3852. * @providesModule ReactBrowserComponentMixin
  3853. */
  3854. 'use strict';
  3855. var findDOMNode = _dereq_(117);
  3856. var ReactBrowserComponentMixin = {
  3857. /**
  3858. * Returns the DOM node rendered by this component.
  3859. *
  3860. * @return {DOMElement} The root node of this component.
  3861. * @final
  3862. * @protected
  3863. */
  3864. getDOMNode: function() {
  3865. return findDOMNode(this);
  3866. }
  3867. };
  3868. module.exports = ReactBrowserComponentMixin;
  3869. },{"117":117}],30:[function(_dereq_,module,exports){
  3870. /**
  3871. * Copyright 2013-2015, Facebook, Inc.
  3872. * All rights reserved.
  3873. *
  3874. * This source code is licensed under the BSD-style license found in the
  3875. * LICENSE file in the root directory of this source tree. An additional grant
  3876. * of patent rights can be found in the PATENTS file in the same directory.
  3877. *
  3878. * @providesModule ReactBrowserEventEmitter
  3879. * @typechecks static-only
  3880. */
  3881. 'use strict';
  3882. var EventConstants = _dereq_(15);
  3883. var EventPluginHub = _dereq_(17);
  3884. var EventPluginRegistry = _dereq_(18);
  3885. var ReactEventEmitterMixin = _dereq_(61);
  3886. var ViewportMetrics = _dereq_(104);
  3887. var assign = _dereq_(27);
  3888. var isEventSupported = _dereq_(136);
  3889. /**
  3890. * Summary of `ReactBrowserEventEmitter` event handling:
  3891. *
  3892. * - Top-level delegation is used to trap most native browser events. This
  3893. * may only occur in the main thread and is the responsibility of
  3894. * ReactEventListener, which is injected and can therefore support pluggable
  3895. * event sources. This is the only work that occurs in the main thread.
  3896. *
  3897. * - We normalize and de-duplicate events to account for browser quirks. This
  3898. * may be done in the worker thread.
  3899. *
  3900. * - Forward these native events (with the associated top-level type used to
  3901. * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
  3902. * to extract any synthetic events.
  3903. *
  3904. * - The `EventPluginHub` will then process each event by annotating them with
  3905. * "dispatches", a sequence of listeners and IDs that care about that event.
  3906. *
  3907. * - The `EventPluginHub` then dispatches the events.
  3908. *
  3909. * Overview of React and the event system:
  3910. *
  3911. * +------------+ .
  3912. * | DOM | .
  3913. * +------------+ .
  3914. * | .
  3915. * v .
  3916. * +------------+ .
  3917. * | ReactEvent | .
  3918. * | Listener | .
  3919. * +------------+ . +-----------+
  3920. * | . +--------+|SimpleEvent|
  3921. * | . | |Plugin |
  3922. * +-----|------+ . v +-----------+
  3923. * | | | . +--------------+ +------------+
  3924. * | +-----------.--->|EventPluginHub| | Event |
  3925. * | | . | | +-----------+ | Propagators|
  3926. * | ReactEvent | . | | |TapEvent | |------------|
  3927. * | Emitter | . | |<---+|Plugin | |other plugin|
  3928. * | | . | | +-----------+ | utilities |
  3929. * | +-----------.--->| | +------------+
  3930. * | | | . +--------------+
  3931. * +-----|------+ . ^ +-----------+
  3932. * | . | |Enter/Leave|
  3933. * + . +-------+|Plugin |
  3934. * +-------------+ . +-----------+
  3935. * | application | .
  3936. * |-------------| .
  3937. * | | .
  3938. * | | .
  3939. * +-------------+ .
  3940. * .
  3941. * React Core . General Purpose Event Plugin System
  3942. */
  3943. var alreadyListeningTo = {};
  3944. var isMonitoringScrollValue = false;
  3945. var reactTopListenersCounter = 0;
  3946. // For events like 'submit' which don't consistently bubble (which we trap at a
  3947. // lower node than `document`), binding at `document` would cause duplicate
  3948. // events so we don't include them here
  3949. var topEventMapping = {
  3950. topBlur: 'blur',
  3951. topChange: 'change',
  3952. topClick: 'click',
  3953. topCompositionEnd: 'compositionend',
  3954. topCompositionStart: 'compositionstart',
  3955. topCompositionUpdate: 'compositionupdate',
  3956. topContextMenu: 'contextmenu',
  3957. topCopy: 'copy',
  3958. topCut: 'cut',
  3959. topDoubleClick: 'dblclick',
  3960. topDrag: 'drag',
  3961. topDragEnd: 'dragend',
  3962. topDragEnter: 'dragenter',
  3963. topDragExit: 'dragexit',
  3964. topDragLeave: 'dragleave',
  3965. topDragOver: 'dragover',
  3966. topDragStart: 'dragstart',
  3967. topDrop: 'drop',
  3968. topFocus: 'focus',
  3969. topInput: 'input',
  3970. topKeyDown: 'keydown',
  3971. topKeyPress: 'keypress',
  3972. topKeyUp: 'keyup',
  3973. topMouseDown: 'mousedown',
  3974. topMouseMove: 'mousemove',
  3975. topMouseOut: 'mouseout',
  3976. topMouseOver: 'mouseover',
  3977. topMouseUp: 'mouseup',
  3978. topPaste: 'paste',
  3979. topScroll: 'scroll',
  3980. topSelectionChange: 'selectionchange',
  3981. topTextInput: 'textInput',
  3982. topTouchCancel: 'touchcancel',
  3983. topTouchEnd: 'touchend',
  3984. topTouchMove: 'touchmove',
  3985. topTouchStart: 'touchstart',
  3986. topWheel: 'wheel'
  3987. };
  3988. /**
  3989. * To ensure no conflicts with other potential React instances on the page
  3990. */
  3991. var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
  3992. function getListeningForDocument(mountAt) {
  3993. // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
  3994. // directly.
  3995. if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
  3996. mountAt[topListenersIDKey] = reactTopListenersCounter++;
  3997. alreadyListeningTo[mountAt[topListenersIDKey]] = {};
  3998. }
  3999. return alreadyListeningTo[mountAt[topListenersIDKey]];
  4000. }
  4001. /**
  4002. * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
  4003. * example:
  4004. *
  4005. * ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
  4006. *
  4007. * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
  4008. *
  4009. * @internal
  4010. */
  4011. var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
  4012. /**
  4013. * Injectable event backend
  4014. */
  4015. ReactEventListener: null,
  4016. injection: {
  4017. /**
  4018. * @param {object} ReactEventListener
  4019. */
  4020. injectReactEventListener: function(ReactEventListener) {
  4021. ReactEventListener.setHandleTopLevel(
  4022. ReactBrowserEventEmitter.handleTopLevel
  4023. );
  4024. ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
  4025. }
  4026. },
  4027. /**
  4028. * Sets whether or not any created callbacks should be enabled.
  4029. *
  4030. * @param {boolean} enabled True if callbacks should be enabled.
  4031. */
  4032. setEnabled: function(enabled) {
  4033. if (ReactBrowserEventEmitter.ReactEventListener) {
  4034. ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
  4035. }
  4036. },
  4037. /**
  4038. * @return {boolean} True if callbacks are enabled.
  4039. */
  4040. isEnabled: function() {
  4041. return !!(
  4042. (ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
  4043. );
  4044. },
  4045. /**
  4046. * We listen for bubbled touch events on the document object.
  4047. *
  4048. * Firefox v8.01 (and possibly others) exhibited strange behavior when
  4049. * mounting `onmousemove` events at some node that was not the document
  4050. * element. The symptoms were that if your mouse is not moving over something
  4051. * contained within that mount point (for example on the background) the
  4052. * top-level listeners for `onmousemove` won't be called. However, if you
  4053. * register the `mousemove` on the document object, then it will of course
  4054. * catch all `mousemove`s. This along with iOS quirks, justifies restricting
  4055. * top-level listeners to the document object only, at least for these
  4056. * movement types of events and possibly all events.
  4057. *
  4058. * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
  4059. *
  4060. * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
  4061. * they bubble to document.
  4062. *
  4063. * @param {string} registrationName Name of listener (e.g. `onClick`).
  4064. * @param {object} contentDocumentHandle Document which owns the container
  4065. */
  4066. listenTo: function(registrationName, contentDocumentHandle) {
  4067. var mountAt = contentDocumentHandle;
  4068. var isListening = getListeningForDocument(mountAt);
  4069. var dependencies = EventPluginRegistry.
  4070. registrationNameDependencies[registrationName];
  4071. var topLevelTypes = EventConstants.topLevelTypes;
  4072. for (var i = 0, l = dependencies.length; i < l; i++) {
  4073. var dependency = dependencies[i];
  4074. if (!(
  4075. (isListening.hasOwnProperty(dependency) && isListening[dependency])
  4076. )) {
  4077. if (dependency === topLevelTypes.topWheel) {
  4078. if (isEventSupported('wheel')) {
  4079. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4080. topLevelTypes.topWheel,
  4081. 'wheel',
  4082. mountAt
  4083. );
  4084. } else if (isEventSupported('mousewheel')) {
  4085. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4086. topLevelTypes.topWheel,
  4087. 'mousewheel',
  4088. mountAt
  4089. );
  4090. } else {
  4091. // Firefox needs to capture a different mouse scroll event.
  4092. // @see http://www.quirksmode.org/dom/events/tests/scroll.html
  4093. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4094. topLevelTypes.topWheel,
  4095. 'DOMMouseScroll',
  4096. mountAt
  4097. );
  4098. }
  4099. } else if (dependency === topLevelTypes.topScroll) {
  4100. if (isEventSupported('scroll', true)) {
  4101. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4102. topLevelTypes.topScroll,
  4103. 'scroll',
  4104. mountAt
  4105. );
  4106. } else {
  4107. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4108. topLevelTypes.topScroll,
  4109. 'scroll',
  4110. ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
  4111. );
  4112. }
  4113. } else if (dependency === topLevelTypes.topFocus ||
  4114. dependency === topLevelTypes.topBlur) {
  4115. if (isEventSupported('focus', true)) {
  4116. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4117. topLevelTypes.topFocus,
  4118. 'focus',
  4119. mountAt
  4120. );
  4121. ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4122. topLevelTypes.topBlur,
  4123. 'blur',
  4124. mountAt
  4125. );
  4126. } else if (isEventSupported('focusin')) {
  4127. // IE has `focusin` and `focusout` events which bubble.
  4128. // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
  4129. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4130. topLevelTypes.topFocus,
  4131. 'focusin',
  4132. mountAt
  4133. );
  4134. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4135. topLevelTypes.topBlur,
  4136. 'focusout',
  4137. mountAt
  4138. );
  4139. }
  4140. // to make sure blur and focus event listeners are only attached once
  4141. isListening[topLevelTypes.topBlur] = true;
  4142. isListening[topLevelTypes.topFocus] = true;
  4143. } else if (topEventMapping.hasOwnProperty(dependency)) {
  4144. ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4145. dependency,
  4146. topEventMapping[dependency],
  4147. mountAt
  4148. );
  4149. }
  4150. isListening[dependency] = true;
  4151. }
  4152. }
  4153. },
  4154. trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
  4155. return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
  4156. topLevelType,
  4157. handlerBaseName,
  4158. handle
  4159. );
  4160. },
  4161. trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
  4162. return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
  4163. topLevelType,
  4164. handlerBaseName,
  4165. handle
  4166. );
  4167. },
  4168. /**
  4169. * Listens to window scroll and resize events. We cache scroll values so that
  4170. * application code can access them without triggering reflows.
  4171. *
  4172. * NOTE: Scroll events do not bubble.
  4173. *
  4174. * @see http://www.quirksmode.org/dom/events/scroll.html
  4175. */
  4176. ensureScrollValueMonitoring: function() {
  4177. if (!isMonitoringScrollValue) {
  4178. var refresh = ViewportMetrics.refreshScrollValues;
  4179. ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
  4180. isMonitoringScrollValue = true;
  4181. }
  4182. },
  4183. eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
  4184. registrationNameModules: EventPluginHub.registrationNameModules,
  4185. putListener: EventPluginHub.putListener,
  4186. getListener: EventPluginHub.getListener,
  4187. deleteListener: EventPluginHub.deleteListener,
  4188. deleteAllListeners: EventPluginHub.deleteAllListeners
  4189. });
  4190. module.exports = ReactBrowserEventEmitter;
  4191. },{"104":104,"136":136,"15":15,"17":17,"18":18,"27":27,"61":61}],31:[function(_dereq_,module,exports){
  4192. /**
  4193. * Copyright 2014-2015, Facebook, Inc.
  4194. * All rights reserved.
  4195. *
  4196. * This source code is licensed under the BSD-style license found in the
  4197. * LICENSE file in the root directory of this source tree. An additional grant
  4198. * of patent rights can be found in the PATENTS file in the same directory.
  4199. *
  4200. * @providesModule ReactChildReconciler
  4201. * @typechecks static-only
  4202. */
  4203. 'use strict';
  4204. var ReactReconciler = _dereq_(81);
  4205. var flattenChildren = _dereq_(118);
  4206. var instantiateReactComponent = _dereq_(134);
  4207. var shouldUpdateReactComponent = _dereq_(151);
  4208. /**
  4209. * ReactChildReconciler provides helpers for initializing or updating a set of
  4210. * children. Its output is suitable for passing it onto ReactMultiChild which
  4211. * does diffed reordering and insertion.
  4212. */
  4213. var ReactChildReconciler = {
  4214. /**
  4215. * Generates a "mount image" for each of the supplied children. In the case
  4216. * of `ReactDOMComponent`, a mount image is a string of markup.
  4217. *
  4218. * @param {?object} nestedChildNodes Nested child maps.
  4219. * @return {?object} A set of child instances.
  4220. * @internal
  4221. */
  4222. instantiateChildren: function(nestedChildNodes, transaction, context) {
  4223. var children = flattenChildren(nestedChildNodes);
  4224. for (var name in children) {
  4225. if (children.hasOwnProperty(name)) {
  4226. var child = children[name];
  4227. // The rendered children must be turned into instances as they're
  4228. // mounted.
  4229. var childInstance = instantiateReactComponent(child, null);
  4230. children[name] = childInstance;
  4231. }
  4232. }
  4233. return children;
  4234. },
  4235. /**
  4236. * Updates the rendered children and returns a new set of children.
  4237. *
  4238. * @param {?object} prevChildren Previously initialized set of children.
  4239. * @param {?object} nextNestedChildNodes Nested child maps.
  4240. * @param {ReactReconcileTransaction} transaction
  4241. * @param {object} context
  4242. * @return {?object} A new set of child instances.
  4243. * @internal
  4244. */
  4245. updateChildren: function(
  4246. prevChildren,
  4247. nextNestedChildNodes,
  4248. transaction,
  4249. context) {
  4250. // We currently don't have a way to track moves here but if we use iterators
  4251. // instead of for..in we can zip the iterators and check if an item has
  4252. // moved.
  4253. // TODO: If nothing has changed, return the prevChildren object so that we
  4254. // can quickly bailout if nothing has changed.
  4255. var nextChildren = flattenChildren(nextNestedChildNodes);
  4256. if (!nextChildren && !prevChildren) {
  4257. return null;
  4258. }
  4259. var name;
  4260. for (name in nextChildren) {
  4261. if (!nextChildren.hasOwnProperty(name)) {
  4262. continue;
  4263. }
  4264. var prevChild = prevChildren && prevChildren[name];
  4265. var prevElement = prevChild && prevChild._currentElement;
  4266. var nextElement = nextChildren[name];
  4267. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  4268. ReactReconciler.receiveComponent(
  4269. prevChild, nextElement, transaction, context
  4270. );
  4271. nextChildren[name] = prevChild;
  4272. } else {
  4273. if (prevChild) {
  4274. ReactReconciler.unmountComponent(prevChild, name);
  4275. }
  4276. // The child must be instantiated before it's mounted.
  4277. var nextChildInstance = instantiateReactComponent(
  4278. nextElement,
  4279. null
  4280. );
  4281. nextChildren[name] = nextChildInstance;
  4282. }
  4283. }
  4284. // Unmount children that are no longer present.
  4285. for (name in prevChildren) {
  4286. if (prevChildren.hasOwnProperty(name) &&
  4287. !(nextChildren && nextChildren.hasOwnProperty(name))) {
  4288. ReactReconciler.unmountComponent(prevChildren[name]);
  4289. }
  4290. }
  4291. return nextChildren;
  4292. },
  4293. /**
  4294. * Unmounts all rendered children. This should be used to clean up children
  4295. * when this component is unmounted.
  4296. *
  4297. * @param {?object} renderedChildren Previously initialized set of children.
  4298. * @internal
  4299. */
  4300. unmountChildren: function(renderedChildren) {
  4301. for (var name in renderedChildren) {
  4302. var renderedChild = renderedChildren[name];
  4303. ReactReconciler.unmountComponent(renderedChild);
  4304. }
  4305. }
  4306. };
  4307. module.exports = ReactChildReconciler;
  4308. },{"118":118,"134":134,"151":151,"81":81}],32:[function(_dereq_,module,exports){
  4309. /**
  4310. * Copyright 2013-2015, Facebook, Inc.
  4311. * All rights reserved.
  4312. *
  4313. * This source code is licensed under the BSD-style license found in the
  4314. * LICENSE file in the root directory of this source tree. An additional grant
  4315. * of patent rights can be found in the PATENTS file in the same directory.
  4316. *
  4317. * @providesModule ReactChildren
  4318. */
  4319. 'use strict';
  4320. var PooledClass = _dereq_(28);
  4321. var ReactFragment = _dereq_(63);
  4322. var traverseAllChildren = _dereq_(153);
  4323. var warning = _dereq_(154);
  4324. var twoArgumentPooler = PooledClass.twoArgumentPooler;
  4325. var threeArgumentPooler = PooledClass.threeArgumentPooler;
  4326. /**
  4327. * PooledClass representing the bookkeeping associated with performing a child
  4328. * traversal. Allows avoiding binding callbacks.
  4329. *
  4330. * @constructor ForEachBookKeeping
  4331. * @param {!function} forEachFunction Function to perform traversal with.
  4332. * @param {?*} forEachContext Context to perform context with.
  4333. */
  4334. function ForEachBookKeeping(forEachFunction, forEachContext) {
  4335. this.forEachFunction = forEachFunction;
  4336. this.forEachContext = forEachContext;
  4337. }
  4338. PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
  4339. function forEachSingleChild(traverseContext, child, name, i) {
  4340. var forEachBookKeeping = traverseContext;
  4341. forEachBookKeeping.forEachFunction.call(
  4342. forEachBookKeeping.forEachContext, child, i);
  4343. }
  4344. /**
  4345. * Iterates through children that are typically specified as `props.children`.
  4346. *
  4347. * The provided forEachFunc(child, index) will be called for each
  4348. * leaf child.
  4349. *
  4350. * @param {?*} children Children tree container.
  4351. * @param {function(*, int)} forEachFunc.
  4352. * @param {*} forEachContext Context for forEachContext.
  4353. */
  4354. function forEachChildren(children, forEachFunc, forEachContext) {
  4355. if (children == null) {
  4356. return children;
  4357. }
  4358. var traverseContext =
  4359. ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
  4360. traverseAllChildren(children, forEachSingleChild, traverseContext);
  4361. ForEachBookKeeping.release(traverseContext);
  4362. }
  4363. /**
  4364. * PooledClass representing the bookkeeping associated with performing a child
  4365. * mapping. Allows avoiding binding callbacks.
  4366. *
  4367. * @constructor MapBookKeeping
  4368. * @param {!*} mapResult Object containing the ordered map of results.
  4369. * @param {!function} mapFunction Function to perform mapping with.
  4370. * @param {?*} mapContext Context to perform mapping with.
  4371. */
  4372. function MapBookKeeping(mapResult, mapFunction, mapContext) {
  4373. this.mapResult = mapResult;
  4374. this.mapFunction = mapFunction;
  4375. this.mapContext = mapContext;
  4376. }
  4377. PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
  4378. function mapSingleChildIntoContext(traverseContext, child, name, i) {
  4379. var mapBookKeeping = traverseContext;
  4380. var mapResult = mapBookKeeping.mapResult;
  4381. var keyUnique = !mapResult.hasOwnProperty(name);
  4382. if ("production" !== "development") {
  4383. ("production" !== "development" ? warning(
  4384. keyUnique,
  4385. 'ReactChildren.map(...): Encountered two children with the same key, ' +
  4386. '`%s`. Child keys must be unique; when two children share a key, only ' +
  4387. 'the first child will be used.',
  4388. name
  4389. ) : null);
  4390. }
  4391. if (keyUnique) {
  4392. var mappedChild =
  4393. mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
  4394. mapResult[name] = mappedChild;
  4395. }
  4396. }
  4397. /**
  4398. * Maps children that are typically specified as `props.children`.
  4399. *
  4400. * The provided mapFunction(child, key, index) will be called for each
  4401. * leaf child.
  4402. *
  4403. * TODO: This may likely break any calls to `ReactChildren.map` that were
  4404. * previously relying on the fact that we guarded against null children.
  4405. *
  4406. * @param {?*} children Children tree container.
  4407. * @param {function(*, int)} mapFunction.
  4408. * @param {*} mapContext Context for mapFunction.
  4409. * @return {object} Object containing the ordered map of results.
  4410. */
  4411. function mapChildren(children, func, context) {
  4412. if (children == null) {
  4413. return children;
  4414. }
  4415. var mapResult = {};
  4416. var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
  4417. traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
  4418. MapBookKeeping.release(traverseContext);
  4419. return ReactFragment.create(mapResult);
  4420. }
  4421. function forEachSingleChildDummy(traverseContext, child, name, i) {
  4422. return null;
  4423. }
  4424. /**
  4425. * Count the number of children that are typically specified as
  4426. * `props.children`.
  4427. *
  4428. * @param {?*} children Children tree container.
  4429. * @return {number} The number of children.
  4430. */
  4431. function countChildren(children, context) {
  4432. return traverseAllChildren(children, forEachSingleChildDummy, null);
  4433. }
  4434. var ReactChildren = {
  4435. forEach: forEachChildren,
  4436. map: mapChildren,
  4437. count: countChildren
  4438. };
  4439. module.exports = ReactChildren;
  4440. },{"153":153,"154":154,"28":28,"63":63}],33:[function(_dereq_,module,exports){
  4441. /**
  4442. * Copyright 2013-2015, Facebook, Inc.
  4443. * All rights reserved.
  4444. *
  4445. * This source code is licensed under the BSD-style license found in the
  4446. * LICENSE file in the root directory of this source tree. An additional grant
  4447. * of patent rights can be found in the PATENTS file in the same directory.
  4448. *
  4449. * @providesModule ReactClass
  4450. */
  4451. 'use strict';
  4452. var ReactComponent = _dereq_(34);
  4453. var ReactCurrentOwner = _dereq_(39);
  4454. var ReactElement = _dereq_(57);
  4455. var ReactErrorUtils = _dereq_(60);
  4456. var ReactInstanceMap = _dereq_(67);
  4457. var ReactLifeCycle = _dereq_(68);
  4458. var ReactPropTypeLocations = _dereq_(77);
  4459. var ReactPropTypeLocationNames = _dereq_(76);
  4460. var ReactUpdateQueue = _dereq_(86);
  4461. var assign = _dereq_(27);
  4462. var invariant = _dereq_(135);
  4463. var keyMirror = _dereq_(140);
  4464. var keyOf = _dereq_(141);
  4465. var warning = _dereq_(154);
  4466. var MIXINS_KEY = keyOf({mixins: null});
  4467. /**
  4468. * Policies that describe methods in `ReactClassInterface`.
  4469. */
  4470. var SpecPolicy = keyMirror({
  4471. /**
  4472. * These methods may be defined only once by the class specification or mixin.
  4473. */
  4474. DEFINE_ONCE: null,
  4475. /**
  4476. * These methods may be defined by both the class specification and mixins.
  4477. * Subsequent definitions will be chained. These methods must return void.
  4478. */
  4479. DEFINE_MANY: null,
  4480. /**
  4481. * These methods are overriding the base class.
  4482. */
  4483. OVERRIDE_BASE: null,
  4484. /**
  4485. * These methods are similar to DEFINE_MANY, except we assume they return
  4486. * objects. We try to merge the keys of the return values of all the mixed in
  4487. * functions. If there is a key conflict we throw.
  4488. */
  4489. DEFINE_MANY_MERGED: null
  4490. });
  4491. var injectedMixins = [];
  4492. /**
  4493. * Composite components are higher-level components that compose other composite
  4494. * or native components.
  4495. *
  4496. * To create a new type of `ReactClass`, pass a specification of
  4497. * your new class to `React.createClass`. The only requirement of your class
  4498. * specification is that you implement a `render` method.
  4499. *
  4500. * var MyComponent = React.createClass({
  4501. * render: function() {
  4502. * return <div>Hello World</div>;
  4503. * }
  4504. * });
  4505. *
  4506. * The class specification supports a specific protocol of methods that have
  4507. * special meaning (e.g. `render`). See `ReactClassInterface` for
  4508. * more the comprehensive protocol. Any other properties and methods in the
  4509. * class specification will available on the prototype.
  4510. *
  4511. * @interface ReactClassInterface
  4512. * @internal
  4513. */
  4514. var ReactClassInterface = {
  4515. /**
  4516. * An array of Mixin objects to include when defining your component.
  4517. *
  4518. * @type {array}
  4519. * @optional
  4520. */
  4521. mixins: SpecPolicy.DEFINE_MANY,
  4522. /**
  4523. * An object containing properties and methods that should be defined on
  4524. * the component's constructor instead of its prototype (static methods).
  4525. *
  4526. * @type {object}
  4527. * @optional
  4528. */
  4529. statics: SpecPolicy.DEFINE_MANY,
  4530. /**
  4531. * Definition of prop types for this component.
  4532. *
  4533. * @type {object}
  4534. * @optional
  4535. */
  4536. propTypes: SpecPolicy.DEFINE_MANY,
  4537. /**
  4538. * Definition of context types for this component.
  4539. *
  4540. * @type {object}
  4541. * @optional
  4542. */
  4543. contextTypes: SpecPolicy.DEFINE_MANY,
  4544. /**
  4545. * Definition of context types this component sets for its children.
  4546. *
  4547. * @type {object}
  4548. * @optional
  4549. */
  4550. childContextTypes: SpecPolicy.DEFINE_MANY,
  4551. // ==== Definition methods ====
  4552. /**
  4553. * Invoked when the component is mounted. Values in the mapping will be set on
  4554. * `this.props` if that prop is not specified (i.e. using an `in` check).
  4555. *
  4556. * This method is invoked before `getInitialState` and therefore cannot rely
  4557. * on `this.state` or use `this.setState`.
  4558. *
  4559. * @return {object}
  4560. * @optional
  4561. */
  4562. getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
  4563. /**
  4564. * Invoked once before the component is mounted. The return value will be used
  4565. * as the initial value of `this.state`.
  4566. *
  4567. * getInitialState: function() {
  4568. * return {
  4569. * isOn: false,
  4570. * fooBaz: new BazFoo()
  4571. * }
  4572. * }
  4573. *
  4574. * @return {object}
  4575. * @optional
  4576. */
  4577. getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
  4578. /**
  4579. * @return {object}
  4580. * @optional
  4581. */
  4582. getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
  4583. /**
  4584. * Uses props from `this.props` and state from `this.state` to render the
  4585. * structure of the component.
  4586. *
  4587. * No guarantees are made about when or how often this method is invoked, so
  4588. * it must not have side effects.
  4589. *
  4590. * render: function() {
  4591. * var name = this.props.name;
  4592. * return <div>Hello, {name}!</div>;
  4593. * }
  4594. *
  4595. * @return {ReactComponent}
  4596. * @nosideeffects
  4597. * @required
  4598. */
  4599. render: SpecPolicy.DEFINE_ONCE,
  4600. // ==== Delegate methods ====
  4601. /**
  4602. * Invoked when the component is initially created and about to be mounted.
  4603. * This may have side effects, but any external subscriptions or data created
  4604. * by this method must be cleaned up in `componentWillUnmount`.
  4605. *
  4606. * @optional
  4607. */
  4608. componentWillMount: SpecPolicy.DEFINE_MANY,
  4609. /**
  4610. * Invoked when the component has been mounted and has a DOM representation.
  4611. * However, there is no guarantee that the DOM node is in the document.
  4612. *
  4613. * Use this as an opportunity to operate on the DOM when the component has
  4614. * been mounted (initialized and rendered) for the first time.
  4615. *
  4616. * @param {DOMElement} rootNode DOM element representing the component.
  4617. * @optional
  4618. */
  4619. componentDidMount: SpecPolicy.DEFINE_MANY,
  4620. /**
  4621. * Invoked before the component receives new props.
  4622. *
  4623. * Use this as an opportunity to react to a prop transition by updating the
  4624. * state using `this.setState`. Current props are accessed via `this.props`.
  4625. *
  4626. * componentWillReceiveProps: function(nextProps, nextContext) {
  4627. * this.setState({
  4628. * likesIncreasing: nextProps.likeCount > this.props.likeCount
  4629. * });
  4630. * }
  4631. *
  4632. * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
  4633. * transition may cause a state change, but the opposite is not true. If you
  4634. * need it, you are probably looking for `componentWillUpdate`.
  4635. *
  4636. * @param {object} nextProps
  4637. * @optional
  4638. */
  4639. componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
  4640. /**
  4641. * Invoked while deciding if the component should be updated as a result of
  4642. * receiving new props, state and/or context.
  4643. *
  4644. * Use this as an opportunity to `return false` when you're certain that the
  4645. * transition to the new props/state/context will not require a component
  4646. * update.
  4647. *
  4648. * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
  4649. * return !equal(nextProps, this.props) ||
  4650. * !equal(nextState, this.state) ||
  4651. * !equal(nextContext, this.context);
  4652. * }
  4653. *
  4654. * @param {object} nextProps
  4655. * @param {?object} nextState
  4656. * @param {?object} nextContext
  4657. * @return {boolean} True if the component should update.
  4658. * @optional
  4659. */
  4660. shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
  4661. /**
  4662. * Invoked when the component is about to update due to a transition from
  4663. * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
  4664. * and `nextContext`.
  4665. *
  4666. * Use this as an opportunity to perform preparation before an update occurs.
  4667. *
  4668. * NOTE: You **cannot** use `this.setState()` in this method.
  4669. *
  4670. * @param {object} nextProps
  4671. * @param {?object} nextState
  4672. * @param {?object} nextContext
  4673. * @param {ReactReconcileTransaction} transaction
  4674. * @optional
  4675. */
  4676. componentWillUpdate: SpecPolicy.DEFINE_MANY,
  4677. /**
  4678. * Invoked when the component's DOM representation has been updated.
  4679. *
  4680. * Use this as an opportunity to operate on the DOM when the component has
  4681. * been updated.
  4682. *
  4683. * @param {object} prevProps
  4684. * @param {?object} prevState
  4685. * @param {?object} prevContext
  4686. * @param {DOMElement} rootNode DOM element representing the component.
  4687. * @optional
  4688. */
  4689. componentDidUpdate: SpecPolicy.DEFINE_MANY,
  4690. /**
  4691. * Invoked when the component is about to be removed from its parent and have
  4692. * its DOM representation destroyed.
  4693. *
  4694. * Use this as an opportunity to deallocate any external resources.
  4695. *
  4696. * NOTE: There is no `componentDidUnmount` since your component will have been
  4697. * destroyed by that point.
  4698. *
  4699. * @optional
  4700. */
  4701. componentWillUnmount: SpecPolicy.DEFINE_MANY,
  4702. // ==== Advanced methods ====
  4703. /**
  4704. * Updates the component's currently mounted DOM representation.
  4705. *
  4706. * By default, this implements React's rendering and reconciliation algorithm.
  4707. * Sophisticated clients may wish to override this.
  4708. *
  4709. * @param {ReactReconcileTransaction} transaction
  4710. * @internal
  4711. * @overridable
  4712. */
  4713. updateComponent: SpecPolicy.OVERRIDE_BASE
  4714. };
  4715. /**
  4716. * Mapping from class specification keys to special processing functions.
  4717. *
  4718. * Although these are declared like instance properties in the specification
  4719. * when defining classes using `React.createClass`, they are actually static
  4720. * and are accessible on the constructor instead of the prototype. Despite
  4721. * being static, they must be defined outside of the "statics" key under
  4722. * which all other static methods are defined.
  4723. */
  4724. var RESERVED_SPEC_KEYS = {
  4725. displayName: function(Constructor, displayName) {
  4726. Constructor.displayName = displayName;
  4727. },
  4728. mixins: function(Constructor, mixins) {
  4729. if (mixins) {
  4730. for (var i = 0; i < mixins.length; i++) {
  4731. mixSpecIntoComponent(Constructor, mixins[i]);
  4732. }
  4733. }
  4734. },
  4735. childContextTypes: function(Constructor, childContextTypes) {
  4736. if ("production" !== "development") {
  4737. validateTypeDef(
  4738. Constructor,
  4739. childContextTypes,
  4740. ReactPropTypeLocations.childContext
  4741. );
  4742. }
  4743. Constructor.childContextTypes = assign(
  4744. {},
  4745. Constructor.childContextTypes,
  4746. childContextTypes
  4747. );
  4748. },
  4749. contextTypes: function(Constructor, contextTypes) {
  4750. if ("production" !== "development") {
  4751. validateTypeDef(
  4752. Constructor,
  4753. contextTypes,
  4754. ReactPropTypeLocations.context
  4755. );
  4756. }
  4757. Constructor.contextTypes = assign(
  4758. {},
  4759. Constructor.contextTypes,
  4760. contextTypes
  4761. );
  4762. },
  4763. /**
  4764. * Special case getDefaultProps which should move into statics but requires
  4765. * automatic merging.
  4766. */
  4767. getDefaultProps: function(Constructor, getDefaultProps) {
  4768. if (Constructor.getDefaultProps) {
  4769. Constructor.getDefaultProps = createMergedResultFunction(
  4770. Constructor.getDefaultProps,
  4771. getDefaultProps
  4772. );
  4773. } else {
  4774. Constructor.getDefaultProps = getDefaultProps;
  4775. }
  4776. },
  4777. propTypes: function(Constructor, propTypes) {
  4778. if ("production" !== "development") {
  4779. validateTypeDef(
  4780. Constructor,
  4781. propTypes,
  4782. ReactPropTypeLocations.prop
  4783. );
  4784. }
  4785. Constructor.propTypes = assign(
  4786. {},
  4787. Constructor.propTypes,
  4788. propTypes
  4789. );
  4790. },
  4791. statics: function(Constructor, statics) {
  4792. mixStaticSpecIntoComponent(Constructor, statics);
  4793. }
  4794. };
  4795. function validateTypeDef(Constructor, typeDef, location) {
  4796. for (var propName in typeDef) {
  4797. if (typeDef.hasOwnProperty(propName)) {
  4798. // use a warning instead of an invariant so components
  4799. // don't show up in prod but not in __DEV__
  4800. ("production" !== "development" ? warning(
  4801. typeof typeDef[propName] === 'function',
  4802. '%s: %s type `%s` is invalid; it must be a function, usually from ' +
  4803. 'React.PropTypes.',
  4804. Constructor.displayName || 'ReactClass',
  4805. ReactPropTypeLocationNames[location],
  4806. propName
  4807. ) : null);
  4808. }
  4809. }
  4810. }
  4811. function validateMethodOverride(proto, name) {
  4812. var specPolicy = ReactClassInterface.hasOwnProperty(name) ?
  4813. ReactClassInterface[name] :
  4814. null;
  4815. // Disallow overriding of base class methods unless explicitly allowed.
  4816. if (ReactClassMixin.hasOwnProperty(name)) {
  4817. ("production" !== "development" ? invariant(
  4818. specPolicy === SpecPolicy.OVERRIDE_BASE,
  4819. 'ReactClassInterface: You are attempting to override ' +
  4820. '`%s` from your class specification. Ensure that your method names ' +
  4821. 'do not overlap with React methods.',
  4822. name
  4823. ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
  4824. }
  4825. // Disallow defining methods more than once unless explicitly allowed.
  4826. if (proto.hasOwnProperty(name)) {
  4827. ("production" !== "development" ? invariant(
  4828. specPolicy === SpecPolicy.DEFINE_MANY ||
  4829. specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
  4830. 'ReactClassInterface: You are attempting to define ' +
  4831. '`%s` on your component more than once. This conflict may be due ' +
  4832. 'to a mixin.',
  4833. name
  4834. ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
  4835. specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
  4836. }
  4837. }
  4838. /**
  4839. * Mixin helper which handles policy validation and reserved
  4840. * specification keys when building React classses.
  4841. */
  4842. function mixSpecIntoComponent(Constructor, spec) {
  4843. if (!spec) {
  4844. return;
  4845. }
  4846. ("production" !== "development" ? invariant(
  4847. typeof spec !== 'function',
  4848. 'ReactClass: You\'re attempting to ' +
  4849. 'use a component class as a mixin. Instead, just use a regular object.'
  4850. ) : invariant(typeof spec !== 'function'));
  4851. ("production" !== "development" ? invariant(
  4852. !ReactElement.isValidElement(spec),
  4853. 'ReactClass: You\'re attempting to ' +
  4854. 'use a component as a mixin. Instead, just use a regular object.'
  4855. ) : invariant(!ReactElement.isValidElement(spec)));
  4856. var proto = Constructor.prototype;
  4857. // By handling mixins before any other properties, we ensure the same
  4858. // chaining order is applied to methods with DEFINE_MANY policy, whether
  4859. // mixins are listed before or after these methods in the spec.
  4860. if (spec.hasOwnProperty(MIXINS_KEY)) {
  4861. RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
  4862. }
  4863. for (var name in spec) {
  4864. if (!spec.hasOwnProperty(name)) {
  4865. continue;
  4866. }
  4867. if (name === MIXINS_KEY) {
  4868. // We have already handled mixins in a special case above
  4869. continue;
  4870. }
  4871. var property = spec[name];
  4872. validateMethodOverride(proto, name);
  4873. if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
  4874. RESERVED_SPEC_KEYS[name](Constructor, property);
  4875. } else {
  4876. // Setup methods on prototype:
  4877. // The following member methods should not be automatically bound:
  4878. // 1. Expected ReactClass methods (in the "interface").
  4879. // 2. Overridden methods (that were mixed in).
  4880. var isReactClassMethod =
  4881. ReactClassInterface.hasOwnProperty(name);
  4882. var isAlreadyDefined = proto.hasOwnProperty(name);
  4883. var markedDontBind = property && property.__reactDontBind;
  4884. var isFunction = typeof property === 'function';
  4885. var shouldAutoBind =
  4886. isFunction &&
  4887. !isReactClassMethod &&
  4888. !isAlreadyDefined &&
  4889. !markedDontBind;
  4890. if (shouldAutoBind) {
  4891. if (!proto.__reactAutoBindMap) {
  4892. proto.__reactAutoBindMap = {};
  4893. }
  4894. proto.__reactAutoBindMap[name] = property;
  4895. proto[name] = property;
  4896. } else {
  4897. if (isAlreadyDefined) {
  4898. var specPolicy = ReactClassInterface[name];
  4899. // These cases should already be caught by validateMethodOverride
  4900. ("production" !== "development" ? invariant(
  4901. isReactClassMethod && (
  4902. (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
  4903. ),
  4904. 'ReactClass: Unexpected spec policy %s for key %s ' +
  4905. 'when mixing in component specs.',
  4906. specPolicy,
  4907. name
  4908. ) : invariant(isReactClassMethod && (
  4909. (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
  4910. )));
  4911. // For methods which are defined more than once, call the existing
  4912. // methods before calling the new property, merging if appropriate.
  4913. if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
  4914. proto[name] = createMergedResultFunction(proto[name], property);
  4915. } else if (specPolicy === SpecPolicy.DEFINE_MANY) {
  4916. proto[name] = createChainedFunction(proto[name], property);
  4917. }
  4918. } else {
  4919. proto[name] = property;
  4920. if ("production" !== "development") {
  4921. // Add verbose displayName to the function, which helps when looking
  4922. // at profiling tools.
  4923. if (typeof property === 'function' && spec.displayName) {
  4924. proto[name].displayName = spec.displayName + '_' + name;
  4925. }
  4926. }
  4927. }
  4928. }
  4929. }
  4930. }
  4931. }
  4932. function mixStaticSpecIntoComponent(Constructor, statics) {
  4933. if (!statics) {
  4934. return;
  4935. }
  4936. for (var name in statics) {
  4937. var property = statics[name];
  4938. if (!statics.hasOwnProperty(name)) {
  4939. continue;
  4940. }
  4941. var isReserved = name in RESERVED_SPEC_KEYS;
  4942. ("production" !== "development" ? invariant(
  4943. !isReserved,
  4944. 'ReactClass: You are attempting to define a reserved ' +
  4945. 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
  4946. 'as an instance property instead; it will still be accessible on the ' +
  4947. 'constructor.',
  4948. name
  4949. ) : invariant(!isReserved));
  4950. var isInherited = name in Constructor;
  4951. ("production" !== "development" ? invariant(
  4952. !isInherited,
  4953. 'ReactClass: You are attempting to define ' +
  4954. '`%s` on your component more than once. This conflict may be ' +
  4955. 'due to a mixin.',
  4956. name
  4957. ) : invariant(!isInherited));
  4958. Constructor[name] = property;
  4959. }
  4960. }
  4961. /**
  4962. * Merge two objects, but throw if both contain the same key.
  4963. *
  4964. * @param {object} one The first object, which is mutated.
  4965. * @param {object} two The second object
  4966. * @return {object} one after it has been mutated to contain everything in two.
  4967. */
  4968. function mergeIntoWithNoDuplicateKeys(one, two) {
  4969. ("production" !== "development" ? invariant(
  4970. one && two && typeof one === 'object' && typeof two === 'object',
  4971. 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
  4972. ) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));
  4973. for (var key in two) {
  4974. if (two.hasOwnProperty(key)) {
  4975. ("production" !== "development" ? invariant(
  4976. one[key] === undefined,
  4977. 'mergeIntoWithNoDuplicateKeys(): ' +
  4978. 'Tried to merge two objects with the same key: `%s`. This conflict ' +
  4979. 'may be due to a mixin; in particular, this may be caused by two ' +
  4980. 'getInitialState() or getDefaultProps() methods returning objects ' +
  4981. 'with clashing keys.',
  4982. key
  4983. ) : invariant(one[key] === undefined));
  4984. one[key] = two[key];
  4985. }
  4986. }
  4987. return one;
  4988. }
  4989. /**
  4990. * Creates a function that invokes two functions and merges their return values.
  4991. *
  4992. * @param {function} one Function to invoke first.
  4993. * @param {function} two Function to invoke second.
  4994. * @return {function} Function that invokes the two argument functions.
  4995. * @private
  4996. */
  4997. function createMergedResultFunction(one, two) {
  4998. return function mergedResult() {
  4999. var a = one.apply(this, arguments);
  5000. var b = two.apply(this, arguments);
  5001. if (a == null) {
  5002. return b;
  5003. } else if (b == null) {
  5004. return a;
  5005. }
  5006. var c = {};
  5007. mergeIntoWithNoDuplicateKeys(c, a);
  5008. mergeIntoWithNoDuplicateKeys(c, b);
  5009. return c;
  5010. };
  5011. }
  5012. /**
  5013. * Creates a function that invokes two functions and ignores their return vales.
  5014. *
  5015. * @param {function} one Function to invoke first.
  5016. * @param {function} two Function to invoke second.
  5017. * @return {function} Function that invokes the two argument functions.
  5018. * @private
  5019. */
  5020. function createChainedFunction(one, two) {
  5021. return function chainedFunction() {
  5022. one.apply(this, arguments);
  5023. two.apply(this, arguments);
  5024. };
  5025. }
  5026. /**
  5027. * Binds a method to the component.
  5028. *
  5029. * @param {object} component Component whose method is going to be bound.
  5030. * @param {function} method Method to be bound.
  5031. * @return {function} The bound method.
  5032. */
  5033. function bindAutoBindMethod(component, method) {
  5034. var boundMethod = method.bind(component);
  5035. if ("production" !== "development") {
  5036. boundMethod.__reactBoundContext = component;
  5037. boundMethod.__reactBoundMethod = method;
  5038. boundMethod.__reactBoundArguments = null;
  5039. var componentName = component.constructor.displayName;
  5040. var _bind = boundMethod.bind;
  5041. /* eslint-disable block-scoped-var, no-undef */
  5042. boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  5043. // User is trying to bind() an autobound method; we effectively will
  5044. // ignore the value of "this" that the user is trying to use, so
  5045. // let's warn.
  5046. if (newThis !== component && newThis !== null) {
  5047. ("production" !== "development" ? warning(
  5048. false,
  5049. 'bind(): React component methods may only be bound to the ' +
  5050. 'component instance. See %s',
  5051. componentName
  5052. ) : null);
  5053. } else if (!args.length) {
  5054. ("production" !== "development" ? warning(
  5055. false,
  5056. 'bind(): You are binding a component method to the component. ' +
  5057. 'React does this for you automatically in a high-performance ' +
  5058. 'way, so you can safely remove this call. See %s',
  5059. componentName
  5060. ) : null);
  5061. return boundMethod;
  5062. }
  5063. var reboundMethod = _bind.apply(boundMethod, arguments);
  5064. reboundMethod.__reactBoundContext = component;
  5065. reboundMethod.__reactBoundMethod = method;
  5066. reboundMethod.__reactBoundArguments = args;
  5067. return reboundMethod;
  5068. /* eslint-enable */
  5069. };
  5070. }
  5071. return boundMethod;
  5072. }
  5073. /**
  5074. * Binds all auto-bound methods in a component.
  5075. *
  5076. * @param {object} component Component whose method is going to be bound.
  5077. */
  5078. function bindAutoBindMethods(component) {
  5079. for (var autoBindKey in component.__reactAutoBindMap) {
  5080. if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
  5081. var method = component.__reactAutoBindMap[autoBindKey];
  5082. component[autoBindKey] = bindAutoBindMethod(
  5083. component,
  5084. ReactErrorUtils.guard(
  5085. method,
  5086. component.constructor.displayName + '.' + autoBindKey
  5087. )
  5088. );
  5089. }
  5090. }
  5091. }
  5092. var typeDeprecationDescriptor = {
  5093. enumerable: false,
  5094. get: function() {
  5095. var displayName = this.displayName || this.name || 'Component';
  5096. ("production" !== "development" ? warning(
  5097. false,
  5098. '%s.type is deprecated. Use %s directly to access the class.',
  5099. displayName,
  5100. displayName
  5101. ) : null);
  5102. Object.defineProperty(this, 'type', {
  5103. value: this
  5104. });
  5105. return this;
  5106. }
  5107. };
  5108. /**
  5109. * Add more to the ReactClass base class. These are all legacy features and
  5110. * therefore not already part of the modern ReactComponent.
  5111. */
  5112. var ReactClassMixin = {
  5113. /**
  5114. * TODO: This will be deprecated because state should always keep a consistent
  5115. * type signature and the only use case for this, is to avoid that.
  5116. */
  5117. replaceState: function(newState, callback) {
  5118. ReactUpdateQueue.enqueueReplaceState(this, newState);
  5119. if (callback) {
  5120. ReactUpdateQueue.enqueueCallback(this, callback);
  5121. }
  5122. },
  5123. /**
  5124. * Checks whether or not this composite component is mounted.
  5125. * @return {boolean} True if mounted, false otherwise.
  5126. * @protected
  5127. * @final
  5128. */
  5129. isMounted: function() {
  5130. if ("production" !== "development") {
  5131. var owner = ReactCurrentOwner.current;
  5132. if (owner !== null) {
  5133. ("production" !== "development" ? warning(
  5134. owner._warnedAboutRefsInRender,
  5135. '%s is accessing isMounted inside its render() function. ' +
  5136. 'render() should be a pure function of props and state. It should ' +
  5137. 'never access something that requires stale data from the previous ' +
  5138. 'render, such as refs. Move this logic to componentDidMount and ' +
  5139. 'componentDidUpdate instead.',
  5140. owner.getName() || 'A component'
  5141. ) : null);
  5142. owner._warnedAboutRefsInRender = true;
  5143. }
  5144. }
  5145. var internalInstance = ReactInstanceMap.get(this);
  5146. return (
  5147. internalInstance &&
  5148. internalInstance !== ReactLifeCycle.currentlyMountingInstance
  5149. );
  5150. },
  5151. /**
  5152. * Sets a subset of the props.
  5153. *
  5154. * @param {object} partialProps Subset of the next props.
  5155. * @param {?function} callback Called after props are updated.
  5156. * @final
  5157. * @public
  5158. * @deprecated
  5159. */
  5160. setProps: function(partialProps, callback) {
  5161. ReactUpdateQueue.enqueueSetProps(this, partialProps);
  5162. if (callback) {
  5163. ReactUpdateQueue.enqueueCallback(this, callback);
  5164. }
  5165. },
  5166. /**
  5167. * Replace all the props.
  5168. *
  5169. * @param {object} newProps Subset of the next props.
  5170. * @param {?function} callback Called after props are updated.
  5171. * @final
  5172. * @public
  5173. * @deprecated
  5174. */
  5175. replaceProps: function(newProps, callback) {
  5176. ReactUpdateQueue.enqueueReplaceProps(this, newProps);
  5177. if (callback) {
  5178. ReactUpdateQueue.enqueueCallback(this, callback);
  5179. }
  5180. }
  5181. };
  5182. var ReactClassComponent = function() {};
  5183. assign(
  5184. ReactClassComponent.prototype,
  5185. ReactComponent.prototype,
  5186. ReactClassMixin
  5187. );
  5188. /**
  5189. * Module for creating composite components.
  5190. *
  5191. * @class ReactClass
  5192. */
  5193. var ReactClass = {
  5194. /**
  5195. * Creates a composite component class given a class specification.
  5196. *
  5197. * @param {object} spec Class specification (which must define `render`).
  5198. * @return {function} Component constructor function.
  5199. * @public
  5200. */
  5201. createClass: function(spec) {
  5202. var Constructor = function(props, context) {
  5203. // This constructor is overridden by mocks. The argument is used
  5204. // by mocks to assert on what gets mounted.
  5205. if ("production" !== "development") {
  5206. ("production" !== "development" ? warning(
  5207. this instanceof Constructor,
  5208. 'Something is calling a React component directly. Use a factory or ' +
  5209. 'JSX instead. See: https://fb.me/react-legacyfactory'
  5210. ) : null);
  5211. }
  5212. // Wire up auto-binding
  5213. if (this.__reactAutoBindMap) {
  5214. bindAutoBindMethods(this);
  5215. }
  5216. this.props = props;
  5217. this.context = context;
  5218. this.state = null;
  5219. // ReactClasses doesn't have constructors. Instead, they use the
  5220. // getInitialState and componentWillMount methods for initialization.
  5221. var initialState = this.getInitialState ? this.getInitialState() : null;
  5222. if ("production" !== "development") {
  5223. // We allow auto-mocks to proceed as if they're returning null.
  5224. if (typeof initialState === 'undefined' &&
  5225. this.getInitialState._isMockFunction) {
  5226. // This is probably bad practice. Consider warning here and
  5227. // deprecating this convenience.
  5228. initialState = null;
  5229. }
  5230. }
  5231. ("production" !== "development" ? invariant(
  5232. typeof initialState === 'object' && !Array.isArray(initialState),
  5233. '%s.getInitialState(): must return an object or null',
  5234. Constructor.displayName || 'ReactCompositeComponent'
  5235. ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
  5236. this.state = initialState;
  5237. };
  5238. Constructor.prototype = new ReactClassComponent();
  5239. Constructor.prototype.constructor = Constructor;
  5240. injectedMixins.forEach(
  5241. mixSpecIntoComponent.bind(null, Constructor)
  5242. );
  5243. mixSpecIntoComponent(Constructor, spec);
  5244. // Initialize the defaultProps property after all mixins have been merged
  5245. if (Constructor.getDefaultProps) {
  5246. Constructor.defaultProps = Constructor.getDefaultProps();
  5247. }
  5248. if ("production" !== "development") {
  5249. // This is a tag to indicate that the use of these method names is ok,
  5250. // since it's used with createClass. If it's not, then it's likely a
  5251. // mistake so we'll warn you to use the static property, property
  5252. // initializer or constructor respectively.
  5253. if (Constructor.getDefaultProps) {
  5254. Constructor.getDefaultProps.isReactClassApproved = {};
  5255. }
  5256. if (Constructor.prototype.getInitialState) {
  5257. Constructor.prototype.getInitialState.isReactClassApproved = {};
  5258. }
  5259. }
  5260. ("production" !== "development" ? invariant(
  5261. Constructor.prototype.render,
  5262. 'createClass(...): Class specification must implement a `render` method.'
  5263. ) : invariant(Constructor.prototype.render));
  5264. if ("production" !== "development") {
  5265. ("production" !== "development" ? warning(
  5266. !Constructor.prototype.componentShouldUpdate,
  5267. '%s has a method called ' +
  5268. 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
  5269. 'The name is phrased as a question because the function is ' +
  5270. 'expected to return a value.',
  5271. spec.displayName || 'A component'
  5272. ) : null);
  5273. }
  5274. // Reduce time spent doing lookups by setting these on the prototype.
  5275. for (var methodName in ReactClassInterface) {
  5276. if (!Constructor.prototype[methodName]) {
  5277. Constructor.prototype[methodName] = null;
  5278. }
  5279. }
  5280. // Legacy hook
  5281. Constructor.type = Constructor;
  5282. if ("production" !== "development") {
  5283. try {
  5284. Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);
  5285. } catch (x) {
  5286. // IE will fail on defineProperty (es5-shim/sham too)
  5287. }
  5288. }
  5289. return Constructor;
  5290. },
  5291. injection: {
  5292. injectMixin: function(mixin) {
  5293. injectedMixins.push(mixin);
  5294. }
  5295. }
  5296. };
  5297. module.exports = ReactClass;
  5298. },{"135":135,"140":140,"141":141,"154":154,"27":27,"34":34,"39":39,"57":57,"60":60,"67":67,"68":68,"76":76,"77":77,"86":86}],34:[function(_dereq_,module,exports){
  5299. /**
  5300. * Copyright 2013-2015, Facebook, Inc.
  5301. * All rights reserved.
  5302. *
  5303. * This source code is licensed under the BSD-style license found in the
  5304. * LICENSE file in the root directory of this source tree. An additional grant
  5305. * of patent rights can be found in the PATENTS file in the same directory.
  5306. *
  5307. * @providesModule ReactComponent
  5308. */
  5309. 'use strict';
  5310. var ReactUpdateQueue = _dereq_(86);
  5311. var invariant = _dereq_(135);
  5312. var warning = _dereq_(154);
  5313. /**
  5314. * Base class helpers for the updating state of a component.
  5315. */
  5316. function ReactComponent(props, context) {
  5317. this.props = props;
  5318. this.context = context;
  5319. }
  5320. /**
  5321. * Sets a subset of the state. Always use this to mutate
  5322. * state. You should treat `this.state` as immutable.
  5323. *
  5324. * There is no guarantee that `this.state` will be immediately updated, so
  5325. * accessing `this.state` after calling this method may return the old value.
  5326. *
  5327. * There is no guarantee that calls to `setState` will run synchronously,
  5328. * as they may eventually be batched together. You can provide an optional
  5329. * callback that will be executed when the call to setState is actually
  5330. * completed.
  5331. *
  5332. * When a function is provided to setState, it will be called at some point in
  5333. * the future (not synchronously). It will be called with the up to date
  5334. * component arguments (state, props, context). These values can be different
  5335. * from this.* because your function may be called after receiveProps but before
  5336. * shouldComponentUpdate, and this new state, props, and context will not yet be
  5337. * assigned to this.
  5338. *
  5339. * @param {object|function} partialState Next partial state or function to
  5340. * produce next partial state to be merged with current state.
  5341. * @param {?function} callback Called after state is updated.
  5342. * @final
  5343. * @protected
  5344. */
  5345. ReactComponent.prototype.setState = function(partialState, callback) {
  5346. ("production" !== "development" ? invariant(
  5347. typeof partialState === 'object' ||
  5348. typeof partialState === 'function' ||
  5349. partialState == null,
  5350. 'setState(...): takes an object of state variables to update or a ' +
  5351. 'function which returns an object of state variables.'
  5352. ) : invariant(typeof partialState === 'object' ||
  5353. typeof partialState === 'function' ||
  5354. partialState == null));
  5355. if ("production" !== "development") {
  5356. ("production" !== "development" ? warning(
  5357. partialState != null,
  5358. 'setState(...): You passed an undefined or null state object; ' +
  5359. 'instead, use forceUpdate().'
  5360. ) : null);
  5361. }
  5362. ReactUpdateQueue.enqueueSetState(this, partialState);
  5363. if (callback) {
  5364. ReactUpdateQueue.enqueueCallback(this, callback);
  5365. }
  5366. };
  5367. /**
  5368. * Forces an update. This should only be invoked when it is known with
  5369. * certainty that we are **not** in a DOM transaction.
  5370. *
  5371. * You may want to call this when you know that some deeper aspect of the
  5372. * component's state has changed but `setState` was not called.
  5373. *
  5374. * This will not invoke `shouldComponentUpdate`, but it will invoke
  5375. * `componentWillUpdate` and `componentDidUpdate`.
  5376. *
  5377. * @param {?function} callback Called after update is complete.
  5378. * @final
  5379. * @protected
  5380. */
  5381. ReactComponent.prototype.forceUpdate = function(callback) {
  5382. ReactUpdateQueue.enqueueForceUpdate(this);
  5383. if (callback) {
  5384. ReactUpdateQueue.enqueueCallback(this, callback);
  5385. }
  5386. };
  5387. /**
  5388. * Deprecated APIs. These APIs used to exist on classic React classes but since
  5389. * we would like to deprecate them, we're not going to move them over to this
  5390. * modern base class. Instead, we define a getter that warns if it's accessed.
  5391. */
  5392. if ("production" !== "development") {
  5393. var deprecatedAPIs = {
  5394. getDOMNode: [
  5395. 'getDOMNode',
  5396. 'Use React.findDOMNode(component) instead.'
  5397. ],
  5398. isMounted: [
  5399. 'isMounted',
  5400. 'Instead, make sure to clean up subscriptions and pending requests in ' +
  5401. 'componentWillUnmount to prevent memory leaks.'
  5402. ],
  5403. replaceProps: [
  5404. 'replaceProps',
  5405. 'Instead call React.render again at the top level.'
  5406. ],
  5407. replaceState: [
  5408. 'replaceState',
  5409. 'Refactor your code to use setState instead (see ' +
  5410. 'https://github.com/facebook/react/issues/3236).'
  5411. ],
  5412. setProps: [
  5413. 'setProps',
  5414. 'Instead call React.render again at the top level.'
  5415. ]
  5416. };
  5417. var defineDeprecationWarning = function(methodName, info) {
  5418. try {
  5419. Object.defineProperty(ReactComponent.prototype, methodName, {
  5420. get: function() {
  5421. ("production" !== "development" ? warning(
  5422. false,
  5423. '%s(...) is deprecated in plain JavaScript React classes. %s',
  5424. info[0],
  5425. info[1]
  5426. ) : null);
  5427. return undefined;
  5428. }
  5429. });
  5430. } catch (x) {
  5431. // IE will fail on defineProperty (es5-shim/sham too)
  5432. }
  5433. };
  5434. for (var fnName in deprecatedAPIs) {
  5435. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  5436. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  5437. }
  5438. }
  5439. }
  5440. module.exports = ReactComponent;
  5441. },{"135":135,"154":154,"86":86}],35:[function(_dereq_,module,exports){
  5442. /**
  5443. * Copyright 2013-2015, Facebook, Inc.
  5444. * All rights reserved.
  5445. *
  5446. * This source code is licensed under the BSD-style license found in the
  5447. * LICENSE file in the root directory of this source tree. An additional grant
  5448. * of patent rights can be found in the PATENTS file in the same directory.
  5449. *
  5450. * @providesModule ReactComponentBrowserEnvironment
  5451. */
  5452. /*jslint evil: true */
  5453. 'use strict';
  5454. var ReactDOMIDOperations = _dereq_(44);
  5455. var ReactMount = _dereq_(70);
  5456. /**
  5457. * Abstracts away all functionality of the reconciler that requires knowledge of
  5458. * the browser context. TODO: These callers should be refactored to avoid the
  5459. * need for this injection.
  5460. */
  5461. var ReactComponentBrowserEnvironment = {
  5462. processChildrenUpdates:
  5463. ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
  5464. replaceNodeWithMarkupByID:
  5465. ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
  5466. /**
  5467. * If a particular environment requires that some resources be cleaned up,
  5468. * specify this in the injected Mixin. In the DOM, we would likely want to
  5469. * purge any cached node ID lookups.
  5470. *
  5471. * @private
  5472. */
  5473. unmountIDFromEnvironment: function(rootNodeID) {
  5474. ReactMount.purgeID(rootNodeID);
  5475. }
  5476. };
  5477. module.exports = ReactComponentBrowserEnvironment;
  5478. },{"44":44,"70":70}],36:[function(_dereq_,module,exports){
  5479. /**
  5480. * Copyright 2014-2015, Facebook, Inc.
  5481. * All rights reserved.
  5482. *
  5483. * This source code is licensed under the BSD-style license found in the
  5484. * LICENSE file in the root directory of this source tree. An additional grant
  5485. * of patent rights can be found in the PATENTS file in the same directory.
  5486. *
  5487. * @providesModule ReactComponentEnvironment
  5488. */
  5489. 'use strict';
  5490. var invariant = _dereq_(135);
  5491. var injected = false;
  5492. var ReactComponentEnvironment = {
  5493. /**
  5494. * Optionally injectable environment dependent cleanup hook. (server vs.
  5495. * browser etc). Example: A browser system caches DOM nodes based on component
  5496. * ID and must remove that cache entry when this instance is unmounted.
  5497. */
  5498. unmountIDFromEnvironment: null,
  5499. /**
  5500. * Optionally injectable hook for swapping out mount images in the middle of
  5501. * the tree.
  5502. */
  5503. replaceNodeWithMarkupByID: null,
  5504. /**
  5505. * Optionally injectable hook for processing a queue of child updates. Will
  5506. * later move into MultiChildComponents.
  5507. */
  5508. processChildrenUpdates: null,
  5509. injection: {
  5510. injectEnvironment: function(environment) {
  5511. ("production" !== "development" ? invariant(
  5512. !injected,
  5513. 'ReactCompositeComponent: injectEnvironment() can only be called once.'
  5514. ) : invariant(!injected));
  5515. ReactComponentEnvironment.unmountIDFromEnvironment =
  5516. environment.unmountIDFromEnvironment;
  5517. ReactComponentEnvironment.replaceNodeWithMarkupByID =
  5518. environment.replaceNodeWithMarkupByID;
  5519. ReactComponentEnvironment.processChildrenUpdates =
  5520. environment.processChildrenUpdates;
  5521. injected = true;
  5522. }
  5523. }
  5524. };
  5525. module.exports = ReactComponentEnvironment;
  5526. },{"135":135}],37:[function(_dereq_,module,exports){
  5527. /**
  5528. * Copyright 2013-2015, Facebook, Inc.
  5529. * All rights reserved.
  5530. *
  5531. * This source code is licensed under the BSD-style license found in the
  5532. * LICENSE file in the root directory of this source tree. An additional grant
  5533. * of patent rights can be found in the PATENTS file in the same directory.
  5534. *
  5535. * @providesModule ReactCompositeComponent
  5536. */
  5537. 'use strict';
  5538. var ReactComponentEnvironment = _dereq_(36);
  5539. var ReactContext = _dereq_(38);
  5540. var ReactCurrentOwner = _dereq_(39);
  5541. var ReactElement = _dereq_(57);
  5542. var ReactElementValidator = _dereq_(58);
  5543. var ReactInstanceMap = _dereq_(67);
  5544. var ReactLifeCycle = _dereq_(68);
  5545. var ReactNativeComponent = _dereq_(73);
  5546. var ReactPerf = _dereq_(75);
  5547. var ReactPropTypeLocations = _dereq_(77);
  5548. var ReactPropTypeLocationNames = _dereq_(76);
  5549. var ReactReconciler = _dereq_(81);
  5550. var ReactUpdates = _dereq_(87);
  5551. var assign = _dereq_(27);
  5552. var emptyObject = _dereq_(115);
  5553. var invariant = _dereq_(135);
  5554. var shouldUpdateReactComponent = _dereq_(151);
  5555. var warning = _dereq_(154);
  5556. function getDeclarationErrorAddendum(component) {
  5557. var owner = component._currentElement._owner || null;
  5558. if (owner) {
  5559. var name = owner.getName();
  5560. if (name) {
  5561. return ' Check the render method of `' + name + '`.';
  5562. }
  5563. }
  5564. return '';
  5565. }
  5566. /**
  5567. * ------------------ The Life-Cycle of a Composite Component ------------------
  5568. *
  5569. * - constructor: Initialization of state. The instance is now retained.
  5570. * - componentWillMount
  5571. * - render
  5572. * - [children's constructors]
  5573. * - [children's componentWillMount and render]
  5574. * - [children's componentDidMount]
  5575. * - componentDidMount
  5576. *
  5577. * Update Phases:
  5578. * - componentWillReceiveProps (only called if parent updated)
  5579. * - shouldComponentUpdate
  5580. * - componentWillUpdate
  5581. * - render
  5582. * - [children's constructors or receive props phases]
  5583. * - componentDidUpdate
  5584. *
  5585. * - componentWillUnmount
  5586. * - [children's componentWillUnmount]
  5587. * - [children destroyed]
  5588. * - (destroyed): The instance is now blank, released by React and ready for GC.
  5589. *
  5590. * -----------------------------------------------------------------------------
  5591. */
  5592. /**
  5593. * An incrementing ID assigned to each component when it is mounted. This is
  5594. * used to enforce the order in which `ReactUpdates` updates dirty components.
  5595. *
  5596. * @private
  5597. */
  5598. var nextMountID = 1;
  5599. /**
  5600. * @lends {ReactCompositeComponent.prototype}
  5601. */
  5602. var ReactCompositeComponentMixin = {
  5603. /**
  5604. * Base constructor for all composite component.
  5605. *
  5606. * @param {ReactElement} element
  5607. * @final
  5608. * @internal
  5609. */
  5610. construct: function(element) {
  5611. this._currentElement = element;
  5612. this._rootNodeID = null;
  5613. this._instance = null;
  5614. // See ReactUpdateQueue
  5615. this._pendingElement = null;
  5616. this._pendingStateQueue = null;
  5617. this._pendingReplaceState = false;
  5618. this._pendingForceUpdate = false;
  5619. this._renderedComponent = null;
  5620. this._context = null;
  5621. this._mountOrder = 0;
  5622. this._isTopLevel = false;
  5623. // See ReactUpdates and ReactUpdateQueue.
  5624. this._pendingCallbacks = null;
  5625. },
  5626. /**
  5627. * Initializes the component, renders markup, and registers event listeners.
  5628. *
  5629. * @param {string} rootID DOM ID of the root node.
  5630. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  5631. * @return {?string} Rendered markup to be inserted into the DOM.
  5632. * @final
  5633. * @internal
  5634. */
  5635. mountComponent: function(rootID, transaction, context) {
  5636. this._context = context;
  5637. this._mountOrder = nextMountID++;
  5638. this._rootNodeID = rootID;
  5639. var publicProps = this._processProps(this._currentElement.props);
  5640. var publicContext = this._processContext(this._currentElement._context);
  5641. var Component = ReactNativeComponent.getComponentClassForElement(
  5642. this._currentElement
  5643. );
  5644. // Initialize the public class
  5645. var inst = new Component(publicProps, publicContext);
  5646. if ("production" !== "development") {
  5647. // This will throw later in _renderValidatedComponent, but add an early
  5648. // warning now to help debugging
  5649. ("production" !== "development" ? warning(
  5650. inst.render != null,
  5651. '%s(...): No `render` method found on the returned component ' +
  5652. 'instance: you may have forgotten to define `render` in your ' +
  5653. 'component or you may have accidentally tried to render an element ' +
  5654. 'whose type is a function that isn\'t a React component.',
  5655. Component.displayName || Component.name || 'Component'
  5656. ) : null);
  5657. }
  5658. // These should be set up in the constructor, but as a convenience for
  5659. // simpler class abstractions, we set them up after the fact.
  5660. inst.props = publicProps;
  5661. inst.context = publicContext;
  5662. inst.refs = emptyObject;
  5663. this._instance = inst;
  5664. // Store a reference from the instance back to the internal representation
  5665. ReactInstanceMap.set(inst, this);
  5666. if ("production" !== "development") {
  5667. this._warnIfContextsDiffer(this._currentElement._context, context);
  5668. }
  5669. if ("production" !== "development") {
  5670. // Since plain JS classes are defined without any special initialization
  5671. // logic, we can not catch common errors early. Therefore, we have to
  5672. // catch them here, at initialization time, instead.
  5673. ("production" !== "development" ? warning(
  5674. !inst.getInitialState ||
  5675. inst.getInitialState.isReactClassApproved,
  5676. 'getInitialState was defined on %s, a plain JavaScript class. ' +
  5677. 'This is only supported for classes created using React.createClass. ' +
  5678. 'Did you mean to define a state property instead?',
  5679. this.getName() || 'a component'
  5680. ) : null);
  5681. ("production" !== "development" ? warning(
  5682. !inst.getDefaultProps ||
  5683. inst.getDefaultProps.isReactClassApproved,
  5684. 'getDefaultProps was defined on %s, a plain JavaScript class. ' +
  5685. 'This is only supported for classes created using React.createClass. ' +
  5686. 'Use a static property to define defaultProps instead.',
  5687. this.getName() || 'a component'
  5688. ) : null);
  5689. ("production" !== "development" ? warning(
  5690. !inst.propTypes,
  5691. 'propTypes was defined as an instance property on %s. Use a static ' +
  5692. 'property to define propTypes instead.',
  5693. this.getName() || 'a component'
  5694. ) : null);
  5695. ("production" !== "development" ? warning(
  5696. !inst.contextTypes,
  5697. 'contextTypes was defined as an instance property on %s. Use a ' +
  5698. 'static property to define contextTypes instead.',
  5699. this.getName() || 'a component'
  5700. ) : null);
  5701. ("production" !== "development" ? warning(
  5702. typeof inst.componentShouldUpdate !== 'function',
  5703. '%s has a method called ' +
  5704. 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
  5705. 'The name is phrased as a question because the function is ' +
  5706. 'expected to return a value.',
  5707. (this.getName() || 'A component')
  5708. ) : null);
  5709. }
  5710. var initialState = inst.state;
  5711. if (initialState === undefined) {
  5712. inst.state = initialState = null;
  5713. }
  5714. ("production" !== "development" ? invariant(
  5715. typeof initialState === 'object' && !Array.isArray(initialState),
  5716. '%s.state: must be set to an object or null',
  5717. this.getName() || 'ReactCompositeComponent'
  5718. ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
  5719. this._pendingStateQueue = null;
  5720. this._pendingReplaceState = false;
  5721. this._pendingForceUpdate = false;
  5722. var childContext;
  5723. var renderedElement;
  5724. var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
  5725. ReactLifeCycle.currentlyMountingInstance = this;
  5726. try {
  5727. if (inst.componentWillMount) {
  5728. inst.componentWillMount();
  5729. // When mounting, calls to `setState` by `componentWillMount` will set
  5730. // `this._pendingStateQueue` without triggering a re-render.
  5731. if (this._pendingStateQueue) {
  5732. inst.state = this._processPendingState(inst.props, inst.context);
  5733. }
  5734. }
  5735. childContext = this._getValidatedChildContext(context);
  5736. renderedElement = this._renderValidatedComponent(childContext);
  5737. } finally {
  5738. ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
  5739. }
  5740. this._renderedComponent = this._instantiateReactComponent(
  5741. renderedElement,
  5742. this._currentElement.type // The wrapping type
  5743. );
  5744. var markup = ReactReconciler.mountComponent(
  5745. this._renderedComponent,
  5746. rootID,
  5747. transaction,
  5748. this._mergeChildContext(context, childContext)
  5749. );
  5750. if (inst.componentDidMount) {
  5751. transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
  5752. }
  5753. return markup;
  5754. },
  5755. /**
  5756. * Releases any resources allocated by `mountComponent`.
  5757. *
  5758. * @final
  5759. * @internal
  5760. */
  5761. unmountComponent: function() {
  5762. var inst = this._instance;
  5763. if (inst.componentWillUnmount) {
  5764. var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;
  5765. ReactLifeCycle.currentlyUnmountingInstance = this;
  5766. try {
  5767. inst.componentWillUnmount();
  5768. } finally {
  5769. ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;
  5770. }
  5771. }
  5772. ReactReconciler.unmountComponent(this._renderedComponent);
  5773. this._renderedComponent = null;
  5774. // Reset pending fields
  5775. this._pendingStateQueue = null;
  5776. this._pendingReplaceState = false;
  5777. this._pendingForceUpdate = false;
  5778. this._pendingCallbacks = null;
  5779. this._pendingElement = null;
  5780. // These fields do not really need to be reset since this object is no
  5781. // longer accessible.
  5782. this._context = null;
  5783. this._rootNodeID = null;
  5784. // Delete the reference from the instance to this internal representation
  5785. // which allow the internals to be properly cleaned up even if the user
  5786. // leaks a reference to the public instance.
  5787. ReactInstanceMap.remove(inst);
  5788. // Some existing components rely on inst.props even after they've been
  5789. // destroyed (in event handlers).
  5790. // TODO: inst.props = null;
  5791. // TODO: inst.state = null;
  5792. // TODO: inst.context = null;
  5793. },
  5794. /**
  5795. * Schedule a partial update to the props. Only used for internal testing.
  5796. *
  5797. * @param {object} partialProps Subset of the next props.
  5798. * @param {?function} callback Called after props are updated.
  5799. * @final
  5800. * @internal
  5801. */
  5802. _setPropsInternal: function(partialProps, callback) {
  5803. // This is a deoptimized path. We optimize for always having an element.
  5804. // This creates an extra internal element.
  5805. var element = this._pendingElement || this._currentElement;
  5806. this._pendingElement = ReactElement.cloneAndReplaceProps(
  5807. element,
  5808. assign({}, element.props, partialProps)
  5809. );
  5810. ReactUpdates.enqueueUpdate(this, callback);
  5811. },
  5812. /**
  5813. * Filters the context object to only contain keys specified in
  5814. * `contextTypes`
  5815. *
  5816. * @param {object} context
  5817. * @return {?object}
  5818. * @private
  5819. */
  5820. _maskContext: function(context) {
  5821. var maskedContext = null;
  5822. // This really should be getting the component class for the element,
  5823. // but we know that we're not going to need it for built-ins.
  5824. if (typeof this._currentElement.type === 'string') {
  5825. return emptyObject;
  5826. }
  5827. var contextTypes = this._currentElement.type.contextTypes;
  5828. if (!contextTypes) {
  5829. return emptyObject;
  5830. }
  5831. maskedContext = {};
  5832. for (var contextName in contextTypes) {
  5833. maskedContext[contextName] = context[contextName];
  5834. }
  5835. return maskedContext;
  5836. },
  5837. /**
  5838. * Filters the context object to only contain keys specified in
  5839. * `contextTypes`, and asserts that they are valid.
  5840. *
  5841. * @param {object} context
  5842. * @return {?object}
  5843. * @private
  5844. */
  5845. _processContext: function(context) {
  5846. var maskedContext = this._maskContext(context);
  5847. if ("production" !== "development") {
  5848. var Component = ReactNativeComponent.getComponentClassForElement(
  5849. this._currentElement
  5850. );
  5851. if (Component.contextTypes) {
  5852. this._checkPropTypes(
  5853. Component.contextTypes,
  5854. maskedContext,
  5855. ReactPropTypeLocations.context
  5856. );
  5857. }
  5858. }
  5859. return maskedContext;
  5860. },
  5861. /**
  5862. * @param {object} currentContext
  5863. * @return {object}
  5864. * @private
  5865. */
  5866. _getValidatedChildContext: function(currentContext) {
  5867. var inst = this._instance;
  5868. var childContext = inst.getChildContext && inst.getChildContext();
  5869. if (childContext) {
  5870. ("production" !== "development" ? invariant(
  5871. typeof inst.constructor.childContextTypes === 'object',
  5872. '%s.getChildContext(): childContextTypes must be defined in order to ' +
  5873. 'use getChildContext().',
  5874. this.getName() || 'ReactCompositeComponent'
  5875. ) : invariant(typeof inst.constructor.childContextTypes === 'object'));
  5876. if ("production" !== "development") {
  5877. this._checkPropTypes(
  5878. inst.constructor.childContextTypes,
  5879. childContext,
  5880. ReactPropTypeLocations.childContext
  5881. );
  5882. }
  5883. for (var name in childContext) {
  5884. ("production" !== "development" ? invariant(
  5885. name in inst.constructor.childContextTypes,
  5886. '%s.getChildContext(): key "%s" is not defined in childContextTypes.',
  5887. this.getName() || 'ReactCompositeComponent',
  5888. name
  5889. ) : invariant(name in inst.constructor.childContextTypes));
  5890. }
  5891. return childContext;
  5892. }
  5893. return null;
  5894. },
  5895. _mergeChildContext: function(currentContext, childContext) {
  5896. if (childContext) {
  5897. return assign({}, currentContext, childContext);
  5898. }
  5899. return currentContext;
  5900. },
  5901. /**
  5902. * Processes props by setting default values for unspecified props and
  5903. * asserting that the props are valid. Does not mutate its argument; returns
  5904. * a new props object with defaults merged in.
  5905. *
  5906. * @param {object} newProps
  5907. * @return {object}
  5908. * @private
  5909. */
  5910. _processProps: function(newProps) {
  5911. if ("production" !== "development") {
  5912. var Component = ReactNativeComponent.getComponentClassForElement(
  5913. this._currentElement
  5914. );
  5915. if (Component.propTypes) {
  5916. this._checkPropTypes(
  5917. Component.propTypes,
  5918. newProps,
  5919. ReactPropTypeLocations.prop
  5920. );
  5921. }
  5922. }
  5923. return newProps;
  5924. },
  5925. /**
  5926. * Assert that the props are valid
  5927. *
  5928. * @param {object} propTypes Map of prop name to a ReactPropType
  5929. * @param {object} props
  5930. * @param {string} location e.g. "prop", "context", "child context"
  5931. * @private
  5932. */
  5933. _checkPropTypes: function(propTypes, props, location) {
  5934. // TODO: Stop validating prop types here and only use the element
  5935. // validation.
  5936. var componentName = this.getName();
  5937. for (var propName in propTypes) {
  5938. if (propTypes.hasOwnProperty(propName)) {
  5939. var error;
  5940. try {
  5941. // This is intentionally an invariant that gets caught. It's the same
  5942. // behavior as without this statement except with a better message.
  5943. ("production" !== "development" ? invariant(
  5944. typeof propTypes[propName] === 'function',
  5945. '%s: %s type `%s` is invalid; it must be a function, usually ' +
  5946. 'from React.PropTypes.',
  5947. componentName || 'React class',
  5948. ReactPropTypeLocationNames[location],
  5949. propName
  5950. ) : invariant(typeof propTypes[propName] === 'function'));
  5951. error = propTypes[propName](props, propName, componentName, location);
  5952. } catch (ex) {
  5953. error = ex;
  5954. }
  5955. if (error instanceof Error) {
  5956. // We may want to extend this logic for similar errors in
  5957. // React.render calls, so I'm abstracting it away into
  5958. // a function to minimize refactoring in the future
  5959. var addendum = getDeclarationErrorAddendum(this);
  5960. if (location === ReactPropTypeLocations.prop) {
  5961. // Preface gives us something to blacklist in warning module
  5962. ("production" !== "development" ? warning(
  5963. false,
  5964. 'Failed Composite propType: %s%s',
  5965. error.message,
  5966. addendum
  5967. ) : null);
  5968. } else {
  5969. ("production" !== "development" ? warning(
  5970. false,
  5971. 'Failed Context Types: %s%s',
  5972. error.message,
  5973. addendum
  5974. ) : null);
  5975. }
  5976. }
  5977. }
  5978. }
  5979. },
  5980. receiveComponent: function(nextElement, transaction, nextContext) {
  5981. var prevElement = this._currentElement;
  5982. var prevContext = this._context;
  5983. this._pendingElement = null;
  5984. this.updateComponent(
  5985. transaction,
  5986. prevElement,
  5987. nextElement,
  5988. prevContext,
  5989. nextContext
  5990. );
  5991. },
  5992. /**
  5993. * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
  5994. * is set, update the component.
  5995. *
  5996. * @param {ReactReconcileTransaction} transaction
  5997. * @internal
  5998. */
  5999. performUpdateIfNecessary: function(transaction) {
  6000. if (this._pendingElement != null) {
  6001. ReactReconciler.receiveComponent(
  6002. this,
  6003. this._pendingElement || this._currentElement,
  6004. transaction,
  6005. this._context
  6006. );
  6007. }
  6008. if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
  6009. if ("production" !== "development") {
  6010. ReactElementValidator.checkAndWarnForMutatedProps(
  6011. this._currentElement
  6012. );
  6013. }
  6014. this.updateComponent(
  6015. transaction,
  6016. this._currentElement,
  6017. this._currentElement,
  6018. this._context,
  6019. this._context
  6020. );
  6021. }
  6022. },
  6023. /**
  6024. * Compare two contexts, warning if they are different
  6025. * TODO: Remove this check when owner-context is removed
  6026. */
  6027. _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
  6028. ownerBasedContext = this._maskContext(ownerBasedContext);
  6029. parentBasedContext = this._maskContext(parentBasedContext);
  6030. var parentKeys = Object.keys(parentBasedContext).sort();
  6031. var displayName = this.getName() || 'ReactCompositeComponent';
  6032. for (var i = 0; i < parentKeys.length; i++) {
  6033. var key = parentKeys[i];
  6034. ("production" !== "development" ? warning(
  6035. ownerBasedContext[key] === parentBasedContext[key],
  6036. 'owner-based and parent-based contexts differ ' +
  6037. '(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
  6038. '(see: http://fb.me/react-context-by-parent)',
  6039. ownerBasedContext[key],
  6040. parentBasedContext[key],
  6041. key,
  6042. displayName
  6043. ) : null);
  6044. }
  6045. },
  6046. /**
  6047. * Perform an update to a mounted component. The componentWillReceiveProps and
  6048. * shouldComponentUpdate methods are called, then (assuming the update isn't
  6049. * skipped) the remaining update lifecycle methods are called and the DOM
  6050. * representation is updated.
  6051. *
  6052. * By default, this implements React's rendering and reconciliation algorithm.
  6053. * Sophisticated clients may wish to override this.
  6054. *
  6055. * @param {ReactReconcileTransaction} transaction
  6056. * @param {ReactElement} prevParentElement
  6057. * @param {ReactElement} nextParentElement
  6058. * @internal
  6059. * @overridable
  6060. */
  6061. updateComponent: function(
  6062. transaction,
  6063. prevParentElement,
  6064. nextParentElement,
  6065. prevUnmaskedContext,
  6066. nextUnmaskedContext
  6067. ) {
  6068. var inst = this._instance;
  6069. var nextContext = inst.context;
  6070. var nextProps = inst.props;
  6071. // Distinguish between a props update versus a simple state update
  6072. if (prevParentElement !== nextParentElement) {
  6073. nextContext = this._processContext(nextParentElement._context);
  6074. nextProps = this._processProps(nextParentElement.props);
  6075. if ("production" !== "development") {
  6076. if (nextUnmaskedContext != null) {
  6077. this._warnIfContextsDiffer(
  6078. nextParentElement._context,
  6079. nextUnmaskedContext
  6080. );
  6081. }
  6082. }
  6083. // An update here will schedule an update but immediately set
  6084. // _pendingStateQueue which will ensure that any state updates gets
  6085. // immediately reconciled instead of waiting for the next batch.
  6086. if (inst.componentWillReceiveProps) {
  6087. inst.componentWillReceiveProps(nextProps, nextContext);
  6088. }
  6089. }
  6090. var nextState = this._processPendingState(nextProps, nextContext);
  6091. var shouldUpdate =
  6092. this._pendingForceUpdate ||
  6093. !inst.shouldComponentUpdate ||
  6094. inst.shouldComponentUpdate(nextProps, nextState, nextContext);
  6095. if ("production" !== "development") {
  6096. ("production" !== "development" ? warning(
  6097. typeof shouldUpdate !== 'undefined',
  6098. '%s.shouldComponentUpdate(): Returned undefined instead of a ' +
  6099. 'boolean value. Make sure to return true or false.',
  6100. this.getName() || 'ReactCompositeComponent'
  6101. ) : null);
  6102. }
  6103. if (shouldUpdate) {
  6104. this._pendingForceUpdate = false;
  6105. // Will set `this.props`, `this.state` and `this.context`.
  6106. this._performComponentUpdate(
  6107. nextParentElement,
  6108. nextProps,
  6109. nextState,
  6110. nextContext,
  6111. transaction,
  6112. nextUnmaskedContext
  6113. );
  6114. } else {
  6115. // If it's determined that a component should not update, we still want
  6116. // to set props and state but we shortcut the rest of the update.
  6117. this._currentElement = nextParentElement;
  6118. this._context = nextUnmaskedContext;
  6119. inst.props = nextProps;
  6120. inst.state = nextState;
  6121. inst.context = nextContext;
  6122. }
  6123. },
  6124. _processPendingState: function(props, context) {
  6125. var inst = this._instance;
  6126. var queue = this._pendingStateQueue;
  6127. var replace = this._pendingReplaceState;
  6128. this._pendingReplaceState = false;
  6129. this._pendingStateQueue = null;
  6130. if (!queue) {
  6131. return inst.state;
  6132. }
  6133. if (replace && queue.length === 1) {
  6134. return queue[0];
  6135. }
  6136. var nextState = assign({}, replace ? queue[0] : inst.state);
  6137. for (var i = replace ? 1 : 0; i < queue.length; i++) {
  6138. var partial = queue[i];
  6139. assign(
  6140. nextState,
  6141. typeof partial === 'function' ?
  6142. partial.call(inst, nextState, props, context) :
  6143. partial
  6144. );
  6145. }
  6146. return nextState;
  6147. },
  6148. /**
  6149. * Merges new props and state, notifies delegate methods of update and
  6150. * performs update.
  6151. *
  6152. * @param {ReactElement} nextElement Next element
  6153. * @param {object} nextProps Next public object to set as properties.
  6154. * @param {?object} nextState Next object to set as state.
  6155. * @param {?object} nextContext Next public object to set as context.
  6156. * @param {ReactReconcileTransaction} transaction
  6157. * @param {?object} unmaskedContext
  6158. * @private
  6159. */
  6160. _performComponentUpdate: function(
  6161. nextElement,
  6162. nextProps,
  6163. nextState,
  6164. nextContext,
  6165. transaction,
  6166. unmaskedContext
  6167. ) {
  6168. var inst = this._instance;
  6169. var prevProps = inst.props;
  6170. var prevState = inst.state;
  6171. var prevContext = inst.context;
  6172. if (inst.componentWillUpdate) {
  6173. inst.componentWillUpdate(nextProps, nextState, nextContext);
  6174. }
  6175. this._currentElement = nextElement;
  6176. this._context = unmaskedContext;
  6177. inst.props = nextProps;
  6178. inst.state = nextState;
  6179. inst.context = nextContext;
  6180. this._updateRenderedComponent(transaction, unmaskedContext);
  6181. if (inst.componentDidUpdate) {
  6182. transaction.getReactMountReady().enqueue(
  6183. inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
  6184. inst
  6185. );
  6186. }
  6187. },
  6188. /**
  6189. * Call the component's `render` method and update the DOM accordingly.
  6190. *
  6191. * @param {ReactReconcileTransaction} transaction
  6192. * @internal
  6193. */
  6194. _updateRenderedComponent: function(transaction, context) {
  6195. var prevComponentInstance = this._renderedComponent;
  6196. var prevRenderedElement = prevComponentInstance._currentElement;
  6197. var childContext = this._getValidatedChildContext();
  6198. var nextRenderedElement = this._renderValidatedComponent(childContext);
  6199. if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
  6200. ReactReconciler.receiveComponent(
  6201. prevComponentInstance,
  6202. nextRenderedElement,
  6203. transaction,
  6204. this._mergeChildContext(context, childContext)
  6205. );
  6206. } else {
  6207. // These two IDs are actually the same! But nothing should rely on that.
  6208. var thisID = this._rootNodeID;
  6209. var prevComponentID = prevComponentInstance._rootNodeID;
  6210. ReactReconciler.unmountComponent(prevComponentInstance);
  6211. this._renderedComponent = this._instantiateReactComponent(
  6212. nextRenderedElement,
  6213. this._currentElement.type
  6214. );
  6215. var nextMarkup = ReactReconciler.mountComponent(
  6216. this._renderedComponent,
  6217. thisID,
  6218. transaction,
  6219. this._mergeChildContext(context, childContext)
  6220. );
  6221. this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
  6222. }
  6223. },
  6224. /**
  6225. * @protected
  6226. */
  6227. _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
  6228. ReactComponentEnvironment.replaceNodeWithMarkupByID(
  6229. prevComponentID,
  6230. nextMarkup
  6231. );
  6232. },
  6233. /**
  6234. * @protected
  6235. */
  6236. _renderValidatedComponentWithoutOwnerOrContext: function() {
  6237. var inst = this._instance;
  6238. var renderedComponent = inst.render();
  6239. if ("production" !== "development") {
  6240. // We allow auto-mocks to proceed as if they're returning null.
  6241. if (typeof renderedComponent === 'undefined' &&
  6242. inst.render._isMockFunction) {
  6243. // This is probably bad practice. Consider warning here and
  6244. // deprecating this convenience.
  6245. renderedComponent = null;
  6246. }
  6247. }
  6248. return renderedComponent;
  6249. },
  6250. /**
  6251. * @private
  6252. */
  6253. _renderValidatedComponent: function(childContext) {
  6254. var renderedComponent;
  6255. var previousContext = ReactContext.current;
  6256. ReactContext.current = this._mergeChildContext(
  6257. this._currentElement._context,
  6258. childContext
  6259. );
  6260. ReactCurrentOwner.current = this;
  6261. try {
  6262. renderedComponent =
  6263. this._renderValidatedComponentWithoutOwnerOrContext();
  6264. } finally {
  6265. ReactContext.current = previousContext;
  6266. ReactCurrentOwner.current = null;
  6267. }
  6268. ("production" !== "development" ? invariant(
  6269. // TODO: An `isValidNode` function would probably be more appropriate
  6270. renderedComponent === null || renderedComponent === false ||
  6271. ReactElement.isValidElement(renderedComponent),
  6272. '%s.render(): A valid ReactComponent must be returned. You may have ' +
  6273. 'returned undefined, an array or some other invalid object.',
  6274. this.getName() || 'ReactCompositeComponent'
  6275. ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
  6276. renderedComponent === null || renderedComponent === false ||
  6277. ReactElement.isValidElement(renderedComponent)));
  6278. return renderedComponent;
  6279. },
  6280. /**
  6281. * Lazily allocates the refs object and stores `component` as `ref`.
  6282. *
  6283. * @param {string} ref Reference name.
  6284. * @param {component} component Component to store as `ref`.
  6285. * @final
  6286. * @private
  6287. */
  6288. attachRef: function(ref, component) {
  6289. var inst = this.getPublicInstance();
  6290. var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
  6291. refs[ref] = component.getPublicInstance();
  6292. },
  6293. /**
  6294. * Detaches a reference name.
  6295. *
  6296. * @param {string} ref Name to dereference.
  6297. * @final
  6298. * @private
  6299. */
  6300. detachRef: function(ref) {
  6301. var refs = this.getPublicInstance().refs;
  6302. delete refs[ref];
  6303. },
  6304. /**
  6305. * Get a text description of the component that can be used to identify it
  6306. * in error messages.
  6307. * @return {string} The name or null.
  6308. * @internal
  6309. */
  6310. getName: function() {
  6311. var type = this._currentElement.type;
  6312. var constructor = this._instance && this._instance.constructor;
  6313. return (
  6314. type.displayName || (constructor && constructor.displayName) ||
  6315. type.name || (constructor && constructor.name) ||
  6316. null
  6317. );
  6318. },
  6319. /**
  6320. * Get the publicly accessible representation of this component - i.e. what
  6321. * is exposed by refs and returned by React.render. Can be null for stateless
  6322. * components.
  6323. *
  6324. * @return {ReactComponent} the public component instance.
  6325. * @internal
  6326. */
  6327. getPublicInstance: function() {
  6328. return this._instance;
  6329. },
  6330. // Stub
  6331. _instantiateReactComponent: null
  6332. };
  6333. ReactPerf.measureMethods(
  6334. ReactCompositeComponentMixin,
  6335. 'ReactCompositeComponent',
  6336. {
  6337. mountComponent: 'mountComponent',
  6338. updateComponent: 'updateComponent',
  6339. _renderValidatedComponent: '_renderValidatedComponent'
  6340. }
  6341. );
  6342. var ReactCompositeComponent = {
  6343. Mixin: ReactCompositeComponentMixin
  6344. };
  6345. module.exports = ReactCompositeComponent;
  6346. },{"115":115,"135":135,"151":151,"154":154,"27":27,"36":36,"38":38,"39":39,"57":57,"58":58,"67":67,"68":68,"73":73,"75":75,"76":76,"77":77,"81":81,"87":87}],38:[function(_dereq_,module,exports){
  6347. /**
  6348. * Copyright 2013-2015, Facebook, Inc.
  6349. * All rights reserved.
  6350. *
  6351. * This source code is licensed under the BSD-style license found in the
  6352. * LICENSE file in the root directory of this source tree. An additional grant
  6353. * of patent rights can be found in the PATENTS file in the same directory.
  6354. *
  6355. * @providesModule ReactContext
  6356. */
  6357. 'use strict';
  6358. var assign = _dereq_(27);
  6359. var emptyObject = _dereq_(115);
  6360. var warning = _dereq_(154);
  6361. var didWarn = false;
  6362. /**
  6363. * Keeps track of the current context.
  6364. *
  6365. * The context is automatically passed down the component ownership hierarchy
  6366. * and is accessible via `this.context` on ReactCompositeComponents.
  6367. */
  6368. var ReactContext = {
  6369. /**
  6370. * @internal
  6371. * @type {object}
  6372. */
  6373. current: emptyObject,
  6374. /**
  6375. * Temporarily extends the current context while executing scopedCallback.
  6376. *
  6377. * A typical use case might look like
  6378. *
  6379. * render: function() {
  6380. * var children = ReactContext.withContext({foo: 'foo'}, () => (
  6381. *
  6382. * ));
  6383. * return <div>{children}</div>;
  6384. * }
  6385. *
  6386. * @param {object} newContext New context to merge into the existing context
  6387. * @param {function} scopedCallback Callback to run with the new context
  6388. * @return {ReactComponent|array<ReactComponent>}
  6389. */
  6390. withContext: function(newContext, scopedCallback) {
  6391. if ("production" !== "development") {
  6392. ("production" !== "development" ? warning(
  6393. didWarn,
  6394. 'withContext is deprecated and will be removed in a future version. ' +
  6395. 'Use a wrapper component with getChildContext instead.'
  6396. ) : null);
  6397. didWarn = true;
  6398. }
  6399. var result;
  6400. var previousContext = ReactContext.current;
  6401. ReactContext.current = assign({}, previousContext, newContext);
  6402. try {
  6403. result = scopedCallback();
  6404. } finally {
  6405. ReactContext.current = previousContext;
  6406. }
  6407. return result;
  6408. }
  6409. };
  6410. module.exports = ReactContext;
  6411. },{"115":115,"154":154,"27":27}],39:[function(_dereq_,module,exports){
  6412. /**
  6413. * Copyright 2013-2015, Facebook, Inc.
  6414. * All rights reserved.
  6415. *
  6416. * This source code is licensed under the BSD-style license found in the
  6417. * LICENSE file in the root directory of this source tree. An additional grant
  6418. * of patent rights can be found in the PATENTS file in the same directory.
  6419. *
  6420. * @providesModule ReactCurrentOwner
  6421. */
  6422. 'use strict';
  6423. /**
  6424. * Keeps track of the current owner.
  6425. *
  6426. * The current owner is the component who should own any components that are
  6427. * currently being constructed.
  6428. *
  6429. * The depth indicate how many composite components are above this render level.
  6430. */
  6431. var ReactCurrentOwner = {
  6432. /**
  6433. * @internal
  6434. * @type {ReactComponent}
  6435. */
  6436. current: null
  6437. };
  6438. module.exports = ReactCurrentOwner;
  6439. },{}],40:[function(_dereq_,module,exports){
  6440. /**
  6441. * Copyright 2013-2015, Facebook, Inc.
  6442. * All rights reserved.
  6443. *
  6444. * This source code is licensed under the BSD-style license found in the
  6445. * LICENSE file in the root directory of this source tree. An additional grant
  6446. * of patent rights can be found in the PATENTS file in the same directory.
  6447. *
  6448. * @providesModule ReactDOM
  6449. * @typechecks static-only
  6450. */
  6451. 'use strict';
  6452. var ReactElement = _dereq_(57);
  6453. var ReactElementValidator = _dereq_(58);
  6454. var mapObject = _dereq_(142);
  6455. /**
  6456. * Create a factory that creates HTML tag elements.
  6457. *
  6458. * @param {string} tag Tag name (e.g. `div`).
  6459. * @private
  6460. */
  6461. function createDOMFactory(tag) {
  6462. if ("production" !== "development") {
  6463. return ReactElementValidator.createFactory(tag);
  6464. }
  6465. return ReactElement.createFactory(tag);
  6466. }
  6467. /**
  6468. * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
  6469. * This is also accessible via `React.DOM`.
  6470. *
  6471. * @public
  6472. */
  6473. var ReactDOM = mapObject({
  6474. a: 'a',
  6475. abbr: 'abbr',
  6476. address: 'address',
  6477. area: 'area',
  6478. article: 'article',
  6479. aside: 'aside',
  6480. audio: 'audio',
  6481. b: 'b',
  6482. base: 'base',
  6483. bdi: 'bdi',
  6484. bdo: 'bdo',
  6485. big: 'big',
  6486. blockquote: 'blockquote',
  6487. body: 'body',
  6488. br: 'br',
  6489. button: 'button',
  6490. canvas: 'canvas',
  6491. caption: 'caption',
  6492. cite: 'cite',
  6493. code: 'code',
  6494. col: 'col',
  6495. colgroup: 'colgroup',
  6496. data: 'data',
  6497. datalist: 'datalist',
  6498. dd: 'dd',
  6499. del: 'del',
  6500. details: 'details',
  6501. dfn: 'dfn',
  6502. dialog: 'dialog',
  6503. div: 'div',
  6504. dl: 'dl',
  6505. dt: 'dt',
  6506. em: 'em',
  6507. embed: 'embed',
  6508. fieldset: 'fieldset',
  6509. figcaption: 'figcaption',
  6510. figure: 'figure',
  6511. footer: 'footer',
  6512. form: 'form',
  6513. h1: 'h1',
  6514. h2: 'h2',
  6515. h3: 'h3',
  6516. h4: 'h4',
  6517. h5: 'h5',
  6518. h6: 'h6',
  6519. head: 'head',
  6520. header: 'header',
  6521. hr: 'hr',
  6522. html: 'html',
  6523. i: 'i',
  6524. iframe: 'iframe',
  6525. img: 'img',
  6526. input: 'input',
  6527. ins: 'ins',
  6528. kbd: 'kbd',
  6529. keygen: 'keygen',
  6530. label: 'label',
  6531. legend: 'legend',
  6532. li: 'li',
  6533. link: 'link',
  6534. main: 'main',
  6535. map: 'map',
  6536. mark: 'mark',
  6537. menu: 'menu',
  6538. menuitem: 'menuitem',
  6539. meta: 'meta',
  6540. meter: 'meter',
  6541. nav: 'nav',
  6542. noscript: 'noscript',
  6543. object: 'object',
  6544. ol: 'ol',
  6545. optgroup: 'optgroup',
  6546. option: 'option',
  6547. output: 'output',
  6548. p: 'p',
  6549. param: 'param',
  6550. picture: 'picture',
  6551. pre: 'pre',
  6552. progress: 'progress',
  6553. q: 'q',
  6554. rp: 'rp',
  6555. rt: 'rt',
  6556. ruby: 'ruby',
  6557. s: 's',
  6558. samp: 'samp',
  6559. script: 'script',
  6560. section: 'section',
  6561. select: 'select',
  6562. small: 'small',
  6563. source: 'source',
  6564. span: 'span',
  6565. strong: 'strong',
  6566. style: 'style',
  6567. sub: 'sub',
  6568. summary: 'summary',
  6569. sup: 'sup',
  6570. table: 'table',
  6571. tbody: 'tbody',
  6572. td: 'td',
  6573. textarea: 'textarea',
  6574. tfoot: 'tfoot',
  6575. th: 'th',
  6576. thead: 'thead',
  6577. time: 'time',
  6578. title: 'title',
  6579. tr: 'tr',
  6580. track: 'track',
  6581. u: 'u',
  6582. ul: 'ul',
  6583. 'var': 'var',
  6584. video: 'video',
  6585. wbr: 'wbr',
  6586. // SVG
  6587. circle: 'circle',
  6588. clipPath: 'clipPath',
  6589. defs: 'defs',
  6590. ellipse: 'ellipse',
  6591. g: 'g',
  6592. line: 'line',
  6593. linearGradient: 'linearGradient',
  6594. mask: 'mask',
  6595. path: 'path',
  6596. pattern: 'pattern',
  6597. polygon: 'polygon',
  6598. polyline: 'polyline',
  6599. radialGradient: 'radialGradient',
  6600. rect: 'rect',
  6601. stop: 'stop',
  6602. svg: 'svg',
  6603. text: 'text',
  6604. tspan: 'tspan'
  6605. }, createDOMFactory);
  6606. module.exports = ReactDOM;
  6607. },{"142":142,"57":57,"58":58}],41:[function(_dereq_,module,exports){
  6608. /**
  6609. * Copyright 2013-2015, Facebook, Inc.
  6610. * All rights reserved.
  6611. *
  6612. * This source code is licensed under the BSD-style license found in the
  6613. * LICENSE file in the root directory of this source tree. An additional grant
  6614. * of patent rights can be found in the PATENTS file in the same directory.
  6615. *
  6616. * @providesModule ReactDOMButton
  6617. */
  6618. 'use strict';
  6619. var AutoFocusMixin = _dereq_(2);
  6620. var ReactBrowserComponentMixin = _dereq_(29);
  6621. var ReactClass = _dereq_(33);
  6622. var ReactElement = _dereq_(57);
  6623. var keyMirror = _dereq_(140);
  6624. var button = ReactElement.createFactory('button');
  6625. var mouseListenerNames = keyMirror({
  6626. onClick: true,
  6627. onDoubleClick: true,
  6628. onMouseDown: true,
  6629. onMouseMove: true,
  6630. onMouseUp: true,
  6631. onClickCapture: true,
  6632. onDoubleClickCapture: true,
  6633. onMouseDownCapture: true,
  6634. onMouseMoveCapture: true,
  6635. onMouseUpCapture: true
  6636. });
  6637. /**
  6638. * Implements a <button> native component that does not receive mouse events
  6639. * when `disabled` is set.
  6640. */
  6641. var ReactDOMButton = ReactClass.createClass({
  6642. displayName: 'ReactDOMButton',
  6643. tagName: 'BUTTON',
  6644. mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
  6645. render: function() {
  6646. var props = {};
  6647. // Copy the props; except the mouse listeners if we're disabled
  6648. for (var key in this.props) {
  6649. if (this.props.hasOwnProperty(key) &&
  6650. (!this.props.disabled || !mouseListenerNames[key])) {
  6651. props[key] = this.props[key];
  6652. }
  6653. }
  6654. return button(props, this.props.children);
  6655. }
  6656. });
  6657. module.exports = ReactDOMButton;
  6658. },{"140":140,"2":2,"29":29,"33":33,"57":57}],42:[function(_dereq_,module,exports){
  6659. /**
  6660. * Copyright 2013-2015, Facebook, Inc.
  6661. * All rights reserved.
  6662. *
  6663. * This source code is licensed under the BSD-style license found in the
  6664. * LICENSE file in the root directory of this source tree. An additional grant
  6665. * of patent rights can be found in the PATENTS file in the same directory.
  6666. *
  6667. * @providesModule ReactDOMComponent
  6668. * @typechecks static-only
  6669. */
  6670. /* global hasOwnProperty:true */
  6671. 'use strict';
  6672. var CSSPropertyOperations = _dereq_(5);
  6673. var DOMProperty = _dereq_(10);
  6674. var DOMPropertyOperations = _dereq_(11);
  6675. var ReactBrowserEventEmitter = _dereq_(30);
  6676. var ReactComponentBrowserEnvironment =
  6677. _dereq_(35);
  6678. var ReactMount = _dereq_(70);
  6679. var ReactMultiChild = _dereq_(71);
  6680. var ReactPerf = _dereq_(75);
  6681. var assign = _dereq_(27);
  6682. var escapeTextContentForBrowser = _dereq_(116);
  6683. var invariant = _dereq_(135);
  6684. var isEventSupported = _dereq_(136);
  6685. var keyOf = _dereq_(141);
  6686. var warning = _dereq_(154);
  6687. var deleteListener = ReactBrowserEventEmitter.deleteListener;
  6688. var listenTo = ReactBrowserEventEmitter.listenTo;
  6689. var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
  6690. // For quickly matching children type, to test if can be treated as content.
  6691. var CONTENT_TYPES = {'string': true, 'number': true};
  6692. var STYLE = keyOf({style: null});
  6693. var ELEMENT_NODE_TYPE = 1;
  6694. /**
  6695. * Optionally injectable operations for mutating the DOM
  6696. */
  6697. var BackendIDOperations = null;
  6698. /**
  6699. * @param {?object} props
  6700. */
  6701. function assertValidProps(props) {
  6702. if (!props) {
  6703. return;
  6704. }
  6705. // Note the use of `==` which checks for null or undefined.
  6706. if (props.dangerouslySetInnerHTML != null) {
  6707. ("production" !== "development" ? invariant(
  6708. props.children == null,
  6709. 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
  6710. ) : invariant(props.children == null));
  6711. ("production" !== "development" ? invariant(
  6712. typeof props.dangerouslySetInnerHTML === 'object' &&
  6713. '__html' in props.dangerouslySetInnerHTML,
  6714. '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
  6715. 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' +
  6716. 'for more information.'
  6717. ) : invariant(typeof props.dangerouslySetInnerHTML === 'object' &&
  6718. '__html' in props.dangerouslySetInnerHTML));
  6719. }
  6720. if ("production" !== "development") {
  6721. ("production" !== "development" ? warning(
  6722. props.innerHTML == null,
  6723. 'Directly setting property `innerHTML` is not permitted. ' +
  6724. 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
  6725. ) : null);
  6726. ("production" !== "development" ? warning(
  6727. !props.contentEditable || props.children == null,
  6728. 'A component is `contentEditable` and contains `children` managed by ' +
  6729. 'React. It is now your responsibility to guarantee that none of ' +
  6730. 'those nodes are unexpectedly modified or duplicated. This is ' +
  6731. 'probably not intentional.'
  6732. ) : null);
  6733. }
  6734. ("production" !== "development" ? invariant(
  6735. props.style == null || typeof props.style === 'object',
  6736. 'The `style` prop expects a mapping from style properties to values, ' +
  6737. 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
  6738. 'using JSX.'
  6739. ) : invariant(props.style == null || typeof props.style === 'object'));
  6740. }
  6741. function putListener(id, registrationName, listener, transaction) {
  6742. if ("production" !== "development") {
  6743. // IE8 has no API for event capturing and the `onScroll` event doesn't
  6744. // bubble.
  6745. ("production" !== "development" ? warning(
  6746. registrationName !== 'onScroll' || isEventSupported('scroll', true),
  6747. 'This browser doesn\'t support the `onScroll` event'
  6748. ) : null);
  6749. }
  6750. var container = ReactMount.findReactContainerForID(id);
  6751. if (container) {
  6752. var doc = container.nodeType === ELEMENT_NODE_TYPE ?
  6753. container.ownerDocument :
  6754. container;
  6755. listenTo(registrationName, doc);
  6756. }
  6757. transaction.getPutListenerQueue().enqueuePutListener(
  6758. id,
  6759. registrationName,
  6760. listener
  6761. );
  6762. }
  6763. // For HTML, certain tags should omit their close tag. We keep a whitelist for
  6764. // those special cased tags.
  6765. var omittedCloseTags = {
  6766. 'area': true,
  6767. 'base': true,
  6768. 'br': true,
  6769. 'col': true,
  6770. 'embed': true,
  6771. 'hr': true,
  6772. 'img': true,
  6773. 'input': true,
  6774. 'keygen': true,
  6775. 'link': true,
  6776. 'meta': true,
  6777. 'param': true,
  6778. 'source': true,
  6779. 'track': true,
  6780. 'wbr': true
  6781. // NOTE: menuitem's close tag should be omitted, but that causes problems.
  6782. };
  6783. // We accept any tag to be rendered but since this gets injected into abitrary
  6784. // HTML, we want to make sure that it's a safe tag.
  6785. // http://www.w3.org/TR/REC-xml/#NT-Name
  6786. var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
  6787. var validatedTagCache = {};
  6788. var hasOwnProperty = {}.hasOwnProperty;
  6789. function validateDangerousTag(tag) {
  6790. if (!hasOwnProperty.call(validatedTagCache, tag)) {
  6791. ("production" !== "development" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag)));
  6792. validatedTagCache[tag] = true;
  6793. }
  6794. }
  6795. /**
  6796. * Creates a new React class that is idempotent and capable of containing other
  6797. * React components. It accepts event listeners and DOM properties that are
  6798. * valid according to `DOMProperty`.
  6799. *
  6800. * - Event listeners: `onClick`, `onMouseDown`, etc.
  6801. * - DOM properties: `className`, `name`, `title`, etc.
  6802. *
  6803. * The `style` property functions differently from the DOM API. It accepts an
  6804. * object mapping of style properties to values.
  6805. *
  6806. * @constructor ReactDOMComponent
  6807. * @extends ReactMultiChild
  6808. */
  6809. function ReactDOMComponent(tag) {
  6810. validateDangerousTag(tag);
  6811. this._tag = tag;
  6812. this._renderedChildren = null;
  6813. this._previousStyleCopy = null;
  6814. this._rootNodeID = null;
  6815. }
  6816. ReactDOMComponent.displayName = 'ReactDOMComponent';
  6817. ReactDOMComponent.Mixin = {
  6818. construct: function(element) {
  6819. this._currentElement = element;
  6820. },
  6821. /**
  6822. * Generates root tag markup then recurses. This method has side effects and
  6823. * is not idempotent.
  6824. *
  6825. * @internal
  6826. * @param {string} rootID The root DOM ID for this node.
  6827. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6828. * @return {string} The computed markup.
  6829. */
  6830. mountComponent: function(rootID, transaction, context) {
  6831. this._rootNodeID = rootID;
  6832. assertValidProps(this._currentElement.props);
  6833. var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';
  6834. return (
  6835. this._createOpenTagMarkupAndPutListeners(transaction) +
  6836. this._createContentMarkup(transaction, context) +
  6837. closeTag
  6838. );
  6839. },
  6840. /**
  6841. * Creates markup for the open tag and all attributes.
  6842. *
  6843. * This method has side effects because events get registered.
  6844. *
  6845. * Iterating over object properties is faster than iterating over arrays.
  6846. * @see http://jsperf.com/obj-vs-arr-iteration
  6847. *
  6848. * @private
  6849. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6850. * @return {string} Markup of opening tag.
  6851. */
  6852. _createOpenTagMarkupAndPutListeners: function(transaction) {
  6853. var props = this._currentElement.props;
  6854. var ret = '<' + this._tag;
  6855. for (var propKey in props) {
  6856. if (!props.hasOwnProperty(propKey)) {
  6857. continue;
  6858. }
  6859. var propValue = props[propKey];
  6860. if (propValue == null) {
  6861. continue;
  6862. }
  6863. if (registrationNameModules.hasOwnProperty(propKey)) {
  6864. putListener(this._rootNodeID, propKey, propValue, transaction);
  6865. } else {
  6866. if (propKey === STYLE) {
  6867. if (propValue) {
  6868. propValue = this._previousStyleCopy = assign({}, props.style);
  6869. }
  6870. propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
  6871. }
  6872. var markup =
  6873. DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
  6874. if (markup) {
  6875. ret += ' ' + markup;
  6876. }
  6877. }
  6878. }
  6879. // For static pages, no need to put React ID and checksum. Saves lots of
  6880. // bytes.
  6881. if (transaction.renderToStaticMarkup) {
  6882. return ret + '>';
  6883. }
  6884. var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
  6885. return ret + ' ' + markupForID + '>';
  6886. },
  6887. /**
  6888. * Creates markup for the content between the tags.
  6889. *
  6890. * @private
  6891. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  6892. * @param {object} context
  6893. * @return {string} Content markup.
  6894. */
  6895. _createContentMarkup: function(transaction, context) {
  6896. var prefix = '';
  6897. if (this._tag === 'listing' ||
  6898. this._tag === 'pre' ||
  6899. this._tag === 'textarea') {
  6900. // Add an initial newline because browsers ignore the first newline in
  6901. // a <listing>, <pre>, or <textarea> as an "authoring convenience" -- see
  6902. // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.
  6903. prefix = '\n';
  6904. }
  6905. var props = this._currentElement.props;
  6906. // Intentional use of != to avoid catching zero/false.
  6907. var innerHTML = props.dangerouslySetInnerHTML;
  6908. if (innerHTML != null) {
  6909. if (innerHTML.__html != null) {
  6910. return prefix + innerHTML.__html;
  6911. }
  6912. } else {
  6913. var contentToUse =
  6914. CONTENT_TYPES[typeof props.children] ? props.children : null;
  6915. var childrenToUse = contentToUse != null ? null : props.children;
  6916. if (contentToUse != null) {
  6917. return prefix + escapeTextContentForBrowser(contentToUse);
  6918. } else if (childrenToUse != null) {
  6919. var mountImages = this.mountChildren(
  6920. childrenToUse,
  6921. transaction,
  6922. context
  6923. );
  6924. return prefix + mountImages.join('');
  6925. }
  6926. }
  6927. return prefix;
  6928. },
  6929. receiveComponent: function(nextElement, transaction, context) {
  6930. var prevElement = this._currentElement;
  6931. this._currentElement = nextElement;
  6932. this.updateComponent(transaction, prevElement, nextElement, context);
  6933. },
  6934. /**
  6935. * Updates a native DOM component after it has already been allocated and
  6936. * attached to the DOM. Reconciles the root DOM node, then recurses.
  6937. *
  6938. * @param {ReactReconcileTransaction} transaction
  6939. * @param {ReactElement} prevElement
  6940. * @param {ReactElement} nextElement
  6941. * @internal
  6942. * @overridable
  6943. */
  6944. updateComponent: function(transaction, prevElement, nextElement, context) {
  6945. assertValidProps(this._currentElement.props);
  6946. this._updateDOMProperties(prevElement.props, transaction);
  6947. this._updateDOMChildren(prevElement.props, transaction, context);
  6948. },
  6949. /**
  6950. * Reconciles the properties by detecting differences in property values and
  6951. * updating the DOM as necessary. This function is probably the single most
  6952. * critical path for performance optimization.
  6953. *
  6954. * TODO: Benchmark whether checking for changed values in memory actually
  6955. * improves performance (especially statically positioned elements).
  6956. * TODO: Benchmark the effects of putting this at the top since 99% of props
  6957. * do not change for a given reconciliation.
  6958. * TODO: Benchmark areas that can be improved with caching.
  6959. *
  6960. * @private
  6961. * @param {object} lastProps
  6962. * @param {ReactReconcileTransaction} transaction
  6963. */
  6964. _updateDOMProperties: function(lastProps, transaction) {
  6965. var nextProps = this._currentElement.props;
  6966. var propKey;
  6967. var styleName;
  6968. var styleUpdates;
  6969. for (propKey in lastProps) {
  6970. if (nextProps.hasOwnProperty(propKey) ||
  6971. !lastProps.hasOwnProperty(propKey)) {
  6972. continue;
  6973. }
  6974. if (propKey === STYLE) {
  6975. var lastStyle = this._previousStyleCopy;
  6976. for (styleName in lastStyle) {
  6977. if (lastStyle.hasOwnProperty(styleName)) {
  6978. styleUpdates = styleUpdates || {};
  6979. styleUpdates[styleName] = '';
  6980. }
  6981. }
  6982. this._previousStyleCopy = null;
  6983. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  6984. deleteListener(this._rootNodeID, propKey);
  6985. } else if (
  6986. DOMProperty.isStandardName[propKey] ||
  6987. DOMProperty.isCustomAttribute(propKey)) {
  6988. BackendIDOperations.deletePropertyByID(
  6989. this._rootNodeID,
  6990. propKey
  6991. );
  6992. }
  6993. }
  6994. for (propKey in nextProps) {
  6995. var nextProp = nextProps[propKey];
  6996. var lastProp = propKey === STYLE ?
  6997. this._previousStyleCopy :
  6998. lastProps[propKey];
  6999. if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
  7000. continue;
  7001. }
  7002. if (propKey === STYLE) {
  7003. if (nextProp) {
  7004. nextProp = this._previousStyleCopy = assign({}, nextProp);
  7005. } else {
  7006. this._previousStyleCopy = null;
  7007. }
  7008. if (lastProp) {
  7009. // Unset styles on `lastProp` but not on `nextProp`.
  7010. for (styleName in lastProp) {
  7011. if (lastProp.hasOwnProperty(styleName) &&
  7012. (!nextProp || !nextProp.hasOwnProperty(styleName))) {
  7013. styleUpdates = styleUpdates || {};
  7014. styleUpdates[styleName] = '';
  7015. }
  7016. }
  7017. // Update styles that changed since `lastProp`.
  7018. for (styleName in nextProp) {
  7019. if (nextProp.hasOwnProperty(styleName) &&
  7020. lastProp[styleName] !== nextProp[styleName]) {
  7021. styleUpdates = styleUpdates || {};
  7022. styleUpdates[styleName] = nextProp[styleName];
  7023. }
  7024. }
  7025. } else {
  7026. // Relies on `updateStylesByID` not mutating `styleUpdates`.
  7027. styleUpdates = nextProp;
  7028. }
  7029. } else if (registrationNameModules.hasOwnProperty(propKey)) {
  7030. putListener(this._rootNodeID, propKey, nextProp, transaction);
  7031. } else if (
  7032. DOMProperty.isStandardName[propKey] ||
  7033. DOMProperty.isCustomAttribute(propKey)) {
  7034. BackendIDOperations.updatePropertyByID(
  7035. this._rootNodeID,
  7036. propKey,
  7037. nextProp
  7038. );
  7039. }
  7040. }
  7041. if (styleUpdates) {
  7042. BackendIDOperations.updateStylesByID(
  7043. this._rootNodeID,
  7044. styleUpdates
  7045. );
  7046. }
  7047. },
  7048. /**
  7049. * Reconciles the children with the various properties that affect the
  7050. * children content.
  7051. *
  7052. * @param {object} lastProps
  7053. * @param {ReactReconcileTransaction} transaction
  7054. */
  7055. _updateDOMChildren: function(lastProps, transaction, context) {
  7056. var nextProps = this._currentElement.props;
  7057. var lastContent =
  7058. CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
  7059. var nextContent =
  7060. CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
  7061. var lastHtml =
  7062. lastProps.dangerouslySetInnerHTML &&
  7063. lastProps.dangerouslySetInnerHTML.__html;
  7064. var nextHtml =
  7065. nextProps.dangerouslySetInnerHTML &&
  7066. nextProps.dangerouslySetInnerHTML.__html;
  7067. // Note the use of `!=` which checks for null or undefined.
  7068. var lastChildren = lastContent != null ? null : lastProps.children;
  7069. var nextChildren = nextContent != null ? null : nextProps.children;
  7070. // If we're switching from children to content/html or vice versa, remove
  7071. // the old content
  7072. var lastHasContentOrHtml = lastContent != null || lastHtml != null;
  7073. var nextHasContentOrHtml = nextContent != null || nextHtml != null;
  7074. if (lastChildren != null && nextChildren == null) {
  7075. this.updateChildren(null, transaction, context);
  7076. } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
  7077. this.updateTextContent('');
  7078. }
  7079. if (nextContent != null) {
  7080. if (lastContent !== nextContent) {
  7081. this.updateTextContent('' + nextContent);
  7082. }
  7083. } else if (nextHtml != null) {
  7084. if (lastHtml !== nextHtml) {
  7085. BackendIDOperations.updateInnerHTMLByID(
  7086. this._rootNodeID,
  7087. nextHtml
  7088. );
  7089. }
  7090. } else if (nextChildren != null) {
  7091. this.updateChildren(nextChildren, transaction, context);
  7092. }
  7093. },
  7094. /**
  7095. * Destroys all event registrations for this instance. Does not remove from
  7096. * the DOM. That must be done by the parent.
  7097. *
  7098. * @internal
  7099. */
  7100. unmountComponent: function() {
  7101. this.unmountChildren();
  7102. ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
  7103. ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
  7104. this._rootNodeID = null;
  7105. }
  7106. };
  7107. ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
  7108. mountComponent: 'mountComponent',
  7109. updateComponent: 'updateComponent'
  7110. });
  7111. assign(
  7112. ReactDOMComponent.prototype,
  7113. ReactDOMComponent.Mixin,
  7114. ReactMultiChild.Mixin
  7115. );
  7116. ReactDOMComponent.injection = {
  7117. injectIDOperations: function(IDOperations) {
  7118. ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;
  7119. }
  7120. };
  7121. module.exports = ReactDOMComponent;
  7122. },{"10":10,"11":11,"116":116,"135":135,"136":136,"141":141,"154":154,"27":27,"30":30,"35":35,"5":5,"70":70,"71":71,"75":75}],43:[function(_dereq_,module,exports){
  7123. /**
  7124. * Copyright 2013-2015, Facebook, Inc.
  7125. * All rights reserved.
  7126. *
  7127. * This source code is licensed under the BSD-style license found in the
  7128. * LICENSE file in the root directory of this source tree. An additional grant
  7129. * of patent rights can be found in the PATENTS file in the same directory.
  7130. *
  7131. * @providesModule ReactDOMForm
  7132. */
  7133. 'use strict';
  7134. var EventConstants = _dereq_(15);
  7135. var LocalEventTrapMixin = _dereq_(25);
  7136. var ReactBrowserComponentMixin = _dereq_(29);
  7137. var ReactClass = _dereq_(33);
  7138. var ReactElement = _dereq_(57);
  7139. var form = ReactElement.createFactory('form');
  7140. /**
  7141. * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
  7142. * to capture it on the <form> element itself. There are lots of hacks we could
  7143. * do to accomplish this, but the most reliable is to make <form> a
  7144. * composite component and use `componentDidMount` to attach the event handlers.
  7145. */
  7146. var ReactDOMForm = ReactClass.createClass({
  7147. displayName: 'ReactDOMForm',
  7148. tagName: 'FORM',
  7149. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7150. render: function() {
  7151. // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
  7152. // `jshint` fails to parse JSX so in order for linting to work in the open
  7153. // source repo, we need to just use `ReactDOM.form`.
  7154. return form(this.props);
  7155. },
  7156. componentDidMount: function() {
  7157. this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
  7158. this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
  7159. }
  7160. });
  7161. module.exports = ReactDOMForm;
  7162. },{"15":15,"25":25,"29":29,"33":33,"57":57}],44:[function(_dereq_,module,exports){
  7163. /**
  7164. * Copyright 2013-2015, Facebook, Inc.
  7165. * All rights reserved.
  7166. *
  7167. * This source code is licensed under the BSD-style license found in the
  7168. * LICENSE file in the root directory of this source tree. An additional grant
  7169. * of patent rights can be found in the PATENTS file in the same directory.
  7170. *
  7171. * @providesModule ReactDOMIDOperations
  7172. * @typechecks static-only
  7173. */
  7174. /*jslint evil: true */
  7175. 'use strict';
  7176. var CSSPropertyOperations = _dereq_(5);
  7177. var DOMChildrenOperations = _dereq_(9);
  7178. var DOMPropertyOperations = _dereq_(11);
  7179. var ReactMount = _dereq_(70);
  7180. var ReactPerf = _dereq_(75);
  7181. var invariant = _dereq_(135);
  7182. var setInnerHTML = _dereq_(148);
  7183. /**
  7184. * Errors for properties that should not be updated with `updatePropertyById()`.
  7185. *
  7186. * @type {object}
  7187. * @private
  7188. */
  7189. var INVALID_PROPERTY_ERRORS = {
  7190. dangerouslySetInnerHTML:
  7191. '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
  7192. style: '`style` must be set using `updateStylesByID()`.'
  7193. };
  7194. /**
  7195. * Operations used to process updates to DOM nodes. This is made injectable via
  7196. * `ReactDOMComponent.BackendIDOperations`.
  7197. */
  7198. var ReactDOMIDOperations = {
  7199. /**
  7200. * Updates a DOM node with new property values. This should only be used to
  7201. * update DOM properties in `DOMProperty`.
  7202. *
  7203. * @param {string} id ID of the node to update.
  7204. * @param {string} name A valid property name, see `DOMProperty`.
  7205. * @param {*} value New value of the property.
  7206. * @internal
  7207. */
  7208. updatePropertyByID: function(id, name, value) {
  7209. var node = ReactMount.getNode(id);
  7210. ("production" !== "development" ? invariant(
  7211. !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
  7212. 'updatePropertyByID(...): %s',
  7213. INVALID_PROPERTY_ERRORS[name]
  7214. ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
  7215. // If we're updating to null or undefined, we should remove the property
  7216. // from the DOM node instead of inadvertantly setting to a string. This
  7217. // brings us in line with the same behavior we have on initial render.
  7218. if (value != null) {
  7219. DOMPropertyOperations.setValueForProperty(node, name, value);
  7220. } else {
  7221. DOMPropertyOperations.deleteValueForProperty(node, name);
  7222. }
  7223. },
  7224. /**
  7225. * Updates a DOM node to remove a property. This should only be used to remove
  7226. * DOM properties in `DOMProperty`.
  7227. *
  7228. * @param {string} id ID of the node to update.
  7229. * @param {string} name A property name to remove, see `DOMProperty`.
  7230. * @internal
  7231. */
  7232. deletePropertyByID: function(id, name, value) {
  7233. var node = ReactMount.getNode(id);
  7234. ("production" !== "development" ? invariant(
  7235. !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
  7236. 'updatePropertyByID(...): %s',
  7237. INVALID_PROPERTY_ERRORS[name]
  7238. ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
  7239. DOMPropertyOperations.deleteValueForProperty(node, name, value);
  7240. },
  7241. /**
  7242. * Updates a DOM node with new style values. If a value is specified as '',
  7243. * the corresponding style property will be unset.
  7244. *
  7245. * @param {string} id ID of the node to update.
  7246. * @param {object} styles Mapping from styles to values.
  7247. * @internal
  7248. */
  7249. updateStylesByID: function(id, styles) {
  7250. var node = ReactMount.getNode(id);
  7251. CSSPropertyOperations.setValueForStyles(node, styles);
  7252. },
  7253. /**
  7254. * Updates a DOM node's innerHTML.
  7255. *
  7256. * @param {string} id ID of the node to update.
  7257. * @param {string} html An HTML string.
  7258. * @internal
  7259. */
  7260. updateInnerHTMLByID: function(id, html) {
  7261. var node = ReactMount.getNode(id);
  7262. setInnerHTML(node, html);
  7263. },
  7264. /**
  7265. * Updates a DOM node's text content set by `props.content`.
  7266. *
  7267. * @param {string} id ID of the node to update.
  7268. * @param {string} content Text content.
  7269. * @internal
  7270. */
  7271. updateTextContentByID: function(id, content) {
  7272. var node = ReactMount.getNode(id);
  7273. DOMChildrenOperations.updateTextContent(node, content);
  7274. },
  7275. /**
  7276. * Replaces a DOM node that exists in the document with markup.
  7277. *
  7278. * @param {string} id ID of child to be replaced.
  7279. * @param {string} markup Dangerous markup to inject in place of child.
  7280. * @internal
  7281. * @see {Danger.dangerouslyReplaceNodeWithMarkup}
  7282. */
  7283. dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
  7284. var node = ReactMount.getNode(id);
  7285. DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
  7286. },
  7287. /**
  7288. * Updates a component's children by processing a series of updates.
  7289. *
  7290. * @param {array<object>} updates List of update configurations.
  7291. * @param {array<string>} markup List of markup strings.
  7292. * @internal
  7293. */
  7294. dangerouslyProcessChildrenUpdates: function(updates, markup) {
  7295. for (var i = 0; i < updates.length; i++) {
  7296. updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
  7297. }
  7298. DOMChildrenOperations.processUpdates(updates, markup);
  7299. }
  7300. };
  7301. ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
  7302. updatePropertyByID: 'updatePropertyByID',
  7303. deletePropertyByID: 'deletePropertyByID',
  7304. updateStylesByID: 'updateStylesByID',
  7305. updateInnerHTMLByID: 'updateInnerHTMLByID',
  7306. updateTextContentByID: 'updateTextContentByID',
  7307. dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
  7308. dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
  7309. });
  7310. module.exports = ReactDOMIDOperations;
  7311. },{"11":11,"135":135,"148":148,"5":5,"70":70,"75":75,"9":9}],45:[function(_dereq_,module,exports){
  7312. /**
  7313. * Copyright 2013-2015, Facebook, Inc.
  7314. * All rights reserved.
  7315. *
  7316. * This source code is licensed under the BSD-style license found in the
  7317. * LICENSE file in the root directory of this source tree. An additional grant
  7318. * of patent rights can be found in the PATENTS file in the same directory.
  7319. *
  7320. * @providesModule ReactDOMIframe
  7321. */
  7322. 'use strict';
  7323. var EventConstants = _dereq_(15);
  7324. var LocalEventTrapMixin = _dereq_(25);
  7325. var ReactBrowserComponentMixin = _dereq_(29);
  7326. var ReactClass = _dereq_(33);
  7327. var ReactElement = _dereq_(57);
  7328. var iframe = ReactElement.createFactory('iframe');
  7329. /**
  7330. * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
  7331. * capture it on the <iframe> element itself. There are lots of hacks we could
  7332. * do to accomplish this, but the most reliable is to make <iframe> a composite
  7333. * component and use `componentDidMount` to attach the event handlers.
  7334. */
  7335. var ReactDOMIframe = ReactClass.createClass({
  7336. displayName: 'ReactDOMIframe',
  7337. tagName: 'IFRAME',
  7338. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7339. render: function() {
  7340. return iframe(this.props);
  7341. },
  7342. componentDidMount: function() {
  7343. this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
  7344. }
  7345. });
  7346. module.exports = ReactDOMIframe;
  7347. },{"15":15,"25":25,"29":29,"33":33,"57":57}],46:[function(_dereq_,module,exports){
  7348. /**
  7349. * Copyright 2013-2015, Facebook, Inc.
  7350. * All rights reserved.
  7351. *
  7352. * This source code is licensed under the BSD-style license found in the
  7353. * LICENSE file in the root directory of this source tree. An additional grant
  7354. * of patent rights can be found in the PATENTS file in the same directory.
  7355. *
  7356. * @providesModule ReactDOMImg
  7357. */
  7358. 'use strict';
  7359. var EventConstants = _dereq_(15);
  7360. var LocalEventTrapMixin = _dereq_(25);
  7361. var ReactBrowserComponentMixin = _dereq_(29);
  7362. var ReactClass = _dereq_(33);
  7363. var ReactElement = _dereq_(57);
  7364. var img = ReactElement.createFactory('img');
  7365. /**
  7366. * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
  7367. * capture it on the <img> element itself. There are lots of hacks we could do
  7368. * to accomplish this, but the most reliable is to make <img> a composite
  7369. * component and use `componentDidMount` to attach the event handlers.
  7370. */
  7371. var ReactDOMImg = ReactClass.createClass({
  7372. displayName: 'ReactDOMImg',
  7373. tagName: 'IMG',
  7374. mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
  7375. render: function() {
  7376. return img(this.props);
  7377. },
  7378. componentDidMount: function() {
  7379. this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
  7380. this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
  7381. }
  7382. });
  7383. module.exports = ReactDOMImg;
  7384. },{"15":15,"25":25,"29":29,"33":33,"57":57}],47:[function(_dereq_,module,exports){
  7385. /**
  7386. * Copyright 2013-2015, Facebook, Inc.
  7387. * All rights reserved.
  7388. *
  7389. * This source code is licensed under the BSD-style license found in the
  7390. * LICENSE file in the root directory of this source tree. An additional grant
  7391. * of patent rights can be found in the PATENTS file in the same directory.
  7392. *
  7393. * @providesModule ReactDOMInput
  7394. */
  7395. 'use strict';
  7396. var AutoFocusMixin = _dereq_(2);
  7397. var DOMPropertyOperations = _dereq_(11);
  7398. var LinkedValueUtils = _dereq_(24);
  7399. var ReactBrowserComponentMixin = _dereq_(29);
  7400. var ReactClass = _dereq_(33);
  7401. var ReactElement = _dereq_(57);
  7402. var ReactMount = _dereq_(70);
  7403. var ReactUpdates = _dereq_(87);
  7404. var assign = _dereq_(27);
  7405. var invariant = _dereq_(135);
  7406. var input = ReactElement.createFactory('input');
  7407. var instancesByReactID = {};
  7408. function forceUpdateIfMounted() {
  7409. /*jshint validthis:true */
  7410. if (this.isMounted()) {
  7411. this.forceUpdate();
  7412. }
  7413. }
  7414. /**
  7415. * Implements an <input> native component that allows setting these optional
  7416. * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
  7417. *
  7418. * If `checked` or `value` are not supplied (or null/undefined), user actions
  7419. * that affect the checked state or value will trigger updates to the element.
  7420. *
  7421. * If they are supplied (and not null/undefined), the rendered element will not
  7422. * trigger updates to the element. Instead, the props must change in order for
  7423. * the rendered element to be updated.
  7424. *
  7425. * The rendered element will be initialized as unchecked (or `defaultChecked`)
  7426. * with an empty value (or `defaultValue`).
  7427. *
  7428. * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
  7429. */
  7430. var ReactDOMInput = ReactClass.createClass({
  7431. displayName: 'ReactDOMInput',
  7432. tagName: 'INPUT',
  7433. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  7434. getInitialState: function() {
  7435. var defaultValue = this.props.defaultValue;
  7436. return {
  7437. initialChecked: this.props.defaultChecked || false,
  7438. initialValue: defaultValue != null ? defaultValue : null
  7439. };
  7440. },
  7441. render: function() {
  7442. // Clone `this.props` so we don't mutate the input.
  7443. var props = assign({}, this.props);
  7444. props.defaultChecked = null;
  7445. props.defaultValue = null;
  7446. var value = LinkedValueUtils.getValue(this);
  7447. props.value = value != null ? value : this.state.initialValue;
  7448. var checked = LinkedValueUtils.getChecked(this);
  7449. props.checked = checked != null ? checked : this.state.initialChecked;
  7450. props.onChange = this._handleChange;
  7451. return input(props, this.props.children);
  7452. },
  7453. componentDidMount: function() {
  7454. var id = ReactMount.getID(this.getDOMNode());
  7455. instancesByReactID[id] = this;
  7456. },
  7457. componentWillUnmount: function() {
  7458. var rootNode = this.getDOMNode();
  7459. var id = ReactMount.getID(rootNode);
  7460. delete instancesByReactID[id];
  7461. },
  7462. componentDidUpdate: function(prevProps, prevState, prevContext) {
  7463. var rootNode = this.getDOMNode();
  7464. if (this.props.checked != null) {
  7465. DOMPropertyOperations.setValueForProperty(
  7466. rootNode,
  7467. 'checked',
  7468. this.props.checked || false
  7469. );
  7470. }
  7471. var value = LinkedValueUtils.getValue(this);
  7472. if (value != null) {
  7473. // Cast `value` to a string to ensure the value is set correctly. While
  7474. // browsers typically do this as necessary, jsdom doesn't.
  7475. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
  7476. }
  7477. },
  7478. _handleChange: function(event) {
  7479. var returnValue;
  7480. var onChange = LinkedValueUtils.getOnChange(this);
  7481. if (onChange) {
  7482. returnValue = onChange.call(this, event);
  7483. }
  7484. // Here we use asap to wait until all updates have propagated, which
  7485. // is important when using controlled components within layers:
  7486. // https://github.com/facebook/react/issues/1698
  7487. ReactUpdates.asap(forceUpdateIfMounted, this);
  7488. var name = this.props.name;
  7489. if (this.props.type === 'radio' && name != null) {
  7490. var rootNode = this.getDOMNode();
  7491. var queryRoot = rootNode;
  7492. while (queryRoot.parentNode) {
  7493. queryRoot = queryRoot.parentNode;
  7494. }
  7495. // If `rootNode.form` was non-null, then we could try `form.elements`,
  7496. // but that sometimes behaves strangely in IE8. We could also try using
  7497. // `form.getElementsByName`, but that will only return direct children
  7498. // and won't include inputs that use the HTML5 `form=` attribute. Since
  7499. // the input might not even be in a form, let's just use the global
  7500. // `querySelectorAll` to ensure we don't miss anything.
  7501. var group = queryRoot.querySelectorAll(
  7502. 'input[name=' + JSON.stringify('' + name) + '][type="radio"]');
  7503. for (var i = 0, groupLen = group.length; i < groupLen; i++) {
  7504. var otherNode = group[i];
  7505. if (otherNode === rootNode ||
  7506. otherNode.form !== rootNode.form) {
  7507. continue;
  7508. }
  7509. var otherID = ReactMount.getID(otherNode);
  7510. ("production" !== "development" ? invariant(
  7511. otherID,
  7512. 'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
  7513. 'same `name` is not supported.'
  7514. ) : invariant(otherID));
  7515. var otherInstance = instancesByReactID[otherID];
  7516. ("production" !== "development" ? invariant(
  7517. otherInstance,
  7518. 'ReactDOMInput: Unknown radio button ID %s.',
  7519. otherID
  7520. ) : invariant(otherInstance));
  7521. // If this is a controlled radio button group, forcing the input that
  7522. // was previously checked to update will cause it to be come re-checked
  7523. // as appropriate.
  7524. ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
  7525. }
  7526. }
  7527. return returnValue;
  7528. }
  7529. });
  7530. module.exports = ReactDOMInput;
  7531. },{"11":11,"135":135,"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"70":70,"87":87}],48:[function(_dereq_,module,exports){
  7532. /**
  7533. * Copyright 2013-2015, Facebook, Inc.
  7534. * All rights reserved.
  7535. *
  7536. * This source code is licensed under the BSD-style license found in the
  7537. * LICENSE file in the root directory of this source tree. An additional grant
  7538. * of patent rights can be found in the PATENTS file in the same directory.
  7539. *
  7540. * @providesModule ReactDOMOption
  7541. */
  7542. 'use strict';
  7543. var ReactBrowserComponentMixin = _dereq_(29);
  7544. var ReactClass = _dereq_(33);
  7545. var ReactElement = _dereq_(57);
  7546. var warning = _dereq_(154);
  7547. var option = ReactElement.createFactory('option');
  7548. /**
  7549. * Implements an <option> native component that warns when `selected` is set.
  7550. */
  7551. var ReactDOMOption = ReactClass.createClass({
  7552. displayName: 'ReactDOMOption',
  7553. tagName: 'OPTION',
  7554. mixins: [ReactBrowserComponentMixin],
  7555. componentWillMount: function() {
  7556. // TODO (yungsters): Remove support for `selected` in <option>.
  7557. if ("production" !== "development") {
  7558. ("production" !== "development" ? warning(
  7559. this.props.selected == null,
  7560. 'Use the `defaultValue` or `value` props on <select> instead of ' +
  7561. 'setting `selected` on <option>.'
  7562. ) : null);
  7563. }
  7564. },
  7565. render: function() {
  7566. return option(this.props, this.props.children);
  7567. }
  7568. });
  7569. module.exports = ReactDOMOption;
  7570. },{"154":154,"29":29,"33":33,"57":57}],49:[function(_dereq_,module,exports){
  7571. /**
  7572. * Copyright 2013-2015, Facebook, Inc.
  7573. * All rights reserved.
  7574. *
  7575. * This source code is licensed under the BSD-style license found in the
  7576. * LICENSE file in the root directory of this source tree. An additional grant
  7577. * of patent rights can be found in the PATENTS file in the same directory.
  7578. *
  7579. * @providesModule ReactDOMSelect
  7580. */
  7581. 'use strict';
  7582. var AutoFocusMixin = _dereq_(2);
  7583. var LinkedValueUtils = _dereq_(24);
  7584. var ReactBrowserComponentMixin = _dereq_(29);
  7585. var ReactClass = _dereq_(33);
  7586. var ReactElement = _dereq_(57);
  7587. var ReactUpdates = _dereq_(87);
  7588. var assign = _dereq_(27);
  7589. var select = ReactElement.createFactory('select');
  7590. function updateOptionsIfPendingUpdateAndMounted() {
  7591. /*jshint validthis:true */
  7592. if (this._pendingUpdate) {
  7593. this._pendingUpdate = false;
  7594. var value = LinkedValueUtils.getValue(this);
  7595. if (value != null && this.isMounted()) {
  7596. updateOptions(this, value);
  7597. }
  7598. }
  7599. }
  7600. /**
  7601. * Validation function for `value` and `defaultValue`.
  7602. * @private
  7603. */
  7604. function selectValueType(props, propName, componentName) {
  7605. if (props[propName] == null) {
  7606. return null;
  7607. }
  7608. if (props.multiple) {
  7609. if (!Array.isArray(props[propName])) {
  7610. return new Error(
  7611. ("The `" + propName + "` prop supplied to <select> must be an array if ") +
  7612. ("`multiple` is true.")
  7613. );
  7614. }
  7615. } else {
  7616. if (Array.isArray(props[propName])) {
  7617. return new Error(
  7618. ("The `" + propName + "` prop supplied to <select> must be a scalar ") +
  7619. ("value if `multiple` is false.")
  7620. );
  7621. }
  7622. }
  7623. }
  7624. /**
  7625. * @param {ReactComponent} component Instance of ReactDOMSelect
  7626. * @param {*} propValue A stringable (with `multiple`, a list of stringables).
  7627. * @private
  7628. */
  7629. function updateOptions(component, propValue) {
  7630. var selectedValue, i, l;
  7631. var options = component.getDOMNode().options;
  7632. if (component.props.multiple) {
  7633. selectedValue = {};
  7634. for (i = 0, l = propValue.length; i < l; i++) {
  7635. selectedValue['' + propValue[i]] = true;
  7636. }
  7637. for (i = 0, l = options.length; i < l; i++) {
  7638. var selected = selectedValue.hasOwnProperty(options[i].value);
  7639. if (options[i].selected !== selected) {
  7640. options[i].selected = selected;
  7641. }
  7642. }
  7643. } else {
  7644. // Do not set `select.value` as exact behavior isn't consistent across all
  7645. // browsers for all cases.
  7646. selectedValue = '' + propValue;
  7647. for (i = 0, l = options.length; i < l; i++) {
  7648. if (options[i].value === selectedValue) {
  7649. options[i].selected = true;
  7650. return;
  7651. }
  7652. }
  7653. if (options.length) {
  7654. options[0].selected = true;
  7655. }
  7656. }
  7657. }
  7658. /**
  7659. * Implements a <select> native component that allows optionally setting the
  7660. * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
  7661. * stringable. If `multiple` is true, the prop must be an array of stringables.
  7662. *
  7663. * If `value` is not supplied (or null/undefined), user actions that change the
  7664. * selected option will trigger updates to the rendered options.
  7665. *
  7666. * If it is supplied (and not null/undefined), the rendered options will not
  7667. * update in response to user actions. Instead, the `value` prop must change in
  7668. * order for the rendered options to update.
  7669. *
  7670. * If `defaultValue` is provided, any options with the supplied values will be
  7671. * selected.
  7672. */
  7673. var ReactDOMSelect = ReactClass.createClass({
  7674. displayName: 'ReactDOMSelect',
  7675. tagName: 'SELECT',
  7676. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  7677. propTypes: {
  7678. defaultValue: selectValueType,
  7679. value: selectValueType
  7680. },
  7681. render: function() {
  7682. // Clone `this.props` so we don't mutate the input.
  7683. var props = assign({}, this.props);
  7684. props.onChange = this._handleChange;
  7685. props.value = null;
  7686. return select(props, this.props.children);
  7687. },
  7688. componentWillMount: function() {
  7689. this._pendingUpdate = false;
  7690. },
  7691. componentDidMount: function() {
  7692. var value = LinkedValueUtils.getValue(this);
  7693. if (value != null) {
  7694. updateOptions(this, value);
  7695. } else if (this.props.defaultValue != null) {
  7696. updateOptions(this, this.props.defaultValue);
  7697. }
  7698. },
  7699. componentDidUpdate: function(prevProps) {
  7700. var value = LinkedValueUtils.getValue(this);
  7701. if (value != null) {
  7702. this._pendingUpdate = false;
  7703. updateOptions(this, value);
  7704. } else if (!prevProps.multiple !== !this.props.multiple) {
  7705. // For simplicity, reapply `defaultValue` if `multiple` is toggled.
  7706. if (this.props.defaultValue != null) {
  7707. updateOptions(this, this.props.defaultValue);
  7708. } else {
  7709. // Revert the select back to its default unselected state.
  7710. updateOptions(this, this.props.multiple ? [] : '');
  7711. }
  7712. }
  7713. },
  7714. _handleChange: function(event) {
  7715. var returnValue;
  7716. var onChange = LinkedValueUtils.getOnChange(this);
  7717. if (onChange) {
  7718. returnValue = onChange.call(this, event);
  7719. }
  7720. this._pendingUpdate = true;
  7721. ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
  7722. return returnValue;
  7723. }
  7724. });
  7725. module.exports = ReactDOMSelect;
  7726. },{"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"87":87}],50:[function(_dereq_,module,exports){
  7727. /**
  7728. * Copyright 2013-2015, Facebook, Inc.
  7729. * All rights reserved.
  7730. *
  7731. * This source code is licensed under the BSD-style license found in the
  7732. * LICENSE file in the root directory of this source tree. An additional grant
  7733. * of patent rights can be found in the PATENTS file in the same directory.
  7734. *
  7735. * @providesModule ReactDOMSelection
  7736. */
  7737. 'use strict';
  7738. var ExecutionEnvironment = _dereq_(21);
  7739. var getNodeForCharacterOffset = _dereq_(128);
  7740. var getTextContentAccessor = _dereq_(130);
  7741. /**
  7742. * While `isCollapsed` is available on the Selection object and `collapsed`
  7743. * is available on the Range object, IE11 sometimes gets them wrong.
  7744. * If the anchor/focus nodes and offsets are the same, the range is collapsed.
  7745. */
  7746. function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
  7747. return anchorNode === focusNode && anchorOffset === focusOffset;
  7748. }
  7749. /**
  7750. * Get the appropriate anchor and focus node/offset pairs for IE.
  7751. *
  7752. * The catch here is that IE's selection API doesn't provide information
  7753. * about whether the selection is forward or backward, so we have to
  7754. * behave as though it's always forward.
  7755. *
  7756. * IE text differs from modern selection in that it behaves as though
  7757. * block elements end with a new line. This means character offsets will
  7758. * differ between the two APIs.
  7759. *
  7760. * @param {DOMElement} node
  7761. * @return {object}
  7762. */
  7763. function getIEOffsets(node) {
  7764. var selection = document.selection;
  7765. var selectedRange = selection.createRange();
  7766. var selectedLength = selectedRange.text.length;
  7767. // Duplicate selection so we can move range without breaking user selection.
  7768. var fromStart = selectedRange.duplicate();
  7769. fromStart.moveToElementText(node);
  7770. fromStart.setEndPoint('EndToStart', selectedRange);
  7771. var startOffset = fromStart.text.length;
  7772. var endOffset = startOffset + selectedLength;
  7773. return {
  7774. start: startOffset,
  7775. end: endOffset
  7776. };
  7777. }
  7778. /**
  7779. * @param {DOMElement} node
  7780. * @return {?object}
  7781. */
  7782. function getModernOffsets(node) {
  7783. var selection = window.getSelection && window.getSelection();
  7784. if (!selection || selection.rangeCount === 0) {
  7785. return null;
  7786. }
  7787. var anchorNode = selection.anchorNode;
  7788. var anchorOffset = selection.anchorOffset;
  7789. var focusNode = selection.focusNode;
  7790. var focusOffset = selection.focusOffset;
  7791. var currentRange = selection.getRangeAt(0);
  7792. // If the node and offset values are the same, the selection is collapsed.
  7793. // `Selection.isCollapsed` is available natively, but IE sometimes gets
  7794. // this value wrong.
  7795. var isSelectionCollapsed = isCollapsed(
  7796. selection.anchorNode,
  7797. selection.anchorOffset,
  7798. selection.focusNode,
  7799. selection.focusOffset
  7800. );
  7801. var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
  7802. var tempRange = currentRange.cloneRange();
  7803. tempRange.selectNodeContents(node);
  7804. tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
  7805. var isTempRangeCollapsed = isCollapsed(
  7806. tempRange.startContainer,
  7807. tempRange.startOffset,
  7808. tempRange.endContainer,
  7809. tempRange.endOffset
  7810. );
  7811. var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
  7812. var end = start + rangeLength;
  7813. // Detect whether the selection is backward.
  7814. var detectionRange = document.createRange();
  7815. detectionRange.setStart(anchorNode, anchorOffset);
  7816. detectionRange.setEnd(focusNode, focusOffset);
  7817. var isBackward = detectionRange.collapsed;
  7818. return {
  7819. start: isBackward ? end : start,
  7820. end: isBackward ? start : end
  7821. };
  7822. }
  7823. /**
  7824. * @param {DOMElement|DOMTextNode} node
  7825. * @param {object} offsets
  7826. */
  7827. function setIEOffsets(node, offsets) {
  7828. var range = document.selection.createRange().duplicate();
  7829. var start, end;
  7830. if (typeof offsets.end === 'undefined') {
  7831. start = offsets.start;
  7832. end = start;
  7833. } else if (offsets.start > offsets.end) {
  7834. start = offsets.end;
  7835. end = offsets.start;
  7836. } else {
  7837. start = offsets.start;
  7838. end = offsets.end;
  7839. }
  7840. range.moveToElementText(node);
  7841. range.moveStart('character', start);
  7842. range.setEndPoint('EndToStart', range);
  7843. range.moveEnd('character', end - start);
  7844. range.select();
  7845. }
  7846. /**
  7847. * In modern non-IE browsers, we can support both forward and backward
  7848. * selections.
  7849. *
  7850. * Note: IE10+ supports the Selection object, but it does not support
  7851. * the `extend` method, which means that even in modern IE, it's not possible
  7852. * to programatically create a backward selection. Thus, for all IE
  7853. * versions, we use the old IE API to create our selections.
  7854. *
  7855. * @param {DOMElement|DOMTextNode} node
  7856. * @param {object} offsets
  7857. */
  7858. function setModernOffsets(node, offsets) {
  7859. if (!window.getSelection) {
  7860. return;
  7861. }
  7862. var selection = window.getSelection();
  7863. var length = node[getTextContentAccessor()].length;
  7864. var start = Math.min(offsets.start, length);
  7865. var end = typeof offsets.end === 'undefined' ?
  7866. start : Math.min(offsets.end, length);
  7867. // IE 11 uses modern selection, but doesn't support the extend method.
  7868. // Flip backward selections, so we can set with a single range.
  7869. if (!selection.extend && start > end) {
  7870. var temp = end;
  7871. end = start;
  7872. start = temp;
  7873. }
  7874. var startMarker = getNodeForCharacterOffset(node, start);
  7875. var endMarker = getNodeForCharacterOffset(node, end);
  7876. if (startMarker && endMarker) {
  7877. var range = document.createRange();
  7878. range.setStart(startMarker.node, startMarker.offset);
  7879. selection.removeAllRanges();
  7880. if (start > end) {
  7881. selection.addRange(range);
  7882. selection.extend(endMarker.node, endMarker.offset);
  7883. } else {
  7884. range.setEnd(endMarker.node, endMarker.offset);
  7885. selection.addRange(range);
  7886. }
  7887. }
  7888. }
  7889. var useIEOffsets = (
  7890. ExecutionEnvironment.canUseDOM &&
  7891. 'selection' in document &&
  7892. !('getSelection' in window)
  7893. );
  7894. var ReactDOMSelection = {
  7895. /**
  7896. * @param {DOMElement} node
  7897. */
  7898. getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
  7899. /**
  7900. * @param {DOMElement|DOMTextNode} node
  7901. * @param {object} offsets
  7902. */
  7903. setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
  7904. };
  7905. module.exports = ReactDOMSelection;
  7906. },{"128":128,"130":130,"21":21}],51:[function(_dereq_,module,exports){
  7907. /**
  7908. * Copyright 2013-2015, Facebook, Inc.
  7909. * All rights reserved.
  7910. *
  7911. * This source code is licensed under the BSD-style license found in the
  7912. * LICENSE file in the root directory of this source tree. An additional grant
  7913. * of patent rights can be found in the PATENTS file in the same directory.
  7914. *
  7915. * @providesModule ReactDOMTextComponent
  7916. * @typechecks static-only
  7917. */
  7918. 'use strict';
  7919. var DOMPropertyOperations = _dereq_(11);
  7920. var ReactComponentBrowserEnvironment =
  7921. _dereq_(35);
  7922. var ReactDOMComponent = _dereq_(42);
  7923. var assign = _dereq_(27);
  7924. var escapeTextContentForBrowser = _dereq_(116);
  7925. /**
  7926. * Text nodes violate a couple assumptions that React makes about components:
  7927. *
  7928. * - When mounting text into the DOM, adjacent text nodes are merged.
  7929. * - Text nodes cannot be assigned a React root ID.
  7930. *
  7931. * This component is used to wrap strings in elements so that they can undergo
  7932. * the same reconciliation that is applied to elements.
  7933. *
  7934. * TODO: Investigate representing React components in the DOM with text nodes.
  7935. *
  7936. * @class ReactDOMTextComponent
  7937. * @extends ReactComponent
  7938. * @internal
  7939. */
  7940. var ReactDOMTextComponent = function(props) {
  7941. // This constructor and its argument is currently used by mocks.
  7942. };
  7943. assign(ReactDOMTextComponent.prototype, {
  7944. /**
  7945. * @param {ReactText} text
  7946. * @internal
  7947. */
  7948. construct: function(text) {
  7949. // TODO: This is really a ReactText (ReactNode), not a ReactElement
  7950. this._currentElement = text;
  7951. this._stringText = '' + text;
  7952. // Properties
  7953. this._rootNodeID = null;
  7954. this._mountIndex = 0;
  7955. },
  7956. /**
  7957. * Creates the markup for this text node. This node is not intended to have
  7958. * any features besides containing text content.
  7959. *
  7960. * @param {string} rootID DOM ID of the root node.
  7961. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  7962. * @return {string} Markup for this text node.
  7963. * @internal
  7964. */
  7965. mountComponent: function(rootID, transaction, context) {
  7966. this._rootNodeID = rootID;
  7967. var escapedText = escapeTextContentForBrowser(this._stringText);
  7968. if (transaction.renderToStaticMarkup) {
  7969. // Normally we'd wrap this in a `span` for the reasons stated above, but
  7970. // since this is a situation where React won't take over (static pages),
  7971. // we can simply return the text as it is.
  7972. return escapedText;
  7973. }
  7974. return (
  7975. '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
  7976. escapedText +
  7977. '</span>'
  7978. );
  7979. },
  7980. /**
  7981. * Updates this component by updating the text content.
  7982. *
  7983. * @param {ReactText} nextText The next text content
  7984. * @param {ReactReconcileTransaction} transaction
  7985. * @internal
  7986. */
  7987. receiveComponent: function(nextText, transaction) {
  7988. if (nextText !== this._currentElement) {
  7989. this._currentElement = nextText;
  7990. var nextStringText = '' + nextText;
  7991. if (nextStringText !== this._stringText) {
  7992. // TODO: Save this as pending props and use performUpdateIfNecessary
  7993. // and/or updateComponent to do the actual update for consistency with
  7994. // other component types?
  7995. this._stringText = nextStringText;
  7996. ReactDOMComponent.BackendIDOperations.updateTextContentByID(
  7997. this._rootNodeID,
  7998. nextStringText
  7999. );
  8000. }
  8001. }
  8002. },
  8003. unmountComponent: function() {
  8004. ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
  8005. }
  8006. });
  8007. module.exports = ReactDOMTextComponent;
  8008. },{"11":11,"116":116,"27":27,"35":35,"42":42}],52:[function(_dereq_,module,exports){
  8009. /**
  8010. * Copyright 2013-2015, Facebook, Inc.
  8011. * All rights reserved.
  8012. *
  8013. * This source code is licensed under the BSD-style license found in the
  8014. * LICENSE file in the root directory of this source tree. An additional grant
  8015. * of patent rights can be found in the PATENTS file in the same directory.
  8016. *
  8017. * @providesModule ReactDOMTextarea
  8018. */
  8019. 'use strict';
  8020. var AutoFocusMixin = _dereq_(2);
  8021. var DOMPropertyOperations = _dereq_(11);
  8022. var LinkedValueUtils = _dereq_(24);
  8023. var ReactBrowserComponentMixin = _dereq_(29);
  8024. var ReactClass = _dereq_(33);
  8025. var ReactElement = _dereq_(57);
  8026. var ReactUpdates = _dereq_(87);
  8027. var assign = _dereq_(27);
  8028. var invariant = _dereq_(135);
  8029. var warning = _dereq_(154);
  8030. var textarea = ReactElement.createFactory('textarea');
  8031. function forceUpdateIfMounted() {
  8032. /*jshint validthis:true */
  8033. if (this.isMounted()) {
  8034. this.forceUpdate();
  8035. }
  8036. }
  8037. /**
  8038. * Implements a <textarea> native component that allows setting `value`, and
  8039. * `defaultValue`. This differs from the traditional DOM API because value is
  8040. * usually set as PCDATA children.
  8041. *
  8042. * If `value` is not supplied (or null/undefined), user actions that affect the
  8043. * value will trigger updates to the element.
  8044. *
  8045. * If `value` is supplied (and not null/undefined), the rendered element will
  8046. * not trigger updates to the element. Instead, the `value` prop must change in
  8047. * order for the rendered element to be updated.
  8048. *
  8049. * The rendered element will be initialized with an empty value, the prop
  8050. * `defaultValue` if specified, or the children content (deprecated).
  8051. */
  8052. var ReactDOMTextarea = ReactClass.createClass({
  8053. displayName: 'ReactDOMTextarea',
  8054. tagName: 'TEXTAREA',
  8055. mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
  8056. getInitialState: function() {
  8057. var defaultValue = this.props.defaultValue;
  8058. // TODO (yungsters): Remove support for children content in <textarea>.
  8059. var children = this.props.children;
  8060. if (children != null) {
  8061. if ("production" !== "development") {
  8062. ("production" !== "development" ? warning(
  8063. false,
  8064. 'Use the `defaultValue` or `value` props instead of setting ' +
  8065. 'children on <textarea>.'
  8066. ) : null);
  8067. }
  8068. ("production" !== "development" ? invariant(
  8069. defaultValue == null,
  8070. 'If you supply `defaultValue` on a <textarea>, do not pass children.'
  8071. ) : invariant(defaultValue == null));
  8072. if (Array.isArray(children)) {
  8073. ("production" !== "development" ? invariant(
  8074. children.length <= 1,
  8075. '<textarea> can only have at most one child.'
  8076. ) : invariant(children.length <= 1));
  8077. children = children[0];
  8078. }
  8079. defaultValue = '' + children;
  8080. }
  8081. if (defaultValue == null) {
  8082. defaultValue = '';
  8083. }
  8084. var value = LinkedValueUtils.getValue(this);
  8085. return {
  8086. // We save the initial value so that `ReactDOMComponent` doesn't update
  8087. // `textContent` (unnecessary since we update value).
  8088. // The initial value can be a boolean or object so that's why it's
  8089. // forced to be a string.
  8090. initialValue: '' + (value != null ? value : defaultValue)
  8091. };
  8092. },
  8093. render: function() {
  8094. // Clone `this.props` so we don't mutate the input.
  8095. var props = assign({}, this.props);
  8096. ("production" !== "development" ? invariant(
  8097. props.dangerouslySetInnerHTML == null,
  8098. '`dangerouslySetInnerHTML` does not make sense on <textarea>.'
  8099. ) : invariant(props.dangerouslySetInnerHTML == null));
  8100. props.defaultValue = null;
  8101. props.value = null;
  8102. props.onChange = this._handleChange;
  8103. // Always set children to the same thing. In IE9, the selection range will
  8104. // get reset if `textContent` is mutated.
  8105. return textarea(props, this.state.initialValue);
  8106. },
  8107. componentDidUpdate: function(prevProps, prevState, prevContext) {
  8108. var value = LinkedValueUtils.getValue(this);
  8109. if (value != null) {
  8110. var rootNode = this.getDOMNode();
  8111. // Cast `value` to a string to ensure the value is set correctly. While
  8112. // browsers typically do this as necessary, jsdom doesn't.
  8113. DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
  8114. }
  8115. },
  8116. _handleChange: function(event) {
  8117. var returnValue;
  8118. var onChange = LinkedValueUtils.getOnChange(this);
  8119. if (onChange) {
  8120. returnValue = onChange.call(this, event);
  8121. }
  8122. ReactUpdates.asap(forceUpdateIfMounted, this);
  8123. return returnValue;
  8124. }
  8125. });
  8126. module.exports = ReactDOMTextarea;
  8127. },{"11":11,"135":135,"154":154,"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"87":87}],53:[function(_dereq_,module,exports){
  8128. /**
  8129. * Copyright 2013-2015, Facebook, Inc.
  8130. * All rights reserved.
  8131. *
  8132. * This source code is licensed under the BSD-style license found in the
  8133. * LICENSE file in the root directory of this source tree. An additional grant
  8134. * of patent rights can be found in the PATENTS file in the same directory.
  8135. *
  8136. * @providesModule ReactDefaultBatchingStrategy
  8137. */
  8138. 'use strict';
  8139. var ReactUpdates = _dereq_(87);
  8140. var Transaction = _dereq_(103);
  8141. var assign = _dereq_(27);
  8142. var emptyFunction = _dereq_(114);
  8143. var RESET_BATCHED_UPDATES = {
  8144. initialize: emptyFunction,
  8145. close: function() {
  8146. ReactDefaultBatchingStrategy.isBatchingUpdates = false;
  8147. }
  8148. };
  8149. var FLUSH_BATCHED_UPDATES = {
  8150. initialize: emptyFunction,
  8151. close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
  8152. };
  8153. var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
  8154. function ReactDefaultBatchingStrategyTransaction() {
  8155. this.reinitializeTransaction();
  8156. }
  8157. assign(
  8158. ReactDefaultBatchingStrategyTransaction.prototype,
  8159. Transaction.Mixin,
  8160. {
  8161. getTransactionWrappers: function() {
  8162. return TRANSACTION_WRAPPERS;
  8163. }
  8164. }
  8165. );
  8166. var transaction = new ReactDefaultBatchingStrategyTransaction();
  8167. var ReactDefaultBatchingStrategy = {
  8168. isBatchingUpdates: false,
  8169. /**
  8170. * Call the provided function in a context within which calls to `setState`
  8171. * and friends are batched such that components aren't updated unnecessarily.
  8172. */
  8173. batchedUpdates: function(callback, a, b, c, d) {
  8174. var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
  8175. ReactDefaultBatchingStrategy.isBatchingUpdates = true;
  8176. // The code is written this way to avoid extra allocations
  8177. if (alreadyBatchingUpdates) {
  8178. callback(a, b, c, d);
  8179. } else {
  8180. transaction.perform(callback, null, a, b, c, d);
  8181. }
  8182. }
  8183. };
  8184. module.exports = ReactDefaultBatchingStrategy;
  8185. },{"103":103,"114":114,"27":27,"87":87}],54:[function(_dereq_,module,exports){
  8186. /**
  8187. * Copyright 2013-2015, Facebook, Inc.
  8188. * All rights reserved.
  8189. *
  8190. * This source code is licensed under the BSD-style license found in the
  8191. * LICENSE file in the root directory of this source tree. An additional grant
  8192. * of patent rights can be found in the PATENTS file in the same directory.
  8193. *
  8194. * @providesModule ReactDefaultInjection
  8195. */
  8196. 'use strict';
  8197. var BeforeInputEventPlugin = _dereq_(3);
  8198. var ChangeEventPlugin = _dereq_(7);
  8199. var ClientReactRootIndex = _dereq_(8);
  8200. var DefaultEventPluginOrder = _dereq_(13);
  8201. var EnterLeaveEventPlugin = _dereq_(14);
  8202. var ExecutionEnvironment = _dereq_(21);
  8203. var HTMLDOMPropertyConfig = _dereq_(23);
  8204. var MobileSafariClickEventPlugin = _dereq_(26);
  8205. var ReactBrowserComponentMixin = _dereq_(29);
  8206. var ReactClass = _dereq_(33);
  8207. var ReactComponentBrowserEnvironment =
  8208. _dereq_(35);
  8209. var ReactDefaultBatchingStrategy = _dereq_(53);
  8210. var ReactDOMComponent = _dereq_(42);
  8211. var ReactDOMButton = _dereq_(41);
  8212. var ReactDOMForm = _dereq_(43);
  8213. var ReactDOMImg = _dereq_(46);
  8214. var ReactDOMIDOperations = _dereq_(44);
  8215. var ReactDOMIframe = _dereq_(45);
  8216. var ReactDOMInput = _dereq_(47);
  8217. var ReactDOMOption = _dereq_(48);
  8218. var ReactDOMSelect = _dereq_(49);
  8219. var ReactDOMTextarea = _dereq_(52);
  8220. var ReactDOMTextComponent = _dereq_(51);
  8221. var ReactElement = _dereq_(57);
  8222. var ReactEventListener = _dereq_(62);
  8223. var ReactInjection = _dereq_(64);
  8224. var ReactInstanceHandles = _dereq_(66);
  8225. var ReactMount = _dereq_(70);
  8226. var ReactReconcileTransaction = _dereq_(80);
  8227. var SelectEventPlugin = _dereq_(89);
  8228. var ServerReactRootIndex = _dereq_(90);
  8229. var SimpleEventPlugin = _dereq_(91);
  8230. var SVGDOMPropertyConfig = _dereq_(88);
  8231. var createFullPageComponent = _dereq_(111);
  8232. function autoGenerateWrapperClass(type) {
  8233. return ReactClass.createClass({
  8234. tagName: type.toUpperCase(),
  8235. render: function() {
  8236. return new ReactElement(
  8237. type,
  8238. null,
  8239. null,
  8240. null,
  8241. null,
  8242. this.props
  8243. );
  8244. }
  8245. });
  8246. }
  8247. function inject() {
  8248. ReactInjection.EventEmitter.injectReactEventListener(
  8249. ReactEventListener
  8250. );
  8251. /**
  8252. * Inject modules for resolving DOM hierarchy and plugin ordering.
  8253. */
  8254. ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
  8255. ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
  8256. ReactInjection.EventPluginHub.injectMount(ReactMount);
  8257. /**
  8258. * Some important event plugins included by default (without having to require
  8259. * them).
  8260. */
  8261. ReactInjection.EventPluginHub.injectEventPluginsByName({
  8262. SimpleEventPlugin: SimpleEventPlugin,
  8263. EnterLeaveEventPlugin: EnterLeaveEventPlugin,
  8264. ChangeEventPlugin: ChangeEventPlugin,
  8265. MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
  8266. SelectEventPlugin: SelectEventPlugin,
  8267. BeforeInputEventPlugin: BeforeInputEventPlugin
  8268. });
  8269. ReactInjection.NativeComponent.injectGenericComponentClass(
  8270. ReactDOMComponent
  8271. );
  8272. ReactInjection.NativeComponent.injectTextComponentClass(
  8273. ReactDOMTextComponent
  8274. );
  8275. ReactInjection.NativeComponent.injectAutoWrapper(
  8276. autoGenerateWrapperClass
  8277. );
  8278. // This needs to happen before createFullPageComponent() otherwise the mixin
  8279. // won't be included.
  8280. ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
  8281. ReactInjection.NativeComponent.injectComponentClasses({
  8282. 'button': ReactDOMButton,
  8283. 'form': ReactDOMForm,
  8284. 'iframe': ReactDOMIframe,
  8285. 'img': ReactDOMImg,
  8286. 'input': ReactDOMInput,
  8287. 'option': ReactDOMOption,
  8288. 'select': ReactDOMSelect,
  8289. 'textarea': ReactDOMTextarea,
  8290. 'html': createFullPageComponent('html'),
  8291. 'head': createFullPageComponent('head'),
  8292. 'body': createFullPageComponent('body')
  8293. });
  8294. ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
  8295. ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
  8296. ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
  8297. ReactInjection.Updates.injectReconcileTransaction(
  8298. ReactReconcileTransaction
  8299. );
  8300. ReactInjection.Updates.injectBatchingStrategy(
  8301. ReactDefaultBatchingStrategy
  8302. );
  8303. ReactInjection.RootIndex.injectCreateReactRootIndex(
  8304. ExecutionEnvironment.canUseDOM ?
  8305. ClientReactRootIndex.createReactRootIndex :
  8306. ServerReactRootIndex.createReactRootIndex
  8307. );
  8308. ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
  8309. ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
  8310. if ("production" !== "development") {
  8311. var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
  8312. if ((/[?&]react_perf\b/).test(url)) {
  8313. var ReactDefaultPerf = _dereq_(55);
  8314. ReactDefaultPerf.start();
  8315. }
  8316. }
  8317. }
  8318. module.exports = {
  8319. inject: inject
  8320. };
  8321. },{"111":111,"13":13,"14":14,"21":21,"23":23,"26":26,"29":29,"3":3,"33":33,"35":35,"41":41,"42":42,"43":43,"44":44,"45":45,"46":46,"47":47,"48":48,"49":49,"51":51,"52":52,"53":53,"55":55,"57":57,"62":62,"64":64,"66":66,"7":7,"70":70,"8":8,"80":80,"88":88,"89":89,"90":90,"91":91}],55:[function(_dereq_,module,exports){
  8322. /**
  8323. * Copyright 2013-2015, Facebook, Inc.
  8324. * All rights reserved.
  8325. *
  8326. * This source code is licensed under the BSD-style license found in the
  8327. * LICENSE file in the root directory of this source tree. An additional grant
  8328. * of patent rights can be found in the PATENTS file in the same directory.
  8329. *
  8330. * @providesModule ReactDefaultPerf
  8331. * @typechecks static-only
  8332. */
  8333. 'use strict';
  8334. var DOMProperty = _dereq_(10);
  8335. var ReactDefaultPerfAnalysis = _dereq_(56);
  8336. var ReactMount = _dereq_(70);
  8337. var ReactPerf = _dereq_(75);
  8338. var performanceNow = _dereq_(146);
  8339. function roundFloat(val) {
  8340. return Math.floor(val * 100) / 100;
  8341. }
  8342. function addValue(obj, key, val) {
  8343. obj[key] = (obj[key] || 0) + val;
  8344. }
  8345. var ReactDefaultPerf = {
  8346. _allMeasurements: [], // last item in the list is the current one
  8347. _mountStack: [0],
  8348. _injected: false,
  8349. start: function() {
  8350. if (!ReactDefaultPerf._injected) {
  8351. ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
  8352. }
  8353. ReactDefaultPerf._allMeasurements.length = 0;
  8354. ReactPerf.enableMeasure = true;
  8355. },
  8356. stop: function() {
  8357. ReactPerf.enableMeasure = false;
  8358. },
  8359. getLastMeasurements: function() {
  8360. return ReactDefaultPerf._allMeasurements;
  8361. },
  8362. printExclusive: function(measurements) {
  8363. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8364. var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
  8365. console.table(summary.map(function(item) {
  8366. return {
  8367. 'Component class name': item.componentName,
  8368. 'Total inclusive time (ms)': roundFloat(item.inclusive),
  8369. 'Exclusive mount time (ms)': roundFloat(item.exclusive),
  8370. 'Exclusive render time (ms)': roundFloat(item.render),
  8371. 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
  8372. 'Render time per instance (ms)': roundFloat(item.render / item.count),
  8373. 'Instances': item.count
  8374. };
  8375. }));
  8376. // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
  8377. // number.
  8378. },
  8379. printInclusive: function(measurements) {
  8380. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8381. var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
  8382. console.table(summary.map(function(item) {
  8383. return {
  8384. 'Owner > component': item.componentName,
  8385. 'Inclusive time (ms)': roundFloat(item.time),
  8386. 'Instances': item.count
  8387. };
  8388. }));
  8389. console.log(
  8390. 'Total time:',
  8391. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8392. );
  8393. },
  8394. getMeasurementsSummaryMap: function(measurements) {
  8395. var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
  8396. measurements,
  8397. true
  8398. );
  8399. return summary.map(function(item) {
  8400. return {
  8401. 'Owner > component': item.componentName,
  8402. 'Wasted time (ms)': item.time,
  8403. 'Instances': item.count
  8404. };
  8405. });
  8406. },
  8407. printWasted: function(measurements) {
  8408. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8409. console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
  8410. console.log(
  8411. 'Total time:',
  8412. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8413. );
  8414. },
  8415. printDOM: function(measurements) {
  8416. measurements = measurements || ReactDefaultPerf._allMeasurements;
  8417. var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
  8418. console.table(summary.map(function(item) {
  8419. var result = {};
  8420. result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
  8421. result['type'] = item.type;
  8422. result['args'] = JSON.stringify(item.args);
  8423. return result;
  8424. }));
  8425. console.log(
  8426. 'Total time:',
  8427. ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
  8428. );
  8429. },
  8430. _recordWrite: function(id, fnName, totalTime, args) {
  8431. // TODO: totalTime isn't that useful since it doesn't count paints/reflows
  8432. var writes =
  8433. ReactDefaultPerf
  8434. ._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]
  8435. .writes;
  8436. writes[id] = writes[id] || [];
  8437. writes[id].push({
  8438. type: fnName,
  8439. time: totalTime,
  8440. args: args
  8441. });
  8442. },
  8443. measure: function(moduleName, fnName, func) {
  8444. return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  8445. var totalTime;
  8446. var rv;
  8447. var start;
  8448. if (fnName === '_renderNewRootComponent' ||
  8449. fnName === 'flushBatchedUpdates') {
  8450. // A "measurement" is a set of metrics recorded for each flush. We want
  8451. // to group the metrics for a given flush together so we can look at the
  8452. // components that rendered and the DOM operations that actually
  8453. // happened to determine the amount of "wasted work" performed.
  8454. ReactDefaultPerf._allMeasurements.push({
  8455. exclusive: {},
  8456. inclusive: {},
  8457. render: {},
  8458. counts: {},
  8459. writes: {},
  8460. displayNames: {},
  8461. totalTime: 0
  8462. });
  8463. start = performanceNow();
  8464. rv = func.apply(this, args);
  8465. ReactDefaultPerf._allMeasurements[
  8466. ReactDefaultPerf._allMeasurements.length - 1
  8467. ].totalTime = performanceNow() - start;
  8468. return rv;
  8469. } else if (fnName === '_mountImageIntoNode' ||
  8470. moduleName === 'ReactDOMIDOperations') {
  8471. start = performanceNow();
  8472. rv = func.apply(this, args);
  8473. totalTime = performanceNow() - start;
  8474. if (fnName === '_mountImageIntoNode') {
  8475. var mountID = ReactMount.getID(args[1]);
  8476. ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
  8477. } else if (fnName === 'dangerouslyProcessChildrenUpdates') {
  8478. // special format
  8479. args[0].forEach(function(update) {
  8480. var writeArgs = {};
  8481. if (update.fromIndex !== null) {
  8482. writeArgs.fromIndex = update.fromIndex;
  8483. }
  8484. if (update.toIndex !== null) {
  8485. writeArgs.toIndex = update.toIndex;
  8486. }
  8487. if (update.textContent !== null) {
  8488. writeArgs.textContent = update.textContent;
  8489. }
  8490. if (update.markupIndex !== null) {
  8491. writeArgs.markup = args[1][update.markupIndex];
  8492. }
  8493. ReactDefaultPerf._recordWrite(
  8494. update.parentID,
  8495. update.type,
  8496. totalTime,
  8497. writeArgs
  8498. );
  8499. });
  8500. } else {
  8501. // basic format
  8502. ReactDefaultPerf._recordWrite(
  8503. args[0],
  8504. fnName,
  8505. totalTime,
  8506. Array.prototype.slice.call(args, 1)
  8507. );
  8508. }
  8509. return rv;
  8510. } else if (moduleName === 'ReactCompositeComponent' && (
  8511. (// TODO: receiveComponent()?
  8512. (fnName === 'mountComponent' ||
  8513. fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {
  8514. if (typeof this._currentElement.type === 'string') {
  8515. return func.apply(this, args);
  8516. }
  8517. var rootNodeID = fnName === 'mountComponent' ?
  8518. args[0] :
  8519. this._rootNodeID;
  8520. var isRender = fnName === '_renderValidatedComponent';
  8521. var isMount = fnName === 'mountComponent';
  8522. var mountStack = ReactDefaultPerf._mountStack;
  8523. var entry = ReactDefaultPerf._allMeasurements[
  8524. ReactDefaultPerf._allMeasurements.length - 1
  8525. ];
  8526. if (isRender) {
  8527. addValue(entry.counts, rootNodeID, 1);
  8528. } else if (isMount) {
  8529. mountStack.push(0);
  8530. }
  8531. start = performanceNow();
  8532. rv = func.apply(this, args);
  8533. totalTime = performanceNow() - start;
  8534. if (isRender) {
  8535. addValue(entry.render, rootNodeID, totalTime);
  8536. } else if (isMount) {
  8537. var subMountTime = mountStack.pop();
  8538. mountStack[mountStack.length - 1] += totalTime;
  8539. addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
  8540. addValue(entry.inclusive, rootNodeID, totalTime);
  8541. } else {
  8542. addValue(entry.inclusive, rootNodeID, totalTime);
  8543. }
  8544. entry.displayNames[rootNodeID] = {
  8545. current: this.getName(),
  8546. owner: this._currentElement._owner ?
  8547. this._currentElement._owner.getName() :
  8548. '<root>'
  8549. };
  8550. return rv;
  8551. } else {
  8552. return func.apply(this, args);
  8553. }
  8554. };
  8555. }
  8556. };
  8557. module.exports = ReactDefaultPerf;
  8558. },{"10":10,"146":146,"56":56,"70":70,"75":75}],56:[function(_dereq_,module,exports){
  8559. /**
  8560. * Copyright 2013-2015, Facebook, Inc.
  8561. * All rights reserved.
  8562. *
  8563. * This source code is licensed under the BSD-style license found in the
  8564. * LICENSE file in the root directory of this source tree. An additional grant
  8565. * of patent rights can be found in the PATENTS file in the same directory.
  8566. *
  8567. * @providesModule ReactDefaultPerfAnalysis
  8568. */
  8569. var assign = _dereq_(27);
  8570. // Don't try to save users less than 1.2ms (a number I made up)
  8571. var DONT_CARE_THRESHOLD = 1.2;
  8572. var DOM_OPERATION_TYPES = {
  8573. '_mountImageIntoNode': 'set innerHTML',
  8574. INSERT_MARKUP: 'set innerHTML',
  8575. MOVE_EXISTING: 'move',
  8576. REMOVE_NODE: 'remove',
  8577. TEXT_CONTENT: 'set textContent',
  8578. 'updatePropertyByID': 'update attribute',
  8579. 'deletePropertyByID': 'delete attribute',
  8580. 'updateStylesByID': 'update styles',
  8581. 'updateInnerHTMLByID': 'set innerHTML',
  8582. 'dangerouslyReplaceNodeWithMarkupByID': 'replace'
  8583. };
  8584. function getTotalTime(measurements) {
  8585. // TODO: return number of DOM ops? could be misleading.
  8586. // TODO: measure dropped frames after reconcile?
  8587. // TODO: log total time of each reconcile and the top-level component
  8588. // class that triggered it.
  8589. var totalTime = 0;
  8590. for (var i = 0; i < measurements.length; i++) {
  8591. var measurement = measurements[i];
  8592. totalTime += measurement.totalTime;
  8593. }
  8594. return totalTime;
  8595. }
  8596. function getDOMSummary(measurements) {
  8597. var items = [];
  8598. for (var i = 0; i < measurements.length; i++) {
  8599. var measurement = measurements[i];
  8600. var id;
  8601. for (id in measurement.writes) {
  8602. measurement.writes[id].forEach(function(write) {
  8603. items.push({
  8604. id: id,
  8605. type: DOM_OPERATION_TYPES[write.type] || write.type,
  8606. args: write.args
  8607. });
  8608. });
  8609. }
  8610. }
  8611. return items;
  8612. }
  8613. function getExclusiveSummary(measurements) {
  8614. var candidates = {};
  8615. var displayName;
  8616. for (var i = 0; i < measurements.length; i++) {
  8617. var measurement = measurements[i];
  8618. var allIDs = assign(
  8619. {},
  8620. measurement.exclusive,
  8621. measurement.inclusive
  8622. );
  8623. for (var id in allIDs) {
  8624. displayName = measurement.displayNames[id].current;
  8625. candidates[displayName] = candidates[displayName] || {
  8626. componentName: displayName,
  8627. inclusive: 0,
  8628. exclusive: 0,
  8629. render: 0,
  8630. count: 0
  8631. };
  8632. if (measurement.render[id]) {
  8633. candidates[displayName].render += measurement.render[id];
  8634. }
  8635. if (measurement.exclusive[id]) {
  8636. candidates[displayName].exclusive += measurement.exclusive[id];
  8637. }
  8638. if (measurement.inclusive[id]) {
  8639. candidates[displayName].inclusive += measurement.inclusive[id];
  8640. }
  8641. if (measurement.counts[id]) {
  8642. candidates[displayName].count += measurement.counts[id];
  8643. }
  8644. }
  8645. }
  8646. // Now make a sorted array with the results.
  8647. var arr = [];
  8648. for (displayName in candidates) {
  8649. if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
  8650. arr.push(candidates[displayName]);
  8651. }
  8652. }
  8653. arr.sort(function(a, b) {
  8654. return b.exclusive - a.exclusive;
  8655. });
  8656. return arr;
  8657. }
  8658. function getInclusiveSummary(measurements, onlyClean) {
  8659. var candidates = {};
  8660. var inclusiveKey;
  8661. for (var i = 0; i < measurements.length; i++) {
  8662. var measurement = measurements[i];
  8663. var allIDs = assign(
  8664. {},
  8665. measurement.exclusive,
  8666. measurement.inclusive
  8667. );
  8668. var cleanComponents;
  8669. if (onlyClean) {
  8670. cleanComponents = getUnchangedComponents(measurement);
  8671. }
  8672. for (var id in allIDs) {
  8673. if (onlyClean && !cleanComponents[id]) {
  8674. continue;
  8675. }
  8676. var displayName = measurement.displayNames[id];
  8677. // Inclusive time is not useful for many components without knowing where
  8678. // they are instantiated. So we aggregate inclusive time with both the
  8679. // owner and current displayName as the key.
  8680. inclusiveKey = displayName.owner + ' > ' + displayName.current;
  8681. candidates[inclusiveKey] = candidates[inclusiveKey] || {
  8682. componentName: inclusiveKey,
  8683. time: 0,
  8684. count: 0
  8685. };
  8686. if (measurement.inclusive[id]) {
  8687. candidates[inclusiveKey].time += measurement.inclusive[id];
  8688. }
  8689. if (measurement.counts[id]) {
  8690. candidates[inclusiveKey].count += measurement.counts[id];
  8691. }
  8692. }
  8693. }
  8694. // Now make a sorted array with the results.
  8695. var arr = [];
  8696. for (inclusiveKey in candidates) {
  8697. if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
  8698. arr.push(candidates[inclusiveKey]);
  8699. }
  8700. }
  8701. arr.sort(function(a, b) {
  8702. return b.time - a.time;
  8703. });
  8704. return arr;
  8705. }
  8706. function getUnchangedComponents(measurement) {
  8707. // For a given reconcile, look at which components did not actually
  8708. // render anything to the DOM and return a mapping of their ID to
  8709. // the amount of time it took to render the entire subtree.
  8710. var cleanComponents = {};
  8711. var dirtyLeafIDs = Object.keys(measurement.writes);
  8712. var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
  8713. for (var id in allIDs) {
  8714. var isDirty = false;
  8715. // For each component that rendered, see if a component that triggered
  8716. // a DOM op is in its subtree.
  8717. for (var i = 0; i < dirtyLeafIDs.length; i++) {
  8718. if (dirtyLeafIDs[i].indexOf(id) === 0) {
  8719. isDirty = true;
  8720. break;
  8721. }
  8722. }
  8723. if (!isDirty && measurement.counts[id] > 0) {
  8724. cleanComponents[id] = true;
  8725. }
  8726. }
  8727. return cleanComponents;
  8728. }
  8729. var ReactDefaultPerfAnalysis = {
  8730. getExclusiveSummary: getExclusiveSummary,
  8731. getInclusiveSummary: getInclusiveSummary,
  8732. getDOMSummary: getDOMSummary,
  8733. getTotalTime: getTotalTime
  8734. };
  8735. module.exports = ReactDefaultPerfAnalysis;
  8736. },{"27":27}],57:[function(_dereq_,module,exports){
  8737. /**
  8738. * Copyright 2014-2015, Facebook, Inc.
  8739. * All rights reserved.
  8740. *
  8741. * This source code is licensed under the BSD-style license found in the
  8742. * LICENSE file in the root directory of this source tree. An additional grant
  8743. * of patent rights can be found in the PATENTS file in the same directory.
  8744. *
  8745. * @providesModule ReactElement
  8746. */
  8747. 'use strict';
  8748. var ReactContext = _dereq_(38);
  8749. var ReactCurrentOwner = _dereq_(39);
  8750. var assign = _dereq_(27);
  8751. var warning = _dereq_(154);
  8752. var RESERVED_PROPS = {
  8753. key: true,
  8754. ref: true
  8755. };
  8756. /**
  8757. * Warn for mutations.
  8758. *
  8759. * @internal
  8760. * @param {object} object
  8761. * @param {string} key
  8762. */
  8763. function defineWarningProperty(object, key) {
  8764. Object.defineProperty(object, key, {
  8765. configurable: false,
  8766. enumerable: true,
  8767. get: function() {
  8768. if (!this._store) {
  8769. return null;
  8770. }
  8771. return this._store[key];
  8772. },
  8773. set: function(value) {
  8774. ("production" !== "development" ? warning(
  8775. false,
  8776. 'Don\'t set the %s property of the React element. Instead, ' +
  8777. 'specify the correct value when initially creating the element.',
  8778. key
  8779. ) : null);
  8780. this._store[key] = value;
  8781. }
  8782. });
  8783. }
  8784. /**
  8785. * This is updated to true if the membrane is successfully created.
  8786. */
  8787. var useMutationMembrane = false;
  8788. /**
  8789. * Warn for mutations.
  8790. *
  8791. * @internal
  8792. * @param {object} element
  8793. */
  8794. function defineMutationMembrane(prototype) {
  8795. try {
  8796. var pseudoFrozenProperties = {
  8797. props: true
  8798. };
  8799. for (var key in pseudoFrozenProperties) {
  8800. defineWarningProperty(prototype, key);
  8801. }
  8802. useMutationMembrane = true;
  8803. } catch (x) {
  8804. // IE will fail on defineProperty
  8805. }
  8806. }
  8807. /**
  8808. * Base constructor for all React elements. This is only used to make this
  8809. * work with a dynamic instanceof check. Nothing should live on this prototype.
  8810. *
  8811. * @param {*} type
  8812. * @param {string|object} ref
  8813. * @param {*} key
  8814. * @param {*} props
  8815. * @internal
  8816. */
  8817. var ReactElement = function(type, key, ref, owner, context, props) {
  8818. // Built-in properties that belong on the element
  8819. this.type = type;
  8820. this.key = key;
  8821. this.ref = ref;
  8822. // Record the component responsible for creating this element.
  8823. this._owner = owner;
  8824. // TODO: Deprecate withContext, and then the context becomes accessible
  8825. // through the owner.
  8826. this._context = context;
  8827. if ("production" !== "development") {
  8828. // The validation flag and props are currently mutative. We put them on
  8829. // an external backing store so that we can freeze the whole object.
  8830. // This can be replaced with a WeakMap once they are implemented in
  8831. // commonly used development environments.
  8832. this._store = {props: props, originalProps: assign({}, props)};
  8833. // To make comparing ReactElements easier for testing purposes, we make
  8834. // the validation flag non-enumerable (where possible, which should
  8835. // include every environment we run tests in), so the test framework
  8836. // ignores it.
  8837. try {
  8838. Object.defineProperty(this._store, 'validated', {
  8839. configurable: false,
  8840. enumerable: false,
  8841. writable: true
  8842. });
  8843. } catch (x) {
  8844. }
  8845. this._store.validated = false;
  8846. // We're not allowed to set props directly on the object so we early
  8847. // return and rely on the prototype membrane to forward to the backing
  8848. // store.
  8849. if (useMutationMembrane) {
  8850. Object.freeze(this);
  8851. return;
  8852. }
  8853. }
  8854. this.props = props;
  8855. };
  8856. // We intentionally don't expose the function on the constructor property.
  8857. // ReactElement should be indistinguishable from a plain object.
  8858. ReactElement.prototype = {
  8859. _isReactElement: true
  8860. };
  8861. if ("production" !== "development") {
  8862. defineMutationMembrane(ReactElement.prototype);
  8863. }
  8864. ReactElement.createElement = function(type, config, children) {
  8865. var propName;
  8866. // Reserved names are extracted
  8867. var props = {};
  8868. var key = null;
  8869. var ref = null;
  8870. if (config != null) {
  8871. ref = config.ref === undefined ? null : config.ref;
  8872. key = config.key === undefined ? null : '' + config.key;
  8873. // Remaining properties are added to a new props object
  8874. for (propName in config) {
  8875. if (config.hasOwnProperty(propName) &&
  8876. !RESERVED_PROPS.hasOwnProperty(propName)) {
  8877. props[propName] = config[propName];
  8878. }
  8879. }
  8880. }
  8881. // Children can be more than one argument, and those are transferred onto
  8882. // the newly allocated props object.
  8883. var childrenLength = arguments.length - 2;
  8884. if (childrenLength === 1) {
  8885. props.children = children;
  8886. } else if (childrenLength > 1) {
  8887. var childArray = Array(childrenLength);
  8888. for (var i = 0; i < childrenLength; i++) {
  8889. childArray[i] = arguments[i + 2];
  8890. }
  8891. props.children = childArray;
  8892. }
  8893. // Resolve default props
  8894. if (type && type.defaultProps) {
  8895. var defaultProps = type.defaultProps;
  8896. for (propName in defaultProps) {
  8897. if (typeof props[propName] === 'undefined') {
  8898. props[propName] = defaultProps[propName];
  8899. }
  8900. }
  8901. }
  8902. return new ReactElement(
  8903. type,
  8904. key,
  8905. ref,
  8906. ReactCurrentOwner.current,
  8907. ReactContext.current,
  8908. props
  8909. );
  8910. };
  8911. ReactElement.createFactory = function(type) {
  8912. var factory = ReactElement.createElement.bind(null, type);
  8913. // Expose the type on the factory and the prototype so that it can be
  8914. // easily accessed on elements. E.g. <Foo />.type === Foo.type.
  8915. // This should not be named `constructor` since this may not be the function
  8916. // that created the element, and it may not even be a constructor.
  8917. // Legacy hook TODO: Warn if this is accessed
  8918. factory.type = type;
  8919. return factory;
  8920. };
  8921. ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {
  8922. var newElement = new ReactElement(
  8923. oldElement.type,
  8924. oldElement.key,
  8925. oldElement.ref,
  8926. oldElement._owner,
  8927. oldElement._context,
  8928. newProps
  8929. );
  8930. if ("production" !== "development") {
  8931. // If the key on the original is valid, then the clone is valid
  8932. newElement._store.validated = oldElement._store.validated;
  8933. }
  8934. return newElement;
  8935. };
  8936. ReactElement.cloneElement = function(element, config, children) {
  8937. var propName;
  8938. // Original props are copied
  8939. var props = assign({}, element.props);
  8940. // Reserved names are extracted
  8941. var key = element.key;
  8942. var ref = element.ref;
  8943. // Owner will be preserved, unless ref is overridden
  8944. var owner = element._owner;
  8945. if (config != null) {
  8946. if (config.ref !== undefined) {
  8947. // Silently steal the ref from the parent.
  8948. ref = config.ref;
  8949. owner = ReactCurrentOwner.current;
  8950. }
  8951. if (config.key !== undefined) {
  8952. key = '' + config.key;
  8953. }
  8954. // Remaining properties override existing props
  8955. for (propName in config) {
  8956. if (config.hasOwnProperty(propName) &&
  8957. !RESERVED_PROPS.hasOwnProperty(propName)) {
  8958. props[propName] = config[propName];
  8959. }
  8960. }
  8961. }
  8962. // Children can be more than one argument, and those are transferred onto
  8963. // the newly allocated props object.
  8964. var childrenLength = arguments.length - 2;
  8965. if (childrenLength === 1) {
  8966. props.children = children;
  8967. } else if (childrenLength > 1) {
  8968. var childArray = Array(childrenLength);
  8969. for (var i = 0; i < childrenLength; i++) {
  8970. childArray[i] = arguments[i + 2];
  8971. }
  8972. props.children = childArray;
  8973. }
  8974. return new ReactElement(
  8975. element.type,
  8976. key,
  8977. ref,
  8978. owner,
  8979. element._context,
  8980. props
  8981. );
  8982. };
  8983. /**
  8984. * @param {?object} object
  8985. * @return {boolean} True if `object` is a valid component.
  8986. * @final
  8987. */
  8988. ReactElement.isValidElement = function(object) {
  8989. // ReactTestUtils is often used outside of beforeEach where as React is
  8990. // within it. This leads to two different instances of React on the same
  8991. // page. To identify a element from a different React instance we use
  8992. // a flag instead of an instanceof check.
  8993. var isElement = !!(object && object._isReactElement);
  8994. // if (isElement && !(object instanceof ReactElement)) {
  8995. // This is an indicator that you're using multiple versions of React at the
  8996. // same time. This will screw with ownership and stuff. Fix it, please.
  8997. // TODO: We could possibly warn here.
  8998. // }
  8999. return isElement;
  9000. };
  9001. module.exports = ReactElement;
  9002. },{"154":154,"27":27,"38":38,"39":39}],58:[function(_dereq_,module,exports){
  9003. /**
  9004. * Copyright 2014-2015, Facebook, Inc.
  9005. * All rights reserved.
  9006. *
  9007. * This source code is licensed under the BSD-style license found in the
  9008. * LICENSE file in the root directory of this source tree. An additional grant
  9009. * of patent rights can be found in the PATENTS file in the same directory.
  9010. *
  9011. * @providesModule ReactElementValidator
  9012. */
  9013. /**
  9014. * ReactElementValidator provides a wrapper around a element factory
  9015. * which validates the props passed to the element. This is intended to be
  9016. * used only in DEV and could be replaced by a static type checker for languages
  9017. * that support it.
  9018. */
  9019. 'use strict';
  9020. var ReactElement = _dereq_(57);
  9021. var ReactFragment = _dereq_(63);
  9022. var ReactPropTypeLocations = _dereq_(77);
  9023. var ReactPropTypeLocationNames = _dereq_(76);
  9024. var ReactCurrentOwner = _dereq_(39);
  9025. var ReactNativeComponent = _dereq_(73);
  9026. var getIteratorFn = _dereq_(126);
  9027. var invariant = _dereq_(135);
  9028. var warning = _dereq_(154);
  9029. function getDeclarationErrorAddendum() {
  9030. if (ReactCurrentOwner.current) {
  9031. var name = ReactCurrentOwner.current.getName();
  9032. if (name) {
  9033. return ' Check the render method of `' + name + '`.';
  9034. }
  9035. }
  9036. return '';
  9037. }
  9038. /**
  9039. * Warn if there's no key explicitly set on dynamic arrays of children or
  9040. * object keys are not valid. This allows us to keep track of children between
  9041. * updates.
  9042. */
  9043. var ownerHasKeyUseWarning = {};
  9044. var loggedTypeFailures = {};
  9045. var NUMERIC_PROPERTY_REGEX = /^\d+$/;
  9046. /**
  9047. * Gets the instance's name for use in warnings.
  9048. *
  9049. * @internal
  9050. * @return {?string} Display name or undefined
  9051. */
  9052. function getName(instance) {
  9053. var publicInstance = instance && instance.getPublicInstance();
  9054. if (!publicInstance) {
  9055. return undefined;
  9056. }
  9057. var constructor = publicInstance.constructor;
  9058. if (!constructor) {
  9059. return undefined;
  9060. }
  9061. return constructor.displayName || constructor.name || undefined;
  9062. }
  9063. /**
  9064. * Gets the current owner's displayName for use in warnings.
  9065. *
  9066. * @internal
  9067. * @return {?string} Display name or undefined
  9068. */
  9069. function getCurrentOwnerDisplayName() {
  9070. var current = ReactCurrentOwner.current;
  9071. return (
  9072. current && getName(current) || undefined
  9073. );
  9074. }
  9075. /**
  9076. * Warn if the element doesn't have an explicit key assigned to it.
  9077. * This element is in an array. The array could grow and shrink or be
  9078. * reordered. All children that haven't already been validated are required to
  9079. * have a "key" property assigned to it.
  9080. *
  9081. * @internal
  9082. * @param {ReactElement} element Element that requires a key.
  9083. * @param {*} parentType element's parent's type.
  9084. */
  9085. function validateExplicitKey(element, parentType) {
  9086. if (element._store.validated || element.key != null) {
  9087. return;
  9088. }
  9089. element._store.validated = true;
  9090. warnAndMonitorForKeyUse(
  9091. 'Each child in an array or iterator should have a unique "key" prop.',
  9092. element,
  9093. parentType
  9094. );
  9095. }
  9096. /**
  9097. * Warn if the key is being defined as an object property but has an incorrect
  9098. * value.
  9099. *
  9100. * @internal
  9101. * @param {string} name Property name of the key.
  9102. * @param {ReactElement} element Component that requires a key.
  9103. * @param {*} parentType element's parent's type.
  9104. */
  9105. function validatePropertyKey(name, element, parentType) {
  9106. if (!NUMERIC_PROPERTY_REGEX.test(name)) {
  9107. return;
  9108. }
  9109. warnAndMonitorForKeyUse(
  9110. 'Child objects should have non-numeric keys so ordering is preserved.',
  9111. element,
  9112. parentType
  9113. );
  9114. }
  9115. /**
  9116. * Shared warning and monitoring code for the key warnings.
  9117. *
  9118. * @internal
  9119. * @param {string} message The base warning that gets output.
  9120. * @param {ReactElement} element Component that requires a key.
  9121. * @param {*} parentType element's parent's type.
  9122. */
  9123. function warnAndMonitorForKeyUse(message, element, parentType) {
  9124. var ownerName = getCurrentOwnerDisplayName();
  9125. var parentName = typeof parentType === 'string' ?
  9126. parentType : parentType.displayName || parentType.name;
  9127. var useName = ownerName || parentName;
  9128. var memoizer = ownerHasKeyUseWarning[message] || (
  9129. (ownerHasKeyUseWarning[message] = {})
  9130. );
  9131. if (memoizer.hasOwnProperty(useName)) {
  9132. return;
  9133. }
  9134. memoizer[useName] = true;
  9135. var parentOrOwnerAddendum =
  9136. ownerName ? (" Check the render method of " + ownerName + ".") :
  9137. parentName ? (" Check the React.render call using <" + parentName + ">.") :
  9138. '';
  9139. // Usually the current owner is the offender, but if it accepts children as a
  9140. // property, it may be the creator of the child that's responsible for
  9141. // assigning it a key.
  9142. var childOwnerAddendum = '';
  9143. if (element &&
  9144. element._owner &&
  9145. element._owner !== ReactCurrentOwner.current) {
  9146. // Name of the component that originally created this child.
  9147. var childOwnerName = getName(element._owner);
  9148. childOwnerAddendum = (" It was passed a child from " + childOwnerName + ".");
  9149. }
  9150. ("production" !== "development" ? warning(
  9151. false,
  9152. message + '%s%s See https://fb.me/react-warning-keys for more information.',
  9153. parentOrOwnerAddendum,
  9154. childOwnerAddendum
  9155. ) : null);
  9156. }
  9157. /**
  9158. * Ensure that every element either is passed in a static location, in an
  9159. * array with an explicit keys property defined, or in an object literal
  9160. * with valid key property.
  9161. *
  9162. * @internal
  9163. * @param {ReactNode} node Statically passed child of any type.
  9164. * @param {*} parentType node's parent's type.
  9165. */
  9166. function validateChildKeys(node, parentType) {
  9167. if (Array.isArray(node)) {
  9168. for (var i = 0; i < node.length; i++) {
  9169. var child = node[i];
  9170. if (ReactElement.isValidElement(child)) {
  9171. validateExplicitKey(child, parentType);
  9172. }
  9173. }
  9174. } else if (ReactElement.isValidElement(node)) {
  9175. // This element was passed in a valid location.
  9176. node._store.validated = true;
  9177. } else if (node) {
  9178. var iteratorFn = getIteratorFn(node);
  9179. // Entry iterators provide implicit keys.
  9180. if (iteratorFn) {
  9181. if (iteratorFn !== node.entries) {
  9182. var iterator = iteratorFn.call(node);
  9183. var step;
  9184. while (!(step = iterator.next()).done) {
  9185. if (ReactElement.isValidElement(step.value)) {
  9186. validateExplicitKey(step.value, parentType);
  9187. }
  9188. }
  9189. }
  9190. } else if (typeof node === 'object') {
  9191. var fragment = ReactFragment.extractIfFragment(node);
  9192. for (var key in fragment) {
  9193. if (fragment.hasOwnProperty(key)) {
  9194. validatePropertyKey(key, fragment[key], parentType);
  9195. }
  9196. }
  9197. }
  9198. }
  9199. }
  9200. /**
  9201. * Assert that the props are valid
  9202. *
  9203. * @param {string} componentName Name of the component for error messages.
  9204. * @param {object} propTypes Map of prop name to a ReactPropType
  9205. * @param {object} props
  9206. * @param {string} location e.g. "prop", "context", "child context"
  9207. * @private
  9208. */
  9209. function checkPropTypes(componentName, propTypes, props, location) {
  9210. for (var propName in propTypes) {
  9211. if (propTypes.hasOwnProperty(propName)) {
  9212. var error;
  9213. // Prop type validation may throw. In case they do, we don't want to
  9214. // fail the render phase where it didn't fail before. So we log it.
  9215. // After these have been cleaned up, we'll let them throw.
  9216. try {
  9217. // This is intentionally an invariant that gets caught. It's the same
  9218. // behavior as without this statement except with a better message.
  9219. ("production" !== "development" ? invariant(
  9220. typeof propTypes[propName] === 'function',
  9221. '%s: %s type `%s` is invalid; it must be a function, usually from ' +
  9222. 'React.PropTypes.',
  9223. componentName || 'React class',
  9224. ReactPropTypeLocationNames[location],
  9225. propName
  9226. ) : invariant(typeof propTypes[propName] === 'function'));
  9227. error = propTypes[propName](props, propName, componentName, location);
  9228. } catch (ex) {
  9229. error = ex;
  9230. }
  9231. if (error instanceof Error && !(error.message in loggedTypeFailures)) {
  9232. // Only monitor this failure once because there tends to be a lot of the
  9233. // same error.
  9234. loggedTypeFailures[error.message] = true;
  9235. var addendum = getDeclarationErrorAddendum(this);
  9236. ("production" !== "development" ? warning(false, 'Failed propType: %s%s', error.message, addendum) : null);
  9237. }
  9238. }
  9239. }
  9240. }
  9241. var warnedPropsMutations = {};
  9242. /**
  9243. * Warn about mutating props when setting `propName` on `element`.
  9244. *
  9245. * @param {string} propName The string key within props that was set
  9246. * @param {ReactElement} element
  9247. */
  9248. function warnForPropsMutation(propName, element) {
  9249. var type = element.type;
  9250. var elementName = typeof type === 'string' ? type : type.displayName;
  9251. var ownerName = element._owner ?
  9252. element._owner.getPublicInstance().constructor.displayName : null;
  9253. var warningKey = propName + '|' + elementName + '|' + ownerName;
  9254. if (warnedPropsMutations.hasOwnProperty(warningKey)) {
  9255. return;
  9256. }
  9257. warnedPropsMutations[warningKey] = true;
  9258. var elementInfo = '';
  9259. if (elementName) {
  9260. elementInfo = ' <' + elementName + ' />';
  9261. }
  9262. var ownerInfo = '';
  9263. if (ownerName) {
  9264. ownerInfo = ' The element was created by ' + ownerName + '.';
  9265. }
  9266. ("production" !== "development" ? warning(
  9267. false,
  9268. 'Don\'t set .props.%s of the React component%s. Instead, specify the ' +
  9269. 'correct value when initially creating the element or use ' +
  9270. 'React.cloneElement to make a new element with updated props.%s',
  9271. propName,
  9272. elementInfo,
  9273. ownerInfo
  9274. ) : null);
  9275. }
  9276. // Inline Object.is polyfill
  9277. function is(a, b) {
  9278. if (a !== a) {
  9279. // NaN
  9280. return b !== b;
  9281. }
  9282. if (a === 0 && b === 0) {
  9283. // +-0
  9284. return 1 / a === 1 / b;
  9285. }
  9286. return a === b;
  9287. }
  9288. /**
  9289. * Given an element, check if its props have been mutated since element
  9290. * creation (or the last call to this function). In particular, check if any
  9291. * new props have been added, which we can't directly catch by defining warning
  9292. * properties on the props object.
  9293. *
  9294. * @param {ReactElement} element
  9295. */
  9296. function checkAndWarnForMutatedProps(element) {
  9297. if (!element._store) {
  9298. // Element was created using `new ReactElement` directly or with
  9299. // `ReactElement.createElement`; skip mutation checking
  9300. return;
  9301. }
  9302. var originalProps = element._store.originalProps;
  9303. var props = element.props;
  9304. for (var propName in props) {
  9305. if (props.hasOwnProperty(propName)) {
  9306. if (!originalProps.hasOwnProperty(propName) ||
  9307. !is(originalProps[propName], props[propName])) {
  9308. warnForPropsMutation(propName, element);
  9309. // Copy over the new value so that the two props objects match again
  9310. originalProps[propName] = props[propName];
  9311. }
  9312. }
  9313. }
  9314. }
  9315. /**
  9316. * Given an element, validate that its props follow the propTypes definition,
  9317. * provided by the type.
  9318. *
  9319. * @param {ReactElement} element
  9320. */
  9321. function validatePropTypes(element) {
  9322. if (element.type == null) {
  9323. // This has already warned. Don't throw.
  9324. return;
  9325. }
  9326. // Extract the component class from the element. Converts string types
  9327. // to a composite class which may have propTypes.
  9328. // TODO: Validating a string's propTypes is not decoupled from the
  9329. // rendering target which is problematic.
  9330. var componentClass = ReactNativeComponent.getComponentClassForElement(
  9331. element
  9332. );
  9333. var name = componentClass.displayName || componentClass.name;
  9334. if (componentClass.propTypes) {
  9335. checkPropTypes(
  9336. name,
  9337. componentClass.propTypes,
  9338. element.props,
  9339. ReactPropTypeLocations.prop
  9340. );
  9341. }
  9342. if (typeof componentClass.getDefaultProps === 'function') {
  9343. ("production" !== "development" ? warning(
  9344. componentClass.getDefaultProps.isReactClassApproved,
  9345. 'getDefaultProps is only used on classic React.createClass ' +
  9346. 'definitions. Use a static property named `defaultProps` instead.'
  9347. ) : null);
  9348. }
  9349. }
  9350. var ReactElementValidator = {
  9351. checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,
  9352. createElement: function(type, props, children) {
  9353. // We warn in this case but don't throw. We expect the element creation to
  9354. // succeed and there will likely be errors in render.
  9355. ("production" !== "development" ? warning(
  9356. type != null,
  9357. 'React.createElement: type should not be null or undefined. It should ' +
  9358. 'be a string (for DOM elements) or a ReactClass (for composite ' +
  9359. 'components).'
  9360. ) : null);
  9361. var element = ReactElement.createElement.apply(this, arguments);
  9362. // The result can be nullish if a mock or a custom function is used.
  9363. // TODO: Drop this when these are no longer allowed as the type argument.
  9364. if (element == null) {
  9365. return element;
  9366. }
  9367. for (var i = 2; i < arguments.length; i++) {
  9368. validateChildKeys(arguments[i], type);
  9369. }
  9370. validatePropTypes(element);
  9371. return element;
  9372. },
  9373. createFactory: function(type) {
  9374. var validatedFactory = ReactElementValidator.createElement.bind(
  9375. null,
  9376. type
  9377. );
  9378. // Legacy hook TODO: Warn if this is accessed
  9379. validatedFactory.type = type;
  9380. if ("production" !== "development") {
  9381. try {
  9382. Object.defineProperty(
  9383. validatedFactory,
  9384. 'type',
  9385. {
  9386. enumerable: false,
  9387. get: function() {
  9388. ("production" !== "development" ? warning(
  9389. false,
  9390. 'Factory.type is deprecated. Access the class directly ' +
  9391. 'before passing it to createFactory.'
  9392. ) : null);
  9393. Object.defineProperty(this, 'type', {
  9394. value: type
  9395. });
  9396. return type;
  9397. }
  9398. }
  9399. );
  9400. } catch (x) {
  9401. // IE will fail on defineProperty (es5-shim/sham too)
  9402. }
  9403. }
  9404. return validatedFactory;
  9405. },
  9406. cloneElement: function(element, props, children) {
  9407. var newElement = ReactElement.cloneElement.apply(this, arguments);
  9408. for (var i = 2; i < arguments.length; i++) {
  9409. validateChildKeys(arguments[i], newElement.type);
  9410. }
  9411. validatePropTypes(newElement);
  9412. return newElement;
  9413. }
  9414. };
  9415. module.exports = ReactElementValidator;
  9416. },{"126":126,"135":135,"154":154,"39":39,"57":57,"63":63,"73":73,"76":76,"77":77}],59:[function(_dereq_,module,exports){
  9417. /**
  9418. * Copyright 2014-2015, Facebook, Inc.
  9419. * All rights reserved.
  9420. *
  9421. * This source code is licensed under the BSD-style license found in the
  9422. * LICENSE file in the root directory of this source tree. An additional grant
  9423. * of patent rights can be found in the PATENTS file in the same directory.
  9424. *
  9425. * @providesModule ReactEmptyComponent
  9426. */
  9427. 'use strict';
  9428. var ReactElement = _dereq_(57);
  9429. var ReactInstanceMap = _dereq_(67);
  9430. var invariant = _dereq_(135);
  9431. var component;
  9432. // This registry keeps track of the React IDs of the components that rendered to
  9433. // `null` (in reality a placeholder such as `noscript`)
  9434. var nullComponentIDsRegistry = {};
  9435. var ReactEmptyComponentInjection = {
  9436. injectEmptyComponent: function(emptyComponent) {
  9437. component = ReactElement.createFactory(emptyComponent);
  9438. }
  9439. };
  9440. var ReactEmptyComponentType = function() {};
  9441. ReactEmptyComponentType.prototype.componentDidMount = function() {
  9442. var internalInstance = ReactInstanceMap.get(this);
  9443. // TODO: Make sure we run these methods in the correct order, we shouldn't
  9444. // need this check. We're going to assume if we're here it means we ran
  9445. // componentWillUnmount already so there is no internal instance (it gets
  9446. // removed as part of the unmounting process).
  9447. if (!internalInstance) {
  9448. return;
  9449. }
  9450. registerNullComponentID(internalInstance._rootNodeID);
  9451. };
  9452. ReactEmptyComponentType.prototype.componentWillUnmount = function() {
  9453. var internalInstance = ReactInstanceMap.get(this);
  9454. // TODO: Get rid of this check. See TODO in componentDidMount.
  9455. if (!internalInstance) {
  9456. return;
  9457. }
  9458. deregisterNullComponentID(internalInstance._rootNodeID);
  9459. };
  9460. ReactEmptyComponentType.prototype.render = function() {
  9461. ("production" !== "development" ? invariant(
  9462. component,
  9463. 'Trying to return null from a render, but no null placeholder component ' +
  9464. 'was injected.'
  9465. ) : invariant(component));
  9466. return component();
  9467. };
  9468. var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
  9469. /**
  9470. * Mark the component as having rendered to null.
  9471. * @param {string} id Component's `_rootNodeID`.
  9472. */
  9473. function registerNullComponentID(id) {
  9474. nullComponentIDsRegistry[id] = true;
  9475. }
  9476. /**
  9477. * Unmark the component as having rendered to null: it renders to something now.
  9478. * @param {string} id Component's `_rootNodeID`.
  9479. */
  9480. function deregisterNullComponentID(id) {
  9481. delete nullComponentIDsRegistry[id];
  9482. }
  9483. /**
  9484. * @param {string} id Component's `_rootNodeID`.
  9485. * @return {boolean} True if the component is rendered to null.
  9486. */
  9487. function isNullComponentID(id) {
  9488. return !!nullComponentIDsRegistry[id];
  9489. }
  9490. var ReactEmptyComponent = {
  9491. emptyElement: emptyElement,
  9492. injection: ReactEmptyComponentInjection,
  9493. isNullComponentID: isNullComponentID
  9494. };
  9495. module.exports = ReactEmptyComponent;
  9496. },{"135":135,"57":57,"67":67}],60:[function(_dereq_,module,exports){
  9497. /**
  9498. * Copyright 2013-2015, Facebook, Inc.
  9499. * All rights reserved.
  9500. *
  9501. * This source code is licensed under the BSD-style license found in the
  9502. * LICENSE file in the root directory of this source tree. An additional grant
  9503. * of patent rights can be found in the PATENTS file in the same directory.
  9504. *
  9505. * @providesModule ReactErrorUtils
  9506. * @typechecks
  9507. */
  9508. "use strict";
  9509. var ReactErrorUtils = {
  9510. /**
  9511. * Creates a guarded version of a function. This is supposed to make debugging
  9512. * of event handlers easier. To aid debugging with the browser's debugger,
  9513. * this currently simply returns the original function.
  9514. *
  9515. * @param {function} func Function to be executed
  9516. * @param {string} name The name of the guard
  9517. * @return {function}
  9518. */
  9519. guard: function(func, name) {
  9520. return func;
  9521. }
  9522. };
  9523. module.exports = ReactErrorUtils;
  9524. },{}],61:[function(_dereq_,module,exports){
  9525. /**
  9526. * Copyright 2013-2015, Facebook, Inc.
  9527. * All rights reserved.
  9528. *
  9529. * This source code is licensed under the BSD-style license found in the
  9530. * LICENSE file in the root directory of this source tree. An additional grant
  9531. * of patent rights can be found in the PATENTS file in the same directory.
  9532. *
  9533. * @providesModule ReactEventEmitterMixin
  9534. */
  9535. 'use strict';
  9536. var EventPluginHub = _dereq_(17);
  9537. function runEventQueueInBatch(events) {
  9538. EventPluginHub.enqueueEvents(events);
  9539. EventPluginHub.processEventQueue();
  9540. }
  9541. var ReactEventEmitterMixin = {
  9542. /**
  9543. * Streams a fired top-level event to `EventPluginHub` where plugins have the
  9544. * opportunity to create `ReactEvent`s to be dispatched.
  9545. *
  9546. * @param {string} topLevelType Record from `EventConstants`.
  9547. * @param {object} topLevelTarget The listening component root node.
  9548. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  9549. * @param {object} nativeEvent Native environment event.
  9550. */
  9551. handleTopLevel: function(
  9552. topLevelType,
  9553. topLevelTarget,
  9554. topLevelTargetID,
  9555. nativeEvent) {
  9556. var events = EventPluginHub.extractEvents(
  9557. topLevelType,
  9558. topLevelTarget,
  9559. topLevelTargetID,
  9560. nativeEvent
  9561. );
  9562. runEventQueueInBatch(events);
  9563. }
  9564. };
  9565. module.exports = ReactEventEmitterMixin;
  9566. },{"17":17}],62:[function(_dereq_,module,exports){
  9567. /**
  9568. * Copyright 2013-2015, Facebook, Inc.
  9569. * All rights reserved.
  9570. *
  9571. * This source code is licensed under the BSD-style license found in the
  9572. * LICENSE file in the root directory of this source tree. An additional grant
  9573. * of patent rights can be found in the PATENTS file in the same directory.
  9574. *
  9575. * @providesModule ReactEventListener
  9576. * @typechecks static-only
  9577. */
  9578. 'use strict';
  9579. var EventListener = _dereq_(16);
  9580. var ExecutionEnvironment = _dereq_(21);
  9581. var PooledClass = _dereq_(28);
  9582. var ReactInstanceHandles = _dereq_(66);
  9583. var ReactMount = _dereq_(70);
  9584. var ReactUpdates = _dereq_(87);
  9585. var assign = _dereq_(27);
  9586. var getEventTarget = _dereq_(125);
  9587. var getUnboundedScrollPosition = _dereq_(131);
  9588. /**
  9589. * Finds the parent React component of `node`.
  9590. *
  9591. * @param {*} node
  9592. * @return {?DOMEventTarget} Parent container, or `null` if the specified node
  9593. * is not nested.
  9594. */
  9595. function findParent(node) {
  9596. // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  9597. // traversal, but caching is difficult to do correctly without using a
  9598. // mutation observer to listen for all DOM changes.
  9599. var nodeID = ReactMount.getID(node);
  9600. var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
  9601. var container = ReactMount.findReactContainerForID(rootID);
  9602. var parent = ReactMount.getFirstReactDOM(container);
  9603. return parent;
  9604. }
  9605. // Used to store ancestor hierarchy in top level callback
  9606. function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
  9607. this.topLevelType = topLevelType;
  9608. this.nativeEvent = nativeEvent;
  9609. this.ancestors = [];
  9610. }
  9611. assign(TopLevelCallbackBookKeeping.prototype, {
  9612. destructor: function() {
  9613. this.topLevelType = null;
  9614. this.nativeEvent = null;
  9615. this.ancestors.length = 0;
  9616. }
  9617. });
  9618. PooledClass.addPoolingTo(
  9619. TopLevelCallbackBookKeeping,
  9620. PooledClass.twoArgumentPooler
  9621. );
  9622. function handleTopLevelImpl(bookKeeping) {
  9623. var topLevelTarget = ReactMount.getFirstReactDOM(
  9624. getEventTarget(bookKeeping.nativeEvent)
  9625. ) || window;
  9626. // Loop through the hierarchy, in case there's any nested components.
  9627. // It's important that we build the array of ancestors before calling any
  9628. // event handlers, because event handlers can modify the DOM, leading to
  9629. // inconsistencies with ReactMount's node cache. See #1105.
  9630. var ancestor = topLevelTarget;
  9631. while (ancestor) {
  9632. bookKeeping.ancestors.push(ancestor);
  9633. ancestor = findParent(ancestor);
  9634. }
  9635. for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
  9636. topLevelTarget = bookKeeping.ancestors[i];
  9637. var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
  9638. ReactEventListener._handleTopLevel(
  9639. bookKeeping.topLevelType,
  9640. topLevelTarget,
  9641. topLevelTargetID,
  9642. bookKeeping.nativeEvent
  9643. );
  9644. }
  9645. }
  9646. function scrollValueMonitor(cb) {
  9647. var scrollPosition = getUnboundedScrollPosition(window);
  9648. cb(scrollPosition);
  9649. }
  9650. var ReactEventListener = {
  9651. _enabled: true,
  9652. _handleTopLevel: null,
  9653. WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
  9654. setHandleTopLevel: function(handleTopLevel) {
  9655. ReactEventListener._handleTopLevel = handleTopLevel;
  9656. },
  9657. setEnabled: function(enabled) {
  9658. ReactEventListener._enabled = !!enabled;
  9659. },
  9660. isEnabled: function() {
  9661. return ReactEventListener._enabled;
  9662. },
  9663. /**
  9664. * Traps top-level events by using event bubbling.
  9665. *
  9666. * @param {string} topLevelType Record from `EventConstants`.
  9667. * @param {string} handlerBaseName Event name (e.g. "click").
  9668. * @param {object} handle Element on which to attach listener.
  9669. * @return {object} An object with a remove function which will forcefully
  9670. * remove the listener.
  9671. * @internal
  9672. */
  9673. trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
  9674. var element = handle;
  9675. if (!element) {
  9676. return null;
  9677. }
  9678. return EventListener.listen(
  9679. element,
  9680. handlerBaseName,
  9681. ReactEventListener.dispatchEvent.bind(null, topLevelType)
  9682. );
  9683. },
  9684. /**
  9685. * Traps a top-level event by using event capturing.
  9686. *
  9687. * @param {string} topLevelType Record from `EventConstants`.
  9688. * @param {string} handlerBaseName Event name (e.g. "click").
  9689. * @param {object} handle Element on which to attach listener.
  9690. * @return {object} An object with a remove function which will forcefully
  9691. * remove the listener.
  9692. * @internal
  9693. */
  9694. trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
  9695. var element = handle;
  9696. if (!element) {
  9697. return null;
  9698. }
  9699. return EventListener.capture(
  9700. element,
  9701. handlerBaseName,
  9702. ReactEventListener.dispatchEvent.bind(null, topLevelType)
  9703. );
  9704. },
  9705. monitorScrollValue: function(refresh) {
  9706. var callback = scrollValueMonitor.bind(null, refresh);
  9707. EventListener.listen(window, 'scroll', callback);
  9708. },
  9709. dispatchEvent: function(topLevelType, nativeEvent) {
  9710. if (!ReactEventListener._enabled) {
  9711. return;
  9712. }
  9713. var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
  9714. topLevelType,
  9715. nativeEvent
  9716. );
  9717. try {
  9718. // Event queue being processed in the same cycle allows
  9719. // `preventDefault`.
  9720. ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
  9721. } finally {
  9722. TopLevelCallbackBookKeeping.release(bookKeeping);
  9723. }
  9724. }
  9725. };
  9726. module.exports = ReactEventListener;
  9727. },{"125":125,"131":131,"16":16,"21":21,"27":27,"28":28,"66":66,"70":70,"87":87}],63:[function(_dereq_,module,exports){
  9728. /**
  9729. * Copyright 2015, Facebook, Inc.
  9730. * All rights reserved.
  9731. *
  9732. * This source code is licensed under the BSD-style license found in the
  9733. * LICENSE file in the root directory of this source tree. An additional grant
  9734. * of patent rights can be found in the PATENTS file in the same directory.
  9735. *
  9736. * @providesModule ReactFragment
  9737. */
  9738. 'use strict';
  9739. var ReactElement = _dereq_(57);
  9740. var warning = _dereq_(154);
  9741. /**
  9742. * We used to allow keyed objects to serve as a collection of ReactElements,
  9743. * or nested sets. This allowed us a way to explicitly key a set a fragment of
  9744. * components. This is now being replaced with an opaque data structure.
  9745. * The upgrade path is to call React.addons.createFragment({ key: value }) to
  9746. * create a keyed fragment. The resulting data structure is opaque, for now.
  9747. */
  9748. if ("production" !== "development") {
  9749. var fragmentKey = '_reactFragment';
  9750. var didWarnKey = '_reactDidWarn';
  9751. var canWarnForReactFragment = false;
  9752. try {
  9753. // Feature test. Don't even try to issue this warning if we can't use
  9754. // enumerable: false.
  9755. var dummy = function() {
  9756. return 1;
  9757. };
  9758. Object.defineProperty(
  9759. {},
  9760. fragmentKey,
  9761. {enumerable: false, value: true}
  9762. );
  9763. Object.defineProperty(
  9764. {},
  9765. 'key',
  9766. {enumerable: true, get: dummy}
  9767. );
  9768. canWarnForReactFragment = true;
  9769. } catch (x) { }
  9770. var proxyPropertyAccessWithWarning = function(obj, key) {
  9771. Object.defineProperty(obj, key, {
  9772. enumerable: true,
  9773. get: function() {
  9774. ("production" !== "development" ? warning(
  9775. this[didWarnKey],
  9776. 'A ReactFragment is an opaque type. Accessing any of its ' +
  9777. 'properties is deprecated. Pass it to one of the React.Children ' +
  9778. 'helpers.'
  9779. ) : null);
  9780. this[didWarnKey] = true;
  9781. return this[fragmentKey][key];
  9782. },
  9783. set: function(value) {
  9784. ("production" !== "development" ? warning(
  9785. this[didWarnKey],
  9786. 'A ReactFragment is an immutable opaque type. Mutating its ' +
  9787. 'properties is deprecated.'
  9788. ) : null);
  9789. this[didWarnKey] = true;
  9790. this[fragmentKey][key] = value;
  9791. }
  9792. });
  9793. };
  9794. var issuedWarnings = {};
  9795. var didWarnForFragment = function(fragment) {
  9796. // We use the keys and the type of the value as a heuristic to dedupe the
  9797. // warning to avoid spamming too much.
  9798. var fragmentCacheKey = '';
  9799. for (var key in fragment) {
  9800. fragmentCacheKey += key + ':' + (typeof fragment[key]) + ',';
  9801. }
  9802. var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
  9803. issuedWarnings[fragmentCacheKey] = true;
  9804. return alreadyWarnedOnce;
  9805. };
  9806. }
  9807. var ReactFragment = {
  9808. // Wrap a keyed object in an opaque proxy that warns you if you access any
  9809. // of its properties.
  9810. create: function(object) {
  9811. if ("production" !== "development") {
  9812. if (typeof object !== 'object' || !object || Array.isArray(object)) {
  9813. ("production" !== "development" ? warning(
  9814. false,
  9815. 'React.addons.createFragment only accepts a single object.',
  9816. object
  9817. ) : null);
  9818. return object;
  9819. }
  9820. if (ReactElement.isValidElement(object)) {
  9821. ("production" !== "development" ? warning(
  9822. false,
  9823. 'React.addons.createFragment does not accept a ReactElement ' +
  9824. 'without a wrapper object.'
  9825. ) : null);
  9826. return object;
  9827. }
  9828. if (canWarnForReactFragment) {
  9829. var proxy = {};
  9830. Object.defineProperty(proxy, fragmentKey, {
  9831. enumerable: false,
  9832. value: object
  9833. });
  9834. Object.defineProperty(proxy, didWarnKey, {
  9835. writable: true,
  9836. enumerable: false,
  9837. value: false
  9838. });
  9839. for (var key in object) {
  9840. proxyPropertyAccessWithWarning(proxy, key);
  9841. }
  9842. Object.preventExtensions(proxy);
  9843. return proxy;
  9844. }
  9845. }
  9846. return object;
  9847. },
  9848. // Extract the original keyed object from the fragment opaque type. Warn if
  9849. // a plain object is passed here.
  9850. extract: function(fragment) {
  9851. if ("production" !== "development") {
  9852. if (canWarnForReactFragment) {
  9853. if (!fragment[fragmentKey]) {
  9854. ("production" !== "development" ? warning(
  9855. didWarnForFragment(fragment),
  9856. 'Any use of a keyed object should be wrapped in ' +
  9857. 'React.addons.createFragment(object) before being passed as a ' +
  9858. 'child.'
  9859. ) : null);
  9860. return fragment;
  9861. }
  9862. return fragment[fragmentKey];
  9863. }
  9864. }
  9865. return fragment;
  9866. },
  9867. // Check if this is a fragment and if so, extract the keyed object. If it
  9868. // is a fragment-like object, warn that it should be wrapped. Ignore if we
  9869. // can't determine what kind of object this is.
  9870. extractIfFragment: function(fragment) {
  9871. if ("production" !== "development") {
  9872. if (canWarnForReactFragment) {
  9873. // If it is the opaque type, return the keyed object.
  9874. if (fragment[fragmentKey]) {
  9875. return fragment[fragmentKey];
  9876. }
  9877. // Otherwise, check each property if it has an element, if it does
  9878. // it is probably meant as a fragment, so we can warn early. Defer,
  9879. // the warning to extract.
  9880. for (var key in fragment) {
  9881. if (fragment.hasOwnProperty(key) &&
  9882. ReactElement.isValidElement(fragment[key])) {
  9883. // This looks like a fragment object, we should provide an
  9884. // early warning.
  9885. return ReactFragment.extract(fragment);
  9886. }
  9887. }
  9888. }
  9889. }
  9890. return fragment;
  9891. }
  9892. };
  9893. module.exports = ReactFragment;
  9894. },{"154":154,"57":57}],64:[function(_dereq_,module,exports){
  9895. /**
  9896. * Copyright 2013-2015, Facebook, Inc.
  9897. * All rights reserved.
  9898. *
  9899. * This source code is licensed under the BSD-style license found in the
  9900. * LICENSE file in the root directory of this source tree. An additional grant
  9901. * of patent rights can be found in the PATENTS file in the same directory.
  9902. *
  9903. * @providesModule ReactInjection
  9904. */
  9905. 'use strict';
  9906. var DOMProperty = _dereq_(10);
  9907. var EventPluginHub = _dereq_(17);
  9908. var ReactComponentEnvironment = _dereq_(36);
  9909. var ReactClass = _dereq_(33);
  9910. var ReactEmptyComponent = _dereq_(59);
  9911. var ReactBrowserEventEmitter = _dereq_(30);
  9912. var ReactNativeComponent = _dereq_(73);
  9913. var ReactDOMComponent = _dereq_(42);
  9914. var ReactPerf = _dereq_(75);
  9915. var ReactRootIndex = _dereq_(83);
  9916. var ReactUpdates = _dereq_(87);
  9917. var ReactInjection = {
  9918. Component: ReactComponentEnvironment.injection,
  9919. Class: ReactClass.injection,
  9920. DOMComponent: ReactDOMComponent.injection,
  9921. DOMProperty: DOMProperty.injection,
  9922. EmptyComponent: ReactEmptyComponent.injection,
  9923. EventPluginHub: EventPluginHub.injection,
  9924. EventEmitter: ReactBrowserEventEmitter.injection,
  9925. NativeComponent: ReactNativeComponent.injection,
  9926. Perf: ReactPerf.injection,
  9927. RootIndex: ReactRootIndex.injection,
  9928. Updates: ReactUpdates.injection
  9929. };
  9930. module.exports = ReactInjection;
  9931. },{"10":10,"17":17,"30":30,"33":33,"36":36,"42":42,"59":59,"73":73,"75":75,"83":83,"87":87}],65:[function(_dereq_,module,exports){
  9932. /**
  9933. * Copyright 2013-2015, Facebook, Inc.
  9934. * All rights reserved.
  9935. *
  9936. * This source code is licensed under the BSD-style license found in the
  9937. * LICENSE file in the root directory of this source tree. An additional grant
  9938. * of patent rights can be found in the PATENTS file in the same directory.
  9939. *
  9940. * @providesModule ReactInputSelection
  9941. */
  9942. 'use strict';
  9943. var ReactDOMSelection = _dereq_(50);
  9944. var containsNode = _dereq_(109);
  9945. var focusNode = _dereq_(119);
  9946. var getActiveElement = _dereq_(121);
  9947. function isInDocument(node) {
  9948. return containsNode(document.documentElement, node);
  9949. }
  9950. /**
  9951. * @ReactInputSelection: React input selection module. Based on Selection.js,
  9952. * but modified to be suitable for react and has a couple of bug fixes (doesn't
  9953. * assume buttons have range selections allowed).
  9954. * Input selection module for React.
  9955. */
  9956. var ReactInputSelection = {
  9957. hasSelectionCapabilities: function(elem) {
  9958. return elem && (
  9959. ((elem.nodeName === 'INPUT' && elem.type === 'text') ||
  9960. elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')
  9961. );
  9962. },
  9963. getSelectionInformation: function() {
  9964. var focusedElem = getActiveElement();
  9965. return {
  9966. focusedElem: focusedElem,
  9967. selectionRange:
  9968. ReactInputSelection.hasSelectionCapabilities(focusedElem) ?
  9969. ReactInputSelection.getSelection(focusedElem) :
  9970. null
  9971. };
  9972. },
  9973. /**
  9974. * @restoreSelection: If any selection information was potentially lost,
  9975. * restore it. This is useful when performing operations that could remove dom
  9976. * nodes and place them back in, resulting in focus being lost.
  9977. */
  9978. restoreSelection: function(priorSelectionInformation) {
  9979. var curFocusedElem = getActiveElement();
  9980. var priorFocusedElem = priorSelectionInformation.focusedElem;
  9981. var priorSelectionRange = priorSelectionInformation.selectionRange;
  9982. if (curFocusedElem !== priorFocusedElem &&
  9983. isInDocument(priorFocusedElem)) {
  9984. if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
  9985. ReactInputSelection.setSelection(
  9986. priorFocusedElem,
  9987. priorSelectionRange
  9988. );
  9989. }
  9990. focusNode(priorFocusedElem);
  9991. }
  9992. },
  9993. /**
  9994. * @getSelection: Gets the selection bounds of a focused textarea, input or
  9995. * contentEditable node.
  9996. * -@input: Look up selection bounds of this input
  9997. * -@return {start: selectionStart, end: selectionEnd}
  9998. */
  9999. getSelection: function(input) {
  10000. var selection;
  10001. if ('selectionStart' in input) {
  10002. // Modern browser with input or textarea.
  10003. selection = {
  10004. start: input.selectionStart,
  10005. end: input.selectionEnd
  10006. };
  10007. } else if (document.selection && input.nodeName === 'INPUT') {
  10008. // IE8 input.
  10009. var range = document.selection.createRange();
  10010. // There can only be one selection per document in IE, so it must
  10011. // be in our element.
  10012. if (range.parentElement() === input) {
  10013. selection = {
  10014. start: -range.moveStart('character', -input.value.length),
  10015. end: -range.moveEnd('character', -input.value.length)
  10016. };
  10017. }
  10018. } else {
  10019. // Content editable or old IE textarea.
  10020. selection = ReactDOMSelection.getOffsets(input);
  10021. }
  10022. return selection || {start: 0, end: 0};
  10023. },
  10024. /**
  10025. * @setSelection: Sets the selection bounds of a textarea or input and focuses
  10026. * the input.
  10027. * -@input Set selection bounds of this input or textarea
  10028. * -@offsets Object of same form that is returned from get*
  10029. */
  10030. setSelection: function(input, offsets) {
  10031. var start = offsets.start;
  10032. var end = offsets.end;
  10033. if (typeof end === 'undefined') {
  10034. end = start;
  10035. }
  10036. if ('selectionStart' in input) {
  10037. input.selectionStart = start;
  10038. input.selectionEnd = Math.min(end, input.value.length);
  10039. } else if (document.selection && input.nodeName === 'INPUT') {
  10040. var range = input.createTextRange();
  10041. range.collapse(true);
  10042. range.moveStart('character', start);
  10043. range.moveEnd('character', end - start);
  10044. range.select();
  10045. } else {
  10046. ReactDOMSelection.setOffsets(input, offsets);
  10047. }
  10048. }
  10049. };
  10050. module.exports = ReactInputSelection;
  10051. },{"109":109,"119":119,"121":121,"50":50}],66:[function(_dereq_,module,exports){
  10052. /**
  10053. * Copyright 2013-2015, Facebook, Inc.
  10054. * All rights reserved.
  10055. *
  10056. * This source code is licensed under the BSD-style license found in the
  10057. * LICENSE file in the root directory of this source tree. An additional grant
  10058. * of patent rights can be found in the PATENTS file in the same directory.
  10059. *
  10060. * @providesModule ReactInstanceHandles
  10061. * @typechecks static-only
  10062. */
  10063. 'use strict';
  10064. var ReactRootIndex = _dereq_(83);
  10065. var invariant = _dereq_(135);
  10066. var SEPARATOR = '.';
  10067. var SEPARATOR_LENGTH = SEPARATOR.length;
  10068. /**
  10069. * Maximum depth of traversals before we consider the possibility of a bad ID.
  10070. */
  10071. var MAX_TREE_DEPTH = 100;
  10072. /**
  10073. * Creates a DOM ID prefix to use when mounting React components.
  10074. *
  10075. * @param {number} index A unique integer
  10076. * @return {string} React root ID.
  10077. * @internal
  10078. */
  10079. function getReactRootIDString(index) {
  10080. return SEPARATOR + index.toString(36);
  10081. }
  10082. /**
  10083. * Checks if a character in the supplied ID is a separator or the end.
  10084. *
  10085. * @param {string} id A React DOM ID.
  10086. * @param {number} index Index of the character to check.
  10087. * @return {boolean} True if the character is a separator or end of the ID.
  10088. * @private
  10089. */
  10090. function isBoundary(id, index) {
  10091. return id.charAt(index) === SEPARATOR || index === id.length;
  10092. }
  10093. /**
  10094. * Checks if the supplied string is a valid React DOM ID.
  10095. *
  10096. * @param {string} id A React DOM ID, maybe.
  10097. * @return {boolean} True if the string is a valid React DOM ID.
  10098. * @private
  10099. */
  10100. function isValidID(id) {
  10101. return id === '' || (
  10102. id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
  10103. );
  10104. }
  10105. /**
  10106. * Checks if the first ID is an ancestor of or equal to the second ID.
  10107. *
  10108. * @param {string} ancestorID
  10109. * @param {string} descendantID
  10110. * @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
  10111. * @internal
  10112. */
  10113. function isAncestorIDOf(ancestorID, descendantID) {
  10114. return (
  10115. descendantID.indexOf(ancestorID) === 0 &&
  10116. isBoundary(descendantID, ancestorID.length)
  10117. );
  10118. }
  10119. /**
  10120. * Gets the parent ID of the supplied React DOM ID, `id`.
  10121. *
  10122. * @param {string} id ID of a component.
  10123. * @return {string} ID of the parent, or an empty string.
  10124. * @private
  10125. */
  10126. function getParentID(id) {
  10127. return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
  10128. }
  10129. /**
  10130. * Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
  10131. * supplied `destinationID`. If they are equal, the ID is returned.
  10132. *
  10133. * @param {string} ancestorID ID of an ancestor node of `destinationID`.
  10134. * @param {string} destinationID ID of the destination node.
  10135. * @return {string} Next ID on the path from `ancestorID` to `destinationID`.
  10136. * @private
  10137. */
  10138. function getNextDescendantID(ancestorID, destinationID) {
  10139. ("production" !== "development" ? invariant(
  10140. isValidID(ancestorID) && isValidID(destinationID),
  10141. 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
  10142. ancestorID,
  10143. destinationID
  10144. ) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
  10145. ("production" !== "development" ? invariant(
  10146. isAncestorIDOf(ancestorID, destinationID),
  10147. 'getNextDescendantID(...): React has made an invalid assumption about ' +
  10148. 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
  10149. ancestorID,
  10150. destinationID
  10151. ) : invariant(isAncestorIDOf(ancestorID, destinationID)));
  10152. if (ancestorID === destinationID) {
  10153. return ancestorID;
  10154. }
  10155. // Skip over the ancestor and the immediate separator. Traverse until we hit
  10156. // another separator or we reach the end of `destinationID`.
  10157. var start = ancestorID.length + SEPARATOR_LENGTH;
  10158. var i;
  10159. for (i = start; i < destinationID.length; i++) {
  10160. if (isBoundary(destinationID, i)) {
  10161. break;
  10162. }
  10163. }
  10164. return destinationID.substr(0, i);
  10165. }
  10166. /**
  10167. * Gets the nearest common ancestor ID of two IDs.
  10168. *
  10169. * Using this ID scheme, the nearest common ancestor ID is the longest common
  10170. * prefix of the two IDs that immediately preceded a "marker" in both strings.
  10171. *
  10172. * @param {string} oneID
  10173. * @param {string} twoID
  10174. * @return {string} Nearest common ancestor ID, or the empty string if none.
  10175. * @private
  10176. */
  10177. function getFirstCommonAncestorID(oneID, twoID) {
  10178. var minLength = Math.min(oneID.length, twoID.length);
  10179. if (minLength === 0) {
  10180. return '';
  10181. }
  10182. var lastCommonMarkerIndex = 0;
  10183. // Use `<=` to traverse until the "EOL" of the shorter string.
  10184. for (var i = 0; i <= minLength; i++) {
  10185. if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
  10186. lastCommonMarkerIndex = i;
  10187. } else if (oneID.charAt(i) !== twoID.charAt(i)) {
  10188. break;
  10189. }
  10190. }
  10191. var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
  10192. ("production" !== "development" ? invariant(
  10193. isValidID(longestCommonID),
  10194. 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
  10195. oneID,
  10196. twoID,
  10197. longestCommonID
  10198. ) : invariant(isValidID(longestCommonID)));
  10199. return longestCommonID;
  10200. }
  10201. /**
  10202. * Traverses the parent path between two IDs (either up or down). The IDs must
  10203. * not be the same, and there must exist a parent path between them. If the
  10204. * callback returns `false`, traversal is stopped.
  10205. *
  10206. * @param {?string} start ID at which to start traversal.
  10207. * @param {?string} stop ID at which to end traversal.
  10208. * @param {function} cb Callback to invoke each ID with.
  10209. * @param {?boolean} skipFirst Whether or not to skip the first node.
  10210. * @param {?boolean} skipLast Whether or not to skip the last node.
  10211. * @private
  10212. */
  10213. function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
  10214. start = start || '';
  10215. stop = stop || '';
  10216. ("production" !== "development" ? invariant(
  10217. start !== stop,
  10218. 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
  10219. start
  10220. ) : invariant(start !== stop));
  10221. var traverseUp = isAncestorIDOf(stop, start);
  10222. ("production" !== "development" ? invariant(
  10223. traverseUp || isAncestorIDOf(start, stop),
  10224. 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
  10225. 'not have a parent path.',
  10226. start,
  10227. stop
  10228. ) : invariant(traverseUp || isAncestorIDOf(start, stop)));
  10229. // Traverse from `start` to `stop` one depth at a time.
  10230. var depth = 0;
  10231. var traverse = traverseUp ? getParentID : getNextDescendantID;
  10232. for (var id = start; /* until break */; id = traverse(id, stop)) {
  10233. var ret;
  10234. if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
  10235. ret = cb(id, traverseUp, arg);
  10236. }
  10237. if (ret === false || id === stop) {
  10238. // Only break //after// visiting `stop`.
  10239. break;
  10240. }
  10241. ("production" !== "development" ? invariant(
  10242. depth++ < MAX_TREE_DEPTH,
  10243. 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
  10244. 'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
  10245. start, stop
  10246. ) : invariant(depth++ < MAX_TREE_DEPTH));
  10247. }
  10248. }
  10249. /**
  10250. * Manages the IDs assigned to DOM representations of React components. This
  10251. * uses a specific scheme in order to traverse the DOM efficiently (e.g. in
  10252. * order to simulate events).
  10253. *
  10254. * @internal
  10255. */
  10256. var ReactInstanceHandles = {
  10257. /**
  10258. * Constructs a React root ID
  10259. * @return {string} A React root ID.
  10260. */
  10261. createReactRootID: function() {
  10262. return getReactRootIDString(ReactRootIndex.createReactRootIndex());
  10263. },
  10264. /**
  10265. * Constructs a React ID by joining a root ID with a name.
  10266. *
  10267. * @param {string} rootID Root ID of a parent component.
  10268. * @param {string} name A component's name (as flattened children).
  10269. * @return {string} A React ID.
  10270. * @internal
  10271. */
  10272. createReactID: function(rootID, name) {
  10273. return rootID + name;
  10274. },
  10275. /**
  10276. * Gets the DOM ID of the React component that is the root of the tree that
  10277. * contains the React component with the supplied DOM ID.
  10278. *
  10279. * @param {string} id DOM ID of a React component.
  10280. * @return {?string} DOM ID of the React component that is the root.
  10281. * @internal
  10282. */
  10283. getReactRootIDFromNodeID: function(id) {
  10284. if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
  10285. var index = id.indexOf(SEPARATOR, 1);
  10286. return index > -1 ? id.substr(0, index) : id;
  10287. }
  10288. return null;
  10289. },
  10290. /**
  10291. * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
  10292. * should would receive a `mouseEnter` or `mouseLeave` event.
  10293. *
  10294. * NOTE: Does not invoke the callback on the nearest common ancestor because
  10295. * nothing "entered" or "left" that element.
  10296. *
  10297. * @param {string} leaveID ID being left.
  10298. * @param {string} enterID ID being entered.
  10299. * @param {function} cb Callback to invoke on each entered/left ID.
  10300. * @param {*} upArg Argument to invoke the callback with on left IDs.
  10301. * @param {*} downArg Argument to invoke the callback with on entered IDs.
  10302. * @internal
  10303. */
  10304. traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
  10305. var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
  10306. if (ancestorID !== leaveID) {
  10307. traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
  10308. }
  10309. if (ancestorID !== enterID) {
  10310. traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
  10311. }
  10312. },
  10313. /**
  10314. * Simulates the traversal of a two-phase, capture/bubble event dispatch.
  10315. *
  10316. * NOTE: This traversal happens on IDs without touching the DOM.
  10317. *
  10318. * @param {string} targetID ID of the target node.
  10319. * @param {function} cb Callback to invoke.
  10320. * @param {*} arg Argument to invoke the callback with.
  10321. * @internal
  10322. */
  10323. traverseTwoPhase: function(targetID, cb, arg) {
  10324. if (targetID) {
  10325. traverseParentPath('', targetID, cb, arg, true, false);
  10326. traverseParentPath(targetID, '', cb, arg, false, true);
  10327. }
  10328. },
  10329. /**
  10330. * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
  10331. * example, passing `.0.$row-0.1` would result in `cb` getting called
  10332. * with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
  10333. *
  10334. * NOTE: This traversal happens on IDs without touching the DOM.
  10335. *
  10336. * @param {string} targetID ID of the target node.
  10337. * @param {function} cb Callback to invoke.
  10338. * @param {*} arg Argument to invoke the callback with.
  10339. * @internal
  10340. */
  10341. traverseAncestors: function(targetID, cb, arg) {
  10342. traverseParentPath('', targetID, cb, arg, true, false);
  10343. },
  10344. /**
  10345. * Exposed for unit testing.
  10346. * @private
  10347. */
  10348. _getFirstCommonAncestorID: getFirstCommonAncestorID,
  10349. /**
  10350. * Exposed for unit testing.
  10351. * @private
  10352. */
  10353. _getNextDescendantID: getNextDescendantID,
  10354. isAncestorIDOf: isAncestorIDOf,
  10355. SEPARATOR: SEPARATOR
  10356. };
  10357. module.exports = ReactInstanceHandles;
  10358. },{"135":135,"83":83}],67:[function(_dereq_,module,exports){
  10359. /**
  10360. * Copyright 2013-2015, Facebook, Inc.
  10361. * All rights reserved.
  10362. *
  10363. * This source code is licensed under the BSD-style license found in the
  10364. * LICENSE file in the root directory of this source tree. An additional grant
  10365. * of patent rights can be found in the PATENTS file in the same directory.
  10366. *
  10367. * @providesModule ReactInstanceMap
  10368. */
  10369. 'use strict';
  10370. /**
  10371. * `ReactInstanceMap` maintains a mapping from a public facing stateful
  10372. * instance (key) and the internal representation (value). This allows public
  10373. * methods to accept the user facing instance as an argument and map them back
  10374. * to internal methods.
  10375. */
  10376. // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
  10377. var ReactInstanceMap = {
  10378. /**
  10379. * This API should be called `delete` but we'd have to make sure to always
  10380. * transform these to strings for IE support. When this transform is fully
  10381. * supported we can rename it.
  10382. */
  10383. remove: function(key) {
  10384. key._reactInternalInstance = undefined;
  10385. },
  10386. get: function(key) {
  10387. return key._reactInternalInstance;
  10388. },
  10389. has: function(key) {
  10390. return key._reactInternalInstance !== undefined;
  10391. },
  10392. set: function(key, value) {
  10393. key._reactInternalInstance = value;
  10394. }
  10395. };
  10396. module.exports = ReactInstanceMap;
  10397. },{}],68:[function(_dereq_,module,exports){
  10398. /**
  10399. * Copyright 2015, Facebook, Inc.
  10400. * All rights reserved.
  10401. *
  10402. * This source code is licensed under the BSD-style license found in the
  10403. * LICENSE file in the root directory of this source tree. An additional grant
  10404. * of patent rights can be found in the PATENTS file in the same directory.
  10405. *
  10406. * @providesModule ReactLifeCycle
  10407. */
  10408. 'use strict';
  10409. /**
  10410. * This module manages the bookkeeping when a component is in the process
  10411. * of being mounted or being unmounted. This is used as a way to enforce
  10412. * invariants (or warnings) when it is not recommended to call
  10413. * setState/forceUpdate.
  10414. *
  10415. * currentlyMountingInstance: During the construction phase, it is not possible
  10416. * to trigger an update since the instance is not fully mounted yet. However, we
  10417. * currently allow this as a convenience for mutating the initial state.
  10418. *
  10419. * currentlyUnmountingInstance: During the unmounting phase, the instance is
  10420. * still mounted and can therefore schedule an update. However, this is not
  10421. * recommended and probably an error since it's about to be unmounted.
  10422. * Therefore we still want to trigger in an error for that case.
  10423. */
  10424. var ReactLifeCycle = {
  10425. currentlyMountingInstance: null,
  10426. currentlyUnmountingInstance: null
  10427. };
  10428. module.exports = ReactLifeCycle;
  10429. },{}],69:[function(_dereq_,module,exports){
  10430. /**
  10431. * Copyright 2013-2015, Facebook, Inc.
  10432. * All rights reserved.
  10433. *
  10434. * This source code is licensed under the BSD-style license found in the
  10435. * LICENSE file in the root directory of this source tree. An additional grant
  10436. * of patent rights can be found in the PATENTS file in the same directory.
  10437. *
  10438. * @providesModule ReactMarkupChecksum
  10439. */
  10440. 'use strict';
  10441. var adler32 = _dereq_(106);
  10442. var ReactMarkupChecksum = {
  10443. CHECKSUM_ATTR_NAME: 'data-react-checksum',
  10444. /**
  10445. * @param {string} markup Markup string
  10446. * @return {string} Markup string with checksum attribute attached
  10447. */
  10448. addChecksumToMarkup: function(markup) {
  10449. var checksum = adler32(markup);
  10450. return markup.replace(
  10451. '>',
  10452. ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
  10453. );
  10454. },
  10455. /**
  10456. * @param {string} markup to use
  10457. * @param {DOMElement} element root React element
  10458. * @returns {boolean} whether or not the markup is the same
  10459. */
  10460. canReuseMarkup: function(markup, element) {
  10461. var existingChecksum = element.getAttribute(
  10462. ReactMarkupChecksum.CHECKSUM_ATTR_NAME
  10463. );
  10464. existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
  10465. var markupChecksum = adler32(markup);
  10466. return markupChecksum === existingChecksum;
  10467. }
  10468. };
  10469. module.exports = ReactMarkupChecksum;
  10470. },{"106":106}],70:[function(_dereq_,module,exports){
  10471. /**
  10472. * Copyright 2013-2015, Facebook, Inc.
  10473. * All rights reserved.
  10474. *
  10475. * This source code is licensed under the BSD-style license found in the
  10476. * LICENSE file in the root directory of this source tree. An additional grant
  10477. * of patent rights can be found in the PATENTS file in the same directory.
  10478. *
  10479. * @providesModule ReactMount
  10480. */
  10481. 'use strict';
  10482. var DOMProperty = _dereq_(10);
  10483. var ReactBrowserEventEmitter = _dereq_(30);
  10484. var ReactCurrentOwner = _dereq_(39);
  10485. var ReactElement = _dereq_(57);
  10486. var ReactElementValidator = _dereq_(58);
  10487. var ReactEmptyComponent = _dereq_(59);
  10488. var ReactInstanceHandles = _dereq_(66);
  10489. var ReactInstanceMap = _dereq_(67);
  10490. var ReactMarkupChecksum = _dereq_(69);
  10491. var ReactPerf = _dereq_(75);
  10492. var ReactReconciler = _dereq_(81);
  10493. var ReactUpdateQueue = _dereq_(86);
  10494. var ReactUpdates = _dereq_(87);
  10495. var emptyObject = _dereq_(115);
  10496. var containsNode = _dereq_(109);
  10497. var getReactRootElementInContainer = _dereq_(129);
  10498. var instantiateReactComponent = _dereq_(134);
  10499. var invariant = _dereq_(135);
  10500. var setInnerHTML = _dereq_(148);
  10501. var shouldUpdateReactComponent = _dereq_(151);
  10502. var warning = _dereq_(154);
  10503. var SEPARATOR = ReactInstanceHandles.SEPARATOR;
  10504. var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
  10505. var nodeCache = {};
  10506. var ELEMENT_NODE_TYPE = 1;
  10507. var DOC_NODE_TYPE = 9;
  10508. /** Mapping from reactRootID to React component instance. */
  10509. var instancesByReactRootID = {};
  10510. /** Mapping from reactRootID to `container` nodes. */
  10511. var containersByReactRootID = {};
  10512. if ("production" !== "development") {
  10513. /** __DEV__-only mapping from reactRootID to root elements. */
  10514. var rootElementsByReactRootID = {};
  10515. }
  10516. // Used to store breadth-first search state in findComponentRoot.
  10517. var findComponentRootReusableArray = [];
  10518. /**
  10519. * Finds the index of the first character
  10520. * that's not common between the two given strings.
  10521. *
  10522. * @return {number} the index of the character where the strings diverge
  10523. */
  10524. function firstDifferenceIndex(string1, string2) {
  10525. var minLen = Math.min(string1.length, string2.length);
  10526. for (var i = 0; i < minLen; i++) {
  10527. if (string1.charAt(i) !== string2.charAt(i)) {
  10528. return i;
  10529. }
  10530. }
  10531. return string1.length === string2.length ? -1 : minLen;
  10532. }
  10533. /**
  10534. * @param {DOMElement} container DOM element that may contain a React component.
  10535. * @return {?string} A "reactRoot" ID, if a React component is rendered.
  10536. */
  10537. function getReactRootID(container) {
  10538. var rootElement = getReactRootElementInContainer(container);
  10539. return rootElement && ReactMount.getID(rootElement);
  10540. }
  10541. /**
  10542. * Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
  10543. * element can return its control whose name or ID equals ATTR_NAME. All
  10544. * DOM nodes support `getAttributeNode` but this can also get called on
  10545. * other objects so just return '' if we're given something other than a
  10546. * DOM node (such as window).
  10547. *
  10548. * @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
  10549. * @return {string} ID of the supplied `domNode`.
  10550. */
  10551. function getID(node) {
  10552. var id = internalGetID(node);
  10553. if (id) {
  10554. if (nodeCache.hasOwnProperty(id)) {
  10555. var cached = nodeCache[id];
  10556. if (cached !== node) {
  10557. ("production" !== "development" ? invariant(
  10558. !isValid(cached, id),
  10559. 'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
  10560. ATTR_NAME, id
  10561. ) : invariant(!isValid(cached, id)));
  10562. nodeCache[id] = node;
  10563. }
  10564. } else {
  10565. nodeCache[id] = node;
  10566. }
  10567. }
  10568. return id;
  10569. }
  10570. function internalGetID(node) {
  10571. // If node is something like a window, document, or text node, none of
  10572. // which support attributes or a .getAttribute method, gracefully return
  10573. // the empty string, as if the attribute were missing.
  10574. return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
  10575. }
  10576. /**
  10577. * Sets the React-specific ID of the given node.
  10578. *
  10579. * @param {DOMElement} node The DOM node whose ID will be set.
  10580. * @param {string} id The value of the ID attribute.
  10581. */
  10582. function setID(node, id) {
  10583. var oldID = internalGetID(node);
  10584. if (oldID !== id) {
  10585. delete nodeCache[oldID];
  10586. }
  10587. node.setAttribute(ATTR_NAME, id);
  10588. nodeCache[id] = node;
  10589. }
  10590. /**
  10591. * Finds the node with the supplied React-generated DOM ID.
  10592. *
  10593. * @param {string} id A React-generated DOM ID.
  10594. * @return {DOMElement} DOM node with the suppled `id`.
  10595. * @internal
  10596. */
  10597. function getNode(id) {
  10598. if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
  10599. nodeCache[id] = ReactMount.findReactNodeByID(id);
  10600. }
  10601. return nodeCache[id];
  10602. }
  10603. /**
  10604. * Finds the node with the supplied public React instance.
  10605. *
  10606. * @param {*} instance A public React instance.
  10607. * @return {?DOMElement} DOM node with the suppled `id`.
  10608. * @internal
  10609. */
  10610. function getNodeFromInstance(instance) {
  10611. var id = ReactInstanceMap.get(instance)._rootNodeID;
  10612. if (ReactEmptyComponent.isNullComponentID(id)) {
  10613. return null;
  10614. }
  10615. if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
  10616. nodeCache[id] = ReactMount.findReactNodeByID(id);
  10617. }
  10618. return nodeCache[id];
  10619. }
  10620. /**
  10621. * A node is "valid" if it is contained by a currently mounted container.
  10622. *
  10623. * This means that the node does not have to be contained by a document in
  10624. * order to be considered valid.
  10625. *
  10626. * @param {?DOMElement} node The candidate DOM node.
  10627. * @param {string} id The expected ID of the node.
  10628. * @return {boolean} Whether the node is contained by a mounted container.
  10629. */
  10630. function isValid(node, id) {
  10631. if (node) {
  10632. ("production" !== "development" ? invariant(
  10633. internalGetID(node) === id,
  10634. 'ReactMount: Unexpected modification of `%s`',
  10635. ATTR_NAME
  10636. ) : invariant(internalGetID(node) === id));
  10637. var container = ReactMount.findReactContainerForID(id);
  10638. if (container && containsNode(container, node)) {
  10639. return true;
  10640. }
  10641. }
  10642. return false;
  10643. }
  10644. /**
  10645. * Causes the cache to forget about one React-specific ID.
  10646. *
  10647. * @param {string} id The ID to forget.
  10648. */
  10649. function purgeID(id) {
  10650. delete nodeCache[id];
  10651. }
  10652. var deepestNodeSoFar = null;
  10653. function findDeepestCachedAncestorImpl(ancestorID) {
  10654. var ancestor = nodeCache[ancestorID];
  10655. if (ancestor && isValid(ancestor, ancestorID)) {
  10656. deepestNodeSoFar = ancestor;
  10657. } else {
  10658. // This node isn't populated in the cache, so presumably none of its
  10659. // descendants are. Break out of the loop.
  10660. return false;
  10661. }
  10662. }
  10663. /**
  10664. * Return the deepest cached node whose ID is a prefix of `targetID`.
  10665. */
  10666. function findDeepestCachedAncestor(targetID) {
  10667. deepestNodeSoFar = null;
  10668. ReactInstanceHandles.traverseAncestors(
  10669. targetID,
  10670. findDeepestCachedAncestorImpl
  10671. );
  10672. var foundNode = deepestNodeSoFar;
  10673. deepestNodeSoFar = null;
  10674. return foundNode;
  10675. }
  10676. /**
  10677. * Mounts this component and inserts it into the DOM.
  10678. *
  10679. * @param {ReactComponent} componentInstance The instance to mount.
  10680. * @param {string} rootID DOM ID of the root node.
  10681. * @param {DOMElement} container DOM element to mount into.
  10682. * @param {ReactReconcileTransaction} transaction
  10683. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  10684. */
  10685. function mountComponentIntoNode(
  10686. componentInstance,
  10687. rootID,
  10688. container,
  10689. transaction,
  10690. shouldReuseMarkup) {
  10691. var markup = ReactReconciler.mountComponent(
  10692. componentInstance, rootID, transaction, emptyObject
  10693. );
  10694. componentInstance._isTopLevel = true;
  10695. ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
  10696. }
  10697. /**
  10698. * Batched mount.
  10699. *
  10700. * @param {ReactComponent} componentInstance The instance to mount.
  10701. * @param {string} rootID DOM ID of the root node.
  10702. * @param {DOMElement} container DOM element to mount into.
  10703. * @param {boolean} shouldReuseMarkup If true, do not insert markup
  10704. */
  10705. function batchedMountComponentIntoNode(
  10706. componentInstance,
  10707. rootID,
  10708. container,
  10709. shouldReuseMarkup) {
  10710. var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
  10711. transaction.perform(
  10712. mountComponentIntoNode,
  10713. null,
  10714. componentInstance,
  10715. rootID,
  10716. container,
  10717. transaction,
  10718. shouldReuseMarkup
  10719. );
  10720. ReactUpdates.ReactReconcileTransaction.release(transaction);
  10721. }
  10722. /**
  10723. * Mounting is the process of initializing a React component by creating its
  10724. * representative DOM elements and inserting them into a supplied `container`.
  10725. * Any prior content inside `container` is destroyed in the process.
  10726. *
  10727. * ReactMount.render(
  10728. * component,
  10729. * document.getElementById('container')
  10730. * );
  10731. *
  10732. * <div id="container"> <-- Supplied `container`.
  10733. * <div data-reactid=".3"> <-- Rendered reactRoot of React
  10734. * // ... component.
  10735. * </div>
  10736. * </div>
  10737. *
  10738. * Inside of `container`, the first element rendered is the "reactRoot".
  10739. */
  10740. var ReactMount = {
  10741. /** Exposed for debugging purposes **/
  10742. _instancesByReactRootID: instancesByReactRootID,
  10743. /**
  10744. * This is a hook provided to support rendering React components while
  10745. * ensuring that the apparent scroll position of its `container` does not
  10746. * change.
  10747. *
  10748. * @param {DOMElement} container The `container` being rendered into.
  10749. * @param {function} renderCallback This must be called once to do the render.
  10750. */
  10751. scrollMonitor: function(container, renderCallback) {
  10752. renderCallback();
  10753. },
  10754. /**
  10755. * Take a component that's already mounted into the DOM and replace its props
  10756. * @param {ReactComponent} prevComponent component instance already in the DOM
  10757. * @param {ReactElement} nextElement component instance to render
  10758. * @param {DOMElement} container container to render into
  10759. * @param {?function} callback function triggered on completion
  10760. */
  10761. _updateRootComponent: function(
  10762. prevComponent,
  10763. nextElement,
  10764. container,
  10765. callback) {
  10766. if ("production" !== "development") {
  10767. ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
  10768. }
  10769. ReactMount.scrollMonitor(container, function() {
  10770. ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
  10771. if (callback) {
  10772. ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
  10773. }
  10774. });
  10775. if ("production" !== "development") {
  10776. // Record the root element in case it later gets transplanted.
  10777. rootElementsByReactRootID[getReactRootID(container)] =
  10778. getReactRootElementInContainer(container);
  10779. }
  10780. return prevComponent;
  10781. },
  10782. /**
  10783. * Register a component into the instance map and starts scroll value
  10784. * monitoring
  10785. * @param {ReactComponent} nextComponent component instance to render
  10786. * @param {DOMElement} container container to render into
  10787. * @return {string} reactRoot ID prefix
  10788. */
  10789. _registerComponent: function(nextComponent, container) {
  10790. ("production" !== "development" ? invariant(
  10791. container && (
  10792. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  10793. ),
  10794. '_registerComponent(...): Target container is not a DOM element.'
  10795. ) : invariant(container && (
  10796. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  10797. )));
  10798. ReactBrowserEventEmitter.ensureScrollValueMonitoring();
  10799. var reactRootID = ReactMount.registerContainer(container);
  10800. instancesByReactRootID[reactRootID] = nextComponent;
  10801. return reactRootID;
  10802. },
  10803. /**
  10804. * Render a new component into the DOM.
  10805. * @param {ReactElement} nextElement element to render
  10806. * @param {DOMElement} container container to render into
  10807. * @param {boolean} shouldReuseMarkup if we should skip the markup insertion
  10808. * @return {ReactComponent} nextComponent
  10809. */
  10810. _renderNewRootComponent: function(
  10811. nextElement,
  10812. container,
  10813. shouldReuseMarkup
  10814. ) {
  10815. // Various parts of our code (such as ReactCompositeComponent's
  10816. // _renderValidatedComponent) assume that calls to render aren't nested;
  10817. // verify that that's the case.
  10818. ("production" !== "development" ? warning(
  10819. ReactCurrentOwner.current == null,
  10820. '_renderNewRootComponent(): Render methods should be a pure function ' +
  10821. 'of props and state; triggering nested component updates from ' +
  10822. 'render is not allowed. If necessary, trigger nested updates in ' +
  10823. 'componentDidUpdate.'
  10824. ) : null);
  10825. var componentInstance = instantiateReactComponent(nextElement, null);
  10826. var reactRootID = ReactMount._registerComponent(
  10827. componentInstance,
  10828. container
  10829. );
  10830. // The initial render is synchronous but any updates that happen during
  10831. // rendering, in componentWillMount or componentDidMount, will be batched
  10832. // according to the current batching strategy.
  10833. ReactUpdates.batchedUpdates(
  10834. batchedMountComponentIntoNode,
  10835. componentInstance,
  10836. reactRootID,
  10837. container,
  10838. shouldReuseMarkup
  10839. );
  10840. if ("production" !== "development") {
  10841. // Record the root element in case it later gets transplanted.
  10842. rootElementsByReactRootID[reactRootID] =
  10843. getReactRootElementInContainer(container);
  10844. }
  10845. return componentInstance;
  10846. },
  10847. /**
  10848. * Renders a React component into the DOM in the supplied `container`.
  10849. *
  10850. * If the React component was previously rendered into `container`, this will
  10851. * perform an update on it and only mutate the DOM as necessary to reflect the
  10852. * latest React component.
  10853. *
  10854. * @param {ReactElement} nextElement Component element to render.
  10855. * @param {DOMElement} container DOM element to render into.
  10856. * @param {?function} callback function triggered on completion
  10857. * @return {ReactComponent} Component instance rendered in `container`.
  10858. */
  10859. render: function(nextElement, container, callback) {
  10860. ("production" !== "development" ? invariant(
  10861. ReactElement.isValidElement(nextElement),
  10862. 'React.render(): Invalid component element.%s',
  10863. (
  10864. typeof nextElement === 'string' ?
  10865. ' Instead of passing an element string, make sure to instantiate ' +
  10866. 'it by passing it to React.createElement.' :
  10867. typeof nextElement === 'function' ?
  10868. ' Instead of passing a component class, make sure to instantiate ' +
  10869. 'it by passing it to React.createElement.' :
  10870. // Check if it quacks like an element
  10871. nextElement != null && nextElement.props !== undefined ?
  10872. ' This may be caused by unintentionally loading two independent ' +
  10873. 'copies of React.' :
  10874. ''
  10875. )
  10876. ) : invariant(ReactElement.isValidElement(nextElement)));
  10877. var prevComponent = instancesByReactRootID[getReactRootID(container)];
  10878. if (prevComponent) {
  10879. var prevElement = prevComponent._currentElement;
  10880. if (shouldUpdateReactComponent(prevElement, nextElement)) {
  10881. return ReactMount._updateRootComponent(
  10882. prevComponent,
  10883. nextElement,
  10884. container,
  10885. callback
  10886. ).getPublicInstance();
  10887. } else {
  10888. ReactMount.unmountComponentAtNode(container);
  10889. }
  10890. }
  10891. var reactRootElement = getReactRootElementInContainer(container);
  10892. var containerHasReactMarkup =
  10893. reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
  10894. if ("production" !== "development") {
  10895. if (!containerHasReactMarkup || reactRootElement.nextSibling) {
  10896. var rootElementSibling = reactRootElement;
  10897. while (rootElementSibling) {
  10898. if (ReactMount.isRenderedByReact(rootElementSibling)) {
  10899. ("production" !== "development" ? warning(
  10900. false,
  10901. 'render(): Target node has markup rendered by React, but there ' +
  10902. 'are unrelated nodes as well. This is most commonly caused by ' +
  10903. 'white-space inserted around server-rendered markup.'
  10904. ) : null);
  10905. break;
  10906. }
  10907. rootElementSibling = rootElementSibling.nextSibling;
  10908. }
  10909. }
  10910. }
  10911. var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
  10912. var component = ReactMount._renderNewRootComponent(
  10913. nextElement,
  10914. container,
  10915. shouldReuseMarkup
  10916. ).getPublicInstance();
  10917. if (callback) {
  10918. callback.call(component);
  10919. }
  10920. return component;
  10921. },
  10922. /**
  10923. * Constructs a component instance of `constructor` with `initialProps` and
  10924. * renders it into the supplied `container`.
  10925. *
  10926. * @param {function} constructor React component constructor.
  10927. * @param {?object} props Initial props of the component instance.
  10928. * @param {DOMElement} container DOM element to render into.
  10929. * @return {ReactComponent} Component instance rendered in `container`.
  10930. */
  10931. constructAndRenderComponent: function(constructor, props, container) {
  10932. var element = ReactElement.createElement(constructor, props);
  10933. return ReactMount.render(element, container);
  10934. },
  10935. /**
  10936. * Constructs a component instance of `constructor` with `initialProps` and
  10937. * renders it into a container node identified by supplied `id`.
  10938. *
  10939. * @param {function} componentConstructor React component constructor
  10940. * @param {?object} props Initial props of the component instance.
  10941. * @param {string} id ID of the DOM element to render into.
  10942. * @return {ReactComponent} Component instance rendered in the container node.
  10943. */
  10944. constructAndRenderComponentByID: function(constructor, props, id) {
  10945. var domNode = document.getElementById(id);
  10946. ("production" !== "development" ? invariant(
  10947. domNode,
  10948. 'Tried to get element with id of "%s" but it is not present on the page.',
  10949. id
  10950. ) : invariant(domNode));
  10951. return ReactMount.constructAndRenderComponent(constructor, props, domNode);
  10952. },
  10953. /**
  10954. * Registers a container node into which React components will be rendered.
  10955. * This also creates the "reactRoot" ID that will be assigned to the element
  10956. * rendered within.
  10957. *
  10958. * @param {DOMElement} container DOM element to register as a container.
  10959. * @return {string} The "reactRoot" ID of elements rendered within.
  10960. */
  10961. registerContainer: function(container) {
  10962. var reactRootID = getReactRootID(container);
  10963. if (reactRootID) {
  10964. // If one exists, make sure it is a valid "reactRoot" ID.
  10965. reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
  10966. }
  10967. if (!reactRootID) {
  10968. // No valid "reactRoot" ID found, create one.
  10969. reactRootID = ReactInstanceHandles.createReactRootID();
  10970. }
  10971. containersByReactRootID[reactRootID] = container;
  10972. return reactRootID;
  10973. },
  10974. /**
  10975. * Unmounts and destroys the React component rendered in the `container`.
  10976. *
  10977. * @param {DOMElement} container DOM element containing a React component.
  10978. * @return {boolean} True if a component was found in and unmounted from
  10979. * `container`
  10980. */
  10981. unmountComponentAtNode: function(container) {
  10982. // Various parts of our code (such as ReactCompositeComponent's
  10983. // _renderValidatedComponent) assume that calls to render aren't nested;
  10984. // verify that that's the case. (Strictly speaking, unmounting won't cause a
  10985. // render but we still don't expect to be in a render call here.)
  10986. ("production" !== "development" ? warning(
  10987. ReactCurrentOwner.current == null,
  10988. 'unmountComponentAtNode(): Render methods should be a pure function of ' +
  10989. 'props and state; triggering nested component updates from render is ' +
  10990. 'not allowed. If necessary, trigger nested updates in ' +
  10991. 'componentDidUpdate.'
  10992. ) : null);
  10993. ("production" !== "development" ? invariant(
  10994. container && (
  10995. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  10996. ),
  10997. 'unmountComponentAtNode(...): Target container is not a DOM element.'
  10998. ) : invariant(container && (
  10999. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11000. )));
  11001. var reactRootID = getReactRootID(container);
  11002. var component = instancesByReactRootID[reactRootID];
  11003. if (!component) {
  11004. return false;
  11005. }
  11006. ReactMount.unmountComponentFromNode(component, container);
  11007. delete instancesByReactRootID[reactRootID];
  11008. delete containersByReactRootID[reactRootID];
  11009. if ("production" !== "development") {
  11010. delete rootElementsByReactRootID[reactRootID];
  11011. }
  11012. return true;
  11013. },
  11014. /**
  11015. * Unmounts a component and removes it from the DOM.
  11016. *
  11017. * @param {ReactComponent} instance React component instance.
  11018. * @param {DOMElement} container DOM element to unmount from.
  11019. * @final
  11020. * @internal
  11021. * @see {ReactMount.unmountComponentAtNode}
  11022. */
  11023. unmountComponentFromNode: function(instance, container) {
  11024. ReactReconciler.unmountComponent(instance);
  11025. if (container.nodeType === DOC_NODE_TYPE) {
  11026. container = container.documentElement;
  11027. }
  11028. // http://jsperf.com/emptying-a-node
  11029. while (container.lastChild) {
  11030. container.removeChild(container.lastChild);
  11031. }
  11032. },
  11033. /**
  11034. * Finds the container DOM element that contains React component to which the
  11035. * supplied DOM `id` belongs.
  11036. *
  11037. * @param {string} id The ID of an element rendered by a React component.
  11038. * @return {?DOMElement} DOM element that contains the `id`.
  11039. */
  11040. findReactContainerForID: function(id) {
  11041. var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
  11042. var container = containersByReactRootID[reactRootID];
  11043. if ("production" !== "development") {
  11044. var rootElement = rootElementsByReactRootID[reactRootID];
  11045. if (rootElement && rootElement.parentNode !== container) {
  11046. ("production" !== "development" ? invariant(
  11047. // Call internalGetID here because getID calls isValid which calls
  11048. // findReactContainerForID (this function).
  11049. internalGetID(rootElement) === reactRootID,
  11050. 'ReactMount: Root element ID differed from reactRootID.'
  11051. ) : invariant(// Call internalGetID here because getID calls isValid which calls
  11052. // findReactContainerForID (this function).
  11053. internalGetID(rootElement) === reactRootID));
  11054. var containerChild = container.firstChild;
  11055. if (containerChild &&
  11056. reactRootID === internalGetID(containerChild)) {
  11057. // If the container has a new child with the same ID as the old
  11058. // root element, then rootElementsByReactRootID[reactRootID] is
  11059. // just stale and needs to be updated. The case that deserves a
  11060. // warning is when the container is empty.
  11061. rootElementsByReactRootID[reactRootID] = containerChild;
  11062. } else {
  11063. ("production" !== "development" ? warning(
  11064. false,
  11065. 'ReactMount: Root element has been removed from its original ' +
  11066. 'container. New container:', rootElement.parentNode
  11067. ) : null);
  11068. }
  11069. }
  11070. }
  11071. return container;
  11072. },
  11073. /**
  11074. * Finds an element rendered by React with the supplied ID.
  11075. *
  11076. * @param {string} id ID of a DOM node in the React component.
  11077. * @return {DOMElement} Root DOM node of the React component.
  11078. */
  11079. findReactNodeByID: function(id) {
  11080. var reactRoot = ReactMount.findReactContainerForID(id);
  11081. return ReactMount.findComponentRoot(reactRoot, id);
  11082. },
  11083. /**
  11084. * True if the supplied `node` is rendered by React.
  11085. *
  11086. * @param {*} node DOM Element to check.
  11087. * @return {boolean} True if the DOM Element appears to be rendered by React.
  11088. * @internal
  11089. */
  11090. isRenderedByReact: function(node) {
  11091. if (node.nodeType !== 1) {
  11092. // Not a DOMElement, therefore not a React component
  11093. return false;
  11094. }
  11095. var id = ReactMount.getID(node);
  11096. return id ? id.charAt(0) === SEPARATOR : false;
  11097. },
  11098. /**
  11099. * Traverses up the ancestors of the supplied node to find a node that is a
  11100. * DOM representation of a React component.
  11101. *
  11102. * @param {*} node
  11103. * @return {?DOMEventTarget}
  11104. * @internal
  11105. */
  11106. getFirstReactDOM: function(node) {
  11107. var current = node;
  11108. while (current && current.parentNode !== current) {
  11109. if (ReactMount.isRenderedByReact(current)) {
  11110. return current;
  11111. }
  11112. current = current.parentNode;
  11113. }
  11114. return null;
  11115. },
  11116. /**
  11117. * Finds a node with the supplied `targetID` inside of the supplied
  11118. * `ancestorNode`. Exploits the ID naming scheme to perform the search
  11119. * quickly.
  11120. *
  11121. * @param {DOMEventTarget} ancestorNode Search from this root.
  11122. * @pararm {string} targetID ID of the DOM representation of the component.
  11123. * @return {DOMEventTarget} DOM node with the supplied `targetID`.
  11124. * @internal
  11125. */
  11126. findComponentRoot: function(ancestorNode, targetID) {
  11127. var firstChildren = findComponentRootReusableArray;
  11128. var childIndex = 0;
  11129. var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
  11130. firstChildren[0] = deepestAncestor.firstChild;
  11131. firstChildren.length = 1;
  11132. while (childIndex < firstChildren.length) {
  11133. var child = firstChildren[childIndex++];
  11134. var targetChild;
  11135. while (child) {
  11136. var childID = ReactMount.getID(child);
  11137. if (childID) {
  11138. // Even if we find the node we're looking for, we finish looping
  11139. // through its siblings to ensure they're cached so that we don't have
  11140. // to revisit this node again. Otherwise, we make n^2 calls to getID
  11141. // when visiting the many children of a single node in order.
  11142. if (targetID === childID) {
  11143. targetChild = child;
  11144. } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
  11145. // If we find a child whose ID is an ancestor of the given ID,
  11146. // then we can be sure that we only want to search the subtree
  11147. // rooted at this child, so we can throw out the rest of the
  11148. // search state.
  11149. firstChildren.length = childIndex = 0;
  11150. firstChildren.push(child.firstChild);
  11151. }
  11152. } else {
  11153. // If this child had no ID, then there's a chance that it was
  11154. // injected automatically by the browser, as when a `<table>`
  11155. // element sprouts an extra `<tbody>` child as a side effect of
  11156. // `.innerHTML` parsing. Optimistically continue down this
  11157. // branch, but not before examining the other siblings.
  11158. firstChildren.push(child.firstChild);
  11159. }
  11160. child = child.nextSibling;
  11161. }
  11162. if (targetChild) {
  11163. // Emptying firstChildren/findComponentRootReusableArray is
  11164. // not necessary for correctness, but it helps the GC reclaim
  11165. // any nodes that were left at the end of the search.
  11166. firstChildren.length = 0;
  11167. return targetChild;
  11168. }
  11169. }
  11170. firstChildren.length = 0;
  11171. ("production" !== "development" ? invariant(
  11172. false,
  11173. 'findComponentRoot(..., %s): Unable to find element. This probably ' +
  11174. 'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
  11175. 'usually due to forgetting a <tbody> when using tables, nesting tags ' +
  11176. 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
  11177. 'parent. ' +
  11178. 'Try inspecting the child nodes of the element with React ID `%s`.',
  11179. targetID,
  11180. ReactMount.getID(ancestorNode)
  11181. ) : invariant(false));
  11182. },
  11183. _mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
  11184. ("production" !== "development" ? invariant(
  11185. container && (
  11186. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11187. ),
  11188. 'mountComponentIntoNode(...): Target container is not valid.'
  11189. ) : invariant(container && (
  11190. (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
  11191. )));
  11192. if (shouldReuseMarkup) {
  11193. var rootElement = getReactRootElementInContainer(container);
  11194. if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
  11195. return;
  11196. } else {
  11197. var checksum = rootElement.getAttribute(
  11198. ReactMarkupChecksum.CHECKSUM_ATTR_NAME
  11199. );
  11200. rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
  11201. var rootMarkup = rootElement.outerHTML;
  11202. rootElement.setAttribute(
  11203. ReactMarkupChecksum.CHECKSUM_ATTR_NAME,
  11204. checksum
  11205. );
  11206. var diffIndex = firstDifferenceIndex(markup, rootMarkup);
  11207. var difference = ' (client) ' +
  11208. markup.substring(diffIndex - 20, diffIndex + 20) +
  11209. '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
  11210. ("production" !== "development" ? invariant(
  11211. container.nodeType !== DOC_NODE_TYPE,
  11212. 'You\'re trying to render a component to the document using ' +
  11213. 'server rendering but the checksum was invalid. This usually ' +
  11214. 'means you rendered a different component type or props on ' +
  11215. 'the client from the one on the server, or your render() ' +
  11216. 'methods are impure. React cannot handle this case due to ' +
  11217. 'cross-browser quirks by rendering at the document root. You ' +
  11218. 'should look for environment dependent code in your components ' +
  11219. 'and ensure the props are the same client and server side:\n%s',
  11220. difference
  11221. ) : invariant(container.nodeType !== DOC_NODE_TYPE));
  11222. if ("production" !== "development") {
  11223. ("production" !== "development" ? warning(
  11224. false,
  11225. 'React attempted to reuse markup in a container but the ' +
  11226. 'checksum was invalid. This generally means that you are ' +
  11227. 'using server rendering and the markup generated on the ' +
  11228. 'server was not what the client was expecting. React injected ' +
  11229. 'new markup to compensate which works but you have lost many ' +
  11230. 'of the benefits of server rendering. Instead, figure out ' +
  11231. 'why the markup being generated is different on the client ' +
  11232. 'or server:\n%s',
  11233. difference
  11234. ) : null);
  11235. }
  11236. }
  11237. }
  11238. ("production" !== "development" ? invariant(
  11239. container.nodeType !== DOC_NODE_TYPE,
  11240. 'You\'re trying to render a component to the document but ' +
  11241. 'you didn\'t use server rendering. We can\'t do this ' +
  11242. 'without using server rendering due to cross-browser quirks. ' +
  11243. 'See React.renderToString() for server rendering.'
  11244. ) : invariant(container.nodeType !== DOC_NODE_TYPE));
  11245. setInnerHTML(container, markup);
  11246. },
  11247. /**
  11248. * React ID utilities.
  11249. */
  11250. getReactRootID: getReactRootID,
  11251. getID: getID,
  11252. setID: setID,
  11253. getNode: getNode,
  11254. getNodeFromInstance: getNodeFromInstance,
  11255. purgeID: purgeID
  11256. };
  11257. ReactPerf.measureMethods(ReactMount, 'ReactMount', {
  11258. _renderNewRootComponent: '_renderNewRootComponent',
  11259. _mountImageIntoNode: '_mountImageIntoNode'
  11260. });
  11261. module.exports = ReactMount;
  11262. },{"10":10,"109":109,"115":115,"129":129,"134":134,"135":135,"148":148,"151":151,"154":154,"30":30,"39":39,"57":57,"58":58,"59":59,"66":66,"67":67,"69":69,"75":75,"81":81,"86":86,"87":87}],71:[function(_dereq_,module,exports){
  11263. /**
  11264. * Copyright 2013-2015, Facebook, Inc.
  11265. * All rights reserved.
  11266. *
  11267. * This source code is licensed under the BSD-style license found in the
  11268. * LICENSE file in the root directory of this source tree. An additional grant
  11269. * of patent rights can be found in the PATENTS file in the same directory.
  11270. *
  11271. * @providesModule ReactMultiChild
  11272. * @typechecks static-only
  11273. */
  11274. 'use strict';
  11275. var ReactComponentEnvironment = _dereq_(36);
  11276. var ReactMultiChildUpdateTypes = _dereq_(72);
  11277. var ReactReconciler = _dereq_(81);
  11278. var ReactChildReconciler = _dereq_(31);
  11279. /**
  11280. * Updating children of a component may trigger recursive updates. The depth is
  11281. * used to batch recursive updates to render markup more efficiently.
  11282. *
  11283. * @type {number}
  11284. * @private
  11285. */
  11286. var updateDepth = 0;
  11287. /**
  11288. * Queue of update configuration objects.
  11289. *
  11290. * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
  11291. *
  11292. * @type {array<object>}
  11293. * @private
  11294. */
  11295. var updateQueue = [];
  11296. /**
  11297. * Queue of markup to be rendered.
  11298. *
  11299. * @type {array<string>}
  11300. * @private
  11301. */
  11302. var markupQueue = [];
  11303. /**
  11304. * Enqueues markup to be rendered and inserted at a supplied index.
  11305. *
  11306. * @param {string} parentID ID of the parent component.
  11307. * @param {string} markup Markup that renders into an element.
  11308. * @param {number} toIndex Destination index.
  11309. * @private
  11310. */
  11311. function enqueueMarkup(parentID, markup, toIndex) {
  11312. // NOTE: Null values reduce hidden classes.
  11313. updateQueue.push({
  11314. parentID: parentID,
  11315. parentNode: null,
  11316. type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
  11317. markupIndex: markupQueue.push(markup) - 1,
  11318. textContent: null,
  11319. fromIndex: null,
  11320. toIndex: toIndex
  11321. });
  11322. }
  11323. /**
  11324. * Enqueues moving an existing element to another index.
  11325. *
  11326. * @param {string} parentID ID of the parent component.
  11327. * @param {number} fromIndex Source index of the existing element.
  11328. * @param {number} toIndex Destination index of the element.
  11329. * @private
  11330. */
  11331. function enqueueMove(parentID, fromIndex, toIndex) {
  11332. // NOTE: Null values reduce hidden classes.
  11333. updateQueue.push({
  11334. parentID: parentID,
  11335. parentNode: null,
  11336. type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
  11337. markupIndex: null,
  11338. textContent: null,
  11339. fromIndex: fromIndex,
  11340. toIndex: toIndex
  11341. });
  11342. }
  11343. /**
  11344. * Enqueues removing an element at an index.
  11345. *
  11346. * @param {string} parentID ID of the parent component.
  11347. * @param {number} fromIndex Index of the element to remove.
  11348. * @private
  11349. */
  11350. function enqueueRemove(parentID, fromIndex) {
  11351. // NOTE: Null values reduce hidden classes.
  11352. updateQueue.push({
  11353. parentID: parentID,
  11354. parentNode: null,
  11355. type: ReactMultiChildUpdateTypes.REMOVE_NODE,
  11356. markupIndex: null,
  11357. textContent: null,
  11358. fromIndex: fromIndex,
  11359. toIndex: null
  11360. });
  11361. }
  11362. /**
  11363. * Enqueues setting the text content.
  11364. *
  11365. * @param {string} parentID ID of the parent component.
  11366. * @param {string} textContent Text content to set.
  11367. * @private
  11368. */
  11369. function enqueueTextContent(parentID, textContent) {
  11370. // NOTE: Null values reduce hidden classes.
  11371. updateQueue.push({
  11372. parentID: parentID,
  11373. parentNode: null,
  11374. type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
  11375. markupIndex: null,
  11376. textContent: textContent,
  11377. fromIndex: null,
  11378. toIndex: null
  11379. });
  11380. }
  11381. /**
  11382. * Processes any enqueued updates.
  11383. *
  11384. * @private
  11385. */
  11386. function processQueue() {
  11387. if (updateQueue.length) {
  11388. ReactComponentEnvironment.processChildrenUpdates(
  11389. updateQueue,
  11390. markupQueue
  11391. );
  11392. clearQueue();
  11393. }
  11394. }
  11395. /**
  11396. * Clears any enqueued updates.
  11397. *
  11398. * @private
  11399. */
  11400. function clearQueue() {
  11401. updateQueue.length = 0;
  11402. markupQueue.length = 0;
  11403. }
  11404. /**
  11405. * ReactMultiChild are capable of reconciling multiple children.
  11406. *
  11407. * @class ReactMultiChild
  11408. * @internal
  11409. */
  11410. var ReactMultiChild = {
  11411. /**
  11412. * Provides common functionality for components that must reconcile multiple
  11413. * children. This is used by `ReactDOMComponent` to mount, update, and
  11414. * unmount child components.
  11415. *
  11416. * @lends {ReactMultiChild.prototype}
  11417. */
  11418. Mixin: {
  11419. /**
  11420. * Generates a "mount image" for each of the supplied children. In the case
  11421. * of `ReactDOMComponent`, a mount image is a string of markup.
  11422. *
  11423. * @param {?object} nestedChildren Nested child maps.
  11424. * @return {array} An array of mounted representations.
  11425. * @internal
  11426. */
  11427. mountChildren: function(nestedChildren, transaction, context) {
  11428. var children = ReactChildReconciler.instantiateChildren(
  11429. nestedChildren, transaction, context
  11430. );
  11431. this._renderedChildren = children;
  11432. var mountImages = [];
  11433. var index = 0;
  11434. for (var name in children) {
  11435. if (children.hasOwnProperty(name)) {
  11436. var child = children[name];
  11437. // Inlined for performance, see `ReactInstanceHandles.createReactID`.
  11438. var rootID = this._rootNodeID + name;
  11439. var mountImage = ReactReconciler.mountComponent(
  11440. child,
  11441. rootID,
  11442. transaction,
  11443. context
  11444. );
  11445. child._mountIndex = index;
  11446. mountImages.push(mountImage);
  11447. index++;
  11448. }
  11449. }
  11450. return mountImages;
  11451. },
  11452. /**
  11453. * Replaces any rendered children with a text content string.
  11454. *
  11455. * @param {string} nextContent String of content.
  11456. * @internal
  11457. */
  11458. updateTextContent: function(nextContent) {
  11459. updateDepth++;
  11460. var errorThrown = true;
  11461. try {
  11462. var prevChildren = this._renderedChildren;
  11463. // Remove any rendered children.
  11464. ReactChildReconciler.unmountChildren(prevChildren);
  11465. // TODO: The setTextContent operation should be enough
  11466. for (var name in prevChildren) {
  11467. if (prevChildren.hasOwnProperty(name)) {
  11468. this._unmountChildByName(prevChildren[name], name);
  11469. }
  11470. }
  11471. // Set new text content.
  11472. this.setTextContent(nextContent);
  11473. errorThrown = false;
  11474. } finally {
  11475. updateDepth--;
  11476. if (!updateDepth) {
  11477. if (errorThrown) {
  11478. clearQueue();
  11479. } else {
  11480. processQueue();
  11481. }
  11482. }
  11483. }
  11484. },
  11485. /**
  11486. * Updates the rendered children with new children.
  11487. *
  11488. * @param {?object} nextNestedChildren Nested child maps.
  11489. * @param {ReactReconcileTransaction} transaction
  11490. * @internal
  11491. */
  11492. updateChildren: function(nextNestedChildren, transaction, context) {
  11493. updateDepth++;
  11494. var errorThrown = true;
  11495. try {
  11496. this._updateChildren(nextNestedChildren, transaction, context);
  11497. errorThrown = false;
  11498. } finally {
  11499. updateDepth--;
  11500. if (!updateDepth) {
  11501. if (errorThrown) {
  11502. clearQueue();
  11503. } else {
  11504. processQueue();
  11505. }
  11506. }
  11507. }
  11508. },
  11509. /**
  11510. * Improve performance by isolating this hot code path from the try/catch
  11511. * block in `updateChildren`.
  11512. *
  11513. * @param {?object} nextNestedChildren Nested child maps.
  11514. * @param {ReactReconcileTransaction} transaction
  11515. * @final
  11516. * @protected
  11517. */
  11518. _updateChildren: function(nextNestedChildren, transaction, context) {
  11519. var prevChildren = this._renderedChildren;
  11520. var nextChildren = ReactChildReconciler.updateChildren(
  11521. prevChildren, nextNestedChildren, transaction, context
  11522. );
  11523. this._renderedChildren = nextChildren;
  11524. if (!nextChildren && !prevChildren) {
  11525. return;
  11526. }
  11527. var name;
  11528. // `nextIndex` will increment for each child in `nextChildren`, but
  11529. // `lastIndex` will be the last index visited in `prevChildren`.
  11530. var lastIndex = 0;
  11531. var nextIndex = 0;
  11532. for (name in nextChildren) {
  11533. if (!nextChildren.hasOwnProperty(name)) {
  11534. continue;
  11535. }
  11536. var prevChild = prevChildren && prevChildren[name];
  11537. var nextChild = nextChildren[name];
  11538. if (prevChild === nextChild) {
  11539. this.moveChild(prevChild, nextIndex, lastIndex);
  11540. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  11541. prevChild._mountIndex = nextIndex;
  11542. } else {
  11543. if (prevChild) {
  11544. // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
  11545. lastIndex = Math.max(prevChild._mountIndex, lastIndex);
  11546. this._unmountChildByName(prevChild, name);
  11547. }
  11548. // The child must be instantiated before it's mounted.
  11549. this._mountChildByNameAtIndex(
  11550. nextChild, name, nextIndex, transaction, context
  11551. );
  11552. }
  11553. nextIndex++;
  11554. }
  11555. // Remove children that are no longer present.
  11556. for (name in prevChildren) {
  11557. if (prevChildren.hasOwnProperty(name) &&
  11558. !(nextChildren && nextChildren.hasOwnProperty(name))) {
  11559. this._unmountChildByName(prevChildren[name], name);
  11560. }
  11561. }
  11562. },
  11563. /**
  11564. * Unmounts all rendered children. This should be used to clean up children
  11565. * when this component is unmounted.
  11566. *
  11567. * @internal
  11568. */
  11569. unmountChildren: function() {
  11570. var renderedChildren = this._renderedChildren;
  11571. ReactChildReconciler.unmountChildren(renderedChildren);
  11572. this._renderedChildren = null;
  11573. },
  11574. /**
  11575. * Moves a child component to the supplied index.
  11576. *
  11577. * @param {ReactComponent} child Component to move.
  11578. * @param {number} toIndex Destination index of the element.
  11579. * @param {number} lastIndex Last index visited of the siblings of `child`.
  11580. * @protected
  11581. */
  11582. moveChild: function(child, toIndex, lastIndex) {
  11583. // If the index of `child` is less than `lastIndex`, then it needs to
  11584. // be moved. Otherwise, we do not need to move it because a child will be
  11585. // inserted or moved before `child`.
  11586. if (child._mountIndex < lastIndex) {
  11587. enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
  11588. }
  11589. },
  11590. /**
  11591. * Creates a child component.
  11592. *
  11593. * @param {ReactComponent} child Component to create.
  11594. * @param {string} mountImage Markup to insert.
  11595. * @protected
  11596. */
  11597. createChild: function(child, mountImage) {
  11598. enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
  11599. },
  11600. /**
  11601. * Removes a child component.
  11602. *
  11603. * @param {ReactComponent} child Child to remove.
  11604. * @protected
  11605. */
  11606. removeChild: function(child) {
  11607. enqueueRemove(this._rootNodeID, child._mountIndex);
  11608. },
  11609. /**
  11610. * Sets this text content string.
  11611. *
  11612. * @param {string} textContent Text content to set.
  11613. * @protected
  11614. */
  11615. setTextContent: function(textContent) {
  11616. enqueueTextContent(this._rootNodeID, textContent);
  11617. },
  11618. /**
  11619. * Mounts a child with the supplied name.
  11620. *
  11621. * NOTE: This is part of `updateChildren` and is here for readability.
  11622. *
  11623. * @param {ReactComponent} child Component to mount.
  11624. * @param {string} name Name of the child.
  11625. * @param {number} index Index at which to insert the child.
  11626. * @param {ReactReconcileTransaction} transaction
  11627. * @private
  11628. */
  11629. _mountChildByNameAtIndex: function(
  11630. child,
  11631. name,
  11632. index,
  11633. transaction,
  11634. context) {
  11635. // Inlined for performance, see `ReactInstanceHandles.createReactID`.
  11636. var rootID = this._rootNodeID + name;
  11637. var mountImage = ReactReconciler.mountComponent(
  11638. child,
  11639. rootID,
  11640. transaction,
  11641. context
  11642. );
  11643. child._mountIndex = index;
  11644. this.createChild(child, mountImage);
  11645. },
  11646. /**
  11647. * Unmounts a rendered child by name.
  11648. *
  11649. * NOTE: This is part of `updateChildren` and is here for readability.
  11650. *
  11651. * @param {ReactComponent} child Component to unmount.
  11652. * @param {string} name Name of the child in `this._renderedChildren`.
  11653. * @private
  11654. */
  11655. _unmountChildByName: function(child, name) {
  11656. this.removeChild(child);
  11657. child._mountIndex = null;
  11658. }
  11659. }
  11660. };
  11661. module.exports = ReactMultiChild;
  11662. },{"31":31,"36":36,"72":72,"81":81}],72:[function(_dereq_,module,exports){
  11663. /**
  11664. * Copyright 2013-2015, Facebook, Inc.
  11665. * All rights reserved.
  11666. *
  11667. * This source code is licensed under the BSD-style license found in the
  11668. * LICENSE file in the root directory of this source tree. An additional grant
  11669. * of patent rights can be found in the PATENTS file in the same directory.
  11670. *
  11671. * @providesModule ReactMultiChildUpdateTypes
  11672. */
  11673. 'use strict';
  11674. var keyMirror = _dereq_(140);
  11675. /**
  11676. * When a component's children are updated, a series of update configuration
  11677. * objects are created in order to batch and serialize the required changes.
  11678. *
  11679. * Enumerates all the possible types of update configurations.
  11680. *
  11681. * @internal
  11682. */
  11683. var ReactMultiChildUpdateTypes = keyMirror({
  11684. INSERT_MARKUP: null,
  11685. MOVE_EXISTING: null,
  11686. REMOVE_NODE: null,
  11687. TEXT_CONTENT: null
  11688. });
  11689. module.exports = ReactMultiChildUpdateTypes;
  11690. },{"140":140}],73:[function(_dereq_,module,exports){
  11691. /**
  11692. * Copyright 2014-2015, Facebook, Inc.
  11693. * All rights reserved.
  11694. *
  11695. * This source code is licensed under the BSD-style license found in the
  11696. * LICENSE file in the root directory of this source tree. An additional grant
  11697. * of patent rights can be found in the PATENTS file in the same directory.
  11698. *
  11699. * @providesModule ReactNativeComponent
  11700. */
  11701. 'use strict';
  11702. var assign = _dereq_(27);
  11703. var invariant = _dereq_(135);
  11704. var autoGenerateWrapperClass = null;
  11705. var genericComponentClass = null;
  11706. // This registry keeps track of wrapper classes around native tags
  11707. var tagToComponentClass = {};
  11708. var textComponentClass = null;
  11709. var ReactNativeComponentInjection = {
  11710. // This accepts a class that receives the tag string. This is a catch all
  11711. // that can render any kind of tag.
  11712. injectGenericComponentClass: function(componentClass) {
  11713. genericComponentClass = componentClass;
  11714. },
  11715. // This accepts a text component class that takes the text string to be
  11716. // rendered as props.
  11717. injectTextComponentClass: function(componentClass) {
  11718. textComponentClass = componentClass;
  11719. },
  11720. // This accepts a keyed object with classes as values. Each key represents a
  11721. // tag. That particular tag will use this class instead of the generic one.
  11722. injectComponentClasses: function(componentClasses) {
  11723. assign(tagToComponentClass, componentClasses);
  11724. },
  11725. // Temporary hack since we expect DOM refs to behave like composites,
  11726. // for this release.
  11727. injectAutoWrapper: function(wrapperFactory) {
  11728. autoGenerateWrapperClass = wrapperFactory;
  11729. }
  11730. };
  11731. /**
  11732. * Get a composite component wrapper class for a specific tag.
  11733. *
  11734. * @param {ReactElement} element The tag for which to get the class.
  11735. * @return {function} The React class constructor function.
  11736. */
  11737. function getComponentClassForElement(element) {
  11738. if (typeof element.type === 'function') {
  11739. return element.type;
  11740. }
  11741. var tag = element.type;
  11742. var componentClass = tagToComponentClass[tag];
  11743. if (componentClass == null) {
  11744. tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
  11745. }
  11746. return componentClass;
  11747. }
  11748. /**
  11749. * Get a native internal component class for a specific tag.
  11750. *
  11751. * @param {ReactElement} element The element to create.
  11752. * @return {function} The internal class constructor function.
  11753. */
  11754. function createInternalComponent(element) {
  11755. ("production" !== "development" ? invariant(
  11756. genericComponentClass,
  11757. 'There is no registered component for the tag %s',
  11758. element.type
  11759. ) : invariant(genericComponentClass));
  11760. return new genericComponentClass(element.type, element.props);
  11761. }
  11762. /**
  11763. * @param {ReactText} text
  11764. * @return {ReactComponent}
  11765. */
  11766. function createInstanceForText(text) {
  11767. return new textComponentClass(text);
  11768. }
  11769. /**
  11770. * @param {ReactComponent} component
  11771. * @return {boolean}
  11772. */
  11773. function isTextComponent(component) {
  11774. return component instanceof textComponentClass;
  11775. }
  11776. var ReactNativeComponent = {
  11777. getComponentClassForElement: getComponentClassForElement,
  11778. createInternalComponent: createInternalComponent,
  11779. createInstanceForText: createInstanceForText,
  11780. isTextComponent: isTextComponent,
  11781. injection: ReactNativeComponentInjection
  11782. };
  11783. module.exports = ReactNativeComponent;
  11784. },{"135":135,"27":27}],74:[function(_dereq_,module,exports){
  11785. /**
  11786. * Copyright 2013-2015, Facebook, Inc.
  11787. * All rights reserved.
  11788. *
  11789. * This source code is licensed under the BSD-style license found in the
  11790. * LICENSE file in the root directory of this source tree. An additional grant
  11791. * of patent rights can be found in the PATENTS file in the same directory.
  11792. *
  11793. * @providesModule ReactOwner
  11794. */
  11795. 'use strict';
  11796. var invariant = _dereq_(135);
  11797. /**
  11798. * ReactOwners are capable of storing references to owned components.
  11799. *
  11800. * All components are capable of //being// referenced by owner components, but
  11801. * only ReactOwner components are capable of //referencing// owned components.
  11802. * The named reference is known as a "ref".
  11803. *
  11804. * Refs are available when mounted and updated during reconciliation.
  11805. *
  11806. * var MyComponent = React.createClass({
  11807. * render: function() {
  11808. * return (
  11809. * <div onClick={this.handleClick}>
  11810. * <CustomComponent ref="custom" />
  11811. * </div>
  11812. * );
  11813. * },
  11814. * handleClick: function() {
  11815. * this.refs.custom.handleClick();
  11816. * },
  11817. * componentDidMount: function() {
  11818. * this.refs.custom.initialize();
  11819. * }
  11820. * });
  11821. *
  11822. * Refs should rarely be used. When refs are used, they should only be done to
  11823. * control data that is not handled by React's data flow.
  11824. *
  11825. * @class ReactOwner
  11826. */
  11827. var ReactOwner = {
  11828. /**
  11829. * @param {?object} object
  11830. * @return {boolean} True if `object` is a valid owner.
  11831. * @final
  11832. */
  11833. isValidOwner: function(object) {
  11834. return !!(
  11835. (object &&
  11836. typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
  11837. );
  11838. },
  11839. /**
  11840. * Adds a component by ref to an owner component.
  11841. *
  11842. * @param {ReactComponent} component Component to reference.
  11843. * @param {string} ref Name by which to refer to the component.
  11844. * @param {ReactOwner} owner Component on which to record the ref.
  11845. * @final
  11846. * @internal
  11847. */
  11848. addComponentAsRefTo: function(component, ref, owner) {
  11849. ("production" !== "development" ? invariant(
  11850. ReactOwner.isValidOwner(owner),
  11851. 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
  11852. 'usually means that you\'re trying to add a ref to a component that ' +
  11853. 'doesn\'t have an owner (that is, was not created inside of another ' +
  11854. 'component\'s `render` method). Try rendering this component inside of ' +
  11855. 'a new top-level component which will hold the ref.'
  11856. ) : invariant(ReactOwner.isValidOwner(owner)));
  11857. owner.attachRef(ref, component);
  11858. },
  11859. /**
  11860. * Removes a component by ref from an owner component.
  11861. *
  11862. * @param {ReactComponent} component Component to dereference.
  11863. * @param {string} ref Name of the ref to remove.
  11864. * @param {ReactOwner} owner Component on which the ref is recorded.
  11865. * @final
  11866. * @internal
  11867. */
  11868. removeComponentAsRefFrom: function(component, ref, owner) {
  11869. ("production" !== "development" ? invariant(
  11870. ReactOwner.isValidOwner(owner),
  11871. 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
  11872. 'usually means that you\'re trying to remove a ref to a component that ' +
  11873. 'doesn\'t have an owner (that is, was not created inside of another ' +
  11874. 'component\'s `render` method). Try rendering this component inside of ' +
  11875. 'a new top-level component which will hold the ref.'
  11876. ) : invariant(ReactOwner.isValidOwner(owner)));
  11877. // Check that `component` is still the current ref because we do not want to
  11878. // detach the ref if another component stole it.
  11879. if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
  11880. owner.detachRef(ref);
  11881. }
  11882. }
  11883. };
  11884. module.exports = ReactOwner;
  11885. },{"135":135}],75:[function(_dereq_,module,exports){
  11886. /**
  11887. * Copyright 2013-2015, Facebook, Inc.
  11888. * All rights reserved.
  11889. *
  11890. * This source code is licensed under the BSD-style license found in the
  11891. * LICENSE file in the root directory of this source tree. An additional grant
  11892. * of patent rights can be found in the PATENTS file in the same directory.
  11893. *
  11894. * @providesModule ReactPerf
  11895. * @typechecks static-only
  11896. */
  11897. 'use strict';
  11898. /**
  11899. * ReactPerf is a general AOP system designed to measure performance. This
  11900. * module only has the hooks: see ReactDefaultPerf for the analysis tool.
  11901. */
  11902. var ReactPerf = {
  11903. /**
  11904. * Boolean to enable/disable measurement. Set to false by default to prevent
  11905. * accidental logging and perf loss.
  11906. */
  11907. enableMeasure: false,
  11908. /**
  11909. * Holds onto the measure function in use. By default, don't measure
  11910. * anything, but we'll override this if we inject a measure function.
  11911. */
  11912. storedMeasure: _noMeasure,
  11913. /**
  11914. * @param {object} object
  11915. * @param {string} objectName
  11916. * @param {object<string>} methodNames
  11917. */
  11918. measureMethods: function(object, objectName, methodNames) {
  11919. if ("production" !== "development") {
  11920. for (var key in methodNames) {
  11921. if (!methodNames.hasOwnProperty(key)) {
  11922. continue;
  11923. }
  11924. object[key] = ReactPerf.measure(
  11925. objectName,
  11926. methodNames[key],
  11927. object[key]
  11928. );
  11929. }
  11930. }
  11931. },
  11932. /**
  11933. * Use this to wrap methods you want to measure. Zero overhead in production.
  11934. *
  11935. * @param {string} objName
  11936. * @param {string} fnName
  11937. * @param {function} func
  11938. * @return {function}
  11939. */
  11940. measure: function(objName, fnName, func) {
  11941. if ("production" !== "development") {
  11942. var measuredFunc = null;
  11943. var wrapper = function() {
  11944. if (ReactPerf.enableMeasure) {
  11945. if (!measuredFunc) {
  11946. measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
  11947. }
  11948. return measuredFunc.apply(this, arguments);
  11949. }
  11950. return func.apply(this, arguments);
  11951. };
  11952. wrapper.displayName = objName + '_' + fnName;
  11953. return wrapper;
  11954. }
  11955. return func;
  11956. },
  11957. injection: {
  11958. /**
  11959. * @param {function} measure
  11960. */
  11961. injectMeasure: function(measure) {
  11962. ReactPerf.storedMeasure = measure;
  11963. }
  11964. }
  11965. };
  11966. /**
  11967. * Simply passes through the measured function, without measuring it.
  11968. *
  11969. * @param {string} objName
  11970. * @param {string} fnName
  11971. * @param {function} func
  11972. * @return {function}
  11973. */
  11974. function _noMeasure(objName, fnName, func) {
  11975. return func;
  11976. }
  11977. module.exports = ReactPerf;
  11978. },{}],76:[function(_dereq_,module,exports){
  11979. /**
  11980. * Copyright 2013-2015, Facebook, Inc.
  11981. * All rights reserved.
  11982. *
  11983. * This source code is licensed under the BSD-style license found in the
  11984. * LICENSE file in the root directory of this source tree. An additional grant
  11985. * of patent rights can be found in the PATENTS file in the same directory.
  11986. *
  11987. * @providesModule ReactPropTypeLocationNames
  11988. */
  11989. 'use strict';
  11990. var ReactPropTypeLocationNames = {};
  11991. if ("production" !== "development") {
  11992. ReactPropTypeLocationNames = {
  11993. prop: 'prop',
  11994. context: 'context',
  11995. childContext: 'child context'
  11996. };
  11997. }
  11998. module.exports = ReactPropTypeLocationNames;
  11999. },{}],77:[function(_dereq_,module,exports){
  12000. /**
  12001. * Copyright 2013-2015, Facebook, Inc.
  12002. * All rights reserved.
  12003. *
  12004. * This source code is licensed under the BSD-style license found in the
  12005. * LICENSE file in the root directory of this source tree. An additional grant
  12006. * of patent rights can be found in the PATENTS file in the same directory.
  12007. *
  12008. * @providesModule ReactPropTypeLocations
  12009. */
  12010. 'use strict';
  12011. var keyMirror = _dereq_(140);
  12012. var ReactPropTypeLocations = keyMirror({
  12013. prop: null,
  12014. context: null,
  12015. childContext: null
  12016. });
  12017. module.exports = ReactPropTypeLocations;
  12018. },{"140":140}],78:[function(_dereq_,module,exports){
  12019. /**
  12020. * Copyright 2013-2015, Facebook, Inc.
  12021. * All rights reserved.
  12022. *
  12023. * This source code is licensed under the BSD-style license found in the
  12024. * LICENSE file in the root directory of this source tree. An additional grant
  12025. * of patent rights can be found in the PATENTS file in the same directory.
  12026. *
  12027. * @providesModule ReactPropTypes
  12028. */
  12029. 'use strict';
  12030. var ReactElement = _dereq_(57);
  12031. var ReactFragment = _dereq_(63);
  12032. var ReactPropTypeLocationNames = _dereq_(76);
  12033. var emptyFunction = _dereq_(114);
  12034. /**
  12035. * Collection of methods that allow declaration and validation of props that are
  12036. * supplied to React components. Example usage:
  12037. *
  12038. * var Props = require('ReactPropTypes');
  12039. * var MyArticle = React.createClass({
  12040. * propTypes: {
  12041. * // An optional string prop named "description".
  12042. * description: Props.string,
  12043. *
  12044. * // A required enum prop named "category".
  12045. * category: Props.oneOf(['News','Photos']).isRequired,
  12046. *
  12047. * // A prop named "dialog" that requires an instance of Dialog.
  12048. * dialog: Props.instanceOf(Dialog).isRequired
  12049. * },
  12050. * render: function() { ... }
  12051. * });
  12052. *
  12053. * A more formal specification of how these methods are used:
  12054. *
  12055. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  12056. * decl := ReactPropTypes.{type}(.isRequired)?
  12057. *
  12058. * Each and every declaration produces a function with the same signature. This
  12059. * allows the creation of custom validation functions. For example:
  12060. *
  12061. * var MyLink = React.createClass({
  12062. * propTypes: {
  12063. * // An optional string or URI prop named "href".
  12064. * href: function(props, propName, componentName) {
  12065. * var propValue = props[propName];
  12066. * if (propValue != null && typeof propValue !== 'string' &&
  12067. * !(propValue instanceof URI)) {
  12068. * return new Error(
  12069. * 'Expected a string or an URI for ' + propName + ' in ' +
  12070. * componentName
  12071. * );
  12072. * }
  12073. * }
  12074. * },
  12075. * render: function() {...}
  12076. * });
  12077. *
  12078. * @internal
  12079. */
  12080. var ANONYMOUS = '<<anonymous>>';
  12081. var elementTypeChecker = createElementTypeChecker();
  12082. var nodeTypeChecker = createNodeChecker();
  12083. var ReactPropTypes = {
  12084. array: createPrimitiveTypeChecker('array'),
  12085. bool: createPrimitiveTypeChecker('boolean'),
  12086. func: createPrimitiveTypeChecker('function'),
  12087. number: createPrimitiveTypeChecker('number'),
  12088. object: createPrimitiveTypeChecker('object'),
  12089. string: createPrimitiveTypeChecker('string'),
  12090. any: createAnyTypeChecker(),
  12091. arrayOf: createArrayOfTypeChecker,
  12092. element: elementTypeChecker,
  12093. instanceOf: createInstanceTypeChecker,
  12094. node: nodeTypeChecker,
  12095. objectOf: createObjectOfTypeChecker,
  12096. oneOf: createEnumTypeChecker,
  12097. oneOfType: createUnionTypeChecker,
  12098. shape: createShapeTypeChecker
  12099. };
  12100. function createChainableTypeChecker(validate) {
  12101. function checkType(isRequired, props, propName, componentName, location) {
  12102. componentName = componentName || ANONYMOUS;
  12103. if (props[propName] == null) {
  12104. var locationName = ReactPropTypeLocationNames[location];
  12105. if (isRequired) {
  12106. return new Error(
  12107. ("Required " + locationName + " `" + propName + "` was not specified in ") +
  12108. ("`" + componentName + "`.")
  12109. );
  12110. }
  12111. return null;
  12112. } else {
  12113. return validate(props, propName, componentName, location);
  12114. }
  12115. }
  12116. var chainedCheckType = checkType.bind(null, false);
  12117. chainedCheckType.isRequired = checkType.bind(null, true);
  12118. return chainedCheckType;
  12119. }
  12120. function createPrimitiveTypeChecker(expectedType) {
  12121. function validate(props, propName, componentName, location) {
  12122. var propValue = props[propName];
  12123. var propType = getPropType(propValue);
  12124. if (propType !== expectedType) {
  12125. var locationName = ReactPropTypeLocationNames[location];
  12126. // `propValue` being instance of, say, date/regexp, pass the 'object'
  12127. // check, but we can offer a more precise error message here rather than
  12128. // 'of type `object`'.
  12129. var preciseType = getPreciseType(propValue);
  12130. return new Error(
  12131. ("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") +
  12132. ("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
  12133. );
  12134. }
  12135. return null;
  12136. }
  12137. return createChainableTypeChecker(validate);
  12138. }
  12139. function createAnyTypeChecker() {
  12140. return createChainableTypeChecker(emptyFunction.thatReturns(null));
  12141. }
  12142. function createArrayOfTypeChecker(typeChecker) {
  12143. function validate(props, propName, componentName, location) {
  12144. var propValue = props[propName];
  12145. if (!Array.isArray(propValue)) {
  12146. var locationName = ReactPropTypeLocationNames[location];
  12147. var propType = getPropType(propValue);
  12148. return new Error(
  12149. ("Invalid " + locationName + " `" + propName + "` of type ") +
  12150. ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")
  12151. );
  12152. }
  12153. for (var i = 0; i < propValue.length; i++) {
  12154. var error = typeChecker(propValue, i, componentName, location);
  12155. if (error instanceof Error) {
  12156. return error;
  12157. }
  12158. }
  12159. return null;
  12160. }
  12161. return createChainableTypeChecker(validate);
  12162. }
  12163. function createElementTypeChecker() {
  12164. function validate(props, propName, componentName, location) {
  12165. if (!ReactElement.isValidElement(props[propName])) {
  12166. var locationName = ReactPropTypeLocationNames[location];
  12167. return new Error(
  12168. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12169. ("`" + componentName + "`, expected a ReactElement.")
  12170. );
  12171. }
  12172. return null;
  12173. }
  12174. return createChainableTypeChecker(validate);
  12175. }
  12176. function createInstanceTypeChecker(expectedClass) {
  12177. function validate(props, propName, componentName, location) {
  12178. if (!(props[propName] instanceof expectedClass)) {
  12179. var locationName = ReactPropTypeLocationNames[location];
  12180. var expectedClassName = expectedClass.name || ANONYMOUS;
  12181. return new Error(
  12182. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12183. ("`" + componentName + "`, expected instance of `" + expectedClassName + "`.")
  12184. );
  12185. }
  12186. return null;
  12187. }
  12188. return createChainableTypeChecker(validate);
  12189. }
  12190. function createEnumTypeChecker(expectedValues) {
  12191. function validate(props, propName, componentName, location) {
  12192. var propValue = props[propName];
  12193. for (var i = 0; i < expectedValues.length; i++) {
  12194. if (propValue === expectedValues[i]) {
  12195. return null;
  12196. }
  12197. }
  12198. var locationName = ReactPropTypeLocationNames[location];
  12199. var valuesString = JSON.stringify(expectedValues);
  12200. return new Error(
  12201. ("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") +
  12202. ("supplied to `" + componentName + "`, expected one of " + valuesString + ".")
  12203. );
  12204. }
  12205. return createChainableTypeChecker(validate);
  12206. }
  12207. function createObjectOfTypeChecker(typeChecker) {
  12208. function validate(props, propName, componentName, location) {
  12209. var propValue = props[propName];
  12210. var propType = getPropType(propValue);
  12211. if (propType !== 'object') {
  12212. var locationName = ReactPropTypeLocationNames[location];
  12213. return new Error(
  12214. ("Invalid " + locationName + " `" + propName + "` of type ") +
  12215. ("`" + propType + "` supplied to `" + componentName + "`, expected an object.")
  12216. );
  12217. }
  12218. for (var key in propValue) {
  12219. if (propValue.hasOwnProperty(key)) {
  12220. var error = typeChecker(propValue, key, componentName, location);
  12221. if (error instanceof Error) {
  12222. return error;
  12223. }
  12224. }
  12225. }
  12226. return null;
  12227. }
  12228. return createChainableTypeChecker(validate);
  12229. }
  12230. function createUnionTypeChecker(arrayOfTypeCheckers) {
  12231. function validate(props, propName, componentName, location) {
  12232. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  12233. var checker = arrayOfTypeCheckers[i];
  12234. if (checker(props, propName, componentName, location) == null) {
  12235. return null;
  12236. }
  12237. }
  12238. var locationName = ReactPropTypeLocationNames[location];
  12239. return new Error(
  12240. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12241. ("`" + componentName + "`.")
  12242. );
  12243. }
  12244. return createChainableTypeChecker(validate);
  12245. }
  12246. function createNodeChecker() {
  12247. function validate(props, propName, componentName, location) {
  12248. if (!isNode(props[propName])) {
  12249. var locationName = ReactPropTypeLocationNames[location];
  12250. return new Error(
  12251. ("Invalid " + locationName + " `" + propName + "` supplied to ") +
  12252. ("`" + componentName + "`, expected a ReactNode.")
  12253. );
  12254. }
  12255. return null;
  12256. }
  12257. return createChainableTypeChecker(validate);
  12258. }
  12259. function createShapeTypeChecker(shapeTypes) {
  12260. function validate(props, propName, componentName, location) {
  12261. var propValue = props[propName];
  12262. var propType = getPropType(propValue);
  12263. if (propType !== 'object') {
  12264. var locationName = ReactPropTypeLocationNames[location];
  12265. return new Error(
  12266. ("Invalid " + locationName + " `" + propName + "` of type `" + propType + "` ") +
  12267. ("supplied to `" + componentName + "`, expected `object`.")
  12268. );
  12269. }
  12270. for (var key in shapeTypes) {
  12271. var checker = shapeTypes[key];
  12272. if (!checker) {
  12273. continue;
  12274. }
  12275. var error = checker(propValue, key, componentName, location);
  12276. if (error) {
  12277. return error;
  12278. }
  12279. }
  12280. return null;
  12281. }
  12282. return createChainableTypeChecker(validate);
  12283. }
  12284. function isNode(propValue) {
  12285. switch (typeof propValue) {
  12286. case 'number':
  12287. case 'string':
  12288. case 'undefined':
  12289. return true;
  12290. case 'boolean':
  12291. return !propValue;
  12292. case 'object':
  12293. if (Array.isArray(propValue)) {
  12294. return propValue.every(isNode);
  12295. }
  12296. if (propValue === null || ReactElement.isValidElement(propValue)) {
  12297. return true;
  12298. }
  12299. propValue = ReactFragment.extractIfFragment(propValue);
  12300. for (var k in propValue) {
  12301. if (!isNode(propValue[k])) {
  12302. return false;
  12303. }
  12304. }
  12305. return true;
  12306. default:
  12307. return false;
  12308. }
  12309. }
  12310. // Equivalent of `typeof` but with special handling for array and regexp.
  12311. function getPropType(propValue) {
  12312. var propType = typeof propValue;
  12313. if (Array.isArray(propValue)) {
  12314. return 'array';
  12315. }
  12316. if (propValue instanceof RegExp) {
  12317. // Old webkits (at least until Android 4.0) return 'function' rather than
  12318. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  12319. // passes PropTypes.object.
  12320. return 'object';
  12321. }
  12322. return propType;
  12323. }
  12324. // This handles more types than `getPropType`. Only used for error messages.
  12325. // See `createPrimitiveTypeChecker`.
  12326. function getPreciseType(propValue) {
  12327. var propType = getPropType(propValue);
  12328. if (propType === 'object') {
  12329. if (propValue instanceof Date) {
  12330. return 'date';
  12331. } else if (propValue instanceof RegExp) {
  12332. return 'regexp';
  12333. }
  12334. }
  12335. return propType;
  12336. }
  12337. module.exports = ReactPropTypes;
  12338. },{"114":114,"57":57,"63":63,"76":76}],79:[function(_dereq_,module,exports){
  12339. /**
  12340. * Copyright 2013-2015, Facebook, Inc.
  12341. * All rights reserved.
  12342. *
  12343. * This source code is licensed under the BSD-style license found in the
  12344. * LICENSE file in the root directory of this source tree. An additional grant
  12345. * of patent rights can be found in the PATENTS file in the same directory.
  12346. *
  12347. * @providesModule ReactPutListenerQueue
  12348. */
  12349. 'use strict';
  12350. var PooledClass = _dereq_(28);
  12351. var ReactBrowserEventEmitter = _dereq_(30);
  12352. var assign = _dereq_(27);
  12353. function ReactPutListenerQueue() {
  12354. this.listenersToPut = [];
  12355. }
  12356. assign(ReactPutListenerQueue.prototype, {
  12357. enqueuePutListener: function(rootNodeID, propKey, propValue) {
  12358. this.listenersToPut.push({
  12359. rootNodeID: rootNodeID,
  12360. propKey: propKey,
  12361. propValue: propValue
  12362. });
  12363. },
  12364. putListeners: function() {
  12365. for (var i = 0; i < this.listenersToPut.length; i++) {
  12366. var listenerToPut = this.listenersToPut[i];
  12367. ReactBrowserEventEmitter.putListener(
  12368. listenerToPut.rootNodeID,
  12369. listenerToPut.propKey,
  12370. listenerToPut.propValue
  12371. );
  12372. }
  12373. },
  12374. reset: function() {
  12375. this.listenersToPut.length = 0;
  12376. },
  12377. destructor: function() {
  12378. this.reset();
  12379. }
  12380. });
  12381. PooledClass.addPoolingTo(ReactPutListenerQueue);
  12382. module.exports = ReactPutListenerQueue;
  12383. },{"27":27,"28":28,"30":30}],80:[function(_dereq_,module,exports){
  12384. /**
  12385. * Copyright 2013-2015, Facebook, Inc.
  12386. * All rights reserved.
  12387. *
  12388. * This source code is licensed under the BSD-style license found in the
  12389. * LICENSE file in the root directory of this source tree. An additional grant
  12390. * of patent rights can be found in the PATENTS file in the same directory.
  12391. *
  12392. * @providesModule ReactReconcileTransaction
  12393. * @typechecks static-only
  12394. */
  12395. 'use strict';
  12396. var CallbackQueue = _dereq_(6);
  12397. var PooledClass = _dereq_(28);
  12398. var ReactBrowserEventEmitter = _dereq_(30);
  12399. var ReactInputSelection = _dereq_(65);
  12400. var ReactPutListenerQueue = _dereq_(79);
  12401. var Transaction = _dereq_(103);
  12402. var assign = _dereq_(27);
  12403. /**
  12404. * Ensures that, when possible, the selection range (currently selected text
  12405. * input) is not disturbed by performing the transaction.
  12406. */
  12407. var SELECTION_RESTORATION = {
  12408. /**
  12409. * @return {Selection} Selection information.
  12410. */
  12411. initialize: ReactInputSelection.getSelectionInformation,
  12412. /**
  12413. * @param {Selection} sel Selection information returned from `initialize`.
  12414. */
  12415. close: ReactInputSelection.restoreSelection
  12416. };
  12417. /**
  12418. * Suppresses events (blur/focus) that could be inadvertently dispatched due to
  12419. * high level DOM manipulations (like temporarily removing a text input from the
  12420. * DOM).
  12421. */
  12422. var EVENT_SUPPRESSION = {
  12423. /**
  12424. * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
  12425. * the reconciliation.
  12426. */
  12427. initialize: function() {
  12428. var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
  12429. ReactBrowserEventEmitter.setEnabled(false);
  12430. return currentlyEnabled;
  12431. },
  12432. /**
  12433. * @param {boolean} previouslyEnabled Enabled status of
  12434. * `ReactBrowserEventEmitter` before the reconciliation occured. `close`
  12435. * restores the previous value.
  12436. */
  12437. close: function(previouslyEnabled) {
  12438. ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
  12439. }
  12440. };
  12441. /**
  12442. * Provides a queue for collecting `componentDidMount` and
  12443. * `componentDidUpdate` callbacks during the the transaction.
  12444. */
  12445. var ON_DOM_READY_QUEUEING = {
  12446. /**
  12447. * Initializes the internal `onDOMReady` queue.
  12448. */
  12449. initialize: function() {
  12450. this.reactMountReady.reset();
  12451. },
  12452. /**
  12453. * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
  12454. */
  12455. close: function() {
  12456. this.reactMountReady.notifyAll();
  12457. }
  12458. };
  12459. var PUT_LISTENER_QUEUEING = {
  12460. initialize: function() {
  12461. this.putListenerQueue.reset();
  12462. },
  12463. close: function() {
  12464. this.putListenerQueue.putListeners();
  12465. }
  12466. };
  12467. /**
  12468. * Executed within the scope of the `Transaction` instance. Consider these as
  12469. * being member methods, but with an implied ordering while being isolated from
  12470. * each other.
  12471. */
  12472. var TRANSACTION_WRAPPERS = [
  12473. PUT_LISTENER_QUEUEING,
  12474. SELECTION_RESTORATION,
  12475. EVENT_SUPPRESSION,
  12476. ON_DOM_READY_QUEUEING
  12477. ];
  12478. /**
  12479. * Currently:
  12480. * - The order that these are listed in the transaction is critical:
  12481. * - Suppresses events.
  12482. * - Restores selection range.
  12483. *
  12484. * Future:
  12485. * - Restore document/overflow scroll positions that were unintentionally
  12486. * modified via DOM insertions above the top viewport boundary.
  12487. * - Implement/integrate with customized constraint based layout system and keep
  12488. * track of which dimensions must be remeasured.
  12489. *
  12490. * @class ReactReconcileTransaction
  12491. */
  12492. function ReactReconcileTransaction() {
  12493. this.reinitializeTransaction();
  12494. // Only server-side rendering really needs this option (see
  12495. // `ReactServerRendering`), but server-side uses
  12496. // `ReactServerRenderingTransaction` instead. This option is here so that it's
  12497. // accessible and defaults to false when `ReactDOMComponent` and
  12498. // `ReactTextComponent` checks it in `mountComponent`.`
  12499. this.renderToStaticMarkup = false;
  12500. this.reactMountReady = CallbackQueue.getPooled(null);
  12501. this.putListenerQueue = ReactPutListenerQueue.getPooled();
  12502. }
  12503. var Mixin = {
  12504. /**
  12505. * @see Transaction
  12506. * @abstract
  12507. * @final
  12508. * @return {array<object>} List of operation wrap proceedures.
  12509. * TODO: convert to array<TransactionWrapper>
  12510. */
  12511. getTransactionWrappers: function() {
  12512. return TRANSACTION_WRAPPERS;
  12513. },
  12514. /**
  12515. * @return {object} The queue to collect `onDOMReady` callbacks with.
  12516. */
  12517. getReactMountReady: function() {
  12518. return this.reactMountReady;
  12519. },
  12520. getPutListenerQueue: function() {
  12521. return this.putListenerQueue;
  12522. },
  12523. /**
  12524. * `PooledClass` looks for this, and will invoke this before allowing this
  12525. * instance to be resused.
  12526. */
  12527. destructor: function() {
  12528. CallbackQueue.release(this.reactMountReady);
  12529. this.reactMountReady = null;
  12530. ReactPutListenerQueue.release(this.putListenerQueue);
  12531. this.putListenerQueue = null;
  12532. }
  12533. };
  12534. assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
  12535. PooledClass.addPoolingTo(ReactReconcileTransaction);
  12536. module.exports = ReactReconcileTransaction;
  12537. },{"103":103,"27":27,"28":28,"30":30,"6":6,"65":65,"79":79}],81:[function(_dereq_,module,exports){
  12538. /**
  12539. * Copyright 2013-2015, Facebook, Inc.
  12540. * All rights reserved.
  12541. *
  12542. * This source code is licensed under the BSD-style license found in the
  12543. * LICENSE file in the root directory of this source tree. An additional grant
  12544. * of patent rights can be found in the PATENTS file in the same directory.
  12545. *
  12546. * @providesModule ReactReconciler
  12547. */
  12548. 'use strict';
  12549. var ReactRef = _dereq_(82);
  12550. var ReactElementValidator = _dereq_(58);
  12551. /**
  12552. * Helper to call ReactRef.attachRefs with this composite component, split out
  12553. * to avoid allocations in the transaction mount-ready queue.
  12554. */
  12555. function attachRefs() {
  12556. ReactRef.attachRefs(this, this._currentElement);
  12557. }
  12558. var ReactReconciler = {
  12559. /**
  12560. * Initializes the component, renders markup, and registers event listeners.
  12561. *
  12562. * @param {ReactComponent} internalInstance
  12563. * @param {string} rootID DOM ID of the root node.
  12564. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
  12565. * @return {?string} Rendered markup to be inserted into the DOM.
  12566. * @final
  12567. * @internal
  12568. */
  12569. mountComponent: function(internalInstance, rootID, transaction, context) {
  12570. var markup = internalInstance.mountComponent(rootID, transaction, context);
  12571. if ("production" !== "development") {
  12572. ReactElementValidator.checkAndWarnForMutatedProps(
  12573. internalInstance._currentElement
  12574. );
  12575. }
  12576. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  12577. return markup;
  12578. },
  12579. /**
  12580. * Releases any resources allocated by `mountComponent`.
  12581. *
  12582. * @final
  12583. * @internal
  12584. */
  12585. unmountComponent: function(internalInstance) {
  12586. ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
  12587. internalInstance.unmountComponent();
  12588. },
  12589. /**
  12590. * Update a component using a new element.
  12591. *
  12592. * @param {ReactComponent} internalInstance
  12593. * @param {ReactElement} nextElement
  12594. * @param {ReactReconcileTransaction} transaction
  12595. * @param {object} context
  12596. * @internal
  12597. */
  12598. receiveComponent: function(
  12599. internalInstance, nextElement, transaction, context
  12600. ) {
  12601. var prevElement = internalInstance._currentElement;
  12602. if (nextElement === prevElement && nextElement._owner != null) {
  12603. // Since elements are immutable after the owner is rendered,
  12604. // we can do a cheap identity compare here to determine if this is a
  12605. // superfluous reconcile. It's possible for state to be mutable but such
  12606. // change should trigger an update of the owner which would recreate
  12607. // the element. We explicitly check for the existence of an owner since
  12608. // it's possible for an element created outside a composite to be
  12609. // deeply mutated and reused.
  12610. return;
  12611. }
  12612. if ("production" !== "development") {
  12613. ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
  12614. }
  12615. var refsChanged = ReactRef.shouldUpdateRefs(
  12616. prevElement,
  12617. nextElement
  12618. );
  12619. if (refsChanged) {
  12620. ReactRef.detachRefs(internalInstance, prevElement);
  12621. }
  12622. internalInstance.receiveComponent(nextElement, transaction, context);
  12623. if (refsChanged) {
  12624. transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
  12625. }
  12626. },
  12627. /**
  12628. * Flush any dirty changes in a component.
  12629. *
  12630. * @param {ReactComponent} internalInstance
  12631. * @param {ReactReconcileTransaction} transaction
  12632. * @internal
  12633. */
  12634. performUpdateIfNecessary: function(
  12635. internalInstance,
  12636. transaction
  12637. ) {
  12638. internalInstance.performUpdateIfNecessary(transaction);
  12639. }
  12640. };
  12641. module.exports = ReactReconciler;
  12642. },{"58":58,"82":82}],82:[function(_dereq_,module,exports){
  12643. /**
  12644. * Copyright 2013-2015, Facebook, Inc.
  12645. * All rights reserved.
  12646. *
  12647. * This source code is licensed under the BSD-style license found in the
  12648. * LICENSE file in the root directory of this source tree. An additional grant
  12649. * of patent rights can be found in the PATENTS file in the same directory.
  12650. *
  12651. * @providesModule ReactRef
  12652. */
  12653. 'use strict';
  12654. var ReactOwner = _dereq_(74);
  12655. var ReactRef = {};
  12656. function attachRef(ref, component, owner) {
  12657. if (typeof ref === 'function') {
  12658. ref(component.getPublicInstance());
  12659. } else {
  12660. // Legacy ref
  12661. ReactOwner.addComponentAsRefTo(component, ref, owner);
  12662. }
  12663. }
  12664. function detachRef(ref, component, owner) {
  12665. if (typeof ref === 'function') {
  12666. ref(null);
  12667. } else {
  12668. // Legacy ref
  12669. ReactOwner.removeComponentAsRefFrom(component, ref, owner);
  12670. }
  12671. }
  12672. ReactRef.attachRefs = function(instance, element) {
  12673. var ref = element.ref;
  12674. if (ref != null) {
  12675. attachRef(ref, instance, element._owner);
  12676. }
  12677. };
  12678. ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
  12679. // If either the owner or a `ref` has changed, make sure the newest owner
  12680. // has stored a reference to `this`, and the previous owner (if different)
  12681. // has forgotten the reference to `this`. We use the element instead
  12682. // of the public this.props because the post processing cannot determine
  12683. // a ref. The ref conceptually lives on the element.
  12684. // TODO: Should this even be possible? The owner cannot change because
  12685. // it's forbidden by shouldUpdateReactComponent. The ref can change
  12686. // if you swap the keys of but not the refs. Reconsider where this check
  12687. // is made. It probably belongs where the key checking and
  12688. // instantiateReactComponent is done.
  12689. return (
  12690. nextElement._owner !== prevElement._owner ||
  12691. nextElement.ref !== prevElement.ref
  12692. );
  12693. };
  12694. ReactRef.detachRefs = function(instance, element) {
  12695. var ref = element.ref;
  12696. if (ref != null) {
  12697. detachRef(ref, instance, element._owner);
  12698. }
  12699. };
  12700. module.exports = ReactRef;
  12701. },{"74":74}],83:[function(_dereq_,module,exports){
  12702. /**
  12703. * Copyright 2013-2015, Facebook, Inc.
  12704. * All rights reserved.
  12705. *
  12706. * This source code is licensed under the BSD-style license found in the
  12707. * LICENSE file in the root directory of this source tree. An additional grant
  12708. * of patent rights can be found in the PATENTS file in the same directory.
  12709. *
  12710. * @providesModule ReactRootIndex
  12711. * @typechecks
  12712. */
  12713. 'use strict';
  12714. var ReactRootIndexInjection = {
  12715. /**
  12716. * @param {function} _createReactRootIndex
  12717. */
  12718. injectCreateReactRootIndex: function(_createReactRootIndex) {
  12719. ReactRootIndex.createReactRootIndex = _createReactRootIndex;
  12720. }
  12721. };
  12722. var ReactRootIndex = {
  12723. createReactRootIndex: null,
  12724. injection: ReactRootIndexInjection
  12725. };
  12726. module.exports = ReactRootIndex;
  12727. },{}],84:[function(_dereq_,module,exports){
  12728. /**
  12729. * Copyright 2013-2015, Facebook, Inc.
  12730. * All rights reserved.
  12731. *
  12732. * This source code is licensed under the BSD-style license found in the
  12733. * LICENSE file in the root directory of this source tree. An additional grant
  12734. * of patent rights can be found in the PATENTS file in the same directory.
  12735. *
  12736. * @typechecks static-only
  12737. * @providesModule ReactServerRendering
  12738. */
  12739. 'use strict';
  12740. var ReactElement = _dereq_(57);
  12741. var ReactInstanceHandles = _dereq_(66);
  12742. var ReactMarkupChecksum = _dereq_(69);
  12743. var ReactServerRenderingTransaction =
  12744. _dereq_(85);
  12745. var emptyObject = _dereq_(115);
  12746. var instantiateReactComponent = _dereq_(134);
  12747. var invariant = _dereq_(135);
  12748. /**
  12749. * @param {ReactElement} element
  12750. * @return {string} the HTML markup
  12751. */
  12752. function renderToString(element) {
  12753. ("production" !== "development" ? invariant(
  12754. ReactElement.isValidElement(element),
  12755. 'renderToString(): You must pass a valid ReactElement.'
  12756. ) : invariant(ReactElement.isValidElement(element)));
  12757. var transaction;
  12758. try {
  12759. var id = ReactInstanceHandles.createReactRootID();
  12760. transaction = ReactServerRenderingTransaction.getPooled(false);
  12761. return transaction.perform(function() {
  12762. var componentInstance = instantiateReactComponent(element, null);
  12763. var markup =
  12764. componentInstance.mountComponent(id, transaction, emptyObject);
  12765. return ReactMarkupChecksum.addChecksumToMarkup(markup);
  12766. }, null);
  12767. } finally {
  12768. ReactServerRenderingTransaction.release(transaction);
  12769. }
  12770. }
  12771. /**
  12772. * @param {ReactElement} element
  12773. * @return {string} the HTML markup, without the extra React ID and checksum
  12774. * (for generating static pages)
  12775. */
  12776. function renderToStaticMarkup(element) {
  12777. ("production" !== "development" ? invariant(
  12778. ReactElement.isValidElement(element),
  12779. 'renderToStaticMarkup(): You must pass a valid ReactElement.'
  12780. ) : invariant(ReactElement.isValidElement(element)));
  12781. var transaction;
  12782. try {
  12783. var id = ReactInstanceHandles.createReactRootID();
  12784. transaction = ReactServerRenderingTransaction.getPooled(true);
  12785. return transaction.perform(function() {
  12786. var componentInstance = instantiateReactComponent(element, null);
  12787. return componentInstance.mountComponent(id, transaction, emptyObject);
  12788. }, null);
  12789. } finally {
  12790. ReactServerRenderingTransaction.release(transaction);
  12791. }
  12792. }
  12793. module.exports = {
  12794. renderToString: renderToString,
  12795. renderToStaticMarkup: renderToStaticMarkup
  12796. };
  12797. },{"115":115,"134":134,"135":135,"57":57,"66":66,"69":69,"85":85}],85:[function(_dereq_,module,exports){
  12798. /**
  12799. * Copyright 2014-2015, Facebook, Inc.
  12800. * All rights reserved.
  12801. *
  12802. * This source code is licensed under the BSD-style license found in the
  12803. * LICENSE file in the root directory of this source tree. An additional grant
  12804. * of patent rights can be found in the PATENTS file in the same directory.
  12805. *
  12806. * @providesModule ReactServerRenderingTransaction
  12807. * @typechecks
  12808. */
  12809. 'use strict';
  12810. var PooledClass = _dereq_(28);
  12811. var CallbackQueue = _dereq_(6);
  12812. var ReactPutListenerQueue = _dereq_(79);
  12813. var Transaction = _dereq_(103);
  12814. var assign = _dereq_(27);
  12815. var emptyFunction = _dereq_(114);
  12816. /**
  12817. * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
  12818. * during the performing of the transaction.
  12819. */
  12820. var ON_DOM_READY_QUEUEING = {
  12821. /**
  12822. * Initializes the internal `onDOMReady` queue.
  12823. */
  12824. initialize: function() {
  12825. this.reactMountReady.reset();
  12826. },
  12827. close: emptyFunction
  12828. };
  12829. var PUT_LISTENER_QUEUEING = {
  12830. initialize: function() {
  12831. this.putListenerQueue.reset();
  12832. },
  12833. close: emptyFunction
  12834. };
  12835. /**
  12836. * Executed within the scope of the `Transaction` instance. Consider these as
  12837. * being member methods, but with an implied ordering while being isolated from
  12838. * each other.
  12839. */
  12840. var TRANSACTION_WRAPPERS = [
  12841. PUT_LISTENER_QUEUEING,
  12842. ON_DOM_READY_QUEUEING
  12843. ];
  12844. /**
  12845. * @class ReactServerRenderingTransaction
  12846. * @param {boolean} renderToStaticMarkup
  12847. */
  12848. function ReactServerRenderingTransaction(renderToStaticMarkup) {
  12849. this.reinitializeTransaction();
  12850. this.renderToStaticMarkup = renderToStaticMarkup;
  12851. this.reactMountReady = CallbackQueue.getPooled(null);
  12852. this.putListenerQueue = ReactPutListenerQueue.getPooled();
  12853. }
  12854. var Mixin = {
  12855. /**
  12856. * @see Transaction
  12857. * @abstract
  12858. * @final
  12859. * @return {array} Empty list of operation wrap proceedures.
  12860. */
  12861. getTransactionWrappers: function() {
  12862. return TRANSACTION_WRAPPERS;
  12863. },
  12864. /**
  12865. * @return {object} The queue to collect `onDOMReady` callbacks with.
  12866. */
  12867. getReactMountReady: function() {
  12868. return this.reactMountReady;
  12869. },
  12870. getPutListenerQueue: function() {
  12871. return this.putListenerQueue;
  12872. },
  12873. /**
  12874. * `PooledClass` looks for this, and will invoke this before allowing this
  12875. * instance to be resused.
  12876. */
  12877. destructor: function() {
  12878. CallbackQueue.release(this.reactMountReady);
  12879. this.reactMountReady = null;
  12880. ReactPutListenerQueue.release(this.putListenerQueue);
  12881. this.putListenerQueue = null;
  12882. }
  12883. };
  12884. assign(
  12885. ReactServerRenderingTransaction.prototype,
  12886. Transaction.Mixin,
  12887. Mixin
  12888. );
  12889. PooledClass.addPoolingTo(ReactServerRenderingTransaction);
  12890. module.exports = ReactServerRenderingTransaction;
  12891. },{"103":103,"114":114,"27":27,"28":28,"6":6,"79":79}],86:[function(_dereq_,module,exports){
  12892. /**
  12893. * Copyright 2015, Facebook, Inc.
  12894. * All rights reserved.
  12895. *
  12896. * This source code is licensed under the BSD-style license found in the
  12897. * LICENSE file in the root directory of this source tree. An additional grant
  12898. * of patent rights can be found in the PATENTS file in the same directory.
  12899. *
  12900. * @providesModule ReactUpdateQueue
  12901. */
  12902. 'use strict';
  12903. var ReactLifeCycle = _dereq_(68);
  12904. var ReactCurrentOwner = _dereq_(39);
  12905. var ReactElement = _dereq_(57);
  12906. var ReactInstanceMap = _dereq_(67);
  12907. var ReactUpdates = _dereq_(87);
  12908. var assign = _dereq_(27);
  12909. var invariant = _dereq_(135);
  12910. var warning = _dereq_(154);
  12911. function enqueueUpdate(internalInstance) {
  12912. if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {
  12913. // If we're in a componentWillMount handler, don't enqueue a rerender
  12914. // because ReactUpdates assumes we're in a browser context (which is
  12915. // wrong for server rendering) and we're about to do a render anyway.
  12916. // See bug in #1740.
  12917. ReactUpdates.enqueueUpdate(internalInstance);
  12918. }
  12919. }
  12920. function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
  12921. ("production" !== "development" ? invariant(
  12922. ReactCurrentOwner.current == null,
  12923. '%s(...): Cannot update during an existing state transition ' +
  12924. '(such as within `render`). Render methods should be a pure function ' +
  12925. 'of props and state.',
  12926. callerName
  12927. ) : invariant(ReactCurrentOwner.current == null));
  12928. var internalInstance = ReactInstanceMap.get(publicInstance);
  12929. if (!internalInstance) {
  12930. if ("production" !== "development") {
  12931. // Only warn when we have a callerName. Otherwise we should be silent.
  12932. // We're probably calling from enqueueCallback. We don't want to warn
  12933. // there because we already warned for the corresponding lifecycle method.
  12934. ("production" !== "development" ? warning(
  12935. !callerName,
  12936. '%s(...): Can only update a mounted or mounting component. ' +
  12937. 'This usually means you called %s() on an unmounted ' +
  12938. 'component. This is a no-op.',
  12939. callerName,
  12940. callerName
  12941. ) : null);
  12942. }
  12943. return null;
  12944. }
  12945. if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {
  12946. return null;
  12947. }
  12948. return internalInstance;
  12949. }
  12950. /**
  12951. * ReactUpdateQueue allows for state updates to be scheduled into a later
  12952. * reconciliation step.
  12953. */
  12954. var ReactUpdateQueue = {
  12955. /**
  12956. * Enqueue a callback that will be executed after all the pending updates
  12957. * have processed.
  12958. *
  12959. * @param {ReactClass} publicInstance The instance to use as `this` context.
  12960. * @param {?function} callback Called after state is updated.
  12961. * @internal
  12962. */
  12963. enqueueCallback: function(publicInstance, callback) {
  12964. ("production" !== "development" ? invariant(
  12965. typeof callback === 'function',
  12966. 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
  12967. '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
  12968. 'isn\'t callable.'
  12969. ) : invariant(typeof callback === 'function'));
  12970. var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
  12971. // Previously we would throw an error if we didn't have an internal
  12972. // instance. Since we want to make it a no-op instead, we mirror the same
  12973. // behavior we have in other enqueue* methods.
  12974. // We also need to ignore callbacks in componentWillMount. See
  12975. // enqueueUpdates.
  12976. if (!internalInstance ||
  12977. internalInstance === ReactLifeCycle.currentlyMountingInstance) {
  12978. return null;
  12979. }
  12980. if (internalInstance._pendingCallbacks) {
  12981. internalInstance._pendingCallbacks.push(callback);
  12982. } else {
  12983. internalInstance._pendingCallbacks = [callback];
  12984. }
  12985. // TODO: The callback here is ignored when setState is called from
  12986. // componentWillMount. Either fix it or disallow doing so completely in
  12987. // favor of getInitialState. Alternatively, we can disallow
  12988. // componentWillMount during server-side rendering.
  12989. enqueueUpdate(internalInstance);
  12990. },
  12991. enqueueCallbackInternal: function(internalInstance, callback) {
  12992. ("production" !== "development" ? invariant(
  12993. typeof callback === 'function',
  12994. 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
  12995. '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
  12996. 'isn\'t callable.'
  12997. ) : invariant(typeof callback === 'function'));
  12998. if (internalInstance._pendingCallbacks) {
  12999. internalInstance._pendingCallbacks.push(callback);
  13000. } else {
  13001. internalInstance._pendingCallbacks = [callback];
  13002. }
  13003. enqueueUpdate(internalInstance);
  13004. },
  13005. /**
  13006. * Forces an update. This should only be invoked when it is known with
  13007. * certainty that we are **not** in a DOM transaction.
  13008. *
  13009. * You may want to call this when you know that some deeper aspect of the
  13010. * component's state has changed but `setState` was not called.
  13011. *
  13012. * This will not invoke `shouldUpdateComponent`, but it will invoke
  13013. * `componentWillUpdate` and `componentDidUpdate`.
  13014. *
  13015. * @param {ReactClass} publicInstance The instance that should rerender.
  13016. * @internal
  13017. */
  13018. enqueueForceUpdate: function(publicInstance) {
  13019. var internalInstance = getInternalInstanceReadyForUpdate(
  13020. publicInstance,
  13021. 'forceUpdate'
  13022. );
  13023. if (!internalInstance) {
  13024. return;
  13025. }
  13026. internalInstance._pendingForceUpdate = true;
  13027. enqueueUpdate(internalInstance);
  13028. },
  13029. /**
  13030. * Replaces all of the state. Always use this or `setState` to mutate state.
  13031. * You should treat `this.state` as immutable.
  13032. *
  13033. * There is no guarantee that `this.state` will be immediately updated, so
  13034. * accessing `this.state` after calling this method may return the old value.
  13035. *
  13036. * @param {ReactClass} publicInstance The instance that should rerender.
  13037. * @param {object} completeState Next state.
  13038. * @internal
  13039. */
  13040. enqueueReplaceState: function(publicInstance, completeState) {
  13041. var internalInstance = getInternalInstanceReadyForUpdate(
  13042. publicInstance,
  13043. 'replaceState'
  13044. );
  13045. if (!internalInstance) {
  13046. return;
  13047. }
  13048. internalInstance._pendingStateQueue = [completeState];
  13049. internalInstance._pendingReplaceState = true;
  13050. enqueueUpdate(internalInstance);
  13051. },
  13052. /**
  13053. * Sets a subset of the state. This only exists because _pendingState is
  13054. * internal. This provides a merging strategy that is not available to deep
  13055. * properties which is confusing. TODO: Expose pendingState or don't use it
  13056. * during the merge.
  13057. *
  13058. * @param {ReactClass} publicInstance The instance that should rerender.
  13059. * @param {object} partialState Next partial state to be merged with state.
  13060. * @internal
  13061. */
  13062. enqueueSetState: function(publicInstance, partialState) {
  13063. var internalInstance = getInternalInstanceReadyForUpdate(
  13064. publicInstance,
  13065. 'setState'
  13066. );
  13067. if (!internalInstance) {
  13068. return;
  13069. }
  13070. var queue =
  13071. internalInstance._pendingStateQueue ||
  13072. (internalInstance._pendingStateQueue = []);
  13073. queue.push(partialState);
  13074. enqueueUpdate(internalInstance);
  13075. },
  13076. /**
  13077. * Sets a subset of the props.
  13078. *
  13079. * @param {ReactClass} publicInstance The instance that should rerender.
  13080. * @param {object} partialProps Subset of the next props.
  13081. * @internal
  13082. */
  13083. enqueueSetProps: function(publicInstance, partialProps) {
  13084. var internalInstance = getInternalInstanceReadyForUpdate(
  13085. publicInstance,
  13086. 'setProps'
  13087. );
  13088. if (!internalInstance) {
  13089. return;
  13090. }
  13091. ("production" !== "development" ? invariant(
  13092. internalInstance._isTopLevel,
  13093. 'setProps(...): You called `setProps` on a ' +
  13094. 'component with a parent. This is an anti-pattern since props will ' +
  13095. 'get reactively updated when rendered. Instead, change the owner\'s ' +
  13096. '`render` method to pass the correct value as props to the component ' +
  13097. 'where it is created.'
  13098. ) : invariant(internalInstance._isTopLevel));
  13099. // Merge with the pending element if it exists, otherwise with existing
  13100. // element props.
  13101. var element = internalInstance._pendingElement ||
  13102. internalInstance._currentElement;
  13103. var props = assign({}, element.props, partialProps);
  13104. internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
  13105. element,
  13106. props
  13107. );
  13108. enqueueUpdate(internalInstance);
  13109. },
  13110. /**
  13111. * Replaces all of the props.
  13112. *
  13113. * @param {ReactClass} publicInstance The instance that should rerender.
  13114. * @param {object} props New props.
  13115. * @internal
  13116. */
  13117. enqueueReplaceProps: function(publicInstance, props) {
  13118. var internalInstance = getInternalInstanceReadyForUpdate(
  13119. publicInstance,
  13120. 'replaceProps'
  13121. );
  13122. if (!internalInstance) {
  13123. return;
  13124. }
  13125. ("production" !== "development" ? invariant(
  13126. internalInstance._isTopLevel,
  13127. 'replaceProps(...): You called `replaceProps` on a ' +
  13128. 'component with a parent. This is an anti-pattern since props will ' +
  13129. 'get reactively updated when rendered. Instead, change the owner\'s ' +
  13130. '`render` method to pass the correct value as props to the component ' +
  13131. 'where it is created.'
  13132. ) : invariant(internalInstance._isTopLevel));
  13133. // Merge with the pending element if it exists, otherwise with existing
  13134. // element props.
  13135. var element = internalInstance._pendingElement ||
  13136. internalInstance._currentElement;
  13137. internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
  13138. element,
  13139. props
  13140. );
  13141. enqueueUpdate(internalInstance);
  13142. },
  13143. enqueueElementInternal: function(internalInstance, newElement) {
  13144. internalInstance._pendingElement = newElement;
  13145. enqueueUpdate(internalInstance);
  13146. }
  13147. };
  13148. module.exports = ReactUpdateQueue;
  13149. },{"135":135,"154":154,"27":27,"39":39,"57":57,"67":67,"68":68,"87":87}],87:[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 ReactUpdates
  13159. */
  13160. 'use strict';
  13161. var CallbackQueue = _dereq_(6);
  13162. var PooledClass = _dereq_(28);
  13163. var ReactCurrentOwner = _dereq_(39);
  13164. var ReactPerf = _dereq_(75);
  13165. var ReactReconciler = _dereq_(81);
  13166. var Transaction = _dereq_(103);
  13167. var assign = _dereq_(27);
  13168. var invariant = _dereq_(135);
  13169. var warning = _dereq_(154);
  13170. var dirtyComponents = [];
  13171. var asapCallbackQueue = CallbackQueue.getPooled();
  13172. var asapEnqueued = false;
  13173. var batchingStrategy = null;
  13174. function ensureInjected() {
  13175. ("production" !== "development" ? invariant(
  13176. ReactUpdates.ReactReconcileTransaction && batchingStrategy,
  13177. 'ReactUpdates: must inject a reconcile transaction class and batching ' +
  13178. 'strategy'
  13179. ) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
  13180. }
  13181. var NESTED_UPDATES = {
  13182. initialize: function() {
  13183. this.dirtyComponentsLength = dirtyComponents.length;
  13184. },
  13185. close: function() {
  13186. if (this.dirtyComponentsLength !== dirtyComponents.length) {
  13187. // Additional updates were enqueued by componentDidUpdate handlers or
  13188. // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
  13189. // these new updates so that if A's componentDidUpdate calls setState on
  13190. // B, B will update before the callback A's updater provided when calling
  13191. // setState.
  13192. dirtyComponents.splice(0, this.dirtyComponentsLength);
  13193. flushBatchedUpdates();
  13194. } else {
  13195. dirtyComponents.length = 0;
  13196. }
  13197. }
  13198. };
  13199. var UPDATE_QUEUEING = {
  13200. initialize: function() {
  13201. this.callbackQueue.reset();
  13202. },
  13203. close: function() {
  13204. this.callbackQueue.notifyAll();
  13205. }
  13206. };
  13207. var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
  13208. function ReactUpdatesFlushTransaction() {
  13209. this.reinitializeTransaction();
  13210. this.dirtyComponentsLength = null;
  13211. this.callbackQueue = CallbackQueue.getPooled();
  13212. this.reconcileTransaction =
  13213. ReactUpdates.ReactReconcileTransaction.getPooled();
  13214. }
  13215. assign(
  13216. ReactUpdatesFlushTransaction.prototype,
  13217. Transaction.Mixin, {
  13218. getTransactionWrappers: function() {
  13219. return TRANSACTION_WRAPPERS;
  13220. },
  13221. destructor: function() {
  13222. this.dirtyComponentsLength = null;
  13223. CallbackQueue.release(this.callbackQueue);
  13224. this.callbackQueue = null;
  13225. ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
  13226. this.reconcileTransaction = null;
  13227. },
  13228. perform: function(method, scope, a) {
  13229. // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
  13230. // with this transaction's wrappers around it.
  13231. return Transaction.Mixin.perform.call(
  13232. this,
  13233. this.reconcileTransaction.perform,
  13234. this.reconcileTransaction,
  13235. method,
  13236. scope,
  13237. a
  13238. );
  13239. }
  13240. });
  13241. PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
  13242. function batchedUpdates(callback, a, b, c, d) {
  13243. ensureInjected();
  13244. batchingStrategy.batchedUpdates(callback, a, b, c, d);
  13245. }
  13246. /**
  13247. * Array comparator for ReactComponents by mount ordering.
  13248. *
  13249. * @param {ReactComponent} c1 first component you're comparing
  13250. * @param {ReactComponent} c2 second component you're comparing
  13251. * @return {number} Return value usable by Array.prototype.sort().
  13252. */
  13253. function mountOrderComparator(c1, c2) {
  13254. return c1._mountOrder - c2._mountOrder;
  13255. }
  13256. function runBatchedUpdates(transaction) {
  13257. var len = transaction.dirtyComponentsLength;
  13258. ("production" !== "development" ? invariant(
  13259. len === dirtyComponents.length,
  13260. 'Expected flush transaction\'s stored dirty-components length (%s) to ' +
  13261. 'match dirty-components array length (%s).',
  13262. len,
  13263. dirtyComponents.length
  13264. ) : invariant(len === dirtyComponents.length));
  13265. // Since reconciling a component higher in the owner hierarchy usually (not
  13266. // always -- see shouldComponentUpdate()) will reconcile children, reconcile
  13267. // them before their children by sorting the array.
  13268. dirtyComponents.sort(mountOrderComparator);
  13269. for (var i = 0; i < len; i++) {
  13270. // If a component is unmounted before pending changes apply, it will still
  13271. // be here, but we assume that it has cleared its _pendingCallbacks and
  13272. // that performUpdateIfNecessary is a noop.
  13273. var component = dirtyComponents[i];
  13274. // If performUpdateIfNecessary happens to enqueue any new updates, we
  13275. // shouldn't execute the callbacks until the next render happens, so
  13276. // stash the callbacks first
  13277. var callbacks = component._pendingCallbacks;
  13278. component._pendingCallbacks = null;
  13279. ReactReconciler.performUpdateIfNecessary(
  13280. component,
  13281. transaction.reconcileTransaction
  13282. );
  13283. if (callbacks) {
  13284. for (var j = 0; j < callbacks.length; j++) {
  13285. transaction.callbackQueue.enqueue(
  13286. callbacks[j],
  13287. component.getPublicInstance()
  13288. );
  13289. }
  13290. }
  13291. }
  13292. }
  13293. var flushBatchedUpdates = function() {
  13294. // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
  13295. // array and perform any updates enqueued by mount-ready handlers (i.e.,
  13296. // componentDidUpdate) but we need to check here too in order to catch
  13297. // updates enqueued by setState callbacks and asap calls.
  13298. while (dirtyComponents.length || asapEnqueued) {
  13299. if (dirtyComponents.length) {
  13300. var transaction = ReactUpdatesFlushTransaction.getPooled();
  13301. transaction.perform(runBatchedUpdates, null, transaction);
  13302. ReactUpdatesFlushTransaction.release(transaction);
  13303. }
  13304. if (asapEnqueued) {
  13305. asapEnqueued = false;
  13306. var queue = asapCallbackQueue;
  13307. asapCallbackQueue = CallbackQueue.getPooled();
  13308. queue.notifyAll();
  13309. CallbackQueue.release(queue);
  13310. }
  13311. }
  13312. };
  13313. flushBatchedUpdates = ReactPerf.measure(
  13314. 'ReactUpdates',
  13315. 'flushBatchedUpdates',
  13316. flushBatchedUpdates
  13317. );
  13318. /**
  13319. * Mark a component as needing a rerender, adding an optional callback to a
  13320. * list of functions which will be executed once the rerender occurs.
  13321. */
  13322. function enqueueUpdate(component) {
  13323. ensureInjected();
  13324. // Various parts of our code (such as ReactCompositeComponent's
  13325. // _renderValidatedComponent) assume that calls to render aren't nested;
  13326. // verify that that's the case. (This is called by each top-level update
  13327. // function, like setProps, setState, forceUpdate, etc.; creation and
  13328. // destruction of top-level components is guarded in ReactMount.)
  13329. ("production" !== "development" ? warning(
  13330. ReactCurrentOwner.current == null,
  13331. 'enqueueUpdate(): Render methods should be a pure function of props ' +
  13332. 'and state; triggering nested component updates from render is not ' +
  13333. 'allowed. If necessary, trigger nested updates in ' +
  13334. 'componentDidUpdate.'
  13335. ) : null);
  13336. if (!batchingStrategy.isBatchingUpdates) {
  13337. batchingStrategy.batchedUpdates(enqueueUpdate, component);
  13338. return;
  13339. }
  13340. dirtyComponents.push(component);
  13341. }
  13342. /**
  13343. * Enqueue a callback to be run at the end of the current batching cycle. Throws
  13344. * if no updates are currently being performed.
  13345. */
  13346. function asap(callback, context) {
  13347. ("production" !== "development" ? invariant(
  13348. batchingStrategy.isBatchingUpdates,
  13349. 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
  13350. 'updates are not being batched.'
  13351. ) : invariant(batchingStrategy.isBatchingUpdates));
  13352. asapCallbackQueue.enqueue(callback, context);
  13353. asapEnqueued = true;
  13354. }
  13355. var ReactUpdatesInjection = {
  13356. injectReconcileTransaction: function(ReconcileTransaction) {
  13357. ("production" !== "development" ? invariant(
  13358. ReconcileTransaction,
  13359. 'ReactUpdates: must provide a reconcile transaction class'
  13360. ) : invariant(ReconcileTransaction));
  13361. ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
  13362. },
  13363. injectBatchingStrategy: function(_batchingStrategy) {
  13364. ("production" !== "development" ? invariant(
  13365. _batchingStrategy,
  13366. 'ReactUpdates: must provide a batching strategy'
  13367. ) : invariant(_batchingStrategy));
  13368. ("production" !== "development" ? invariant(
  13369. typeof _batchingStrategy.batchedUpdates === 'function',
  13370. 'ReactUpdates: must provide a batchedUpdates() function'
  13371. ) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
  13372. ("production" !== "development" ? invariant(
  13373. typeof _batchingStrategy.isBatchingUpdates === 'boolean',
  13374. 'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
  13375. ) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
  13376. batchingStrategy = _batchingStrategy;
  13377. }
  13378. };
  13379. var ReactUpdates = {
  13380. /**
  13381. * React references `ReactReconcileTransaction` using this property in order
  13382. * to allow dependency injection.
  13383. *
  13384. * @internal
  13385. */
  13386. ReactReconcileTransaction: null,
  13387. batchedUpdates: batchedUpdates,
  13388. enqueueUpdate: enqueueUpdate,
  13389. flushBatchedUpdates: flushBatchedUpdates,
  13390. injection: ReactUpdatesInjection,
  13391. asap: asap
  13392. };
  13393. module.exports = ReactUpdates;
  13394. },{"103":103,"135":135,"154":154,"27":27,"28":28,"39":39,"6":6,"75":75,"81":81}],88:[function(_dereq_,module,exports){
  13395. /**
  13396. * Copyright 2013-2015, Facebook, Inc.
  13397. * All rights reserved.
  13398. *
  13399. * This source code is licensed under the BSD-style license found in the
  13400. * LICENSE file in the root directory of this source tree. An additional grant
  13401. * of patent rights can be found in the PATENTS file in the same directory.
  13402. *
  13403. * @providesModule SVGDOMPropertyConfig
  13404. */
  13405. /*jslint bitwise: true*/
  13406. 'use strict';
  13407. var DOMProperty = _dereq_(10);
  13408. var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
  13409. var SVGDOMPropertyConfig = {
  13410. Properties: {
  13411. clipPath: MUST_USE_ATTRIBUTE,
  13412. cx: MUST_USE_ATTRIBUTE,
  13413. cy: MUST_USE_ATTRIBUTE,
  13414. d: MUST_USE_ATTRIBUTE,
  13415. dx: MUST_USE_ATTRIBUTE,
  13416. dy: MUST_USE_ATTRIBUTE,
  13417. fill: MUST_USE_ATTRIBUTE,
  13418. fillOpacity: MUST_USE_ATTRIBUTE,
  13419. fontFamily: MUST_USE_ATTRIBUTE,
  13420. fontSize: MUST_USE_ATTRIBUTE,
  13421. fx: MUST_USE_ATTRIBUTE,
  13422. fy: MUST_USE_ATTRIBUTE,
  13423. gradientTransform: MUST_USE_ATTRIBUTE,
  13424. gradientUnits: MUST_USE_ATTRIBUTE,
  13425. markerEnd: MUST_USE_ATTRIBUTE,
  13426. markerMid: MUST_USE_ATTRIBUTE,
  13427. markerStart: MUST_USE_ATTRIBUTE,
  13428. offset: MUST_USE_ATTRIBUTE,
  13429. opacity: MUST_USE_ATTRIBUTE,
  13430. patternContentUnits: MUST_USE_ATTRIBUTE,
  13431. patternUnits: MUST_USE_ATTRIBUTE,
  13432. points: MUST_USE_ATTRIBUTE,
  13433. preserveAspectRatio: MUST_USE_ATTRIBUTE,
  13434. r: MUST_USE_ATTRIBUTE,
  13435. rx: MUST_USE_ATTRIBUTE,
  13436. ry: MUST_USE_ATTRIBUTE,
  13437. spreadMethod: MUST_USE_ATTRIBUTE,
  13438. stopColor: MUST_USE_ATTRIBUTE,
  13439. stopOpacity: MUST_USE_ATTRIBUTE,
  13440. stroke: MUST_USE_ATTRIBUTE,
  13441. strokeDasharray: MUST_USE_ATTRIBUTE,
  13442. strokeLinecap: MUST_USE_ATTRIBUTE,
  13443. strokeOpacity: MUST_USE_ATTRIBUTE,
  13444. strokeWidth: MUST_USE_ATTRIBUTE,
  13445. textAnchor: MUST_USE_ATTRIBUTE,
  13446. transform: MUST_USE_ATTRIBUTE,
  13447. version: MUST_USE_ATTRIBUTE,
  13448. viewBox: MUST_USE_ATTRIBUTE,
  13449. x1: MUST_USE_ATTRIBUTE,
  13450. x2: MUST_USE_ATTRIBUTE,
  13451. x: MUST_USE_ATTRIBUTE,
  13452. y1: MUST_USE_ATTRIBUTE,
  13453. y2: MUST_USE_ATTRIBUTE,
  13454. y: MUST_USE_ATTRIBUTE
  13455. },
  13456. DOMAttributeNames: {
  13457. clipPath: 'clip-path',
  13458. fillOpacity: 'fill-opacity',
  13459. fontFamily: 'font-family',
  13460. fontSize: 'font-size',
  13461. gradientTransform: 'gradientTransform',
  13462. gradientUnits: 'gradientUnits',
  13463. markerEnd: 'marker-end',
  13464. markerMid: 'marker-mid',
  13465. markerStart: 'marker-start',
  13466. patternContentUnits: 'patternContentUnits',
  13467. patternUnits: 'patternUnits',
  13468. preserveAspectRatio: 'preserveAspectRatio',
  13469. spreadMethod: 'spreadMethod',
  13470. stopColor: 'stop-color',
  13471. stopOpacity: 'stop-opacity',
  13472. strokeDasharray: 'stroke-dasharray',
  13473. strokeLinecap: 'stroke-linecap',
  13474. strokeOpacity: 'stroke-opacity',
  13475. strokeWidth: 'stroke-width',
  13476. textAnchor: 'text-anchor',
  13477. viewBox: 'viewBox'
  13478. }
  13479. };
  13480. module.exports = SVGDOMPropertyConfig;
  13481. },{"10":10}],89:[function(_dereq_,module,exports){
  13482. /**
  13483. * Copyright 2013-2015, Facebook, Inc.
  13484. * All rights reserved.
  13485. *
  13486. * This source code is licensed under the BSD-style license found in the
  13487. * LICENSE file in the root directory of this source tree. An additional grant
  13488. * of patent rights can be found in the PATENTS file in the same directory.
  13489. *
  13490. * @providesModule SelectEventPlugin
  13491. */
  13492. 'use strict';
  13493. var EventConstants = _dereq_(15);
  13494. var EventPropagators = _dereq_(20);
  13495. var ReactInputSelection = _dereq_(65);
  13496. var SyntheticEvent = _dereq_(95);
  13497. var getActiveElement = _dereq_(121);
  13498. var isTextInputElement = _dereq_(138);
  13499. var keyOf = _dereq_(141);
  13500. var shallowEqual = _dereq_(150);
  13501. var topLevelTypes = EventConstants.topLevelTypes;
  13502. var eventTypes = {
  13503. select: {
  13504. phasedRegistrationNames: {
  13505. bubbled: keyOf({onSelect: null}),
  13506. captured: keyOf({onSelectCapture: null})
  13507. },
  13508. dependencies: [
  13509. topLevelTypes.topBlur,
  13510. topLevelTypes.topContextMenu,
  13511. topLevelTypes.topFocus,
  13512. topLevelTypes.topKeyDown,
  13513. topLevelTypes.topMouseDown,
  13514. topLevelTypes.topMouseUp,
  13515. topLevelTypes.topSelectionChange
  13516. ]
  13517. }
  13518. };
  13519. var activeElement = null;
  13520. var activeElementID = null;
  13521. var lastSelection = null;
  13522. var mouseDown = false;
  13523. /**
  13524. * Get an object which is a unique representation of the current selection.
  13525. *
  13526. * The return value will not be consistent across nodes or browsers, but
  13527. * two identical selections on the same node will return identical objects.
  13528. *
  13529. * @param {DOMElement} node
  13530. * @param {object}
  13531. */
  13532. function getSelection(node) {
  13533. if ('selectionStart' in node &&
  13534. ReactInputSelection.hasSelectionCapabilities(node)) {
  13535. return {
  13536. start: node.selectionStart,
  13537. end: node.selectionEnd
  13538. };
  13539. } else if (window.getSelection) {
  13540. var selection = window.getSelection();
  13541. return {
  13542. anchorNode: selection.anchorNode,
  13543. anchorOffset: selection.anchorOffset,
  13544. focusNode: selection.focusNode,
  13545. focusOffset: selection.focusOffset
  13546. };
  13547. } else if (document.selection) {
  13548. var range = document.selection.createRange();
  13549. return {
  13550. parentElement: range.parentElement(),
  13551. text: range.text,
  13552. top: range.boundingTop,
  13553. left: range.boundingLeft
  13554. };
  13555. }
  13556. }
  13557. /**
  13558. * Poll selection to see whether it's changed.
  13559. *
  13560. * @param {object} nativeEvent
  13561. * @return {?SyntheticEvent}
  13562. */
  13563. function constructSelectEvent(nativeEvent) {
  13564. // Ensure we have the right element, and that the user is not dragging a
  13565. // selection (this matches native `select` event behavior). In HTML5, select
  13566. // fires only on input and textarea thus if there's no focused element we
  13567. // won't dispatch.
  13568. if (mouseDown ||
  13569. activeElement == null ||
  13570. activeElement !== getActiveElement()) {
  13571. return null;
  13572. }
  13573. // Only fire when selection has actually changed.
  13574. var currentSelection = getSelection(activeElement);
  13575. if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
  13576. lastSelection = currentSelection;
  13577. var syntheticEvent = SyntheticEvent.getPooled(
  13578. eventTypes.select,
  13579. activeElementID,
  13580. nativeEvent
  13581. );
  13582. syntheticEvent.type = 'select';
  13583. syntheticEvent.target = activeElement;
  13584. EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
  13585. return syntheticEvent;
  13586. }
  13587. }
  13588. /**
  13589. * This plugin creates an `onSelect` event that normalizes select events
  13590. * across form elements.
  13591. *
  13592. * Supported elements are:
  13593. * - input (see `isTextInputElement`)
  13594. * - textarea
  13595. * - contentEditable
  13596. *
  13597. * This differs from native browser implementations in the following ways:
  13598. * - Fires on contentEditable fields as well as inputs.
  13599. * - Fires for collapsed selection.
  13600. * - Fires after user input.
  13601. */
  13602. var SelectEventPlugin = {
  13603. eventTypes: eventTypes,
  13604. /**
  13605. * @param {string} topLevelType Record from `EventConstants`.
  13606. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  13607. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  13608. * @param {object} nativeEvent Native browser event.
  13609. * @return {*} An accumulation of synthetic events.
  13610. * @see {EventPluginHub.extractEvents}
  13611. */
  13612. extractEvents: function(
  13613. topLevelType,
  13614. topLevelTarget,
  13615. topLevelTargetID,
  13616. nativeEvent) {
  13617. switch (topLevelType) {
  13618. // Track the input node that has focus.
  13619. case topLevelTypes.topFocus:
  13620. if (isTextInputElement(topLevelTarget) ||
  13621. topLevelTarget.contentEditable === 'true') {
  13622. activeElement = topLevelTarget;
  13623. activeElementID = topLevelTargetID;
  13624. lastSelection = null;
  13625. }
  13626. break;
  13627. case topLevelTypes.topBlur:
  13628. activeElement = null;
  13629. activeElementID = null;
  13630. lastSelection = null;
  13631. break;
  13632. // Don't fire the event while the user is dragging. This matches the
  13633. // semantics of the native select event.
  13634. case topLevelTypes.topMouseDown:
  13635. mouseDown = true;
  13636. break;
  13637. case topLevelTypes.topContextMenu:
  13638. case topLevelTypes.topMouseUp:
  13639. mouseDown = false;
  13640. return constructSelectEvent(nativeEvent);
  13641. // Chrome and IE fire non-standard event when selection is changed (and
  13642. // sometimes when it hasn't).
  13643. // Firefox doesn't support selectionchange, so check selection status
  13644. // after each key entry. The selection changes after keydown and before
  13645. // keyup, but we check on keydown as well in the case of holding down a
  13646. // key, when multiple keydown events are fired but only one keyup is.
  13647. case topLevelTypes.topSelectionChange:
  13648. case topLevelTypes.topKeyDown:
  13649. case topLevelTypes.topKeyUp:
  13650. return constructSelectEvent(nativeEvent);
  13651. }
  13652. }
  13653. };
  13654. module.exports = SelectEventPlugin;
  13655. },{"121":121,"138":138,"141":141,"15":15,"150":150,"20":20,"65":65,"95":95}],90:[function(_dereq_,module,exports){
  13656. /**
  13657. * Copyright 2013-2015, Facebook, Inc.
  13658. * All rights reserved.
  13659. *
  13660. * This source code is licensed under the BSD-style license found in the
  13661. * LICENSE file in the root directory of this source tree. An additional grant
  13662. * of patent rights can be found in the PATENTS file in the same directory.
  13663. *
  13664. * @providesModule ServerReactRootIndex
  13665. * @typechecks
  13666. */
  13667. 'use strict';
  13668. /**
  13669. * Size of the reactRoot ID space. We generate random numbers for React root
  13670. * IDs and if there's a collision the events and DOM update system will
  13671. * get confused. In the future we need a way to generate GUIDs but for
  13672. * now this will work on a smaller scale.
  13673. */
  13674. var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
  13675. var ServerReactRootIndex = {
  13676. createReactRootIndex: function() {
  13677. return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
  13678. }
  13679. };
  13680. module.exports = ServerReactRootIndex;
  13681. },{}],91:[function(_dereq_,module,exports){
  13682. /**
  13683. * Copyright 2013-2015, Facebook, Inc.
  13684. * All rights reserved.
  13685. *
  13686. * This source code is licensed under the BSD-style license found in the
  13687. * LICENSE file in the root directory of this source tree. An additional grant
  13688. * of patent rights can be found in the PATENTS file in the same directory.
  13689. *
  13690. * @providesModule SimpleEventPlugin
  13691. */
  13692. 'use strict';
  13693. var EventConstants = _dereq_(15);
  13694. var EventPluginUtils = _dereq_(19);
  13695. var EventPropagators = _dereq_(20);
  13696. var SyntheticClipboardEvent = _dereq_(92);
  13697. var SyntheticEvent = _dereq_(95);
  13698. var SyntheticFocusEvent = _dereq_(96);
  13699. var SyntheticKeyboardEvent = _dereq_(98);
  13700. var SyntheticMouseEvent = _dereq_(99);
  13701. var SyntheticDragEvent = _dereq_(94);
  13702. var SyntheticTouchEvent = _dereq_(100);
  13703. var SyntheticUIEvent = _dereq_(101);
  13704. var SyntheticWheelEvent = _dereq_(102);
  13705. var getEventCharCode = _dereq_(122);
  13706. var invariant = _dereq_(135);
  13707. var keyOf = _dereq_(141);
  13708. var warning = _dereq_(154);
  13709. var topLevelTypes = EventConstants.topLevelTypes;
  13710. var eventTypes = {
  13711. blur: {
  13712. phasedRegistrationNames: {
  13713. bubbled: keyOf({onBlur: true}),
  13714. captured: keyOf({onBlurCapture: true})
  13715. }
  13716. },
  13717. click: {
  13718. phasedRegistrationNames: {
  13719. bubbled: keyOf({onClick: true}),
  13720. captured: keyOf({onClickCapture: true})
  13721. }
  13722. },
  13723. contextMenu: {
  13724. phasedRegistrationNames: {
  13725. bubbled: keyOf({onContextMenu: true}),
  13726. captured: keyOf({onContextMenuCapture: true})
  13727. }
  13728. },
  13729. copy: {
  13730. phasedRegistrationNames: {
  13731. bubbled: keyOf({onCopy: true}),
  13732. captured: keyOf({onCopyCapture: true})
  13733. }
  13734. },
  13735. cut: {
  13736. phasedRegistrationNames: {
  13737. bubbled: keyOf({onCut: true}),
  13738. captured: keyOf({onCutCapture: true})
  13739. }
  13740. },
  13741. doubleClick: {
  13742. phasedRegistrationNames: {
  13743. bubbled: keyOf({onDoubleClick: true}),
  13744. captured: keyOf({onDoubleClickCapture: true})
  13745. }
  13746. },
  13747. drag: {
  13748. phasedRegistrationNames: {
  13749. bubbled: keyOf({onDrag: true}),
  13750. captured: keyOf({onDragCapture: true})
  13751. }
  13752. },
  13753. dragEnd: {
  13754. phasedRegistrationNames: {
  13755. bubbled: keyOf({onDragEnd: true}),
  13756. captured: keyOf({onDragEndCapture: true})
  13757. }
  13758. },
  13759. dragEnter: {
  13760. phasedRegistrationNames: {
  13761. bubbled: keyOf({onDragEnter: true}),
  13762. captured: keyOf({onDragEnterCapture: true})
  13763. }
  13764. },
  13765. dragExit: {
  13766. phasedRegistrationNames: {
  13767. bubbled: keyOf({onDragExit: true}),
  13768. captured: keyOf({onDragExitCapture: true})
  13769. }
  13770. },
  13771. dragLeave: {
  13772. phasedRegistrationNames: {
  13773. bubbled: keyOf({onDragLeave: true}),
  13774. captured: keyOf({onDragLeaveCapture: true})
  13775. }
  13776. },
  13777. dragOver: {
  13778. phasedRegistrationNames: {
  13779. bubbled: keyOf({onDragOver: true}),
  13780. captured: keyOf({onDragOverCapture: true})
  13781. }
  13782. },
  13783. dragStart: {
  13784. phasedRegistrationNames: {
  13785. bubbled: keyOf({onDragStart: true}),
  13786. captured: keyOf({onDragStartCapture: true})
  13787. }
  13788. },
  13789. drop: {
  13790. phasedRegistrationNames: {
  13791. bubbled: keyOf({onDrop: true}),
  13792. captured: keyOf({onDropCapture: true})
  13793. }
  13794. },
  13795. focus: {
  13796. phasedRegistrationNames: {
  13797. bubbled: keyOf({onFocus: true}),
  13798. captured: keyOf({onFocusCapture: true})
  13799. }
  13800. },
  13801. input: {
  13802. phasedRegistrationNames: {
  13803. bubbled: keyOf({onInput: true}),
  13804. captured: keyOf({onInputCapture: true})
  13805. }
  13806. },
  13807. keyDown: {
  13808. phasedRegistrationNames: {
  13809. bubbled: keyOf({onKeyDown: true}),
  13810. captured: keyOf({onKeyDownCapture: true})
  13811. }
  13812. },
  13813. keyPress: {
  13814. phasedRegistrationNames: {
  13815. bubbled: keyOf({onKeyPress: true}),
  13816. captured: keyOf({onKeyPressCapture: true})
  13817. }
  13818. },
  13819. keyUp: {
  13820. phasedRegistrationNames: {
  13821. bubbled: keyOf({onKeyUp: true}),
  13822. captured: keyOf({onKeyUpCapture: true})
  13823. }
  13824. },
  13825. load: {
  13826. phasedRegistrationNames: {
  13827. bubbled: keyOf({onLoad: true}),
  13828. captured: keyOf({onLoadCapture: true})
  13829. }
  13830. },
  13831. error: {
  13832. phasedRegistrationNames: {
  13833. bubbled: keyOf({onError: true}),
  13834. captured: keyOf({onErrorCapture: true})
  13835. }
  13836. },
  13837. // Note: We do not allow listening to mouseOver events. Instead, use the
  13838. // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
  13839. mouseDown: {
  13840. phasedRegistrationNames: {
  13841. bubbled: keyOf({onMouseDown: true}),
  13842. captured: keyOf({onMouseDownCapture: true})
  13843. }
  13844. },
  13845. mouseMove: {
  13846. phasedRegistrationNames: {
  13847. bubbled: keyOf({onMouseMove: true}),
  13848. captured: keyOf({onMouseMoveCapture: true})
  13849. }
  13850. },
  13851. mouseOut: {
  13852. phasedRegistrationNames: {
  13853. bubbled: keyOf({onMouseOut: true}),
  13854. captured: keyOf({onMouseOutCapture: true})
  13855. }
  13856. },
  13857. mouseOver: {
  13858. phasedRegistrationNames: {
  13859. bubbled: keyOf({onMouseOver: true}),
  13860. captured: keyOf({onMouseOverCapture: true})
  13861. }
  13862. },
  13863. mouseUp: {
  13864. phasedRegistrationNames: {
  13865. bubbled: keyOf({onMouseUp: true}),
  13866. captured: keyOf({onMouseUpCapture: true})
  13867. }
  13868. },
  13869. paste: {
  13870. phasedRegistrationNames: {
  13871. bubbled: keyOf({onPaste: true}),
  13872. captured: keyOf({onPasteCapture: true})
  13873. }
  13874. },
  13875. reset: {
  13876. phasedRegistrationNames: {
  13877. bubbled: keyOf({onReset: true}),
  13878. captured: keyOf({onResetCapture: true})
  13879. }
  13880. },
  13881. scroll: {
  13882. phasedRegistrationNames: {
  13883. bubbled: keyOf({onScroll: true}),
  13884. captured: keyOf({onScrollCapture: true})
  13885. }
  13886. },
  13887. submit: {
  13888. phasedRegistrationNames: {
  13889. bubbled: keyOf({onSubmit: true}),
  13890. captured: keyOf({onSubmitCapture: true})
  13891. }
  13892. },
  13893. touchCancel: {
  13894. phasedRegistrationNames: {
  13895. bubbled: keyOf({onTouchCancel: true}),
  13896. captured: keyOf({onTouchCancelCapture: true})
  13897. }
  13898. },
  13899. touchEnd: {
  13900. phasedRegistrationNames: {
  13901. bubbled: keyOf({onTouchEnd: true}),
  13902. captured: keyOf({onTouchEndCapture: true})
  13903. }
  13904. },
  13905. touchMove: {
  13906. phasedRegistrationNames: {
  13907. bubbled: keyOf({onTouchMove: true}),
  13908. captured: keyOf({onTouchMoveCapture: true})
  13909. }
  13910. },
  13911. touchStart: {
  13912. phasedRegistrationNames: {
  13913. bubbled: keyOf({onTouchStart: true}),
  13914. captured: keyOf({onTouchStartCapture: true})
  13915. }
  13916. },
  13917. wheel: {
  13918. phasedRegistrationNames: {
  13919. bubbled: keyOf({onWheel: true}),
  13920. captured: keyOf({onWheelCapture: true})
  13921. }
  13922. }
  13923. };
  13924. var topLevelEventsToDispatchConfig = {
  13925. topBlur: eventTypes.blur,
  13926. topClick: eventTypes.click,
  13927. topContextMenu: eventTypes.contextMenu,
  13928. topCopy: eventTypes.copy,
  13929. topCut: eventTypes.cut,
  13930. topDoubleClick: eventTypes.doubleClick,
  13931. topDrag: eventTypes.drag,
  13932. topDragEnd: eventTypes.dragEnd,
  13933. topDragEnter: eventTypes.dragEnter,
  13934. topDragExit: eventTypes.dragExit,
  13935. topDragLeave: eventTypes.dragLeave,
  13936. topDragOver: eventTypes.dragOver,
  13937. topDragStart: eventTypes.dragStart,
  13938. topDrop: eventTypes.drop,
  13939. topError: eventTypes.error,
  13940. topFocus: eventTypes.focus,
  13941. topInput: eventTypes.input,
  13942. topKeyDown: eventTypes.keyDown,
  13943. topKeyPress: eventTypes.keyPress,
  13944. topKeyUp: eventTypes.keyUp,
  13945. topLoad: eventTypes.load,
  13946. topMouseDown: eventTypes.mouseDown,
  13947. topMouseMove: eventTypes.mouseMove,
  13948. topMouseOut: eventTypes.mouseOut,
  13949. topMouseOver: eventTypes.mouseOver,
  13950. topMouseUp: eventTypes.mouseUp,
  13951. topPaste: eventTypes.paste,
  13952. topReset: eventTypes.reset,
  13953. topScroll: eventTypes.scroll,
  13954. topSubmit: eventTypes.submit,
  13955. topTouchCancel: eventTypes.touchCancel,
  13956. topTouchEnd: eventTypes.touchEnd,
  13957. topTouchMove: eventTypes.touchMove,
  13958. topTouchStart: eventTypes.touchStart,
  13959. topWheel: eventTypes.wheel
  13960. };
  13961. for (var type in topLevelEventsToDispatchConfig) {
  13962. topLevelEventsToDispatchConfig[type].dependencies = [type];
  13963. }
  13964. var SimpleEventPlugin = {
  13965. eventTypes: eventTypes,
  13966. /**
  13967. * Same as the default implementation, except cancels the event when return
  13968. * value is false. This behavior will be disabled in a future release.
  13969. *
  13970. * @param {object} Event to be dispatched.
  13971. * @param {function} Application-level callback.
  13972. * @param {string} domID DOM ID to pass to the callback.
  13973. */
  13974. executeDispatch: function(event, listener, domID) {
  13975. var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
  13976. ("production" !== "development" ? warning(
  13977. typeof returnValue !== 'boolean',
  13978. 'Returning `false` from an event handler is deprecated and will be ' +
  13979. 'ignored in a future release. Instead, manually call ' +
  13980. 'e.stopPropagation() or e.preventDefault(), as appropriate.'
  13981. ) : null);
  13982. if (returnValue === false) {
  13983. event.stopPropagation();
  13984. event.preventDefault();
  13985. }
  13986. },
  13987. /**
  13988. * @param {string} topLevelType Record from `EventConstants`.
  13989. * @param {DOMEventTarget} topLevelTarget The listening component root node.
  13990. * @param {string} topLevelTargetID ID of `topLevelTarget`.
  13991. * @param {object} nativeEvent Native browser event.
  13992. * @return {*} An accumulation of synthetic events.
  13993. * @see {EventPluginHub.extractEvents}
  13994. */
  13995. extractEvents: function(
  13996. topLevelType,
  13997. topLevelTarget,
  13998. topLevelTargetID,
  13999. nativeEvent) {
  14000. var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
  14001. if (!dispatchConfig) {
  14002. return null;
  14003. }
  14004. var EventConstructor;
  14005. switch (topLevelType) {
  14006. case topLevelTypes.topInput:
  14007. case topLevelTypes.topLoad:
  14008. case topLevelTypes.topError:
  14009. case topLevelTypes.topReset:
  14010. case topLevelTypes.topSubmit:
  14011. // HTML Events
  14012. // @see http://www.w3.org/TR/html5/index.html#events-0
  14013. EventConstructor = SyntheticEvent;
  14014. break;
  14015. case topLevelTypes.topKeyPress:
  14016. // FireFox creates a keypress event for function keys too. This removes
  14017. // the unwanted keypress events. Enter is however both printable and
  14018. // non-printable. One would expect Tab to be as well (but it isn't).
  14019. if (getEventCharCode(nativeEvent) === 0) {
  14020. return null;
  14021. }
  14022. /* falls through */
  14023. case topLevelTypes.topKeyDown:
  14024. case topLevelTypes.topKeyUp:
  14025. EventConstructor = SyntheticKeyboardEvent;
  14026. break;
  14027. case topLevelTypes.topBlur:
  14028. case topLevelTypes.topFocus:
  14029. EventConstructor = SyntheticFocusEvent;
  14030. break;
  14031. case topLevelTypes.topClick:
  14032. // Firefox creates a click event on right mouse clicks. This removes the
  14033. // unwanted click events.
  14034. if (nativeEvent.button === 2) {
  14035. return null;
  14036. }
  14037. /* falls through */
  14038. case topLevelTypes.topContextMenu:
  14039. case topLevelTypes.topDoubleClick:
  14040. case topLevelTypes.topMouseDown:
  14041. case topLevelTypes.topMouseMove:
  14042. case topLevelTypes.topMouseOut:
  14043. case topLevelTypes.topMouseOver:
  14044. case topLevelTypes.topMouseUp:
  14045. EventConstructor = SyntheticMouseEvent;
  14046. break;
  14047. case topLevelTypes.topDrag:
  14048. case topLevelTypes.topDragEnd:
  14049. case topLevelTypes.topDragEnter:
  14050. case topLevelTypes.topDragExit:
  14051. case topLevelTypes.topDragLeave:
  14052. case topLevelTypes.topDragOver:
  14053. case topLevelTypes.topDragStart:
  14054. case topLevelTypes.topDrop:
  14055. EventConstructor = SyntheticDragEvent;
  14056. break;
  14057. case topLevelTypes.topTouchCancel:
  14058. case topLevelTypes.topTouchEnd:
  14059. case topLevelTypes.topTouchMove:
  14060. case topLevelTypes.topTouchStart:
  14061. EventConstructor = SyntheticTouchEvent;
  14062. break;
  14063. case topLevelTypes.topScroll:
  14064. EventConstructor = SyntheticUIEvent;
  14065. break;
  14066. case topLevelTypes.topWheel:
  14067. EventConstructor = SyntheticWheelEvent;
  14068. break;
  14069. case topLevelTypes.topCopy:
  14070. case topLevelTypes.topCut:
  14071. case topLevelTypes.topPaste:
  14072. EventConstructor = SyntheticClipboardEvent;
  14073. break;
  14074. }
  14075. ("production" !== "development" ? invariant(
  14076. EventConstructor,
  14077. 'SimpleEventPlugin: Unhandled event type, `%s`.',
  14078. topLevelType
  14079. ) : invariant(EventConstructor));
  14080. var event = EventConstructor.getPooled(
  14081. dispatchConfig,
  14082. topLevelTargetID,
  14083. nativeEvent
  14084. );
  14085. EventPropagators.accumulateTwoPhaseDispatches(event);
  14086. return event;
  14087. }
  14088. };
  14089. module.exports = SimpleEventPlugin;
  14090. },{"100":100,"101":101,"102":102,"122":122,"135":135,"141":141,"15":15,"154":154,"19":19,"20":20,"92":92,"94":94,"95":95,"96":96,"98":98,"99":99}],92:[function(_dereq_,module,exports){
  14091. /**
  14092. * Copyright 2013-2015, Facebook, Inc.
  14093. * All rights reserved.
  14094. *
  14095. * This source code is licensed under the BSD-style license found in the
  14096. * LICENSE file in the root directory of this source tree. An additional grant
  14097. * of patent rights can be found in the PATENTS file in the same directory.
  14098. *
  14099. * @providesModule SyntheticClipboardEvent
  14100. * @typechecks static-only
  14101. */
  14102. 'use strict';
  14103. var SyntheticEvent = _dereq_(95);
  14104. /**
  14105. * @interface Event
  14106. * @see http://www.w3.org/TR/clipboard-apis/
  14107. */
  14108. var ClipboardEventInterface = {
  14109. clipboardData: function(event) {
  14110. return (
  14111. 'clipboardData' in event ?
  14112. event.clipboardData :
  14113. window.clipboardData
  14114. );
  14115. }
  14116. };
  14117. /**
  14118. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14119. * @param {string} dispatchMarker Marker identifying the event target.
  14120. * @param {object} nativeEvent Native browser event.
  14121. * @extends {SyntheticUIEvent}
  14122. */
  14123. function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14124. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14125. }
  14126. SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
  14127. module.exports = SyntheticClipboardEvent;
  14128. },{"95":95}],93:[function(_dereq_,module,exports){
  14129. /**
  14130. * Copyright 2013-2015, Facebook, Inc.
  14131. * All rights reserved.
  14132. *
  14133. * This source code is licensed under the BSD-style license found in the
  14134. * LICENSE file in the root directory of this source tree. An additional grant
  14135. * of patent rights can be found in the PATENTS file in the same directory.
  14136. *
  14137. * @providesModule SyntheticCompositionEvent
  14138. * @typechecks static-only
  14139. */
  14140. 'use strict';
  14141. var SyntheticEvent = _dereq_(95);
  14142. /**
  14143. * @interface Event
  14144. * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
  14145. */
  14146. var CompositionEventInterface = {
  14147. data: null
  14148. };
  14149. /**
  14150. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14151. * @param {string} dispatchMarker Marker identifying the event target.
  14152. * @param {object} nativeEvent Native browser event.
  14153. * @extends {SyntheticUIEvent}
  14154. */
  14155. function SyntheticCompositionEvent(
  14156. dispatchConfig,
  14157. dispatchMarker,
  14158. nativeEvent) {
  14159. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14160. }
  14161. SyntheticEvent.augmentClass(
  14162. SyntheticCompositionEvent,
  14163. CompositionEventInterface
  14164. );
  14165. module.exports = SyntheticCompositionEvent;
  14166. },{"95":95}],94:[function(_dereq_,module,exports){
  14167. /**
  14168. * Copyright 2013-2015, Facebook, Inc.
  14169. * All rights reserved.
  14170. *
  14171. * This source code is licensed under the BSD-style license found in the
  14172. * LICENSE file in the root directory of this source tree. An additional grant
  14173. * of patent rights can be found in the PATENTS file in the same directory.
  14174. *
  14175. * @providesModule SyntheticDragEvent
  14176. * @typechecks static-only
  14177. */
  14178. 'use strict';
  14179. var SyntheticMouseEvent = _dereq_(99);
  14180. /**
  14181. * @interface DragEvent
  14182. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14183. */
  14184. var DragEventInterface = {
  14185. dataTransfer: null
  14186. };
  14187. /**
  14188. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14189. * @param {string} dispatchMarker Marker identifying the event target.
  14190. * @param {object} nativeEvent Native browser event.
  14191. * @extends {SyntheticUIEvent}
  14192. */
  14193. function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14194. SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14195. }
  14196. SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
  14197. module.exports = SyntheticDragEvent;
  14198. },{"99":99}],95:[function(_dereq_,module,exports){
  14199. /**
  14200. * Copyright 2013-2015, Facebook, Inc.
  14201. * All rights reserved.
  14202. *
  14203. * This source code is licensed under the BSD-style license found in the
  14204. * LICENSE file in the root directory of this source tree. An additional grant
  14205. * of patent rights can be found in the PATENTS file in the same directory.
  14206. *
  14207. * @providesModule SyntheticEvent
  14208. * @typechecks static-only
  14209. */
  14210. 'use strict';
  14211. var PooledClass = _dereq_(28);
  14212. var assign = _dereq_(27);
  14213. var emptyFunction = _dereq_(114);
  14214. var getEventTarget = _dereq_(125);
  14215. /**
  14216. * @interface Event
  14217. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14218. */
  14219. var EventInterface = {
  14220. type: null,
  14221. target: getEventTarget,
  14222. // currentTarget is set when dispatching; no use in copying it here
  14223. currentTarget: emptyFunction.thatReturnsNull,
  14224. eventPhase: null,
  14225. bubbles: null,
  14226. cancelable: null,
  14227. timeStamp: function(event) {
  14228. return event.timeStamp || Date.now();
  14229. },
  14230. defaultPrevented: null,
  14231. isTrusted: null
  14232. };
  14233. /**
  14234. * Synthetic events are dispatched by event plugins, typically in response to a
  14235. * top-level event delegation handler.
  14236. *
  14237. * These systems should generally use pooling to reduce the frequency of garbage
  14238. * collection. The system should check `isPersistent` to determine whether the
  14239. * event should be released into the pool after being dispatched. Users that
  14240. * need a persisted event should invoke `persist`.
  14241. *
  14242. * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
  14243. * normalizing browser quirks. Subclasses do not necessarily have to implement a
  14244. * DOM interface; custom application-specific events can also subclass this.
  14245. *
  14246. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14247. * @param {string} dispatchMarker Marker identifying the event target.
  14248. * @param {object} nativeEvent Native browser event.
  14249. */
  14250. function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14251. this.dispatchConfig = dispatchConfig;
  14252. this.dispatchMarker = dispatchMarker;
  14253. this.nativeEvent = nativeEvent;
  14254. var Interface = this.constructor.Interface;
  14255. for (var propName in Interface) {
  14256. if (!Interface.hasOwnProperty(propName)) {
  14257. continue;
  14258. }
  14259. var normalize = Interface[propName];
  14260. if (normalize) {
  14261. this[propName] = normalize(nativeEvent);
  14262. } else {
  14263. this[propName] = nativeEvent[propName];
  14264. }
  14265. }
  14266. var defaultPrevented = nativeEvent.defaultPrevented != null ?
  14267. nativeEvent.defaultPrevented :
  14268. nativeEvent.returnValue === false;
  14269. if (defaultPrevented) {
  14270. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  14271. } else {
  14272. this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
  14273. }
  14274. this.isPropagationStopped = emptyFunction.thatReturnsFalse;
  14275. }
  14276. assign(SyntheticEvent.prototype, {
  14277. preventDefault: function() {
  14278. this.defaultPrevented = true;
  14279. var event = this.nativeEvent;
  14280. if (event.preventDefault) {
  14281. event.preventDefault();
  14282. } else {
  14283. event.returnValue = false;
  14284. }
  14285. this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
  14286. },
  14287. stopPropagation: function() {
  14288. var event = this.nativeEvent;
  14289. if (event.stopPropagation) {
  14290. event.stopPropagation();
  14291. } else {
  14292. event.cancelBubble = true;
  14293. }
  14294. this.isPropagationStopped = emptyFunction.thatReturnsTrue;
  14295. },
  14296. /**
  14297. * We release all dispatched `SyntheticEvent`s after each event loop, adding
  14298. * them back into the pool. This allows a way to hold onto a reference that
  14299. * won't be added back into the pool.
  14300. */
  14301. persist: function() {
  14302. this.isPersistent = emptyFunction.thatReturnsTrue;
  14303. },
  14304. /**
  14305. * Checks if this event should be released back into the pool.
  14306. *
  14307. * @return {boolean} True if this should not be released, false otherwise.
  14308. */
  14309. isPersistent: emptyFunction.thatReturnsFalse,
  14310. /**
  14311. * `PooledClass` looks for `destructor` on each instance it releases.
  14312. */
  14313. destructor: function() {
  14314. var Interface = this.constructor.Interface;
  14315. for (var propName in Interface) {
  14316. this[propName] = null;
  14317. }
  14318. this.dispatchConfig = null;
  14319. this.dispatchMarker = null;
  14320. this.nativeEvent = null;
  14321. }
  14322. });
  14323. SyntheticEvent.Interface = EventInterface;
  14324. /**
  14325. * Helper to reduce boilerplate when creating subclasses.
  14326. *
  14327. * @param {function} Class
  14328. * @param {?object} Interface
  14329. */
  14330. SyntheticEvent.augmentClass = function(Class, Interface) {
  14331. var Super = this;
  14332. var prototype = Object.create(Super.prototype);
  14333. assign(prototype, Class.prototype);
  14334. Class.prototype = prototype;
  14335. Class.prototype.constructor = Class;
  14336. Class.Interface = assign({}, Super.Interface, Interface);
  14337. Class.augmentClass = Super.augmentClass;
  14338. PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
  14339. };
  14340. PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
  14341. module.exports = SyntheticEvent;
  14342. },{"114":114,"125":125,"27":27,"28":28}],96:[function(_dereq_,module,exports){
  14343. /**
  14344. * Copyright 2013-2015, Facebook, Inc.
  14345. * All rights reserved.
  14346. *
  14347. * This source code is licensed under the BSD-style license found in the
  14348. * LICENSE file in the root directory of this source tree. An additional grant
  14349. * of patent rights can be found in the PATENTS file in the same directory.
  14350. *
  14351. * @providesModule SyntheticFocusEvent
  14352. * @typechecks static-only
  14353. */
  14354. 'use strict';
  14355. var SyntheticUIEvent = _dereq_(101);
  14356. /**
  14357. * @interface FocusEvent
  14358. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14359. */
  14360. var FocusEventInterface = {
  14361. relatedTarget: null
  14362. };
  14363. /**
  14364. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14365. * @param {string} dispatchMarker Marker identifying the event target.
  14366. * @param {object} nativeEvent Native browser event.
  14367. * @extends {SyntheticUIEvent}
  14368. */
  14369. function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14370. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14371. }
  14372. SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
  14373. module.exports = SyntheticFocusEvent;
  14374. },{"101":101}],97:[function(_dereq_,module,exports){
  14375. /**
  14376. * Copyright 2013-2015, Facebook, Inc.
  14377. * All rights reserved.
  14378. *
  14379. * This source code is licensed under the BSD-style license found in the
  14380. * LICENSE file in the root directory of this source tree. An additional grant
  14381. * of patent rights can be found in the PATENTS file in the same directory.
  14382. *
  14383. * @providesModule SyntheticInputEvent
  14384. * @typechecks static-only
  14385. */
  14386. 'use strict';
  14387. var SyntheticEvent = _dereq_(95);
  14388. /**
  14389. * @interface Event
  14390. * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
  14391. * /#events-inputevents
  14392. */
  14393. var InputEventInterface = {
  14394. data: null
  14395. };
  14396. /**
  14397. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14398. * @param {string} dispatchMarker Marker identifying the event target.
  14399. * @param {object} nativeEvent Native browser event.
  14400. * @extends {SyntheticUIEvent}
  14401. */
  14402. function SyntheticInputEvent(
  14403. dispatchConfig,
  14404. dispatchMarker,
  14405. nativeEvent) {
  14406. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14407. }
  14408. SyntheticEvent.augmentClass(
  14409. SyntheticInputEvent,
  14410. InputEventInterface
  14411. );
  14412. module.exports = SyntheticInputEvent;
  14413. },{"95":95}],98:[function(_dereq_,module,exports){
  14414. /**
  14415. * Copyright 2013-2015, Facebook, Inc.
  14416. * All rights reserved.
  14417. *
  14418. * This source code is licensed under the BSD-style license found in the
  14419. * LICENSE file in the root directory of this source tree. An additional grant
  14420. * of patent rights can be found in the PATENTS file in the same directory.
  14421. *
  14422. * @providesModule SyntheticKeyboardEvent
  14423. * @typechecks static-only
  14424. */
  14425. 'use strict';
  14426. var SyntheticUIEvent = _dereq_(101);
  14427. var getEventCharCode = _dereq_(122);
  14428. var getEventKey = _dereq_(123);
  14429. var getEventModifierState = _dereq_(124);
  14430. /**
  14431. * @interface KeyboardEvent
  14432. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14433. */
  14434. var KeyboardEventInterface = {
  14435. key: getEventKey,
  14436. location: null,
  14437. ctrlKey: null,
  14438. shiftKey: null,
  14439. altKey: null,
  14440. metaKey: null,
  14441. repeat: null,
  14442. locale: null,
  14443. getModifierState: getEventModifierState,
  14444. // Legacy Interface
  14445. charCode: function(event) {
  14446. // `charCode` is the result of a KeyPress event and represents the value of
  14447. // the actual printable character.
  14448. // KeyPress is deprecated, but its replacement is not yet final and not
  14449. // implemented in any major browser. Only KeyPress has charCode.
  14450. if (event.type === 'keypress') {
  14451. return getEventCharCode(event);
  14452. }
  14453. return 0;
  14454. },
  14455. keyCode: function(event) {
  14456. // `keyCode` is the result of a KeyDown/Up event and represents the value of
  14457. // physical keyboard key.
  14458. // The actual meaning of the value depends on the users' keyboard layout
  14459. // which cannot be detected. Assuming that it is a US keyboard layout
  14460. // provides a surprisingly accurate mapping for US and European users.
  14461. // Due to this, it is left to the user to implement at this time.
  14462. if (event.type === 'keydown' || event.type === 'keyup') {
  14463. return event.keyCode;
  14464. }
  14465. return 0;
  14466. },
  14467. which: function(event) {
  14468. // `which` is an alias for either `keyCode` or `charCode` depending on the
  14469. // type of the event.
  14470. if (event.type === 'keypress') {
  14471. return getEventCharCode(event);
  14472. }
  14473. if (event.type === 'keydown' || event.type === 'keyup') {
  14474. return event.keyCode;
  14475. }
  14476. return 0;
  14477. }
  14478. };
  14479. /**
  14480. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14481. * @param {string} dispatchMarker Marker identifying the event target.
  14482. * @param {object} nativeEvent Native browser event.
  14483. * @extends {SyntheticUIEvent}
  14484. */
  14485. function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14486. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14487. }
  14488. SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
  14489. module.exports = SyntheticKeyboardEvent;
  14490. },{"101":101,"122":122,"123":123,"124":124}],99:[function(_dereq_,module,exports){
  14491. /**
  14492. * Copyright 2013-2015, Facebook, Inc.
  14493. * All rights reserved.
  14494. *
  14495. * This source code is licensed under the BSD-style license found in the
  14496. * LICENSE file in the root directory of this source tree. An additional grant
  14497. * of patent rights can be found in the PATENTS file in the same directory.
  14498. *
  14499. * @providesModule SyntheticMouseEvent
  14500. * @typechecks static-only
  14501. */
  14502. 'use strict';
  14503. var SyntheticUIEvent = _dereq_(101);
  14504. var ViewportMetrics = _dereq_(104);
  14505. var getEventModifierState = _dereq_(124);
  14506. /**
  14507. * @interface MouseEvent
  14508. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14509. */
  14510. var MouseEventInterface = {
  14511. screenX: null,
  14512. screenY: null,
  14513. clientX: null,
  14514. clientY: null,
  14515. ctrlKey: null,
  14516. shiftKey: null,
  14517. altKey: null,
  14518. metaKey: null,
  14519. getModifierState: getEventModifierState,
  14520. button: function(event) {
  14521. // Webkit, Firefox, IE9+
  14522. // which: 1 2 3
  14523. // button: 0 1 2 (standard)
  14524. var button = event.button;
  14525. if ('which' in event) {
  14526. return button;
  14527. }
  14528. // IE<9
  14529. // which: undefined
  14530. // button: 0 0 0
  14531. // button: 1 4 2 (onmouseup)
  14532. return button === 2 ? 2 : button === 4 ? 1 : 0;
  14533. },
  14534. buttons: null,
  14535. relatedTarget: function(event) {
  14536. return event.relatedTarget || (
  14537. ((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
  14538. );
  14539. },
  14540. // "Proprietary" Interface.
  14541. pageX: function(event) {
  14542. return 'pageX' in event ?
  14543. event.pageX :
  14544. event.clientX + ViewportMetrics.currentScrollLeft;
  14545. },
  14546. pageY: function(event) {
  14547. return 'pageY' in event ?
  14548. event.pageY :
  14549. event.clientY + ViewportMetrics.currentScrollTop;
  14550. }
  14551. };
  14552. /**
  14553. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14554. * @param {string} dispatchMarker Marker identifying the event target.
  14555. * @param {object} nativeEvent Native browser event.
  14556. * @extends {SyntheticUIEvent}
  14557. */
  14558. function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14559. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14560. }
  14561. SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
  14562. module.exports = SyntheticMouseEvent;
  14563. },{"101":101,"104":104,"124":124}],100:[function(_dereq_,module,exports){
  14564. /**
  14565. * Copyright 2013-2015, Facebook, Inc.
  14566. * All rights reserved.
  14567. *
  14568. * This source code is licensed under the BSD-style license found in the
  14569. * LICENSE file in the root directory of this source tree. An additional grant
  14570. * of patent rights can be found in the PATENTS file in the same directory.
  14571. *
  14572. * @providesModule SyntheticTouchEvent
  14573. * @typechecks static-only
  14574. */
  14575. 'use strict';
  14576. var SyntheticUIEvent = _dereq_(101);
  14577. var getEventModifierState = _dereq_(124);
  14578. /**
  14579. * @interface TouchEvent
  14580. * @see http://www.w3.org/TR/touch-events/
  14581. */
  14582. var TouchEventInterface = {
  14583. touches: null,
  14584. targetTouches: null,
  14585. changedTouches: null,
  14586. altKey: null,
  14587. metaKey: null,
  14588. ctrlKey: null,
  14589. shiftKey: null,
  14590. getModifierState: getEventModifierState
  14591. };
  14592. /**
  14593. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14594. * @param {string} dispatchMarker Marker identifying the event target.
  14595. * @param {object} nativeEvent Native browser event.
  14596. * @extends {SyntheticUIEvent}
  14597. */
  14598. function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14599. SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14600. }
  14601. SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
  14602. module.exports = SyntheticTouchEvent;
  14603. },{"101":101,"124":124}],101:[function(_dereq_,module,exports){
  14604. /**
  14605. * Copyright 2013-2015, Facebook, Inc.
  14606. * All rights reserved.
  14607. *
  14608. * This source code is licensed under the BSD-style license found in the
  14609. * LICENSE file in the root directory of this source tree. An additional grant
  14610. * of patent rights can be found in the PATENTS file in the same directory.
  14611. *
  14612. * @providesModule SyntheticUIEvent
  14613. * @typechecks static-only
  14614. */
  14615. 'use strict';
  14616. var SyntheticEvent = _dereq_(95);
  14617. var getEventTarget = _dereq_(125);
  14618. /**
  14619. * @interface UIEvent
  14620. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14621. */
  14622. var UIEventInterface = {
  14623. view: function(event) {
  14624. if (event.view) {
  14625. return event.view;
  14626. }
  14627. var target = getEventTarget(event);
  14628. if (target != null && target.window === target) {
  14629. // target is a window object
  14630. return target;
  14631. }
  14632. var doc = target.ownerDocument;
  14633. // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
  14634. if (doc) {
  14635. return doc.defaultView || doc.parentWindow;
  14636. } else {
  14637. return window;
  14638. }
  14639. },
  14640. detail: function(event) {
  14641. return event.detail || 0;
  14642. }
  14643. };
  14644. /**
  14645. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14646. * @param {string} dispatchMarker Marker identifying the event target.
  14647. * @param {object} nativeEvent Native browser event.
  14648. * @extends {SyntheticEvent}
  14649. */
  14650. function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14651. SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14652. }
  14653. SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
  14654. module.exports = SyntheticUIEvent;
  14655. },{"125":125,"95":95}],102:[function(_dereq_,module,exports){
  14656. /**
  14657. * Copyright 2013-2015, Facebook, Inc.
  14658. * All rights reserved.
  14659. *
  14660. * This source code is licensed under the BSD-style license found in the
  14661. * LICENSE file in the root directory of this source tree. An additional grant
  14662. * of patent rights can be found in the PATENTS file in the same directory.
  14663. *
  14664. * @providesModule SyntheticWheelEvent
  14665. * @typechecks static-only
  14666. */
  14667. 'use strict';
  14668. var SyntheticMouseEvent = _dereq_(99);
  14669. /**
  14670. * @interface WheelEvent
  14671. * @see http://www.w3.org/TR/DOM-Level-3-Events/
  14672. */
  14673. var WheelEventInterface = {
  14674. deltaX: function(event) {
  14675. return (
  14676. 'deltaX' in event ? event.deltaX :
  14677. // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
  14678. 'wheelDeltaX' in event ? -event.wheelDeltaX : 0
  14679. );
  14680. },
  14681. deltaY: function(event) {
  14682. return (
  14683. 'deltaY' in event ? event.deltaY :
  14684. // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
  14685. 'wheelDeltaY' in event ? -event.wheelDeltaY :
  14686. // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
  14687. 'wheelDelta' in event ? -event.wheelDelta : 0
  14688. );
  14689. },
  14690. deltaZ: null,
  14691. // Browsers without "deltaMode" is reporting in raw wheel delta where one
  14692. // notch on the scroll is always +/- 120, roughly equivalent to pixels.
  14693. // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
  14694. // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
  14695. deltaMode: null
  14696. };
  14697. /**
  14698. * @param {object} dispatchConfig Configuration used to dispatch this event.
  14699. * @param {string} dispatchMarker Marker identifying the event target.
  14700. * @param {object} nativeEvent Native browser event.
  14701. * @extends {SyntheticMouseEvent}
  14702. */
  14703. function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
  14704. SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
  14705. }
  14706. SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
  14707. module.exports = SyntheticWheelEvent;
  14708. },{"99":99}],103:[function(_dereq_,module,exports){
  14709. /**
  14710. * Copyright 2013-2015, Facebook, Inc.
  14711. * All rights reserved.
  14712. *
  14713. * This source code is licensed under the BSD-style license found in the
  14714. * LICENSE file in the root directory of this source tree. An additional grant
  14715. * of patent rights can be found in the PATENTS file in the same directory.
  14716. *
  14717. * @providesModule Transaction
  14718. */
  14719. 'use strict';
  14720. var invariant = _dereq_(135);
  14721. /**
  14722. * `Transaction` creates a black box that is able to wrap any method such that
  14723. * certain invariants are maintained before and after the method is invoked
  14724. * (Even if an exception is thrown while invoking the wrapped method). Whoever
  14725. * instantiates a transaction can provide enforcers of the invariants at
  14726. * creation time. The `Transaction` class itself will supply one additional
  14727. * automatic invariant for you - the invariant that any transaction instance
  14728. * should not be run while it is already being run. You would typically create a
  14729. * single instance of a `Transaction` for reuse multiple times, that potentially
  14730. * is used to wrap several different methods. Wrappers are extremely simple -
  14731. * they only require implementing two methods.
  14732. *
  14733. * <pre>
  14734. * wrappers (injected at creation time)
  14735. * + +
  14736. * | |
  14737. * +-----------------|--------|--------------+
  14738. * | v | |
  14739. * | +---------------+ | |
  14740. * | +--| wrapper1 |---|----+ |
  14741. * | | +---------------+ v | |
  14742. * | | +-------------+ | |
  14743. * | | +----| wrapper2 |--------+ |
  14744. * | | | +-------------+ | | |
  14745. * | | | | | |
  14746. * | v v v v | wrapper
  14747. * | +---+ +---+ +---------+ +---+ +---+ | invariants
  14748. * perform(anyMethod) | | | | | | | | | | | | maintained
  14749. * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
  14750. * | | | | | | | | | | | |
  14751. * | | | | | | | | | | | |
  14752. * | | | | | | | | | | | |
  14753. * | +---+ +---+ +---------+ +---+ +---+ |
  14754. * | initialize close |
  14755. * +-----------------------------------------+
  14756. * </pre>
  14757. *
  14758. * Use cases:
  14759. * - Preserving the input selection ranges before/after reconciliation.
  14760. * Restoring selection even in the event of an unexpected error.
  14761. * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
  14762. * while guaranteeing that afterwards, the event system is reactivated.
  14763. * - Flushing a queue of collected DOM mutations to the main UI thread after a
  14764. * reconciliation takes place in a worker thread.
  14765. * - Invoking any collected `componentDidUpdate` callbacks after rendering new
  14766. * content.
  14767. * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
  14768. * to preserve the `scrollTop` (an automatic scroll aware DOM).
  14769. * - (Future use case): Layout calculations before and after DOM updates.
  14770. *
  14771. * Transactional plugin API:
  14772. * - A module that has an `initialize` method that returns any precomputation.
  14773. * - and a `close` method that accepts the precomputation. `close` is invoked
  14774. * when the wrapped process is completed, or has failed.
  14775. *
  14776. * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
  14777. * that implement `initialize` and `close`.
  14778. * @return {Transaction} Single transaction for reuse in thread.
  14779. *
  14780. * @class Transaction
  14781. */
  14782. var Mixin = {
  14783. /**
  14784. * Sets up this instance so that it is prepared for collecting metrics. Does
  14785. * so such that this setup method may be used on an instance that is already
  14786. * initialized, in a way that does not consume additional memory upon reuse.
  14787. * That can be useful if you decide to make your subclass of this mixin a
  14788. * "PooledClass".
  14789. */
  14790. reinitializeTransaction: function() {
  14791. this.transactionWrappers = this.getTransactionWrappers();
  14792. if (!this.wrapperInitData) {
  14793. this.wrapperInitData = [];
  14794. } else {
  14795. this.wrapperInitData.length = 0;
  14796. }
  14797. this._isInTransaction = false;
  14798. },
  14799. _isInTransaction: false,
  14800. /**
  14801. * @abstract
  14802. * @return {Array<TransactionWrapper>} Array of transaction wrappers.
  14803. */
  14804. getTransactionWrappers: null,
  14805. isInTransaction: function() {
  14806. return !!this._isInTransaction;
  14807. },
  14808. /**
  14809. * Executes the function within a safety window. Use this for the top level
  14810. * methods that result in large amounts of computation/mutations that would
  14811. * need to be safety checked.
  14812. *
  14813. * @param {function} method Member of scope to call.
  14814. * @param {Object} scope Scope to invoke from.
  14815. * @param {Object?=} args... Arguments to pass to the method (optional).
  14816. * Helps prevent need to bind in many cases.
  14817. * @return Return value from `method`.
  14818. */
  14819. perform: function(method, scope, a, b, c, d, e, f) {
  14820. ("production" !== "development" ? invariant(
  14821. !this.isInTransaction(),
  14822. 'Transaction.perform(...): Cannot initialize a transaction when there ' +
  14823. 'is already an outstanding transaction.'
  14824. ) : invariant(!this.isInTransaction()));
  14825. var errorThrown;
  14826. var ret;
  14827. try {
  14828. this._isInTransaction = true;
  14829. // Catching errors makes debugging more difficult, so we start with
  14830. // errorThrown set to true before setting it to false after calling
  14831. // close -- if it's still set to true in the finally block, it means
  14832. // one of these calls threw.
  14833. errorThrown = true;
  14834. this.initializeAll(0);
  14835. ret = method.call(scope, a, b, c, d, e, f);
  14836. errorThrown = false;
  14837. } finally {
  14838. try {
  14839. if (errorThrown) {
  14840. // If `method` throws, prefer to show that stack trace over any thrown
  14841. // by invoking `closeAll`.
  14842. try {
  14843. this.closeAll(0);
  14844. } catch (err) {
  14845. }
  14846. } else {
  14847. // Since `method` didn't throw, we don't want to silence the exception
  14848. // here.
  14849. this.closeAll(0);
  14850. }
  14851. } finally {
  14852. this._isInTransaction = false;
  14853. }
  14854. }
  14855. return ret;
  14856. },
  14857. initializeAll: function(startIndex) {
  14858. var transactionWrappers = this.transactionWrappers;
  14859. for (var i = startIndex; i < transactionWrappers.length; i++) {
  14860. var wrapper = transactionWrappers[i];
  14861. try {
  14862. // Catching errors makes debugging more difficult, so we start with the
  14863. // OBSERVED_ERROR state before overwriting it with the real return value
  14864. // of initialize -- if it's still set to OBSERVED_ERROR in the finally
  14865. // block, it means wrapper.initialize threw.
  14866. this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
  14867. this.wrapperInitData[i] = wrapper.initialize ?
  14868. wrapper.initialize.call(this) :
  14869. null;
  14870. } finally {
  14871. if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
  14872. // The initializer for wrapper i threw an error; initialize the
  14873. // remaining wrappers but silence any exceptions from them to ensure
  14874. // that the first error is the one to bubble up.
  14875. try {
  14876. this.initializeAll(i + 1);
  14877. } catch (err) {
  14878. }
  14879. }
  14880. }
  14881. }
  14882. },
  14883. /**
  14884. * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
  14885. * them the respective return values of `this.transactionWrappers.init[i]`
  14886. * (`close`rs that correspond to initializers that failed will not be
  14887. * invoked).
  14888. */
  14889. closeAll: function(startIndex) {
  14890. ("production" !== "development" ? invariant(
  14891. this.isInTransaction(),
  14892. 'Transaction.closeAll(): Cannot close transaction when none are open.'
  14893. ) : invariant(this.isInTransaction()));
  14894. var transactionWrappers = this.transactionWrappers;
  14895. for (var i = startIndex; i < transactionWrappers.length; i++) {
  14896. var wrapper = transactionWrappers[i];
  14897. var initData = this.wrapperInitData[i];
  14898. var errorThrown;
  14899. try {
  14900. // Catching errors makes debugging more difficult, so we start with
  14901. // errorThrown set to true before setting it to false after calling
  14902. // close -- if it's still set to true in the finally block, it means
  14903. // wrapper.close threw.
  14904. errorThrown = true;
  14905. if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
  14906. wrapper.close.call(this, initData);
  14907. }
  14908. errorThrown = false;
  14909. } finally {
  14910. if (errorThrown) {
  14911. // The closer for wrapper i threw an error; close the remaining
  14912. // wrappers but silence any exceptions from them to ensure that the
  14913. // first error is the one to bubble up.
  14914. try {
  14915. this.closeAll(i + 1);
  14916. } catch (e) {
  14917. }
  14918. }
  14919. }
  14920. }
  14921. this.wrapperInitData.length = 0;
  14922. }
  14923. };
  14924. var Transaction = {
  14925. Mixin: Mixin,
  14926. /**
  14927. * Token to look for to determine if an error occured.
  14928. */
  14929. OBSERVED_ERROR: {}
  14930. };
  14931. module.exports = Transaction;
  14932. },{"135":135}],104:[function(_dereq_,module,exports){
  14933. /**
  14934. * Copyright 2013-2015, Facebook, Inc.
  14935. * All rights reserved.
  14936. *
  14937. * This source code is licensed under the BSD-style license found in the
  14938. * LICENSE file in the root directory of this source tree. An additional grant
  14939. * of patent rights can be found in the PATENTS file in the same directory.
  14940. *
  14941. * @providesModule ViewportMetrics
  14942. */
  14943. 'use strict';
  14944. var ViewportMetrics = {
  14945. currentScrollLeft: 0,
  14946. currentScrollTop: 0,
  14947. refreshScrollValues: function(scrollPosition) {
  14948. ViewportMetrics.currentScrollLeft = scrollPosition.x;
  14949. ViewportMetrics.currentScrollTop = scrollPosition.y;
  14950. }
  14951. };
  14952. module.exports = ViewportMetrics;
  14953. },{}],105:[function(_dereq_,module,exports){
  14954. /**
  14955. * Copyright 2014-2015, Facebook, Inc.
  14956. * All rights reserved.
  14957. *
  14958. * This source code is licensed under the BSD-style license found in the
  14959. * LICENSE file in the root directory of this source tree. An additional grant
  14960. * of patent rights can be found in the PATENTS file in the same directory.
  14961. *
  14962. * @providesModule accumulateInto
  14963. */
  14964. 'use strict';
  14965. var invariant = _dereq_(135);
  14966. /**
  14967. *
  14968. * Accumulates items that must not be null or undefined into the first one. This
  14969. * is used to conserve memory by avoiding array allocations, and thus sacrifices
  14970. * API cleanness. Since `current` can be null before being passed in and not
  14971. * null after this function, make sure to assign it back to `current`:
  14972. *
  14973. * `a = accumulateInto(a, b);`
  14974. *
  14975. * This API should be sparingly used. Try `accumulate` for something cleaner.
  14976. *
  14977. * @return {*|array<*>} An accumulation of items.
  14978. */
  14979. function accumulateInto(current, next) {
  14980. ("production" !== "development" ? invariant(
  14981. next != null,
  14982. 'accumulateInto(...): Accumulated items must not be null or undefined.'
  14983. ) : invariant(next != null));
  14984. if (current == null) {
  14985. return next;
  14986. }
  14987. // Both are not empty. Warning: Never call x.concat(y) when you are not
  14988. // certain that x is an Array (x could be a string with concat method).
  14989. var currentIsArray = Array.isArray(current);
  14990. var nextIsArray = Array.isArray(next);
  14991. if (currentIsArray && nextIsArray) {
  14992. current.push.apply(current, next);
  14993. return current;
  14994. }
  14995. if (currentIsArray) {
  14996. current.push(next);
  14997. return current;
  14998. }
  14999. if (nextIsArray) {
  15000. // A bit too dangerous to mutate `next`.
  15001. return [current].concat(next);
  15002. }
  15003. return [current, next];
  15004. }
  15005. module.exports = accumulateInto;
  15006. },{"135":135}],106:[function(_dereq_,module,exports){
  15007. /**
  15008. * Copyright 2013-2015, Facebook, Inc.
  15009. * All rights reserved.
  15010. *
  15011. * This source code is licensed under the BSD-style license found in the
  15012. * LICENSE file in the root directory of this source tree. An additional grant
  15013. * of patent rights can be found in the PATENTS file in the same directory.
  15014. *
  15015. * @providesModule adler32
  15016. */
  15017. /* jslint bitwise:true */
  15018. 'use strict';
  15019. var MOD = 65521;
  15020. // This is a clean-room implementation of adler32 designed for detecting
  15021. // if markup is not what we expect it to be. It does not need to be
  15022. // cryptographically strong, only reasonably good at detecting if markup
  15023. // generated on the server is different than that on the client.
  15024. function adler32(data) {
  15025. var a = 1;
  15026. var b = 0;
  15027. for (var i = 0; i < data.length; i++) {
  15028. a = (a + data.charCodeAt(i)) % MOD;
  15029. b = (b + a) % MOD;
  15030. }
  15031. return a | (b << 16);
  15032. }
  15033. module.exports = adler32;
  15034. },{}],107:[function(_dereq_,module,exports){
  15035. /**
  15036. * Copyright 2013-2015, Facebook, Inc.
  15037. * All rights reserved.
  15038. *
  15039. * This source code is licensed under the BSD-style license found in the
  15040. * LICENSE file in the root directory of this source tree. An additional grant
  15041. * of patent rights can be found in the PATENTS file in the same directory.
  15042. *
  15043. * @providesModule camelize
  15044. * @typechecks
  15045. */
  15046. var _hyphenPattern = /-(.)/g;
  15047. /**
  15048. * Camelcases a hyphenated string, for example:
  15049. *
  15050. * > camelize('background-color')
  15051. * < "backgroundColor"
  15052. *
  15053. * @param {string} string
  15054. * @return {string}
  15055. */
  15056. function camelize(string) {
  15057. return string.replace(_hyphenPattern, function(_, character) {
  15058. return character.toUpperCase();
  15059. });
  15060. }
  15061. module.exports = camelize;
  15062. },{}],108:[function(_dereq_,module,exports){
  15063. /**
  15064. * Copyright 2014-2015, Facebook, Inc.
  15065. * All rights reserved.
  15066. *
  15067. * This source code is licensed under the BSD-style license found in the
  15068. * LICENSE file in the root directory of this source tree. An additional grant
  15069. * of patent rights can be found in the PATENTS file in the same directory.
  15070. *
  15071. * @providesModule camelizeStyleName
  15072. * @typechecks
  15073. */
  15074. "use strict";
  15075. var camelize = _dereq_(107);
  15076. var msPattern = /^-ms-/;
  15077. /**
  15078. * Camelcases a hyphenated CSS property name, for example:
  15079. *
  15080. * > camelizeStyleName('background-color')
  15081. * < "backgroundColor"
  15082. * > camelizeStyleName('-moz-transition')
  15083. * < "MozTransition"
  15084. * > camelizeStyleName('-ms-transition')
  15085. * < "msTransition"
  15086. *
  15087. * As Andi Smith suggests
  15088. * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
  15089. * is converted to lowercase `ms`.
  15090. *
  15091. * @param {string} string
  15092. * @return {string}
  15093. */
  15094. function camelizeStyleName(string) {
  15095. return camelize(string.replace(msPattern, 'ms-'));
  15096. }
  15097. module.exports = camelizeStyleName;
  15098. },{"107":107}],109:[function(_dereq_,module,exports){
  15099. /**
  15100. * Copyright 2013-2015, Facebook, Inc.
  15101. * All rights reserved.
  15102. *
  15103. * This source code is licensed under the BSD-style license found in the
  15104. * LICENSE file in the root directory of this source tree. An additional grant
  15105. * of patent rights can be found in the PATENTS file in the same directory.
  15106. *
  15107. * @providesModule containsNode
  15108. * @typechecks
  15109. */
  15110. var isTextNode = _dereq_(139);
  15111. /*jslint bitwise:true */
  15112. /**
  15113. * Checks if a given DOM node contains or is another DOM node.
  15114. *
  15115. * @param {?DOMNode} outerNode Outer DOM node.
  15116. * @param {?DOMNode} innerNode Inner DOM node.
  15117. * @return {boolean} True if `outerNode` contains or is `innerNode`.
  15118. */
  15119. function containsNode(outerNode, innerNode) {
  15120. if (!outerNode || !innerNode) {
  15121. return false;
  15122. } else if (outerNode === innerNode) {
  15123. return true;
  15124. } else if (isTextNode(outerNode)) {
  15125. return false;
  15126. } else if (isTextNode(innerNode)) {
  15127. return containsNode(outerNode, innerNode.parentNode);
  15128. } else if (outerNode.contains) {
  15129. return outerNode.contains(innerNode);
  15130. } else if (outerNode.compareDocumentPosition) {
  15131. return !!(outerNode.compareDocumentPosition(innerNode) & 16);
  15132. } else {
  15133. return false;
  15134. }
  15135. }
  15136. module.exports = containsNode;
  15137. },{"139":139}],110:[function(_dereq_,module,exports){
  15138. /**
  15139. * Copyright 2013-2015, Facebook, Inc.
  15140. * All rights reserved.
  15141. *
  15142. * This source code is licensed under the BSD-style license found in the
  15143. * LICENSE file in the root directory of this source tree. An additional grant
  15144. * of patent rights can be found in the PATENTS file in the same directory.
  15145. *
  15146. * @providesModule createArrayFromMixed
  15147. * @typechecks
  15148. */
  15149. var toArray = _dereq_(152);
  15150. /**
  15151. * Perform a heuristic test to determine if an object is "array-like".
  15152. *
  15153. * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
  15154. * Joshu replied: "Mu."
  15155. *
  15156. * This function determines if its argument has "array nature": it returns
  15157. * true if the argument is an actual array, an `arguments' object, or an
  15158. * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
  15159. *
  15160. * It will return false for other array-like objects like Filelist.
  15161. *
  15162. * @param {*} obj
  15163. * @return {boolean}
  15164. */
  15165. function hasArrayNature(obj) {
  15166. return (
  15167. // not null/false
  15168. !!obj &&
  15169. // arrays are objects, NodeLists are functions in Safari
  15170. (typeof obj == 'object' || typeof obj == 'function') &&
  15171. // quacks like an array
  15172. ('length' in obj) &&
  15173. // not window
  15174. !('setInterval' in obj) &&
  15175. // no DOM node should be considered an array-like
  15176. // a 'select' element has 'length' and 'item' properties on IE8
  15177. (typeof obj.nodeType != 'number') &&
  15178. (
  15179. // a real array
  15180. (// HTMLCollection/NodeList
  15181. (Array.isArray(obj) ||
  15182. // arguments
  15183. ('callee' in obj) || 'item' in obj))
  15184. )
  15185. );
  15186. }
  15187. /**
  15188. * Ensure that the argument is an array by wrapping it in an array if it is not.
  15189. * Creates a copy of the argument if it is already an array.
  15190. *
  15191. * This is mostly useful idiomatically:
  15192. *
  15193. * var createArrayFromMixed = require('createArrayFromMixed');
  15194. *
  15195. * function takesOneOrMoreThings(things) {
  15196. * things = createArrayFromMixed(things);
  15197. * ...
  15198. * }
  15199. *
  15200. * This allows you to treat `things' as an array, but accept scalars in the API.
  15201. *
  15202. * If you need to convert an array-like object, like `arguments`, into an array
  15203. * use toArray instead.
  15204. *
  15205. * @param {*} obj
  15206. * @return {array}
  15207. */
  15208. function createArrayFromMixed(obj) {
  15209. if (!hasArrayNature(obj)) {
  15210. return [obj];
  15211. } else if (Array.isArray(obj)) {
  15212. return obj.slice();
  15213. } else {
  15214. return toArray(obj);
  15215. }
  15216. }
  15217. module.exports = createArrayFromMixed;
  15218. },{"152":152}],111:[function(_dereq_,module,exports){
  15219. /**
  15220. * Copyright 2013-2015, Facebook, Inc.
  15221. * All rights reserved.
  15222. *
  15223. * This source code is licensed under the BSD-style license found in the
  15224. * LICENSE file in the root directory of this source tree. An additional grant
  15225. * of patent rights can be found in the PATENTS file in the same directory.
  15226. *
  15227. * @providesModule createFullPageComponent
  15228. * @typechecks
  15229. */
  15230. 'use strict';
  15231. // Defeat circular references by requiring this directly.
  15232. var ReactClass = _dereq_(33);
  15233. var ReactElement = _dereq_(57);
  15234. var invariant = _dereq_(135);
  15235. /**
  15236. * Create a component that will throw an exception when unmounted.
  15237. *
  15238. * Components like <html> <head> and <body> can't be removed or added
  15239. * easily in a cross-browser way, however it's valuable to be able to
  15240. * take advantage of React's reconciliation for styling and <title>
  15241. * management. So we just document it and throw in dangerous cases.
  15242. *
  15243. * @param {string} tag The tag to wrap
  15244. * @return {function} convenience constructor of new component
  15245. */
  15246. function createFullPageComponent(tag) {
  15247. var elementFactory = ReactElement.createFactory(tag);
  15248. var FullPageComponent = ReactClass.createClass({
  15249. tagName: tag.toUpperCase(),
  15250. displayName: 'ReactFullPageComponent' + tag,
  15251. componentWillUnmount: function() {
  15252. ("production" !== "development" ? invariant(
  15253. false,
  15254. '%s tried to unmount. Because of cross-browser quirks it is ' +
  15255. 'impossible to unmount some top-level components (eg <html>, <head>, ' +
  15256. 'and <body>) reliably and efficiently. To fix this, have a single ' +
  15257. 'top-level component that never unmounts render these elements.',
  15258. this.constructor.displayName
  15259. ) : invariant(false));
  15260. },
  15261. render: function() {
  15262. return elementFactory(this.props);
  15263. }
  15264. });
  15265. return FullPageComponent;
  15266. }
  15267. module.exports = createFullPageComponent;
  15268. },{"135":135,"33":33,"57":57}],112:[function(_dereq_,module,exports){
  15269. /**
  15270. * Copyright 2013-2015, Facebook, Inc.
  15271. * All rights reserved.
  15272. *
  15273. * This source code is licensed under the BSD-style license found in the
  15274. * LICENSE file in the root directory of this source tree. An additional grant
  15275. * of patent rights can be found in the PATENTS file in the same directory.
  15276. *
  15277. * @providesModule createNodesFromMarkup
  15278. * @typechecks
  15279. */
  15280. /*jslint evil: true, sub: true */
  15281. var ExecutionEnvironment = _dereq_(21);
  15282. var createArrayFromMixed = _dereq_(110);
  15283. var getMarkupWrap = _dereq_(127);
  15284. var invariant = _dereq_(135);
  15285. /**
  15286. * Dummy container used to render all markup.
  15287. */
  15288. var dummyNode =
  15289. ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  15290. /**
  15291. * Pattern used by `getNodeName`.
  15292. */
  15293. var nodeNamePattern = /^\s*<(\w+)/;
  15294. /**
  15295. * Extracts the `nodeName` of the first element in a string of markup.
  15296. *
  15297. * @param {string} markup String of markup.
  15298. * @return {?string} Node name of the supplied markup.
  15299. */
  15300. function getNodeName(markup) {
  15301. var nodeNameMatch = markup.match(nodeNamePattern);
  15302. return nodeNameMatch && nodeNameMatch[1].toLowerCase();
  15303. }
  15304. /**
  15305. * Creates an array containing the nodes rendered from the supplied markup. The
  15306. * optionally supplied `handleScript` function will be invoked once for each
  15307. * <script> element that is rendered. If no `handleScript` function is supplied,
  15308. * an exception is thrown if any <script> elements are rendered.
  15309. *
  15310. * @param {string} markup A string of valid HTML markup.
  15311. * @param {?function} handleScript Invoked once for each rendered <script>.
  15312. * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
  15313. */
  15314. function createNodesFromMarkup(markup, handleScript) {
  15315. var node = dummyNode;
  15316. ("production" !== "development" ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));
  15317. var nodeName = getNodeName(markup);
  15318. var wrap = nodeName && getMarkupWrap(nodeName);
  15319. if (wrap) {
  15320. node.innerHTML = wrap[1] + markup + wrap[2];
  15321. var wrapDepth = wrap[0];
  15322. while (wrapDepth--) {
  15323. node = node.lastChild;
  15324. }
  15325. } else {
  15326. node.innerHTML = markup;
  15327. }
  15328. var scripts = node.getElementsByTagName('script');
  15329. if (scripts.length) {
  15330. ("production" !== "development" ? invariant(
  15331. handleScript,
  15332. 'createNodesFromMarkup(...): Unexpected <script> element rendered.'
  15333. ) : invariant(handleScript));
  15334. createArrayFromMixed(scripts).forEach(handleScript);
  15335. }
  15336. var nodes = createArrayFromMixed(node.childNodes);
  15337. while (node.lastChild) {
  15338. node.removeChild(node.lastChild);
  15339. }
  15340. return nodes;
  15341. }
  15342. module.exports = createNodesFromMarkup;
  15343. },{"110":110,"127":127,"135":135,"21":21}],113:[function(_dereq_,module,exports){
  15344. /**
  15345. * Copyright 2013-2015, Facebook, Inc.
  15346. * All rights reserved.
  15347. *
  15348. * This source code is licensed under the BSD-style license found in the
  15349. * LICENSE file in the root directory of this source tree. An additional grant
  15350. * of patent rights can be found in the PATENTS file in the same directory.
  15351. *
  15352. * @providesModule dangerousStyleValue
  15353. * @typechecks static-only
  15354. */
  15355. 'use strict';
  15356. var CSSProperty = _dereq_(4);
  15357. var isUnitlessNumber = CSSProperty.isUnitlessNumber;
  15358. /**
  15359. * Convert a value into the proper css writable value. The style name `name`
  15360. * should be logical (no hyphens), as specified
  15361. * in `CSSProperty.isUnitlessNumber`.
  15362. *
  15363. * @param {string} name CSS property name such as `topMargin`.
  15364. * @param {*} value CSS property value such as `10px`.
  15365. * @return {string} Normalized style value with dimensions applied.
  15366. */
  15367. function dangerousStyleValue(name, value) {
  15368. // Note that we've removed escapeTextForBrowser() calls here since the
  15369. // whole string will be escaped when the attribute is injected into
  15370. // the markup. If you provide unsafe user data here they can inject
  15371. // arbitrary CSS which may be problematic (I couldn't repro this):
  15372. // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
  15373. // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
  15374. // This is not an XSS hole but instead a potential CSS injection issue
  15375. // which has lead to a greater discussion about how we're going to
  15376. // trust URLs moving forward. See #2115901
  15377. var isEmpty = value == null || typeof value === 'boolean' || value === '';
  15378. if (isEmpty) {
  15379. return '';
  15380. }
  15381. var isNonNumeric = isNaN(value);
  15382. if (isNonNumeric || value === 0 ||
  15383. isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
  15384. return '' + value; // cast to string
  15385. }
  15386. if (typeof value === 'string') {
  15387. value = value.trim();
  15388. }
  15389. return value + 'px';
  15390. }
  15391. module.exports = dangerousStyleValue;
  15392. },{"4":4}],114:[function(_dereq_,module,exports){
  15393. /**
  15394. * Copyright 2013-2015, Facebook, Inc.
  15395. * All rights reserved.
  15396. *
  15397. * This source code is licensed under the BSD-style license found in the
  15398. * LICENSE file in the root directory of this source tree. An additional grant
  15399. * of patent rights can be found in the PATENTS file in the same directory.
  15400. *
  15401. * @providesModule emptyFunction
  15402. */
  15403. function makeEmptyFunction(arg) {
  15404. return function() {
  15405. return arg;
  15406. };
  15407. }
  15408. /**
  15409. * This function accepts and discards inputs; it has no side effects. This is
  15410. * primarily useful idiomatically for overridable function endpoints which
  15411. * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
  15412. */
  15413. function emptyFunction() {}
  15414. emptyFunction.thatReturns = makeEmptyFunction;
  15415. emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
  15416. emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
  15417. emptyFunction.thatReturnsNull = makeEmptyFunction(null);
  15418. emptyFunction.thatReturnsThis = function() { return this; };
  15419. emptyFunction.thatReturnsArgument = function(arg) { return arg; };
  15420. module.exports = emptyFunction;
  15421. },{}],115:[function(_dereq_,module,exports){
  15422. /**
  15423. * Copyright 2013-2015, Facebook, Inc.
  15424. * All rights reserved.
  15425. *
  15426. * This source code is licensed under the BSD-style license found in the
  15427. * LICENSE file in the root directory of this source tree. An additional grant
  15428. * of patent rights can be found in the PATENTS file in the same directory.
  15429. *
  15430. * @providesModule emptyObject
  15431. */
  15432. "use strict";
  15433. var emptyObject = {};
  15434. if ("production" !== "development") {
  15435. Object.freeze(emptyObject);
  15436. }
  15437. module.exports = emptyObject;
  15438. },{}],116:[function(_dereq_,module,exports){
  15439. /**
  15440. * Copyright 2013-2015, Facebook, Inc.
  15441. * All rights reserved.
  15442. *
  15443. * This source code is licensed under the BSD-style license found in the
  15444. * LICENSE file in the root directory of this source tree. An additional grant
  15445. * of patent rights can be found in the PATENTS file in the same directory.
  15446. *
  15447. * @providesModule escapeTextContentForBrowser
  15448. */
  15449. 'use strict';
  15450. var ESCAPE_LOOKUP = {
  15451. '&': '&amp;',
  15452. '>': '&gt;',
  15453. '<': '&lt;',
  15454. '"': '&quot;',
  15455. '\'': '&#x27;'
  15456. };
  15457. var ESCAPE_REGEX = /[&><"']/g;
  15458. function escaper(match) {
  15459. return ESCAPE_LOOKUP[match];
  15460. }
  15461. /**
  15462. * Escapes text to prevent scripting attacks.
  15463. *
  15464. * @param {*} text Text value to escape.
  15465. * @return {string} An escaped string.
  15466. */
  15467. function escapeTextContentForBrowser(text) {
  15468. return ('' + text).replace(ESCAPE_REGEX, escaper);
  15469. }
  15470. module.exports = escapeTextContentForBrowser;
  15471. },{}],117:[function(_dereq_,module,exports){
  15472. /**
  15473. * Copyright 2013-2015, Facebook, Inc.
  15474. * All rights reserved.
  15475. *
  15476. * This source code is licensed under the BSD-style license found in the
  15477. * LICENSE file in the root directory of this source tree. An additional grant
  15478. * of patent rights can be found in the PATENTS file in the same directory.
  15479. *
  15480. * @providesModule findDOMNode
  15481. * @typechecks static-only
  15482. */
  15483. 'use strict';
  15484. var ReactCurrentOwner = _dereq_(39);
  15485. var ReactInstanceMap = _dereq_(67);
  15486. var ReactMount = _dereq_(70);
  15487. var invariant = _dereq_(135);
  15488. var isNode = _dereq_(137);
  15489. var warning = _dereq_(154);
  15490. /**
  15491. * Returns the DOM node rendered by this element.
  15492. *
  15493. * @param {ReactComponent|DOMElement} componentOrElement
  15494. * @return {DOMElement} The root node of this element.
  15495. */
  15496. function findDOMNode(componentOrElement) {
  15497. if ("production" !== "development") {
  15498. var owner = ReactCurrentOwner.current;
  15499. if (owner !== null) {
  15500. ("production" !== "development" ? warning(
  15501. owner._warnedAboutRefsInRender,
  15502. '%s is accessing getDOMNode or findDOMNode inside its render(). ' +
  15503. 'render() should be a pure function of props and state. It should ' +
  15504. 'never access something that requires stale data from the previous ' +
  15505. 'render, such as refs. Move this logic to componentDidMount and ' +
  15506. 'componentDidUpdate instead.',
  15507. owner.getName() || 'A component'
  15508. ) : null);
  15509. owner._warnedAboutRefsInRender = true;
  15510. }
  15511. }
  15512. if (componentOrElement == null) {
  15513. return null;
  15514. }
  15515. if (isNode(componentOrElement)) {
  15516. return componentOrElement;
  15517. }
  15518. if (ReactInstanceMap.has(componentOrElement)) {
  15519. return ReactMount.getNodeFromInstance(componentOrElement);
  15520. }
  15521. ("production" !== "development" ? invariant(
  15522. componentOrElement.render == null ||
  15523. typeof componentOrElement.render !== 'function',
  15524. 'Component (with keys: %s) contains `render` method ' +
  15525. 'but is not mounted in the DOM',
  15526. Object.keys(componentOrElement)
  15527. ) : invariant(componentOrElement.render == null ||
  15528. typeof componentOrElement.render !== 'function'));
  15529. ("production" !== "development" ? invariant(
  15530. false,
  15531. 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
  15532. Object.keys(componentOrElement)
  15533. ) : invariant(false));
  15534. }
  15535. module.exports = findDOMNode;
  15536. },{"135":135,"137":137,"154":154,"39":39,"67":67,"70":70}],118:[function(_dereq_,module,exports){
  15537. /**
  15538. * Copyright 2013-2015, Facebook, Inc.
  15539. * All rights reserved.
  15540. *
  15541. * This source code is licensed under the BSD-style license found in the
  15542. * LICENSE file in the root directory of this source tree. An additional grant
  15543. * of patent rights can be found in the PATENTS file in the same directory.
  15544. *
  15545. * @providesModule flattenChildren
  15546. */
  15547. 'use strict';
  15548. var traverseAllChildren = _dereq_(153);
  15549. var warning = _dereq_(154);
  15550. /**
  15551. * @param {function} traverseContext Context passed through traversal.
  15552. * @param {?ReactComponent} child React child component.
  15553. * @param {!string} name String name of key path to child.
  15554. */
  15555. function flattenSingleChildIntoContext(traverseContext, child, name) {
  15556. // We found a component instance.
  15557. var result = traverseContext;
  15558. var keyUnique = !result.hasOwnProperty(name);
  15559. if ("production" !== "development") {
  15560. ("production" !== "development" ? warning(
  15561. keyUnique,
  15562. 'flattenChildren(...): Encountered two children with the same key, ' +
  15563. '`%s`. Child keys must be unique; when two children share a key, only ' +
  15564. 'the first child will be used.',
  15565. name
  15566. ) : null);
  15567. }
  15568. if (keyUnique && child != null) {
  15569. result[name] = child;
  15570. }
  15571. }
  15572. /**
  15573. * Flattens children that are typically specified as `props.children`. Any null
  15574. * children will not be included in the resulting object.
  15575. * @return {!object} flattened children keyed by name.
  15576. */
  15577. function flattenChildren(children) {
  15578. if (children == null) {
  15579. return children;
  15580. }
  15581. var result = {};
  15582. traverseAllChildren(children, flattenSingleChildIntoContext, result);
  15583. return result;
  15584. }
  15585. module.exports = flattenChildren;
  15586. },{"153":153,"154":154}],119:[function(_dereq_,module,exports){
  15587. /**
  15588. * Copyright 2014-2015, Facebook, Inc.
  15589. * All rights reserved.
  15590. *
  15591. * This source code is licensed under the BSD-style license found in the
  15592. * LICENSE file in the root directory of this source tree. An additional grant
  15593. * of patent rights can be found in the PATENTS file in the same directory.
  15594. *
  15595. * @providesModule focusNode
  15596. */
  15597. "use strict";
  15598. /**
  15599. * @param {DOMElement} node input/textarea to focus
  15600. */
  15601. function focusNode(node) {
  15602. // IE8 can throw "Can't move focus to the control because it is invisible,
  15603. // not enabled, or of a type that does not accept the focus." for all kinds of
  15604. // reasons that are too expensive and fragile to test.
  15605. try {
  15606. node.focus();
  15607. } catch(e) {
  15608. }
  15609. }
  15610. module.exports = focusNode;
  15611. },{}],120:[function(_dereq_,module,exports){
  15612. /**
  15613. * Copyright 2013-2015, Facebook, Inc.
  15614. * All rights reserved.
  15615. *
  15616. * This source code is licensed under the BSD-style license found in the
  15617. * LICENSE file in the root directory of this source tree. An additional grant
  15618. * of patent rights can be found in the PATENTS file in the same directory.
  15619. *
  15620. * @providesModule forEachAccumulated
  15621. */
  15622. 'use strict';
  15623. /**
  15624. * @param {array} an "accumulation" of items which is either an Array or
  15625. * a single item. Useful when paired with the `accumulate` module. This is a
  15626. * simple utility that allows us to reason about a collection of items, but
  15627. * handling the case when there is exactly one item (and we do not need to
  15628. * allocate an array).
  15629. */
  15630. var forEachAccumulated = function(arr, cb, scope) {
  15631. if (Array.isArray(arr)) {
  15632. arr.forEach(cb, scope);
  15633. } else if (arr) {
  15634. cb.call(scope, arr);
  15635. }
  15636. };
  15637. module.exports = forEachAccumulated;
  15638. },{}],121:[function(_dereq_,module,exports){
  15639. /**
  15640. * Copyright 2013-2015, Facebook, Inc.
  15641. * All rights reserved.
  15642. *
  15643. * This source code is licensed under the BSD-style license found in the
  15644. * LICENSE file in the root directory of this source tree. An additional grant
  15645. * of patent rights can be found in the PATENTS file in the same directory.
  15646. *
  15647. * @providesModule getActiveElement
  15648. * @typechecks
  15649. */
  15650. /**
  15651. * Same as document.activeElement but wraps in a try-catch block. In IE it is
  15652. * not safe to call document.activeElement if there is nothing focused.
  15653. *
  15654. * The activeElement will be null only if the document body is not yet defined.
  15655. */
  15656. function getActiveElement() /*?DOMElement*/ {
  15657. try {
  15658. return document.activeElement || document.body;
  15659. } catch (e) {
  15660. return document.body;
  15661. }
  15662. }
  15663. module.exports = getActiveElement;
  15664. },{}],122:[function(_dereq_,module,exports){
  15665. /**
  15666. * Copyright 2013-2015, Facebook, Inc.
  15667. * All rights reserved.
  15668. *
  15669. * This source code is licensed under the BSD-style license found in the
  15670. * LICENSE file in the root directory of this source tree. An additional grant
  15671. * of patent rights can be found in the PATENTS file in the same directory.
  15672. *
  15673. * @providesModule getEventCharCode
  15674. * @typechecks static-only
  15675. */
  15676. 'use strict';
  15677. /**
  15678. * `charCode` represents the actual "character code" and is safe to use with
  15679. * `String.fromCharCode`. As such, only keys that correspond to printable
  15680. * characters produce a valid `charCode`, the only exception to this is Enter.
  15681. * The Tab-key is considered non-printable and does not have a `charCode`,
  15682. * presumably because it does not produce a tab-character in browsers.
  15683. *
  15684. * @param {object} nativeEvent Native browser event.
  15685. * @return {string} Normalized `charCode` property.
  15686. */
  15687. function getEventCharCode(nativeEvent) {
  15688. var charCode;
  15689. var keyCode = nativeEvent.keyCode;
  15690. if ('charCode' in nativeEvent) {
  15691. charCode = nativeEvent.charCode;
  15692. // FF does not set `charCode` for the Enter-key, check against `keyCode`.
  15693. if (charCode === 0 && keyCode === 13) {
  15694. charCode = 13;
  15695. }
  15696. } else {
  15697. // IE8 does not implement `charCode`, but `keyCode` has the correct value.
  15698. charCode = keyCode;
  15699. }
  15700. // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
  15701. // Must not discard the (non-)printable Enter-key.
  15702. if (charCode >= 32 || charCode === 13) {
  15703. return charCode;
  15704. }
  15705. return 0;
  15706. }
  15707. module.exports = getEventCharCode;
  15708. },{}],123:[function(_dereq_,module,exports){
  15709. /**
  15710. * Copyright 2013-2015, Facebook, Inc.
  15711. * All rights reserved.
  15712. *
  15713. * This source code is licensed under the BSD-style license found in the
  15714. * LICENSE file in the root directory of this source tree. An additional grant
  15715. * of patent rights can be found in the PATENTS file in the same directory.
  15716. *
  15717. * @providesModule getEventKey
  15718. * @typechecks static-only
  15719. */
  15720. 'use strict';
  15721. var getEventCharCode = _dereq_(122);
  15722. /**
  15723. * Normalization of deprecated HTML5 `key` values
  15724. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  15725. */
  15726. var normalizeKey = {
  15727. 'Esc': 'Escape',
  15728. 'Spacebar': ' ',
  15729. 'Left': 'ArrowLeft',
  15730. 'Up': 'ArrowUp',
  15731. 'Right': 'ArrowRight',
  15732. 'Down': 'ArrowDown',
  15733. 'Del': 'Delete',
  15734. 'Win': 'OS',
  15735. 'Menu': 'ContextMenu',
  15736. 'Apps': 'ContextMenu',
  15737. 'Scroll': 'ScrollLock',
  15738. 'MozPrintableKey': 'Unidentified'
  15739. };
  15740. /**
  15741. * Translation from legacy `keyCode` to HTML5 `key`
  15742. * Only special keys supported, all others depend on keyboard layout or browser
  15743. * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
  15744. */
  15745. var translateToKey = {
  15746. 8: 'Backspace',
  15747. 9: 'Tab',
  15748. 12: 'Clear',
  15749. 13: 'Enter',
  15750. 16: 'Shift',
  15751. 17: 'Control',
  15752. 18: 'Alt',
  15753. 19: 'Pause',
  15754. 20: 'CapsLock',
  15755. 27: 'Escape',
  15756. 32: ' ',
  15757. 33: 'PageUp',
  15758. 34: 'PageDown',
  15759. 35: 'End',
  15760. 36: 'Home',
  15761. 37: 'ArrowLeft',
  15762. 38: 'ArrowUp',
  15763. 39: 'ArrowRight',
  15764. 40: 'ArrowDown',
  15765. 45: 'Insert',
  15766. 46: 'Delete',
  15767. 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
  15768. 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
  15769. 144: 'NumLock',
  15770. 145: 'ScrollLock',
  15771. 224: 'Meta'
  15772. };
  15773. /**
  15774. * @param {object} nativeEvent Native browser event.
  15775. * @return {string} Normalized `key` property.
  15776. */
  15777. function getEventKey(nativeEvent) {
  15778. if (nativeEvent.key) {
  15779. // Normalize inconsistent values reported by browsers due to
  15780. // implementations of a working draft specification.
  15781. // FireFox implements `key` but returns `MozPrintableKey` for all
  15782. // printable characters (normalized to `Unidentified`), ignore it.
  15783. var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
  15784. if (key !== 'Unidentified') {
  15785. return key;
  15786. }
  15787. }
  15788. // Browser does not implement `key`, polyfill as much of it as we can.
  15789. if (nativeEvent.type === 'keypress') {
  15790. var charCode = getEventCharCode(nativeEvent);
  15791. // The enter-key is technically both printable and non-printable and can
  15792. // thus be captured by `keypress`, no other non-printable key should.
  15793. return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
  15794. }
  15795. if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
  15796. // While user keyboard layout determines the actual meaning of each
  15797. // `keyCode` value, almost all function keys have a universal value.
  15798. return translateToKey[nativeEvent.keyCode] || 'Unidentified';
  15799. }
  15800. return '';
  15801. }
  15802. module.exports = getEventKey;
  15803. },{"122":122}],124:[function(_dereq_,module,exports){
  15804. /**
  15805. * Copyright 2013-2015, Facebook, Inc.
  15806. * All rights reserved.
  15807. *
  15808. * This source code is licensed under the BSD-style license found in the
  15809. * LICENSE file in the root directory of this source tree. An additional grant
  15810. * of patent rights can be found in the PATENTS file in the same directory.
  15811. *
  15812. * @providesModule getEventModifierState
  15813. * @typechecks static-only
  15814. */
  15815. 'use strict';
  15816. /**
  15817. * Translation from modifier key to the associated property in the event.
  15818. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
  15819. */
  15820. var modifierKeyToProp = {
  15821. 'Alt': 'altKey',
  15822. 'Control': 'ctrlKey',
  15823. 'Meta': 'metaKey',
  15824. 'Shift': 'shiftKey'
  15825. };
  15826. // IE8 does not implement getModifierState so we simply map it to the only
  15827. // modifier keys exposed by the event itself, does not support Lock-keys.
  15828. // Currently, all major browsers except Chrome seems to support Lock-keys.
  15829. function modifierStateGetter(keyArg) {
  15830. /*jshint validthis:true */
  15831. var syntheticEvent = this;
  15832. var nativeEvent = syntheticEvent.nativeEvent;
  15833. if (nativeEvent.getModifierState) {
  15834. return nativeEvent.getModifierState(keyArg);
  15835. }
  15836. var keyProp = modifierKeyToProp[keyArg];
  15837. return keyProp ? !!nativeEvent[keyProp] : false;
  15838. }
  15839. function getEventModifierState(nativeEvent) {
  15840. return modifierStateGetter;
  15841. }
  15842. module.exports = getEventModifierState;
  15843. },{}],125:[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 getEventTarget
  15853. * @typechecks static-only
  15854. */
  15855. 'use strict';
  15856. /**
  15857. * Gets the target node from a native browser event by accounting for
  15858. * inconsistencies in browser DOM APIs.
  15859. *
  15860. * @param {object} nativeEvent Native browser event.
  15861. * @return {DOMEventTarget} Target node.
  15862. */
  15863. function getEventTarget(nativeEvent) {
  15864. var target = nativeEvent.target || nativeEvent.srcElement || window;
  15865. // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
  15866. // @see http://www.quirksmode.org/js/events_properties.html
  15867. return target.nodeType === 3 ? target.parentNode : target;
  15868. }
  15869. module.exports = getEventTarget;
  15870. },{}],126:[function(_dereq_,module,exports){
  15871. /**
  15872. * Copyright 2013-2015, Facebook, Inc.
  15873. * All rights reserved.
  15874. *
  15875. * This source code is licensed under the BSD-style license found in the
  15876. * LICENSE file in the root directory of this source tree. An additional grant
  15877. * of patent rights can be found in the PATENTS file in the same directory.
  15878. *
  15879. * @providesModule getIteratorFn
  15880. * @typechecks static-only
  15881. */
  15882. 'use strict';
  15883. /* global Symbol */
  15884. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  15885. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  15886. /**
  15887. * Returns the iterator method function contained on the iterable object.
  15888. *
  15889. * Be sure to invoke the function with the iterable as context:
  15890. *
  15891. * var iteratorFn = getIteratorFn(myIterable);
  15892. * if (iteratorFn) {
  15893. * var iterator = iteratorFn.call(myIterable);
  15894. * ...
  15895. * }
  15896. *
  15897. * @param {?object} maybeIterable
  15898. * @return {?function}
  15899. */
  15900. function getIteratorFn(maybeIterable) {
  15901. var iteratorFn = maybeIterable && (
  15902. (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL])
  15903. );
  15904. if (typeof iteratorFn === 'function') {
  15905. return iteratorFn;
  15906. }
  15907. }
  15908. module.exports = getIteratorFn;
  15909. },{}],127:[function(_dereq_,module,exports){
  15910. /**
  15911. * Copyright 2013-2015, Facebook, Inc.
  15912. * All rights reserved.
  15913. *
  15914. * This source code is licensed under the BSD-style license found in the
  15915. * LICENSE file in the root directory of this source tree. An additional grant
  15916. * of patent rights can be found in the PATENTS file in the same directory.
  15917. *
  15918. * @providesModule getMarkupWrap
  15919. */
  15920. var ExecutionEnvironment = _dereq_(21);
  15921. var invariant = _dereq_(135);
  15922. /**
  15923. * Dummy container used to detect which wraps are necessary.
  15924. */
  15925. var dummyNode =
  15926. ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
  15927. /**
  15928. * Some browsers cannot use `innerHTML` to render certain elements standalone,
  15929. * so we wrap them, render the wrapped nodes, then extract the desired node.
  15930. *
  15931. * In IE8, certain elements cannot render alone, so wrap all elements ('*').
  15932. */
  15933. var shouldWrap = {
  15934. // Force wrapping for SVG elements because if they get created inside a <div>,
  15935. // they will be initialized in the wrong namespace (and will not display).
  15936. 'circle': true,
  15937. 'clipPath': true,
  15938. 'defs': true,
  15939. 'ellipse': true,
  15940. 'g': true,
  15941. 'line': true,
  15942. 'linearGradient': true,
  15943. 'path': true,
  15944. 'polygon': true,
  15945. 'polyline': true,
  15946. 'radialGradient': true,
  15947. 'rect': true,
  15948. 'stop': true,
  15949. 'text': true
  15950. };
  15951. var selectWrap = [1, '<select multiple="true">', '</select>'];
  15952. var tableWrap = [1, '<table>', '</table>'];
  15953. var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  15954. var svgWrap = [1, '<svg>', '</svg>'];
  15955. var markupWrap = {
  15956. '*': [1, '?<div>', '</div>'],
  15957. 'area': [1, '<map>', '</map>'],
  15958. 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
  15959. 'legend': [1, '<fieldset>', '</fieldset>'],
  15960. 'param': [1, '<object>', '</object>'],
  15961. 'tr': [2, '<table><tbody>', '</tbody></table>'],
  15962. 'optgroup': selectWrap,
  15963. 'option': selectWrap,
  15964. 'caption': tableWrap,
  15965. 'colgroup': tableWrap,
  15966. 'tbody': tableWrap,
  15967. 'tfoot': tableWrap,
  15968. 'thead': tableWrap,
  15969. 'td': trWrap,
  15970. 'th': trWrap,
  15971. 'circle': svgWrap,
  15972. 'clipPath': svgWrap,
  15973. 'defs': svgWrap,
  15974. 'ellipse': svgWrap,
  15975. 'g': svgWrap,
  15976. 'line': svgWrap,
  15977. 'linearGradient': svgWrap,
  15978. 'path': svgWrap,
  15979. 'polygon': svgWrap,
  15980. 'polyline': svgWrap,
  15981. 'radialGradient': svgWrap,
  15982. 'rect': svgWrap,
  15983. 'stop': svgWrap,
  15984. 'text': svgWrap
  15985. };
  15986. /**
  15987. * Gets the markup wrap configuration for the supplied `nodeName`.
  15988. *
  15989. * NOTE: This lazily detects which wraps are necessary for the current browser.
  15990. *
  15991. * @param {string} nodeName Lowercase `nodeName`.
  15992. * @return {?array} Markup wrap configuration, if applicable.
  15993. */
  15994. function getMarkupWrap(nodeName) {
  15995. ("production" !== "development" ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));
  15996. if (!markupWrap.hasOwnProperty(nodeName)) {
  15997. nodeName = '*';
  15998. }
  15999. if (!shouldWrap.hasOwnProperty(nodeName)) {
  16000. if (nodeName === '*') {
  16001. dummyNode.innerHTML = '<link />';
  16002. } else {
  16003. dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
  16004. }
  16005. shouldWrap[nodeName] = !dummyNode.firstChild;
  16006. }
  16007. return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
  16008. }
  16009. module.exports = getMarkupWrap;
  16010. },{"135":135,"21":21}],128:[function(_dereq_,module,exports){
  16011. /**
  16012. * Copyright 2013-2015, Facebook, Inc.
  16013. * All rights reserved.
  16014. *
  16015. * This source code is licensed under the BSD-style license found in the
  16016. * LICENSE file in the root directory of this source tree. An additional grant
  16017. * of patent rights can be found in the PATENTS file in the same directory.
  16018. *
  16019. * @providesModule getNodeForCharacterOffset
  16020. */
  16021. 'use strict';
  16022. /**
  16023. * Given any node return the first leaf node without children.
  16024. *
  16025. * @param {DOMElement|DOMTextNode} node
  16026. * @return {DOMElement|DOMTextNode}
  16027. */
  16028. function getLeafNode(node) {
  16029. while (node && node.firstChild) {
  16030. node = node.firstChild;
  16031. }
  16032. return node;
  16033. }
  16034. /**
  16035. * Get the next sibling within a container. This will walk up the
  16036. * DOM if a node's siblings have been exhausted.
  16037. *
  16038. * @param {DOMElement|DOMTextNode} node
  16039. * @return {?DOMElement|DOMTextNode}
  16040. */
  16041. function getSiblingNode(node) {
  16042. while (node) {
  16043. if (node.nextSibling) {
  16044. return node.nextSibling;
  16045. }
  16046. node = node.parentNode;
  16047. }
  16048. }
  16049. /**
  16050. * Get object describing the nodes which contain characters at offset.
  16051. *
  16052. * @param {DOMElement|DOMTextNode} root
  16053. * @param {number} offset
  16054. * @return {?object}
  16055. */
  16056. function getNodeForCharacterOffset(root, offset) {
  16057. var node = getLeafNode(root);
  16058. var nodeStart = 0;
  16059. var nodeEnd = 0;
  16060. while (node) {
  16061. if (node.nodeType === 3) {
  16062. nodeEnd = nodeStart + node.textContent.length;
  16063. if (nodeStart <= offset && nodeEnd >= offset) {
  16064. return {
  16065. node: node,
  16066. offset: offset - nodeStart
  16067. };
  16068. }
  16069. nodeStart = nodeEnd;
  16070. }
  16071. node = getLeafNode(getSiblingNode(node));
  16072. }
  16073. }
  16074. module.exports = getNodeForCharacterOffset;
  16075. },{}],129:[function(_dereq_,module,exports){
  16076. /**
  16077. * Copyright 2013-2015, Facebook, Inc.
  16078. * All rights reserved.
  16079. *
  16080. * This source code is licensed under the BSD-style license found in the
  16081. * LICENSE file in the root directory of this source tree. An additional grant
  16082. * of patent rights can be found in the PATENTS file in the same directory.
  16083. *
  16084. * @providesModule getReactRootElementInContainer
  16085. */
  16086. 'use strict';
  16087. var DOC_NODE_TYPE = 9;
  16088. /**
  16089. * @param {DOMElement|DOMDocument} container DOM element that may contain
  16090. * a React component
  16091. * @return {?*} DOM element that may have the reactRoot ID, or null.
  16092. */
  16093. function getReactRootElementInContainer(container) {
  16094. if (!container) {
  16095. return null;
  16096. }
  16097. if (container.nodeType === DOC_NODE_TYPE) {
  16098. return container.documentElement;
  16099. } else {
  16100. return container.firstChild;
  16101. }
  16102. }
  16103. module.exports = getReactRootElementInContainer;
  16104. },{}],130:[function(_dereq_,module,exports){
  16105. /**
  16106. * Copyright 2013-2015, Facebook, Inc.
  16107. * All rights reserved.
  16108. *
  16109. * This source code is licensed under the BSD-style license found in the
  16110. * LICENSE file in the root directory of this source tree. An additional grant
  16111. * of patent rights can be found in the PATENTS file in the same directory.
  16112. *
  16113. * @providesModule getTextContentAccessor
  16114. */
  16115. 'use strict';
  16116. var ExecutionEnvironment = _dereq_(21);
  16117. var contentKey = null;
  16118. /**
  16119. * Gets the key used to access text content on a DOM node.
  16120. *
  16121. * @return {?string} Key used to access text content.
  16122. * @internal
  16123. */
  16124. function getTextContentAccessor() {
  16125. if (!contentKey && ExecutionEnvironment.canUseDOM) {
  16126. // Prefer textContent to innerText because many browsers support both but
  16127. // SVG <text> elements don't support innerText even when <div> does.
  16128. contentKey = 'textContent' in document.documentElement ?
  16129. 'textContent' :
  16130. 'innerText';
  16131. }
  16132. return contentKey;
  16133. }
  16134. module.exports = getTextContentAccessor;
  16135. },{"21":21}],131:[function(_dereq_,module,exports){
  16136. /**
  16137. * Copyright 2013-2015, Facebook, Inc.
  16138. * All rights reserved.
  16139. *
  16140. * This source code is licensed under the BSD-style license found in the
  16141. * LICENSE file in the root directory of this source tree. An additional grant
  16142. * of patent rights can be found in the PATENTS file in the same directory.
  16143. *
  16144. * @providesModule getUnboundedScrollPosition
  16145. * @typechecks
  16146. */
  16147. "use strict";
  16148. /**
  16149. * Gets the scroll position of the supplied element or window.
  16150. *
  16151. * The return values are unbounded, unlike `getScrollPosition`. This means they
  16152. * may be negative or exceed the element boundaries (which is possible using
  16153. * inertial scrolling).
  16154. *
  16155. * @param {DOMWindow|DOMElement} scrollable
  16156. * @return {object} Map with `x` and `y` keys.
  16157. */
  16158. function getUnboundedScrollPosition(scrollable) {
  16159. if (scrollable === window) {
  16160. return {
  16161. x: window.pageXOffset || document.documentElement.scrollLeft,
  16162. y: window.pageYOffset || document.documentElement.scrollTop
  16163. };
  16164. }
  16165. return {
  16166. x: scrollable.scrollLeft,
  16167. y: scrollable.scrollTop
  16168. };
  16169. }
  16170. module.exports = getUnboundedScrollPosition;
  16171. },{}],132:[function(_dereq_,module,exports){
  16172. /**
  16173. * Copyright 2013-2015, Facebook, Inc.
  16174. * All rights reserved.
  16175. *
  16176. * This source code is licensed under the BSD-style license found in the
  16177. * LICENSE file in the root directory of this source tree. An additional grant
  16178. * of patent rights can be found in the PATENTS file in the same directory.
  16179. *
  16180. * @providesModule hyphenate
  16181. * @typechecks
  16182. */
  16183. var _uppercasePattern = /([A-Z])/g;
  16184. /**
  16185. * Hyphenates a camelcased string, for example:
  16186. *
  16187. * > hyphenate('backgroundColor')
  16188. * < "background-color"
  16189. *
  16190. * For CSS style names, use `hyphenateStyleName` instead which works properly
  16191. * with all vendor prefixes, including `ms`.
  16192. *
  16193. * @param {string} string
  16194. * @return {string}
  16195. */
  16196. function hyphenate(string) {
  16197. return string.replace(_uppercasePattern, '-$1').toLowerCase();
  16198. }
  16199. module.exports = hyphenate;
  16200. },{}],133:[function(_dereq_,module,exports){
  16201. /**
  16202. * Copyright 2013-2015, Facebook, Inc.
  16203. * All rights reserved.
  16204. *
  16205. * This source code is licensed under the BSD-style license found in the
  16206. * LICENSE file in the root directory of this source tree. An additional grant
  16207. * of patent rights can be found in the PATENTS file in the same directory.
  16208. *
  16209. * @providesModule hyphenateStyleName
  16210. * @typechecks
  16211. */
  16212. "use strict";
  16213. var hyphenate = _dereq_(132);
  16214. var msPattern = /^ms-/;
  16215. /**
  16216. * Hyphenates a camelcased CSS property name, for example:
  16217. *
  16218. * > hyphenateStyleName('backgroundColor')
  16219. * < "background-color"
  16220. * > hyphenateStyleName('MozTransition')
  16221. * < "-moz-transition"
  16222. * > hyphenateStyleName('msTransition')
  16223. * < "-ms-transition"
  16224. *
  16225. * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
  16226. * is converted to `-ms-`.
  16227. *
  16228. * @param {string} string
  16229. * @return {string}
  16230. */
  16231. function hyphenateStyleName(string) {
  16232. return hyphenate(string).replace(msPattern, '-ms-');
  16233. }
  16234. module.exports = hyphenateStyleName;
  16235. },{"132":132}],134:[function(_dereq_,module,exports){
  16236. /**
  16237. * Copyright 2013-2015, Facebook, Inc.
  16238. * All rights reserved.
  16239. *
  16240. * This source code is licensed under the BSD-style license found in the
  16241. * LICENSE file in the root directory of this source tree. An additional grant
  16242. * of patent rights can be found in the PATENTS file in the same directory.
  16243. *
  16244. * @providesModule instantiateReactComponent
  16245. * @typechecks static-only
  16246. */
  16247. 'use strict';
  16248. var ReactCompositeComponent = _dereq_(37);
  16249. var ReactEmptyComponent = _dereq_(59);
  16250. var ReactNativeComponent = _dereq_(73);
  16251. var assign = _dereq_(27);
  16252. var invariant = _dereq_(135);
  16253. var warning = _dereq_(154);
  16254. // To avoid a cyclic dependency, we create the final class in this module
  16255. var ReactCompositeComponentWrapper = function() { };
  16256. assign(
  16257. ReactCompositeComponentWrapper.prototype,
  16258. ReactCompositeComponent.Mixin,
  16259. {
  16260. _instantiateReactComponent: instantiateReactComponent
  16261. }
  16262. );
  16263. /**
  16264. * Check if the type reference is a known internal type. I.e. not a user
  16265. * provided composite type.
  16266. *
  16267. * @param {function} type
  16268. * @return {boolean} Returns true if this is a valid internal type.
  16269. */
  16270. function isInternalComponentType(type) {
  16271. return (
  16272. typeof type === 'function' &&
  16273. typeof type.prototype !== 'undefined' &&
  16274. typeof type.prototype.mountComponent === 'function' &&
  16275. typeof type.prototype.receiveComponent === 'function'
  16276. );
  16277. }
  16278. /**
  16279. * Given a ReactNode, create an instance that will actually be mounted.
  16280. *
  16281. * @param {ReactNode} node
  16282. * @param {*} parentCompositeType The composite type that resolved this.
  16283. * @return {object} A new instance of the element's constructor.
  16284. * @protected
  16285. */
  16286. function instantiateReactComponent(node, parentCompositeType) {
  16287. var instance;
  16288. if (node === null || node === false) {
  16289. node = ReactEmptyComponent.emptyElement;
  16290. }
  16291. if (typeof node === 'object') {
  16292. var element = node;
  16293. if ("production" !== "development") {
  16294. ("production" !== "development" ? warning(
  16295. element && (typeof element.type === 'function' ||
  16296. typeof element.type === 'string'),
  16297. 'Only functions or strings can be mounted as React components.'
  16298. ) : null);
  16299. }
  16300. // Special case string values
  16301. if (parentCompositeType === element.type &&
  16302. typeof element.type === 'string') {
  16303. // Avoid recursion if the wrapper renders itself.
  16304. instance = ReactNativeComponent.createInternalComponent(element);
  16305. // All native components are currently wrapped in a composite so we're
  16306. // safe to assume that this is what we should instantiate.
  16307. } else if (isInternalComponentType(element.type)) {
  16308. // This is temporarily available for custom components that are not string
  16309. // represenations. I.e. ART. Once those are updated to use the string
  16310. // representation, we can drop this code path.
  16311. instance = new element.type(element);
  16312. } else {
  16313. instance = new ReactCompositeComponentWrapper();
  16314. }
  16315. } else if (typeof node === 'string' || typeof node === 'number') {
  16316. instance = ReactNativeComponent.createInstanceForText(node);
  16317. } else {
  16318. ("production" !== "development" ? invariant(
  16319. false,
  16320. 'Encountered invalid React node of type %s',
  16321. typeof node
  16322. ) : invariant(false));
  16323. }
  16324. if ("production" !== "development") {
  16325. ("production" !== "development" ? warning(
  16326. typeof instance.construct === 'function' &&
  16327. typeof instance.mountComponent === 'function' &&
  16328. typeof instance.receiveComponent === 'function' &&
  16329. typeof instance.unmountComponent === 'function',
  16330. 'Only React Components can be mounted.'
  16331. ) : null);
  16332. }
  16333. // Sets up the instance. This can probably just move into the constructor now.
  16334. instance.construct(node);
  16335. // These two fields are used by the DOM and ART diffing algorithms
  16336. // respectively. Instead of using expandos on components, we should be
  16337. // storing the state needed by the diffing algorithms elsewhere.
  16338. instance._mountIndex = 0;
  16339. instance._mountImage = null;
  16340. if ("production" !== "development") {
  16341. instance._isOwnerNecessary = false;
  16342. instance._warnedAboutRefsInRender = false;
  16343. }
  16344. // Internal instances should fully constructed at this point, so they should
  16345. // not get any new fields added to them at this point.
  16346. if ("production" !== "development") {
  16347. if (Object.preventExtensions) {
  16348. Object.preventExtensions(instance);
  16349. }
  16350. }
  16351. return instance;
  16352. }
  16353. module.exports = instantiateReactComponent;
  16354. },{"135":135,"154":154,"27":27,"37":37,"59":59,"73":73}],135:[function(_dereq_,module,exports){
  16355. /**
  16356. * Copyright 2013-2015, Facebook, Inc.
  16357. * All rights reserved.
  16358. *
  16359. * This source code is licensed under the BSD-style license found in the
  16360. * LICENSE file in the root directory of this source tree. An additional grant
  16361. * of patent rights can be found in the PATENTS file in the same directory.
  16362. *
  16363. * @providesModule invariant
  16364. */
  16365. "use strict";
  16366. /**
  16367. * Use invariant() to assert state which your program assumes to be true.
  16368. *
  16369. * Provide sprintf-style format (only %s is supported) and arguments
  16370. * to provide information about what broke and what you were
  16371. * expecting.
  16372. *
  16373. * The invariant message will be stripped in production, but the invariant
  16374. * will remain to ensure logic does not differ in production.
  16375. */
  16376. var invariant = function(condition, format, a, b, c, d, e, f) {
  16377. if ("production" !== "development") {
  16378. if (format === undefined) {
  16379. throw new Error('invariant requires an error message argument');
  16380. }
  16381. }
  16382. if (!condition) {
  16383. var error;
  16384. if (format === undefined) {
  16385. error = new Error(
  16386. 'Minified exception occurred; use the non-minified dev environment ' +
  16387. 'for the full error message and additional helpful warnings.'
  16388. );
  16389. } else {
  16390. var args = [a, b, c, d, e, f];
  16391. var argIndex = 0;
  16392. error = new Error(
  16393. 'Invariant Violation: ' +
  16394. format.replace(/%s/g, function() { return args[argIndex++]; })
  16395. );
  16396. }
  16397. error.framesToPop = 1; // we don't care about invariant's own frame
  16398. throw error;
  16399. }
  16400. };
  16401. module.exports = invariant;
  16402. },{}],136:[function(_dereq_,module,exports){
  16403. /**
  16404. * Copyright 2013-2015, Facebook, Inc.
  16405. * All rights reserved.
  16406. *
  16407. * This source code is licensed under the BSD-style license found in the
  16408. * LICENSE file in the root directory of this source tree. An additional grant
  16409. * of patent rights can be found in the PATENTS file in the same directory.
  16410. *
  16411. * @providesModule isEventSupported
  16412. */
  16413. 'use strict';
  16414. var ExecutionEnvironment = _dereq_(21);
  16415. var useHasFeature;
  16416. if (ExecutionEnvironment.canUseDOM) {
  16417. useHasFeature =
  16418. document.implementation &&
  16419. document.implementation.hasFeature &&
  16420. // always returns true in newer browsers as per the standard.
  16421. // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
  16422. document.implementation.hasFeature('', '') !== true;
  16423. }
  16424. /**
  16425. * Checks if an event is supported in the current execution environment.
  16426. *
  16427. * NOTE: This will not work correctly for non-generic events such as `change`,
  16428. * `reset`, `load`, `error`, and `select`.
  16429. *
  16430. * Borrows from Modernizr.
  16431. *
  16432. * @param {string} eventNameSuffix Event name, e.g. "click".
  16433. * @param {?boolean} capture Check if the capture phase is supported.
  16434. * @return {boolean} True if the event is supported.
  16435. * @internal
  16436. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  16437. */
  16438. function isEventSupported(eventNameSuffix, capture) {
  16439. if (!ExecutionEnvironment.canUseDOM ||
  16440. capture && !('addEventListener' in document)) {
  16441. return false;
  16442. }
  16443. var eventName = 'on' + eventNameSuffix;
  16444. var isSupported = eventName in document;
  16445. if (!isSupported) {
  16446. var element = document.createElement('div');
  16447. element.setAttribute(eventName, 'return;');
  16448. isSupported = typeof element[eventName] === 'function';
  16449. }
  16450. if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
  16451. // This is the only way to test support for the `wheel` event in IE9+.
  16452. isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
  16453. }
  16454. return isSupported;
  16455. }
  16456. module.exports = isEventSupported;
  16457. },{"21":21}],137:[function(_dereq_,module,exports){
  16458. /**
  16459. * Copyright 2013-2015, Facebook, Inc.
  16460. * All rights reserved.
  16461. *
  16462. * This source code is licensed under the BSD-style license found in the
  16463. * LICENSE file in the root directory of this source tree. An additional grant
  16464. * of patent rights can be found in the PATENTS file in the same directory.
  16465. *
  16466. * @providesModule isNode
  16467. * @typechecks
  16468. */
  16469. /**
  16470. * @param {*} object The object to check.
  16471. * @return {boolean} Whether or not the object is a DOM node.
  16472. */
  16473. function isNode(object) {
  16474. return !!(object && (
  16475. ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
  16476. typeof object.nodeType === 'number' &&
  16477. typeof object.nodeName === 'string'))
  16478. ));
  16479. }
  16480. module.exports = isNode;
  16481. },{}],138:[function(_dereq_,module,exports){
  16482. /**
  16483. * Copyright 2013-2015, Facebook, Inc.
  16484. * All rights reserved.
  16485. *
  16486. * This source code is licensed under the BSD-style license found in the
  16487. * LICENSE file in the root directory of this source tree. An additional grant
  16488. * of patent rights can be found in the PATENTS file in the same directory.
  16489. *
  16490. * @providesModule isTextInputElement
  16491. */
  16492. 'use strict';
  16493. /**
  16494. * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
  16495. */
  16496. var supportedInputTypes = {
  16497. 'color': true,
  16498. 'date': true,
  16499. 'datetime': true,
  16500. 'datetime-local': true,
  16501. 'email': true,
  16502. 'month': true,
  16503. 'number': true,
  16504. 'password': true,
  16505. 'range': true,
  16506. 'search': true,
  16507. 'tel': true,
  16508. 'text': true,
  16509. 'time': true,
  16510. 'url': true,
  16511. 'week': true
  16512. };
  16513. function isTextInputElement(elem) {
  16514. return elem && (
  16515. (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')
  16516. );
  16517. }
  16518. module.exports = isTextInputElement;
  16519. },{}],139:[function(_dereq_,module,exports){
  16520. /**
  16521. * Copyright 2013-2015, Facebook, Inc.
  16522. * All rights reserved.
  16523. *
  16524. * This source code is licensed under the BSD-style license found in the
  16525. * LICENSE file in the root directory of this source tree. An additional grant
  16526. * of patent rights can be found in the PATENTS file in the same directory.
  16527. *
  16528. * @providesModule isTextNode
  16529. * @typechecks
  16530. */
  16531. var isNode = _dereq_(137);
  16532. /**
  16533. * @param {*} object The object to check.
  16534. * @return {boolean} Whether or not the object is a DOM text node.
  16535. */
  16536. function isTextNode(object) {
  16537. return isNode(object) && object.nodeType == 3;
  16538. }
  16539. module.exports = isTextNode;
  16540. },{"137":137}],140:[function(_dereq_,module,exports){
  16541. /**
  16542. * Copyright 2013-2015, Facebook, Inc.
  16543. * All rights reserved.
  16544. *
  16545. * This source code is licensed under the BSD-style license found in the
  16546. * LICENSE file in the root directory of this source tree. An additional grant
  16547. * of patent rights can be found in the PATENTS file in the same directory.
  16548. *
  16549. * @providesModule keyMirror
  16550. * @typechecks static-only
  16551. */
  16552. 'use strict';
  16553. var invariant = _dereq_(135);
  16554. /**
  16555. * Constructs an enumeration with keys equal to their value.
  16556. *
  16557. * For example:
  16558. *
  16559. * var COLORS = keyMirror({blue: null, red: null});
  16560. * var myColor = COLORS.blue;
  16561. * var isColorValid = !!COLORS[myColor];
  16562. *
  16563. * The last line could not be performed if the values of the generated enum were
  16564. * not equal to their keys.
  16565. *
  16566. * Input: {key1: val1, key2: val2}
  16567. * Output: {key1: key1, key2: key2}
  16568. *
  16569. * @param {object} obj
  16570. * @return {object}
  16571. */
  16572. var keyMirror = function(obj) {
  16573. var ret = {};
  16574. var key;
  16575. ("production" !== "development" ? invariant(
  16576. obj instanceof Object && !Array.isArray(obj),
  16577. 'keyMirror(...): Argument must be an object.'
  16578. ) : invariant(obj instanceof Object && !Array.isArray(obj)));
  16579. for (key in obj) {
  16580. if (!obj.hasOwnProperty(key)) {
  16581. continue;
  16582. }
  16583. ret[key] = key;
  16584. }
  16585. return ret;
  16586. };
  16587. module.exports = keyMirror;
  16588. },{"135":135}],141:[function(_dereq_,module,exports){
  16589. /**
  16590. * Copyright 2013-2015, Facebook, Inc.
  16591. * All rights reserved.
  16592. *
  16593. * This source code is licensed under the BSD-style license found in the
  16594. * LICENSE file in the root directory of this source tree. An additional grant
  16595. * of patent rights can be found in the PATENTS file in the same directory.
  16596. *
  16597. * @providesModule keyOf
  16598. */
  16599. /**
  16600. * Allows extraction of a minified key. Let's the build system minify keys
  16601. * without loosing the ability to dynamically use key strings as values
  16602. * themselves. Pass in an object with a single key/val pair and it will return
  16603. * you the string key of that single record. Suppose you want to grab the
  16604. * value for a key 'className' inside of an object. Key/val minification may
  16605. * have aliased that key to be 'xa12'. keyOf({className: null}) will return
  16606. * 'xa12' in that case. Resolve keys you want to use once at startup time, then
  16607. * reuse those resolutions.
  16608. */
  16609. var keyOf = function(oneKeyObj) {
  16610. var key;
  16611. for (key in oneKeyObj) {
  16612. if (!oneKeyObj.hasOwnProperty(key)) {
  16613. continue;
  16614. }
  16615. return key;
  16616. }
  16617. return null;
  16618. };
  16619. module.exports = keyOf;
  16620. },{}],142:[function(_dereq_,module,exports){
  16621. /**
  16622. * Copyright 2013-2015, Facebook, Inc.
  16623. * All rights reserved.
  16624. *
  16625. * This source code is licensed under the BSD-style license found in the
  16626. * LICENSE file in the root directory of this source tree. An additional grant
  16627. * of patent rights can be found in the PATENTS file in the same directory.
  16628. *
  16629. * @providesModule mapObject
  16630. */
  16631. 'use strict';
  16632. var hasOwnProperty = Object.prototype.hasOwnProperty;
  16633. /**
  16634. * Executes the provided `callback` once for each enumerable own property in the
  16635. * object and constructs a new object from the results. The `callback` is
  16636. * invoked with three arguments:
  16637. *
  16638. * - the property value
  16639. * - the property name
  16640. * - the object being traversed
  16641. *
  16642. * Properties that are added after the call to `mapObject` will not be visited
  16643. * by `callback`. If the values of existing properties are changed, the value
  16644. * passed to `callback` will be the value at the time `mapObject` visits them.
  16645. * Properties that are deleted before being visited are not visited.
  16646. *
  16647. * @grep function objectMap()
  16648. * @grep function objMap()
  16649. *
  16650. * @param {?object} object
  16651. * @param {function} callback
  16652. * @param {*} context
  16653. * @return {?object}
  16654. */
  16655. function mapObject(object, callback, context) {
  16656. if (!object) {
  16657. return null;
  16658. }
  16659. var result = {};
  16660. for (var name in object) {
  16661. if (hasOwnProperty.call(object, name)) {
  16662. result[name] = callback.call(context, object[name], name, object);
  16663. }
  16664. }
  16665. return result;
  16666. }
  16667. module.exports = mapObject;
  16668. },{}],143:[function(_dereq_,module,exports){
  16669. /**
  16670. * Copyright 2013-2015, Facebook, Inc.
  16671. * All rights reserved.
  16672. *
  16673. * This source code is licensed under the BSD-style license found in the
  16674. * LICENSE file in the root directory of this source tree. An additional grant
  16675. * of patent rights can be found in the PATENTS file in the same directory.
  16676. *
  16677. * @providesModule memoizeStringOnly
  16678. * @typechecks static-only
  16679. */
  16680. 'use strict';
  16681. /**
  16682. * Memoizes the return value of a function that accepts one string argument.
  16683. *
  16684. * @param {function} callback
  16685. * @return {function}
  16686. */
  16687. function memoizeStringOnly(callback) {
  16688. var cache = {};
  16689. return function(string) {
  16690. if (!cache.hasOwnProperty(string)) {
  16691. cache[string] = callback.call(this, string);
  16692. }
  16693. return cache[string];
  16694. };
  16695. }
  16696. module.exports = memoizeStringOnly;
  16697. },{}],144:[function(_dereq_,module,exports){
  16698. /**
  16699. * Copyright 2013-2015, Facebook, Inc.
  16700. * All rights reserved.
  16701. *
  16702. * This source code is licensed under the BSD-style license found in the
  16703. * LICENSE file in the root directory of this source tree. An additional grant
  16704. * of patent rights can be found in the PATENTS file in the same directory.
  16705. *
  16706. * @providesModule onlyChild
  16707. */
  16708. 'use strict';
  16709. var ReactElement = _dereq_(57);
  16710. var invariant = _dereq_(135);
  16711. /**
  16712. * Returns the first child in a collection of children and verifies that there
  16713. * is only one child in the collection. The current implementation of this
  16714. * function assumes that a single child gets passed without a wrapper, but the
  16715. * purpose of this helper function is to abstract away the particular structure
  16716. * of children.
  16717. *
  16718. * @param {?object} children Child collection structure.
  16719. * @return {ReactComponent} The first and only `ReactComponent` contained in the
  16720. * structure.
  16721. */
  16722. function onlyChild(children) {
  16723. ("production" !== "development" ? invariant(
  16724. ReactElement.isValidElement(children),
  16725. 'onlyChild must be passed a children with exactly one child.'
  16726. ) : invariant(ReactElement.isValidElement(children)));
  16727. return children;
  16728. }
  16729. module.exports = onlyChild;
  16730. },{"135":135,"57":57}],145:[function(_dereq_,module,exports){
  16731. /**
  16732. * Copyright 2013-2015, Facebook, Inc.
  16733. * All rights reserved.
  16734. *
  16735. * This source code is licensed under the BSD-style license found in the
  16736. * LICENSE file in the root directory of this source tree. An additional grant
  16737. * of patent rights can be found in the PATENTS file in the same directory.
  16738. *
  16739. * @providesModule performance
  16740. * @typechecks
  16741. */
  16742. "use strict";
  16743. var ExecutionEnvironment = _dereq_(21);
  16744. var performance;
  16745. if (ExecutionEnvironment.canUseDOM) {
  16746. performance =
  16747. window.performance ||
  16748. window.msPerformance ||
  16749. window.webkitPerformance;
  16750. }
  16751. module.exports = performance || {};
  16752. },{"21":21}],146:[function(_dereq_,module,exports){
  16753. /**
  16754. * Copyright 2013-2015, Facebook, Inc.
  16755. * All rights reserved.
  16756. *
  16757. * This source code is licensed under the BSD-style license found in the
  16758. * LICENSE file in the root directory of this source tree. An additional grant
  16759. * of patent rights can be found in the PATENTS file in the same directory.
  16760. *
  16761. * @providesModule performanceNow
  16762. * @typechecks
  16763. */
  16764. var performance = _dereq_(145);
  16765. /**
  16766. * Detect if we can use `window.performance.now()` and gracefully fallback to
  16767. * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
  16768. * because of Facebook's testing infrastructure.
  16769. */
  16770. if (!performance || !performance.now) {
  16771. performance = Date;
  16772. }
  16773. var performanceNow = performance.now.bind(performance);
  16774. module.exports = performanceNow;
  16775. },{"145":145}],147:[function(_dereq_,module,exports){
  16776. /**
  16777. * Copyright 2013-2015, Facebook, Inc.
  16778. * All rights reserved.
  16779. *
  16780. * This source code is licensed under the BSD-style license found in the
  16781. * LICENSE file in the root directory of this source tree. An additional grant
  16782. * of patent rights can be found in the PATENTS file in the same directory.
  16783. *
  16784. * @providesModule quoteAttributeValueForBrowser
  16785. */
  16786. 'use strict';
  16787. var escapeTextContentForBrowser = _dereq_(116);
  16788. /**
  16789. * Escapes attribute value to prevent scripting attacks.
  16790. *
  16791. * @param {*} value Value to escape.
  16792. * @return {string} An escaped string.
  16793. */
  16794. function quoteAttributeValueForBrowser(value) {
  16795. return '"' + escapeTextContentForBrowser(value) + '"';
  16796. }
  16797. module.exports = quoteAttributeValueForBrowser;
  16798. },{"116":116}],148:[function(_dereq_,module,exports){
  16799. /**
  16800. * Copyright 2013-2015, Facebook, Inc.
  16801. * All rights reserved.
  16802. *
  16803. * This source code is licensed under the BSD-style license found in the
  16804. * LICENSE file in the root directory of this source tree. An additional grant
  16805. * of patent rights can be found in the PATENTS file in the same directory.
  16806. *
  16807. * @providesModule setInnerHTML
  16808. */
  16809. /* globals MSApp */
  16810. 'use strict';
  16811. var ExecutionEnvironment = _dereq_(21);
  16812. var WHITESPACE_TEST = /^[ \r\n\t\f]/;
  16813. var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
  16814. /**
  16815. * Set the innerHTML property of a node, ensuring that whitespace is preserved
  16816. * even in IE8.
  16817. *
  16818. * @param {DOMElement} node
  16819. * @param {string} html
  16820. * @internal
  16821. */
  16822. var setInnerHTML = function(node, html) {
  16823. node.innerHTML = html;
  16824. };
  16825. // Win8 apps: Allow all html to be inserted
  16826. if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
  16827. setInnerHTML = function(node, html) {
  16828. MSApp.execUnsafeLocalFunction(function() {
  16829. node.innerHTML = html;
  16830. });
  16831. };
  16832. }
  16833. if (ExecutionEnvironment.canUseDOM) {
  16834. // IE8: When updating a just created node with innerHTML only leading
  16835. // whitespace is removed. When updating an existing node with innerHTML
  16836. // whitespace in root TextNodes is also collapsed.
  16837. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
  16838. // Feature detection; only IE8 is known to behave improperly like this.
  16839. var testElement = document.createElement('div');
  16840. testElement.innerHTML = ' ';
  16841. if (testElement.innerHTML === '') {
  16842. setInnerHTML = function(node, html) {
  16843. // Magic theory: IE8 supposedly differentiates between added and updated
  16844. // nodes when processing innerHTML, innerHTML on updated nodes suffers
  16845. // from worse whitespace behavior. Re-adding a node like this triggers
  16846. // the initial and more favorable whitespace behavior.
  16847. // TODO: What to do on a detached node?
  16848. if (node.parentNode) {
  16849. node.parentNode.replaceChild(node, node);
  16850. }
  16851. // We also implement a workaround for non-visible tags disappearing into
  16852. // thin air on IE8, this only happens if there is no visible text
  16853. // in-front of the non-visible tags. Piggyback on the whitespace fix
  16854. // and simply check if any non-visible tags appear in the source.
  16855. if (WHITESPACE_TEST.test(html) ||
  16856. html[0] === '<' && NONVISIBLE_TEST.test(html)) {
  16857. // Recover leading whitespace by temporarily prepending any character.
  16858. // \uFEFF has the potential advantage of being zero-width/invisible.
  16859. node.innerHTML = '\uFEFF' + html;
  16860. // deleteData leaves an empty `TextNode` which offsets the index of all
  16861. // children. Definitely want to avoid this.
  16862. var textNode = node.firstChild;
  16863. if (textNode.data.length === 1) {
  16864. node.removeChild(textNode);
  16865. } else {
  16866. textNode.deleteData(0, 1);
  16867. }
  16868. } else {
  16869. node.innerHTML = html;
  16870. }
  16871. };
  16872. }
  16873. }
  16874. module.exports = setInnerHTML;
  16875. },{"21":21}],149:[function(_dereq_,module,exports){
  16876. /**
  16877. * Copyright 2013-2015, Facebook, Inc.
  16878. * All rights reserved.
  16879. *
  16880. * This source code is licensed under the BSD-style license found in the
  16881. * LICENSE file in the root directory of this source tree. An additional grant
  16882. * of patent rights can be found in the PATENTS file in the same directory.
  16883. *
  16884. * @providesModule setTextContent
  16885. */
  16886. 'use strict';
  16887. var ExecutionEnvironment = _dereq_(21);
  16888. var escapeTextContentForBrowser = _dereq_(116);
  16889. var setInnerHTML = _dereq_(148);
  16890. /**
  16891. * Set the textContent property of a node, ensuring that whitespace is preserved
  16892. * even in IE8. innerText is a poor substitute for textContent and, among many
  16893. * issues, inserts <br> instead of the literal newline chars. innerHTML behaves
  16894. * as it should.
  16895. *
  16896. * @param {DOMElement} node
  16897. * @param {string} text
  16898. * @internal
  16899. */
  16900. var setTextContent = function(node, text) {
  16901. node.textContent = text;
  16902. };
  16903. if (ExecutionEnvironment.canUseDOM) {
  16904. if (!('textContent' in document.documentElement)) {
  16905. setTextContent = function(node, text) {
  16906. setInnerHTML(node, escapeTextContentForBrowser(text));
  16907. };
  16908. }
  16909. }
  16910. module.exports = setTextContent;
  16911. },{"116":116,"148":148,"21":21}],150:[function(_dereq_,module,exports){
  16912. /**
  16913. * Copyright 2013-2015, Facebook, Inc.
  16914. * All rights reserved.
  16915. *
  16916. * This source code is licensed under the BSD-style license found in the
  16917. * LICENSE file in the root directory of this source tree. An additional grant
  16918. * of patent rights can be found in the PATENTS file in the same directory.
  16919. *
  16920. * @providesModule shallowEqual
  16921. */
  16922. 'use strict';
  16923. /**
  16924. * Performs equality by iterating through keys on an object and returning
  16925. * false when any key has values which are not strictly equal between
  16926. * objA and objB. Returns true when the values of all keys are strictly equal.
  16927. *
  16928. * @return {boolean}
  16929. */
  16930. function shallowEqual(objA, objB) {
  16931. if (objA === objB) {
  16932. return true;
  16933. }
  16934. var key;
  16935. // Test for A's keys different from B.
  16936. for (key in objA) {
  16937. if (objA.hasOwnProperty(key) &&
  16938. (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
  16939. return false;
  16940. }
  16941. }
  16942. // Test for B's keys missing from A.
  16943. for (key in objB) {
  16944. if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
  16945. return false;
  16946. }
  16947. }
  16948. return true;
  16949. }
  16950. module.exports = shallowEqual;
  16951. },{}],151:[function(_dereq_,module,exports){
  16952. /**
  16953. * Copyright 2013-2015, Facebook, Inc.
  16954. * All rights reserved.
  16955. *
  16956. * This source code is licensed under the BSD-style license found in the
  16957. * LICENSE file in the root directory of this source tree. An additional grant
  16958. * of patent rights can be found in the PATENTS file in the same directory.
  16959. *
  16960. * @providesModule shouldUpdateReactComponent
  16961. * @typechecks static-only
  16962. */
  16963. 'use strict';
  16964. var warning = _dereq_(154);
  16965. /**
  16966. * Given a `prevElement` and `nextElement`, determines if the existing
  16967. * instance should be updated as opposed to being destroyed or replaced by a new
  16968. * instance. Both arguments are elements. This ensures that this logic can
  16969. * operate on stateless trees without any backing instance.
  16970. *
  16971. * @param {?object} prevElement
  16972. * @param {?object} nextElement
  16973. * @return {boolean} True if the existing instance should be updated.
  16974. * @protected
  16975. */
  16976. function shouldUpdateReactComponent(prevElement, nextElement) {
  16977. if (prevElement != null && nextElement != null) {
  16978. var prevType = typeof prevElement;
  16979. var nextType = typeof nextElement;
  16980. if (prevType === 'string' || prevType === 'number') {
  16981. return (nextType === 'string' || nextType === 'number');
  16982. } else {
  16983. if (nextType === 'object' &&
  16984. prevElement.type === nextElement.type &&
  16985. prevElement.key === nextElement.key) {
  16986. var ownersMatch = prevElement._owner === nextElement._owner;
  16987. var prevName = null;
  16988. var nextName = null;
  16989. var nextDisplayName = null;
  16990. if ("production" !== "development") {
  16991. if (!ownersMatch) {
  16992. if (prevElement._owner != null &&
  16993. prevElement._owner.getPublicInstance() != null &&
  16994. prevElement._owner.getPublicInstance().constructor != null) {
  16995. prevName =
  16996. prevElement._owner.getPublicInstance().constructor.displayName;
  16997. }
  16998. if (nextElement._owner != null &&
  16999. nextElement._owner.getPublicInstance() != null &&
  17000. nextElement._owner.getPublicInstance().constructor != null) {
  17001. nextName =
  17002. nextElement._owner.getPublicInstance().constructor.displayName;
  17003. }
  17004. if (nextElement.type != null &&
  17005. nextElement.type.displayName != null) {
  17006. nextDisplayName = nextElement.type.displayName;
  17007. }
  17008. if (nextElement.type != null && typeof nextElement.type === 'string') {
  17009. nextDisplayName = nextElement.type;
  17010. }
  17011. if (typeof nextElement.type !== 'string' ||
  17012. nextElement.type === 'input' ||
  17013. nextElement.type === 'textarea') {
  17014. if ((prevElement._owner != null &&
  17015. prevElement._owner._isOwnerNecessary === false) ||
  17016. (nextElement._owner != null &&
  17017. nextElement._owner._isOwnerNecessary === false)) {
  17018. if (prevElement._owner != null) {
  17019. prevElement._owner._isOwnerNecessary = true;
  17020. }
  17021. if (nextElement._owner != null) {
  17022. nextElement._owner._isOwnerNecessary = true;
  17023. }
  17024. ("production" !== "development" ? warning(
  17025. false,
  17026. '<%s /> is being rendered by both %s and %s using the same ' +
  17027. 'key (%s) in the same place. Currently, this means that ' +
  17028. 'they don\'t preserve state. This behavior should be very ' +
  17029. 'rare so we\'re considering deprecating it. Please contact ' +
  17030. 'the React team and explain your use case so that we can ' +
  17031. 'take that into consideration.',
  17032. nextDisplayName || 'Unknown Component',
  17033. prevName || '[Unknown]',
  17034. nextName || '[Unknown]',
  17035. prevElement.key
  17036. ) : null);
  17037. }
  17038. }
  17039. }
  17040. }
  17041. return ownersMatch;
  17042. }
  17043. }
  17044. }
  17045. return false;
  17046. }
  17047. module.exports = shouldUpdateReactComponent;
  17048. },{"154":154}],152:[function(_dereq_,module,exports){
  17049. /**
  17050. * Copyright 2014-2015, Facebook, Inc.
  17051. * All rights reserved.
  17052. *
  17053. * This source code is licensed under the BSD-style license found in the
  17054. * LICENSE file in the root directory of this source tree. An additional grant
  17055. * of patent rights can be found in the PATENTS file in the same directory.
  17056. *
  17057. * @providesModule toArray
  17058. * @typechecks
  17059. */
  17060. var invariant = _dereq_(135);
  17061. /**
  17062. * Convert array-like objects to arrays.
  17063. *
  17064. * This API assumes the caller knows the contents of the data type. For less
  17065. * well defined inputs use createArrayFromMixed.
  17066. *
  17067. * @param {object|function|filelist} obj
  17068. * @return {array}
  17069. */
  17070. function toArray(obj) {
  17071. var length = obj.length;
  17072. // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
  17073. // old versions of Safari).
  17074. ("production" !== "development" ? invariant(
  17075. !Array.isArray(obj) &&
  17076. (typeof obj === 'object' || typeof obj === 'function'),
  17077. 'toArray: Array-like object expected'
  17078. ) : invariant(!Array.isArray(obj) &&
  17079. (typeof obj === 'object' || typeof obj === 'function')));
  17080. ("production" !== "development" ? invariant(
  17081. typeof length === 'number',
  17082. 'toArray: Object needs a length property'
  17083. ) : invariant(typeof length === 'number'));
  17084. ("production" !== "development" ? invariant(
  17085. length === 0 ||
  17086. (length - 1) in obj,
  17087. 'toArray: Object should have keys for indices'
  17088. ) : invariant(length === 0 ||
  17089. (length - 1) in obj));
  17090. // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
  17091. // without method will throw during the slice call and skip straight to the
  17092. // fallback.
  17093. if (obj.hasOwnProperty) {
  17094. try {
  17095. return Array.prototype.slice.call(obj);
  17096. } catch (e) {
  17097. // IE < 9 does not support Array#slice on collections objects
  17098. }
  17099. }
  17100. // Fall back to copying key by key. This assumes all keys have a value,
  17101. // so will not preserve sparsely populated inputs.
  17102. var ret = Array(length);
  17103. for (var ii = 0; ii < length; ii++) {
  17104. ret[ii] = obj[ii];
  17105. }
  17106. return ret;
  17107. }
  17108. module.exports = toArray;
  17109. },{"135":135}],153:[function(_dereq_,module,exports){
  17110. /**
  17111. * Copyright 2013-2015, Facebook, Inc.
  17112. * All rights reserved.
  17113. *
  17114. * This source code is licensed under the BSD-style license found in the
  17115. * LICENSE file in the root directory of this source tree. An additional grant
  17116. * of patent rights can be found in the PATENTS file in the same directory.
  17117. *
  17118. * @providesModule traverseAllChildren
  17119. */
  17120. 'use strict';
  17121. var ReactElement = _dereq_(57);
  17122. var ReactFragment = _dereq_(63);
  17123. var ReactInstanceHandles = _dereq_(66);
  17124. var getIteratorFn = _dereq_(126);
  17125. var invariant = _dereq_(135);
  17126. var warning = _dereq_(154);
  17127. var SEPARATOR = ReactInstanceHandles.SEPARATOR;
  17128. var SUBSEPARATOR = ':';
  17129. /**
  17130. * TODO: Test that a single child and an array with one item have the same key
  17131. * pattern.
  17132. */
  17133. var userProvidedKeyEscaperLookup = {
  17134. '=': '=0',
  17135. '.': '=1',
  17136. ':': '=2'
  17137. };
  17138. var userProvidedKeyEscapeRegex = /[=.:]/g;
  17139. var didWarnAboutMaps = false;
  17140. function userProvidedKeyEscaper(match) {
  17141. return userProvidedKeyEscaperLookup[match];
  17142. }
  17143. /**
  17144. * Generate a key string that identifies a component within a set.
  17145. *
  17146. * @param {*} component A component that could contain a manual key.
  17147. * @param {number} index Index that is used if a manual key is not provided.
  17148. * @return {string}
  17149. */
  17150. function getComponentKey(component, index) {
  17151. if (component && component.key != null) {
  17152. // Explicit key
  17153. return wrapUserProvidedKey(component.key);
  17154. }
  17155. // Implicit key determined by the index in the set
  17156. return index.toString(36);
  17157. }
  17158. /**
  17159. * Escape a component key so that it is safe to use in a reactid.
  17160. *
  17161. * @param {*} key Component key to be escaped.
  17162. * @return {string} An escaped string.
  17163. */
  17164. function escapeUserProvidedKey(text) {
  17165. return ('' + text).replace(
  17166. userProvidedKeyEscapeRegex,
  17167. userProvidedKeyEscaper
  17168. );
  17169. }
  17170. /**
  17171. * Wrap a `key` value explicitly provided by the user to distinguish it from
  17172. * implicitly-generated keys generated by a component's index in its parent.
  17173. *
  17174. * @param {string} key Value of a user-provided `key` attribute
  17175. * @return {string}
  17176. */
  17177. function wrapUserProvidedKey(key) {
  17178. return '$' + escapeUserProvidedKey(key);
  17179. }
  17180. /**
  17181. * @param {?*} children Children tree container.
  17182. * @param {!string} nameSoFar Name of the key path so far.
  17183. * @param {!number} indexSoFar Number of children encountered until this point.
  17184. * @param {!function} callback Callback to invoke with each child found.
  17185. * @param {?*} traverseContext Used to pass information throughout the traversal
  17186. * process.
  17187. * @return {!number} The number of children in this subtree.
  17188. */
  17189. function traverseAllChildrenImpl(
  17190. children,
  17191. nameSoFar,
  17192. indexSoFar,
  17193. callback,
  17194. traverseContext
  17195. ) {
  17196. var type = typeof children;
  17197. if (type === 'undefined' || type === 'boolean') {
  17198. // All of the above are perceived as null.
  17199. children = null;
  17200. }
  17201. if (children === null ||
  17202. type === 'string' ||
  17203. type === 'number' ||
  17204. ReactElement.isValidElement(children)) {
  17205. callback(
  17206. traverseContext,
  17207. children,
  17208. // If it's the only child, treat the name as if it was wrapped in an array
  17209. // so that it's consistent if the number of children grows.
  17210. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar,
  17211. indexSoFar
  17212. );
  17213. return 1;
  17214. }
  17215. var child, nextName, nextIndex;
  17216. var subtreeCount = 0; // Count of children found in the current subtree.
  17217. if (Array.isArray(children)) {
  17218. for (var i = 0; i < children.length; i++) {
  17219. child = children[i];
  17220. nextName = (
  17221. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  17222. getComponentKey(child, i)
  17223. );
  17224. nextIndex = indexSoFar + subtreeCount;
  17225. subtreeCount += traverseAllChildrenImpl(
  17226. child,
  17227. nextName,
  17228. nextIndex,
  17229. callback,
  17230. traverseContext
  17231. );
  17232. }
  17233. } else {
  17234. var iteratorFn = getIteratorFn(children);
  17235. if (iteratorFn) {
  17236. var iterator = iteratorFn.call(children);
  17237. var step;
  17238. if (iteratorFn !== children.entries) {
  17239. var ii = 0;
  17240. while (!(step = iterator.next()).done) {
  17241. child = step.value;
  17242. nextName = (
  17243. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  17244. getComponentKey(child, ii++)
  17245. );
  17246. nextIndex = indexSoFar + subtreeCount;
  17247. subtreeCount += traverseAllChildrenImpl(
  17248. child,
  17249. nextName,
  17250. nextIndex,
  17251. callback,
  17252. traverseContext
  17253. );
  17254. }
  17255. } else {
  17256. if ("production" !== "development") {
  17257. ("production" !== "development" ? warning(
  17258. didWarnAboutMaps,
  17259. 'Using Maps as children is not yet fully supported. It is an ' +
  17260. 'experimental feature that might be removed. Convert it to a ' +
  17261. 'sequence / iterable of keyed ReactElements instead.'
  17262. ) : null);
  17263. didWarnAboutMaps = true;
  17264. }
  17265. // Iterator will provide entry [k,v] tuples rather than values.
  17266. while (!(step = iterator.next()).done) {
  17267. var entry = step.value;
  17268. if (entry) {
  17269. child = entry[1];
  17270. nextName = (
  17271. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  17272. wrapUserProvidedKey(entry[0]) + SUBSEPARATOR +
  17273. getComponentKey(child, 0)
  17274. );
  17275. nextIndex = indexSoFar + subtreeCount;
  17276. subtreeCount += traverseAllChildrenImpl(
  17277. child,
  17278. nextName,
  17279. nextIndex,
  17280. callback,
  17281. traverseContext
  17282. );
  17283. }
  17284. }
  17285. }
  17286. } else if (type === 'object') {
  17287. ("production" !== "development" ? invariant(
  17288. children.nodeType !== 1,
  17289. 'traverseAllChildren(...): Encountered an invalid child; DOM ' +
  17290. 'elements are not valid children of React components.'
  17291. ) : invariant(children.nodeType !== 1));
  17292. var fragment = ReactFragment.extract(children);
  17293. for (var key in fragment) {
  17294. if (fragment.hasOwnProperty(key)) {
  17295. child = fragment[key];
  17296. nextName = (
  17297. (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
  17298. wrapUserProvidedKey(key) + SUBSEPARATOR +
  17299. getComponentKey(child, 0)
  17300. );
  17301. nextIndex = indexSoFar + subtreeCount;
  17302. subtreeCount += traverseAllChildrenImpl(
  17303. child,
  17304. nextName,
  17305. nextIndex,
  17306. callback,
  17307. traverseContext
  17308. );
  17309. }
  17310. }
  17311. }
  17312. }
  17313. return subtreeCount;
  17314. }
  17315. /**
  17316. * Traverses children that are typically specified as `props.children`, but
  17317. * might also be specified through attributes:
  17318. *
  17319. * - `traverseAllChildren(this.props.children, ...)`
  17320. * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
  17321. *
  17322. * The `traverseContext` is an optional argument that is passed through the
  17323. * entire traversal. It can be used to store accumulations or anything else that
  17324. * the callback might find relevant.
  17325. *
  17326. * @param {?*} children Children tree object.
  17327. * @param {!function} callback To invoke upon traversing each child.
  17328. * @param {?*} traverseContext Context for traversal.
  17329. * @return {!number} The number of children in this subtree.
  17330. */
  17331. function traverseAllChildren(children, callback, traverseContext) {
  17332. if (children == null) {
  17333. return 0;
  17334. }
  17335. return traverseAllChildrenImpl(children, '', 0, callback, traverseContext);
  17336. }
  17337. module.exports = traverseAllChildren;
  17338. },{"126":126,"135":135,"154":154,"57":57,"63":63,"66":66}],154:[function(_dereq_,module,exports){
  17339. /**
  17340. * Copyright 2014-2015, Facebook, Inc.
  17341. * All rights reserved.
  17342. *
  17343. * This source code is licensed under the BSD-style license found in the
  17344. * LICENSE file in the root directory of this source tree. An additional grant
  17345. * of patent rights can be found in the PATENTS file in the same directory.
  17346. *
  17347. * @providesModule warning
  17348. */
  17349. "use strict";
  17350. var emptyFunction = _dereq_(114);
  17351. /**
  17352. * Similar to invariant but only logs a warning if the condition is not met.
  17353. * This can be used to log issues in development environments in critical
  17354. * paths. Removing the logging code for production environments will keep the
  17355. * same logic and follow the same code paths.
  17356. */
  17357. var warning = emptyFunction;
  17358. if ("production" !== "development") {
  17359. warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
  17360. if (format === undefined) {
  17361. throw new Error(
  17362. '`warning(condition, format, ...args)` requires a warning ' +
  17363. 'message argument'
  17364. );
  17365. }
  17366. if (format.length < 10 || /^[s\W]*$/.test(format)) {
  17367. throw new Error(
  17368. 'The warning format should be able to uniquely identify this ' +
  17369. 'warning. Please, use a more descriptive format than: ' + format
  17370. );
  17371. }
  17372. if (format.indexOf('Failed Composite propType: ') === 0) {
  17373. return; // Ignore CompositeComponent proptype check.
  17374. }
  17375. if (!condition) {
  17376. var argIndex = 0;
  17377. var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];});
  17378. console.warn(message);
  17379. try {
  17380. // --- Welcome to debugging React ---
  17381. // This error was thrown as a convenience so that you can use this stack
  17382. // to find the callsite that caused this warning to fire.
  17383. throw new Error(message);
  17384. } catch(x) {}
  17385. }
  17386. };
  17387. }
  17388. module.exports = warning;
  17389. },{"114":114}]},{},[1])(1)
  17390. });