diff --git a/Makefile b/Makefile index cfb2cb3..731fcdf 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ PROF = dev,test CLJSBUILD = client CLJSDIRS = src test -VERSION = 0.0.4-SNAPSHOT +VERSION = 0.1.0-SNAPSHOT all: buildrun @@ -44,10 +44,13 @@ veryclean: clean bower_components: bower install react#v0.8.0 -src/cloact/impl/react.min.js: bower_components/react/react-with-addons.min.js Makefile +src/cloact/react.min.js: bower_components/react/react.min.js Makefile cp $< $@ -copyjs: bower_components src/cloact/impl/react.min.js +src/cloact/react.js: bower_components/react/react.js Makefile + cp $< $@ + +copyjs: bower_components src/cloact/react.min.js src/cloact/react.js gensite: node bin/gen-site.js diff --git a/examples/simple/project.clj b/examples/simple/project.clj index b07bb8f..756dca9 100644 --- a/examples/simple/project.clj +++ b/examples/simple/project.clj @@ -1,15 +1,16 @@ -(defproject simple-cloact "0.0.3" +(defproject simple-cloact "0.1.0-SNAPSHOT" :dependencies [[org.clojure/clojure "1.5.1"] - [org.clojure/clojurescript "0.0-2120"] - [cloact "0.0.3"]] + [org.clojure/clojurescript "0.0-2138"] + [cloact "0.1.0-SNAPSHOT"]] :plugins [[lein-cljsbuild "1.0.1"]] :hooks [leiningen.cljsbuild] :profiles {:prod {:cljsbuild {:builds {:client {:compiler {:optimizations :advanced + :preamble ^:replace ["cloact/react.min.js"] :pretty-print false}}}}} :srcmap {:cljsbuild {:builds @@ -21,6 +22,7 @@ {:builds {:client {:source-paths ["src"] :compiler - {:output-dir "target/client" + {:preamble ["cloact/react.js"] + :output-dir "target/client" :output-to "target/client.js" :pretty-print true}}}}) diff --git a/examples/todomvc/project.clj b/examples/todomvc/project.clj index 65fef8d..5187159 100644 --- a/examples/todomvc/project.clj +++ b/examples/todomvc/project.clj @@ -1,15 +1,16 @@ -(defproject todomvc-cloact "0.0.3" +(defproject todomvc-cloact "0.1.0-SNAPSHOT" :dependencies [[org.clojure/clojure "1.5.1"] - [org.clojure/clojurescript "0.0-2120"] - [cloact "0.0.3"]] + [org.clojure/clojurescript "0.0-2138"] + [cloact "0.1.0-SNAPSHOT"]] :plugins [[lein-cljsbuild "1.0.1"]] :hooks [leiningen.cljsbuild] :profiles {:prod {:cljsbuild {:builds {:client {:compiler {:optimizations :advanced + :preamble ^:replace ["cloact/react.min.js"] :pretty-print false}}}}} :srcmap {:cljsbuild {:builds @@ -21,6 +22,7 @@ {:builds {:client {:source-paths ["src"] :compiler - {:output-dir "target/client" + {:preamble ["cloact/react.js"] + :output-dir "target/client" :output-to "target/client.js" :pretty-print true}}}}) diff --git a/project.clj b/project.clj index 05b4339..2469e9e 100644 --- a/project.clj +++ b/project.clj @@ -1,17 +1,17 @@ -(defproject cloact "0.0.4-SNAPSHOT" +(defproject cloact "0.1.0-SNAPSHOT" :url "http://github.com/holmsand/cloact" :license {:name "MIT"} :description "A simple ClojureScript interface to React" :dependencies [[org.clojure/clojure "1.5.1"] [org.clojure/clojurescript "0.0-2138"]] :plugins [[lein-cljsbuild "1.0.1"]] - ;; :hooks [leiningen.cljsbuild] :profiles {:prod {:cljsbuild {:builds {:client {:compiler {:optimizations :advanced + :preamble ^:replace ["cloact/react.min.js"] :pretty-print false}}}}} :test {:plugins [[com.cemerick/clojurescript.test "0.2.1"]] :cljsbuild @@ -30,6 +30,7 @@ {:builds {:client {:source-paths ["src"] :compiler - {:output-dir "target/client" + {:preamble ["cloact/react.js"] + :output-dir "target/client" :output-to "target/cljs-client.js" :pretty-print true}}}}) diff --git a/src/cloact/impl/react.min.js b/src/cloact/impl/react.min.js deleted file mode 100644 index 34fb78b..0000000 --- a/src/cloact/impl/react.min.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * React (with addons) v0.8.0 - * - * Copyright 2013 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -!function(t){"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(t):"undefined"!=typeof window?window.React=t():"undefined"!=typeof global?global.React=t():"undefined"!=typeof self&&(self.React=t())}(function(){return function t(e,n,o){function r(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);throw new Error("Cannot find module '"+a+"'")}var c=n[a]={exports:{}};e[a][0].call(c.exports,function(t){var n=e[a][1][t];return r(n?n:t)},c,c.exports,t,e,n,o)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a-1}var o=t("./invariant"),r={addClass:function(t,e){return o(!/\s/.test(e)),e&&(t.classList?t.classList.add(e):n(t,e)||(t.className=t.className+" "+e)),t},removeClass:function(t,e){return o(!/\s/.test(e)),e&&(t.classList?t.classList.remove(e):n(t,e)&&(t.className=t.className.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,""))),t},conditionClass:function(t,e,n){return(n?r.addClass:r.removeClass)(t,e)}};e.exports=r},{"./invariant":109}],3:[function(t,e){"use strict";var n={fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,zIndex:!0,zoom:!0},o={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},r={isUnitlessNumber:n,shorthandPropertyExpansions:o};e.exports=r},{}],4:[function(t,e){"use strict";var n=t("./CSSProperty"),o=t("./dangerousStyleValue"),r=t("./escapeTextForBrowser"),i=t("./hyphenate"),a=t("./memoizeStringOnly"),s=a(function(t){return r(i(t))}),u={createMarkupForStyles:function(t){var e="";for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];null!=r&&(e+=s(n)+":",e+=o(n,r)+";")}return e||null},setValueForStyles:function(t,e){var r=t.style;for(var i in e)if(e.hasOwnProperty(i)){var a=o(i,e[i]);if(a)r[i]=a;else{var s=n.shorthandPropertyExpansions[i];if(s)for(var u in s)r[u]="";else r[i]=""}}}};e.exports=u},{"./CSSProperty":3,"./dangerousStyleValue":93,"./escapeTextForBrowser":95,"./hyphenate":108,"./memoizeStringOnly":117}],5:[function(t,e){"use strict";var n={},o={putListener:function(t,e,o){var r=n[e]||(n[e]={});r[t]=o},getListener:function(t,e){var o=n[e];return o&&o[t]},deleteListener:function(t,e){var o=n[e];o&&delete o[t]},deleteAllListeners:function(t){for(var e in n)delete n[e][t]},__purge:function(){n={}}};e.exports=o},{}],6:[function(t,e){"use strict";function n(t){return"SELECT"===t.nodeName||"INPUT"===t.nodeName&&"file"===t.type}function o(t){var e=E.getPooled(x.change,N,t);C.accumulateTwoPhaseDispatches(e),g.enqueueEvents(e),g.processEventQueue()}function r(t,e){T=t,N=e,T.attachEvent("onchange",o)}function i(){T&&(T.detachEvent("onchange",o),T=null,N=null)}function a(t,e,n){return t===D.topChange?n:void 0}function s(t,e,n){t===D.topFocus?(i(),r(e,n)):t===D.topBlur&&i()}function u(t,e){T=t,N=e,S=t.value,_=Object.getOwnPropertyDescriptor(t.constructor.prototype,"value"),Object.defineProperty(T,"value",O),T.attachEvent("onpropertychange",l)}function c(){T&&(delete T.value,T.detachEvent("onpropertychange",l),T=null,N=null,S=null,_=null)}function l(t){if("value"===t.propertyName){var e=t.srcElement.value;e!==S&&(S=e,o(t))}}function p(t,e,n){return t===D.topInput?n:void 0}function d(t,e,n){t===D.topFocus?(c(),u(e,n)):t===D.topBlur&&c()}function h(t){return t!==D.topSelectionChange&&t!==D.topKeyUp&&t!==D.topKeyDown||!T||T.value===S?void 0:(S=T.value,N)}function f(t){return"INPUT"===t.nodeName&&("checkbox"===t.type||"radio"===t.type)}function m(t,e,n){return t===D.topClick?n:void 0}var v=t("./EventConstants"),g=t("./EventPluginHub"),C=t("./EventPropagators"),y=t("./ExecutionEnvironment"),E=t("./SyntheticEvent"),M=t("./isEventSupported"),R=t("./isTextInputElement"),b=t("./keyOf"),D=v.topLevelTypes,x={change:{phasedRegistrationNames:{bubbled:b({onChange:null}),captured:b({onChangeCapture:null})}}},T=null,N=null,S=null,_=null,P=!1;y.canUseDOM&&(P=M("change")&&(!("documentMode"in document)||document.documentMode>8));var I=!1;y.canUseDOM&&(I=M("input")&&(!("documentMode"in document)||document.documentMode>9));var O={get:function(){return _.get.call(this)},set:function(t){S=""+t,_.set.call(this,t)}},w={eventTypes:x,extractEvents:function(t,e,o,r){var i,u;if(n(e)?P?i=a:u=s:R(e)?I?i=p:(i=h,u=d):f(e)&&(i=m),i){var c=i(t,e,o);if(c){var l=E.getPooled(x.change,c,r);return C.accumulateTwoPhaseDispatches(l),l}}u&&u(t,e,o)}};e.exports=w},{"./EventConstants":15,"./EventPluginHub":17,"./EventPropagators":20,"./ExecutionEnvironment":21,"./SyntheticEvent":76,"./isEventSupported":110,"./isTextInputElement":112,"./keyOf":116}],7:[function(t,e){"use strict";function n(t){switch(t){case v.topCompositionStart:return C.compositionStart;case v.topCompositionEnd:return C.compositionEnd;case v.topCompositionUpdate:return C.compositionUpdate}}function o(t,e){return t===v.topKeyDown&&e.keyCode===f}function r(t,e){switch(t){case v.topKeyUp:return-1!==h.indexOf(e.keyCode);case v.topKeyDown:return e.keyCode!==f;case v.topKeyPress:case v.topMouseDown:case v.topBlur:return!0;default:return!1}}function i(t){this.root=t,this.startSelection=c.getSelection(t),this.startValue=this.getText()}var a=t("./EventConstants"),s=t("./EventPropagators"),u=t("./ExecutionEnvironment"),c=t("./ReactInputSelection"),l=t("./SyntheticCompositionEvent"),p=t("./getTextContentAccessor"),d=t("./keyOf"),h=[9,13,27,32],f=229,m=u.canUseDOM&&"CompositionEvent"in window,v=a.topLevelTypes,g=null,C={compositionEnd:{phasedRegistrationNames:{bubbled:d({onCompositionEnd:null}),captured:d({onCompositionEndCapture:null})}},compositionStart:{phasedRegistrationNames:{bubbled:d({onCompositionStart:null}),captured:d({onCompositionStartCapture:null})}},compositionUpdate:{phasedRegistrationNames:{bubbled:d({onCompositionUpdate:null}),captured:d({onCompositionUpdateCapture:null})}}};i.prototype.getText=function(){return this.root.value||this.root[p()]},i.prototype.getData=function(){var t=this.getText(),e=this.startSelection.start,n=this.startValue.length-this.startSelection.end;return t.substr(e,t.length-n-e)};var y={eventTypes:C,extractEvents:function(t,e,a,u){var c,p;if(m?c=n(t):g?r(t,u)&&(c=C.compositionEnd,p=g.getData(),g=null):o(t,u)&&(c=C.start,g=new i(e)),c){var d=l.getPooled(c,a,u);return p&&(d.data=p),s.accumulateTwoPhaseDispatches(d),d}}};e.exports=y},{"./EventConstants":15,"./EventPropagators":20,"./ExecutionEnvironment":21,"./ReactInputSelection":50,"./SyntheticCompositionEvent":75,"./getTextContentAccessor":106,"./keyOf":116}],8:[function(t,e){"use strict";function n(t,e,n){var o=t.childNodes;o[n]!==e&&(e.parentNode===t&&t.removeChild(e),n>=o.length?t.appendChild(e):t.insertBefore(e,o[n]))}var o=t("./Danger"),r=t("./ReactMultiChildUpdateTypes"),i=t("./getTextContentAccessor"),a=i()||"NA",s={dangerouslyReplaceNodeWithMarkup:o.dangerouslyReplaceNodeWithMarkup,processUpdates:function(t,e){for(var i,s=null,u=null,c=0;i=t[c];c++)if(i.type===r.MOVE_EXISTING||i.type===r.REMOVE_NODE){var l=i.fromIndex,p=i.parentNode.childNodes[l],d=i.parentID;s=s||{},s[d]=s[d]||[],s[d][l]=p,u=u||[],u.push(p)}var h=o.dangerouslyRenderMarkup(e);if(u)for(var f=0;fe)}var o=t("./DOMProperty"),r=t("./escapeTextForBrowser"),i=t("./memoizeStringOnly"),a=i(function(t){return r(t)+'="'}),s={createMarkupForProperty:function(t,e){if(o.isStandardName[t]){if(n(t,e))return"";var i=o.getAttributeName[t];return a(i)+r(e)+'"'}return o.isCustomAttribute(t)?null==e?"":a(t)+r(e)+'"':null},setValueForProperty:function(t,e,r){if(o.isStandardName[e]){var i=o.getMutationMethod[e];if(i)i(t,r);else if(n(e,r))this.deleteValueForProperty(t,e);else if(o.mustUseAttribute[e])t.setAttribute(o.getAttributeName[e],""+r);else{var a=o.getPropertyName[e];o.hasSideEffects[e]&&t[a]===r||(t[a]=r)}}else o.isCustomAttribute(e)&&(null==r?t.removeAttribute(o.getAttributeName[e]):t.setAttribute(e,""+r))},deleteValueForProperty:function(t,e){if(o.isStandardName[e]){var n=o.getMutationMethod[e];if(n)n(t,void 0);else if(o.mustUseAttribute[e])t.removeAttribute(o.getAttributeName[e]);else{var r=o.getPropertyName[e],i=o.getDefaultValueForProperty(t.nodeName,e);o.hasSideEffects[e]&&t[r]===i||(t[r]=i)}}else o.isCustomAttribute(e)&&t.removeAttribute(e)}};e.exports=s},{"./DOMProperty":9,"./escapeTextForBrowser":95,"./memoizeStringOnly":117}],11:[function(t,e){"use strict";function n(t){return t.substring(1,t.indexOf(" "))}var o=t("./ExecutionEnvironment"),r=t("./createNodesFromMarkup"),i=t("./emptyFunction"),a=t("./getMarkupWrap"),s=t("./invariant"),u=t("./mutateHTMLNodeWithMarkup"),c=/^(<[^ \/>]+)/,l="data-danger-index",p={dangerouslyRenderMarkup:function(t){s(o.canUseDOM);for(var e,u={},p=0;pu;u++){var l=a[u];if(l){var p=l.extractEvents(t,e,n,r);p&&(i=s(i,p))}}return i},enqueueEvents:function(t){t&&(l=s(l,t))},processEventQueue:function(){var t=l;l=null,u(t,p),c(!l)}};a.canUseDOM&&(window.EventPluginHub=d),e.exports=d},{"./CallbackRegistry":5,"./EventPluginRegistry":18,"./EventPluginUtils":19,"./EventPropagators":20,"./ExecutionEnvironment":21,"./accumulate":85,"./forEachAccumulated":99,"./invariant":109}],18:[function(t,e){"use strict";function n(){if(a)for(var t in s){var e=s[t],n=a.indexOf(t);if(i(n>-1),!u.plugins[n]){i(e.extractEvents),u.plugins[n]=e;var r=e.eventTypes;for(var c in r)i(o(r[c],e))}}}function o(t,e){var n=t.phasedRegistrationNames;if(n){for(var o in n)if(n.hasOwnProperty(o)){var i=n[o];r(i,e)}return!0}return t.registrationName?(r(t.registrationName,e),!0):!1}function r(t,e){i(!u.registrationNames[t]),u.registrationNames[t]=e}var i=t("./invariant"),a=null,s={},u={plugins:[],registrationNames:{},injectEventPluginOrder:function(t){i(!a),a=Array.prototype.slice.call(t),n()},injectEventPluginsByName:function(t){var e=!1;for(var o in t)if(t.hasOwnProperty(o)){var r=t[o];s[o]!==r&&(i(!s[o]),s[o]=r,e=!0)}e&&n()},getPluginModuleForEvent:function(t){var e=t.dispatchConfig;if(e.registrationName)return u.registrationNames[e.registrationName]||null;for(var n in e.phasedRegistrationNames)if(e.phasedRegistrationNames.hasOwnProperty(n)){var o=u.registrationNames[e.phasedRegistrationNames[n]];if(o)return o}return null},_resetEventPlugins:function(){a=null;for(var t in s)s.hasOwnProperty(t)&&delete s[t];u.plugins.length=0;var e=u.registrationNames;for(var n in e)e.hasOwnProperty(n)&&delete e[n]}};e.exports=u},{"./invariant":109}],19:[function(t,e){"use strict";function n(t){return t===h.topMouseUp||t===h.topTouchEnd||t===h.topTouchCancel}function o(t){return t===h.topMouseMove||t===h.topTouchMove}function r(t){return t===h.topMouseDown||t===h.topTouchStart}function i(t,e){var n=t._dispatchListeners,o=t._dispatchIDs;if(Array.isArray(n))for(var r=0;r1){for(var r=Array(n),i=0;n>i;i++)r[i]=arguments[i+1];this.props.children=r}},mountComponent:function(t,e,n){a(!this.isMounted());var o=this.props;null!=o.ref&&r.addComponentAsRefTo(this,o.ref,o.__owner__),this._rootNodeID=t,this._lifeCycleState=c.MOUNTED,this._mountDepth=n},unmountComponent:function(){a(this.isMounted());var t=this.props;null!=t.ref&&r.removeComponentAsRefFrom(this,t.ref,t.__owner__),l.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null,this._lifeCycleState=c.UNMOUNTED},receiveComponent:function(t,e){a(this.isMounted()),this._pendingProps=t.props,this._performUpdateIfNecessary(e)},performUpdateIfNecessary:function(){var t=l.ReactReconcileTransaction.getPooled();t.perform(this._performUpdateIfNecessary,this,t),l.ReactReconcileTransaction.release(t)},_performUpdateIfNecessary:function(t){if(null!=this._pendingProps){var e=this.props;this.props=this._pendingProps,this._pendingProps=null,this.updateComponent(t,e)}},updateComponent:function(t,e){var n=this.props;(n.__owner__!==e.__owner__||n.ref!==e.ref)&&(null!=e.ref&&r.removeComponentAsRefFrom(this,e.ref,e.__owner__),null!=n.ref&&r.addComponentAsRefTo(this,n.ref,n.__owner__))},mountComponentIntoNode:function(t,e,n){var o=l.ReactReconcileTransaction.getPooled();o.perform(this._mountComponentIntoNode,this,t,e,o,n),l.ReactReconcileTransaction.release(o)},_mountComponentIntoNode:function(t,e,n,o){var r=this.mountComponent(t,n,0);l.mountImageIntoNode(r,e,o)},isOwnedBy:function(t){return this.props.__owner__===t},getSiblingByRef:function(t){var e=this.props.__owner__;return e&&e.refs?e.refs[t]:null}})};e.exports=l},{"./ReactComponentEnvironment":30,"./ReactCurrentOwner":32,"./ReactOwner":58,"./ReactUpdates":70,"./invariant":109,"./keyMirror":115,"./merge":118}],29:[function(t,e){"use strict";var n=t("./ReactDOMIDOperations"),o=t("./ReactMarkupChecksum"),r=t("./ReactMount"),i=t("./ReactReconcileTransaction"),a=t("./getReactRootElementInContainer"),s=t("./invariant"),u=t("./mutateHTMLNodeWithMarkup"),c=1,l=9,p={Mixin:{getDOMNode:function(){return s(this.isMounted()),r.getNode(this._rootNodeID)}},ReactReconcileTransaction:i,DOMIDOperations:n,unmountIDFromEnvironment:function(t){r.purgeID(t)},mountImageIntoNode:function(t,e,n){if(s(e&&(e.nodeType===c||e.nodeType===l&&r.allowFullPageRender)),!n||!o.canReuseMarkup(t,a(e))){if(e.nodeType===l)return u(e.documentElement,t),void 0;var i=e.parentNode;if(i){var p=e.nextSibling;i.removeChild(e),e.innerHTML=t,p?i.insertBefore(e,p):i.appendChild(e)}else e.innerHTML=t}}};e.exports=p},{"./ReactDOMIDOperations":37,"./ReactMarkupChecksum":53,"./ReactMount":54,"./ReactReconcileTransaction":62,"./getReactRootElementInContainer":105,"./invariant":109,"./mutateHTMLNodeWithMarkup":122}],30:[function(t,e){var n=t("./ReactComponentBrowserEnvironment"),o=n;e.exports=o},{"./ReactComponentBrowserEnvironment":29}],31:[function(t,e){"use strict";function n(t,e){var n=M[e];D.hasOwnProperty(e)&&m(n===E.OVERRIDE_BASE),t.hasOwnProperty(e)&&m(n===E.DEFINE_MANY||n===E.DEFINE_MANY_MERGED)}function o(t){var e=t._compositeLifeCycleState;m(t.isMounted()||e===b.MOUNTING),m(e!==b.RECEIVING_STATE),m(e!==b.UNMOUNTING)}function r(t,e){var o=t.prototype;for(var r in e){var i=e[r];if(e.hasOwnProperty(r)&&i)if(n(o,r),R.hasOwnProperty(r))R[r](t,i);else{var u=r in M,c=r in o,l=i.__reactDontBind,p="function"==typeof i,d=p&&!u&&!c&&!l;d?(o.__reactAutoBindMap||(o.__reactAutoBindMap={}),o.__reactAutoBindMap[r]=i,o[r]=i):o[r]=c?M[r]===E.DEFINE_MANY_MERGED?a(o[r],i):s(o[r],i):i}}}function i(t,e){return m(t&&e&&"object"==typeof t&&"object"==typeof e),y(e,function(e,n){m(void 0===t[n]),t[n]=e}),t}function a(t,e){return function(){return i(t.apply(this,arguments),e.apply(this,arguments))}}function s(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}var u=t("./ReactComponent"),c=t("./ReactCurrentOwner"),l=t("./ReactErrorUtils"),p=t("./ReactOwner"),d=t("./ReactPerf"),h=t("./ReactPropTransferer"),f=t("./ReactUpdates"),m=t("./invariant"),v=t("./keyMirror"),g=t("./merge"),C=t("./mixInto"),y=t("./objMap"),E=v({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),M={mixins:E.DEFINE_MANY,propTypes:E.DEFINE_ONCE,getDefaultProps:E.DEFINE_MANY_MERGED,getInitialState:E.DEFINE_MANY_MERGED,render:E.DEFINE_ONCE,componentWillMount:E.DEFINE_MANY,componentDidMount:E.DEFINE_MANY,componentWillReceiveProps:E.DEFINE_MANY,shouldComponentUpdate:E.DEFINE_ONCE,componentWillUpdate:E.DEFINE_MANY,componentDidUpdate:E.DEFINE_MANY,componentWillUnmount:E.DEFINE_MANY,updateComponent:E.OVERRIDE_BASE},R={displayName:function(t,e){t.displayName=e},mixins:function(t,e){if(e)for(var n=0;n",this.tagName=t.toUpperCase()}var r=t("./CSSPropertyOperations"),i=t("./DOMProperty"),a=t("./DOMPropertyOperations"),s=t("./ReactComponent"),u=t("./ReactEventEmitter"),c=t("./ReactMultiChild"),l=t("./ReactMount"),p=t("./ReactPerf"),d=t("./escapeTextForBrowser"),h=t("./invariant"),f=t("./keyOf"),m=t("./merge"),v=t("./mixInto"),g=u.putListener,C=u.deleteListener,y=u.registrationNames,E={string:!0,number:!0},M=f({style:null});o.Mixin={mountComponent:p.measure("ReactDOMComponent","mountComponent",function(t,e,o){return s.Mixin.mountComponent.call(this,t,e,o),n(this.props),this._createOpenTagMarkup()+this._createContentMarkup(e)+this._tagClose}),_createOpenTagMarkup:function(){var t=this.props,e=this._tagOpen;for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];if(null!=o)if(y[n])g(this._rootNodeID,n,o);else{n===M&&(o&&(o=t.style=m(t.style)),o=r.createMarkupForStyles(o));var i=a.createMarkupForProperty(n,o);i&&(e+=" "+i)}}var s=d(this._rootNodeID);return e+" "+l.ATTR_NAME+'="'+s+'">'},_createContentMarkup:function(t){var e=this.props.dangerouslySetInnerHTML;if(null!=e){if(null!=e.__html)return e.__html}else{var n=E[typeof this.props.children]?this.props.children:null,o=null!=n?null:this.props.children;if(null!=n)return d(n);if(null!=o){var r=this.mountChildren(o,t);return r.join("")}}return""},receiveComponent:function(t,e){n(t.props),s.Mixin.receiveComponent.call(this,t,e)},updateComponent:p.measure("ReactDOMComponent","updateComponent",function(t,e){s.Mixin.updateComponent.call(this,t,e),this._updateDOMProperties(e),this._updateDOMChildren(e,t)}),_updateDOMProperties:function(t){var e,n,o,r=this.props;for(e in t)if(!r.hasOwnProperty(e)&&t.hasOwnProperty(e))if(e===M){var a=t[e];for(n in a)a.hasOwnProperty(n)&&(o=o||{},o[n]="")}else y[e]?C(this._rootNodeID,e):(i.isStandardName[e]||i.isCustomAttribute(e))&&s.DOMIDOperations.deletePropertyByID(this._rootNodeID,e);for(e in r){var u=r[e],c=t[e];if(r.hasOwnProperty(e)&&u!==c)if(e===M)if(u&&(u=r.style=m(u)),c){for(n in c)c.hasOwnProperty(n)&&!u.hasOwnProperty(n)&&(o=o||{},o[n]="");for(n in u)u.hasOwnProperty(n)&&c[n]!==u[n]&&(o=o||{},o[n]=u[n])}else o=u;else y[e]?g(this._rootNodeID,e,u):(i.isStandardName[e]||i.isCustomAttribute(e))&&s.DOMIDOperations.updatePropertyByID(this._rootNodeID,e,u)}o&&s.DOMIDOperations.updateStylesByID(this._rootNodeID,o)},_updateDOMChildren:function(t,e){var n=this.props,o=E[typeof t.children]?t.children:null,r=E[typeof n.children]?n.children:null,i=t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html,a=n.dangerouslySetInnerHTML&&n.dangerouslySetInnerHTML.__html,u=null!=o?null:t.children,c=null!=r?null:n.children,l=null!=o||null!=i,p=null!=r||null!=a;null!=u&&null==c?this.updateChildren(null,e):l&&!p&&this.updateTextContent(""),null!=r?o!==r&&this.updateTextContent(""+r):null!=a?i!==a&&s.DOMIDOperations.updateInnerHTMLByID(this._rootNodeID,a):null!=c&&this.updateChildren(c,e)},unmountComponent:function(){u.deleteAllListeners(this._rootNodeID),s.Mixin.unmountComponent.call(this),this.unmountChildren()}},v(o,s.Mixin),v(o,o.Mixin),v(o,c.Mixin),e.exports=o},{"./CSSPropertyOperations":4,"./DOMProperty":9,"./DOMPropertyOperations":10,"./ReactComponent":28,"./ReactEventEmitter":47,"./ReactMount":54,"./ReactMultiChild":56,"./ReactPerf":59,"./escapeTextForBrowser":95,"./invariant":109,"./keyOf":116,"./merge":118,"./mixInto":121}],36:[function(t,e){"use strict";var n=t("./ReactCompositeComponent"),o=t("./ReactDOM"),r=t("./ReactEventEmitter"),i=t("./EventConstants"),a=o.form,s=n.createClass({render:function(){return this.transferPropsTo(a(null,this.props.children))},componentDidMount:function(t){r.trapBubbledEvent(i.topLevelTypes.topSubmit,"submit",t)}});e.exports=s},{"./EventConstants":15,"./ReactCompositeComponent":31,"./ReactDOM":33,"./ReactEventEmitter":47}],37:[function(t,e){"use strict";var n=t("./CSSPropertyOperations"),o=t("./DOMChildrenOperations"),r=t("./DOMPropertyOperations"),i=t("./ReactMount"),a=t("./getTextContentAccessor"),s=t("./invariant"),u={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},c=a()||"NA",l=/^ /,p={updatePropertyByID:function(t,e,n){var o=i.getNode(t);s(!u.hasOwnProperty(e)),null!=n?r.setValueForProperty(o,e,n):r.deleteValueForProperty(o,e)},deletePropertyByID:function(t,e,n){var o=i.getNode(t);s(!u.hasOwnProperty(e)),r.deleteValueForProperty(o,e,n)},updateStylesByID:function(t,e){var o=i.getNode(t);n.setValueForStyles(o,e)},updateInnerHTMLByID:function(t,e){var n=i.getNode(t);n.innerHTML=e.replace(l," ")},updateTextContentByID:function(t,e){var n=i.getNode(t);n[c]=e},dangerouslyReplaceNodeWithMarkupByID:function(t,e){var n=i.getNode(t);o.dangerouslyReplaceNodeWithMarkup(n,e)},dangerouslyProcessChildrenUpdates:function(t,e){for(var n=0;nu;u++){var p=i[u];if(p!==r&&"INPUT"===p.nodeName&&"radio"===p.type&&p.form===r.form){var d=a.getID(p);s(d);var h=l[d];s(h),h.setState({checked:!1})}}return e}});e.exports=p},{"./DOMPropertyOperations":10,"./LinkedValueMixin":23,"./ReactCompositeComponent":31,"./ReactDOM":33,"./ReactMount":54,"./invariant":109,"./merge":118}],39:[function(t,e){"use strict";var n=t("./ReactCompositeComponent"),o=t("./ReactDOM"),r=o.option,i=n.createClass({componentWillMount:function(){null!=this.props.selected},render:function(){return r(this.props,this.props.children)}});e.exports=i},{"./ReactCompositeComponent":31,"./ReactDOM":33}],40:[function(t,e){"use strict";function n(t,e){null!=t[e]&&(t.multiple?s(Array.isArray(t[e])):s(!Array.isArray(t[e])))}function o(){for(var t=this.getValue(),e=null!=t?t:this.state.value,n=this.getDOMNode().options,o=""+e,r=0,i=n.length;i>r;r++){var a=this.props.multiple?o.indexOf(n[r].value)>=0:a=n[r].value===o;a!==n[r].selected&&(n[r].selected=a)}}var r=t("./LinkedValueMixin"),i=t("./ReactCompositeComponent"),a=t("./ReactDOM"),s=t("./invariant"),u=t("./merge"),c=a.select,l=i.createClass({mixins:[r],propTypes:{defaultValue:n,value:n},getInitialState:function(){return{value:this.props.defaultValue||(this.props.multiple?[]:"")}},componentWillReceiveProps:function(t){!this.props.multiple&&t.multiple?this.setState({value:[this.state.value]}):this.props.multiple&&!t.multiple&&this.setState({value:this.state.value[0]})},shouldComponentUpdate:function(){return!this._isChanging},render:function(){var t=u(this.props);return t.onChange=this._handleChange,t.value=null,c(t,this.props.children)},componentDidMount:o,componentDidUpdate:o,_handleChange:function(t){var e,n=this.getOnChange();n&&(this._isChanging=!0,e=n(t),this._isChanging=!1);var o;if(this.props.multiple){o=[];for(var r=t.target.options,i=0,a=r.length;a>i;i++)r[i].selected&&o.push(r[i].value)}else o=t.target.value;return this.setState({value:o}),e}});e.exports=l},{"./LinkedValueMixin":23,"./ReactCompositeComponent":31,"./ReactDOM":33,"./invariant":109,"./merge":118}],41:[function(t,e){"use strict";function n(t){var e=document.selection,n=e.createRange(),o=n.text.length,r=n.duplicate();r.moveToElementText(t),r.setEndPoint("EndToStart",n);var i=r.text.length,a=i+o;return{start:i,end:a}}function o(t){var e=window.getSelection();if(0===e.rangeCount)return null;var n=e.anchorNode,o=e.anchorOffset,r=e.focusNode,i=e.focusOffset,a=e.getRangeAt(0),s=a.toString().length,u=a.cloneRange();u.selectNodeContents(t),u.setEnd(a.startContainer,a.startOffset);var c=u.toString().length,l=c+s,p=document.createRange();p.setStart(n,o),p.setEnd(r,i);var d=p.collapsed;return p.detach(),{start:d?l:c,end:d?c:l}}function r(t,e){var n,o,r=document.selection.createRange().duplicate();"undefined"==typeof e.end?(n=e.start,o=n):e.start>e.end?(n=e.end,o=e.start):(n=e.start,o=e.end),r.moveToElementText(t),r.moveStart("character",n),r.setEndPoint("EndToStart",r),r.moveEnd("character",o-n),r.select()}function i(t,e){var n=window.getSelection(),o=t[s()].length,r=Math.min(e.start,o),i="undefined"==typeof e.end?r:Math.min(e.end,o);if(!n.extend&&r>i){var u=i;i=r,r=u}var c=a(t,r),l=a(t,i);if(c&&l){var p=document.createRange();p.setStart(c.node,c.offset),n.removeAllRanges(),r>i?(n.addRange(p),n.extend(l.node,l.offset)):(p.setEnd(l.node,l.offset),n.addRange(p)),p.detach()}}var a=t("./getNodeForCharacterOffset"),s=t("./getTextContentAccessor"),u={getOffsets:function(t){var e=document.selection?n:o;return e(t)},setOffsets:function(t,e){var n=document.selection?r:i;n(t,e)}};e.exports=u},{"./getNodeForCharacterOffset":104,"./getTextContentAccessor":106}],42:[function(t,e){"use strict";var n=t("./DOMPropertyOperations"),o=t("./LinkedValueMixin"),r=t("./ReactCompositeComponent"),i=t("./ReactDOM"),a=t("./invariant"),s=t("./merge"),u=i.textarea,c=r.createClass({mixins:[o],getInitialState:function(){var t=this.props.defaultValue,e=this.props.children;null!=e&&(a(null==t),Array.isArray(e)&&(a(e.length<=1),e=e[0]),t=""+e),null==t&&(t="");var n=this.getValue();return{initialValue:""+(null!=n?n:t),value:t}},shouldComponentUpdate:function(){return!this._isChanging},render:function(){var t=s(this.props),e=this.getValue();return a(null==t.dangerouslySetInnerHTML),t.defaultValue=null,t.value=null!=e?e:this.state.value,t.onChange=this._handleChange,u(t,this.state.initialValue)},componentDidUpdate:function(t,e,o){var r=this.getValue();null!=r&&n.setValueForProperty(o,"value",""+r)},_handleChange:function(t){var e,n=this.getOnChange();return n&&(this._isChanging=!0,e=n(t),this._isChanging=!1),this.setState({value:t.target.value}),e}});e.exports=c},{"./DOMPropertyOperations":10,"./LinkedValueMixin":23,"./ReactCompositeComponent":31,"./ReactDOM":33,"./invariant":109,"./merge":118}],43:[function(t,e){"use strict";function n(){this.reinitializeTransaction()}var o=t("./ReactUpdates"),r=t("./Transaction"),i=t("./emptyFunction"),a=t("./mixInto"),s={initialize:i,close:function(){p.isBatchingUpdates=!1}},u={initialize:i,close:o.flushBatchedUpdates.bind(o)},c=[u,s];a(n,r.Mixin),a(n,{getTransactionWrappers:function(){return c}});var l=new n,p={isBatchingUpdates:!1,batchedUpdates:function(t,e){var n=p.isBatchingUpdates;p.isBatchingUpdates=!0,n?t(e):l.perform(t,null,e)}};e.exports=p},{"./ReactUpdates":70,"./Transaction":83,"./emptyFunction":94,"./mixInto":121}],44:[function(t,e){"use strict";function n(){l.TopLevelCallbackCreator=p,C.injection.injectEventPluginOrder(v),C.injection.injectInstanceHandle(E),C.injection.injectEventPluginsByName({SimpleEventPlugin:R,EnterLeaveEventPlugin:g,ChangeEventPlugin:f,CompositionEventPlugin:m,MobileSafariClickEventPlugin:y,SelectEventPlugin:M}),o.injection.injectComponentClasses({button:r,form:i,input:a,option:s,select:u,textarea:c}),h.injection.injectDOMPropertyConfig(d),D.injection.injectBatchingStrategy(b)}var o=t("./ReactDOM"),r=t("./ReactDOMButton"),i=t("./ReactDOMForm"),a=t("./ReactDOMInput"),s=t("./ReactDOMOption"),u=t("./ReactDOMSelect"),c=t("./ReactDOMTextarea"),l=t("./ReactEventEmitter"),p=t("./ReactEventTopLevelCallback"),d=(t("./ReactPerf"),t("./DefaultDOMPropertyConfig")),h=t("./DOMProperty"),f=t("./ChangeEventPlugin"),m=t("./CompositionEventPlugin"),v=t("./DefaultEventPluginOrder"),g=t("./EnterLeaveEventPlugin"),C=t("./EventPluginHub"),y=t("./MobileSafariClickEventPlugin"),E=t("./ReactInstanceHandles"),M=t("./SelectEventPlugin"),R=t("./SimpleEventPlugin"),b=t("./ReactDefaultBatchingStrategy"),D=t("./ReactUpdates");e.exports={inject:n}},{"./ChangeEventPlugin":6,"./CompositionEventPlugin":7,"./DOMProperty":9,"./DefaultDOMPropertyConfig":12,"./DefaultEventPluginOrder":13,"./EnterLeaveEventPlugin":14,"./EventPluginHub":17,"./MobileSafariClickEventPlugin":24,"./ReactDOM":33,"./ReactDOMButton":34,"./ReactDOMForm":36,"./ReactDOMInput":38,"./ReactDOMOption":39,"./ReactDOMSelect":40,"./ReactDOMTextarea":42,"./ReactDefaultBatchingStrategy":43,"./ReactDefaultPerf":45,"./ReactEventEmitter":47,"./ReactEventTopLevelCallback":49,"./ReactInstanceHandles":51,"./ReactPerf":59,"./ReactUpdates":70,"./SelectEventPlugin":72,"./SimpleEventPlugin":73}],45:[function(t,e){"use strict";var n=(t("./performanceNow"),{});e.exports=n},{"./performanceNow":125}],46:[function(t,e){var n={guard:function(t,e){return t}};e.exports=n},{}],47:[function(t,e){"use strict";function n(t,e,n){a.listen(n,e,f.TopLevelCallbackCreator.createTopLevelCallback(t))}function o(t,e,n){a.capture(n,e,f.TopLevelCallbackCreator.createTopLevelCallback(t))}function r(){var t=l.refreshScrollValues;a.listen(window,"scroll",t),a.listen(window,"resize",t)}var i=t("./EventConstants"),a=t("./EventListener"),s=t("./EventPluginHub"),u=t("./ExecutionEnvironment"),c=t("./ReactEventEmitterMixin"),l=t("./ViewportMetrics"),p=t("./invariant"),d=t("./isEventSupported"),h=t("./merge"),f=h(c,{TopLevelCallbackCreator:null,ensureListening:function(t,e){p(u.canUseDOM),p(f.TopLevelCallbackCreator),c.ensureListening.call(f,{touchNotMouse:t,contentDocument:e})},setEnabled:function(t){p(u.canUseDOM),f.TopLevelCallbackCreator&&f.TopLevelCallbackCreator.setEnabled(t)},isEnabled:function(){return!(!f.TopLevelCallbackCreator||!f.TopLevelCallbackCreator.isEnabled())},listenAtTopLevel:function(t,e){p(!e._isListening);var a=i.topLevelTypes,s=e;r(),n(a.topMouseOver,"mouseover",s),n(a.topMouseDown,"mousedown",s),n(a.topMouseUp,"mouseup",s),n(a.topMouseMove,"mousemove",s),n(a.topMouseOut,"mouseout",s),n(a.topClick,"click",s),n(a.topDoubleClick,"dblclick",s),n(a.topContextMenu,"contextmenu",s),t&&(n(a.topTouchStart,"touchstart",s),n(a.topTouchEnd,"touchend",s),n(a.topTouchMove,"touchmove",s),n(a.topTouchCancel,"touchcancel",s)),n(a.topKeyUp,"keyup",s),n(a.topKeyPress,"keypress",s),n(a.topKeyDown,"keydown",s),n(a.topInput,"input",s),n(a.topChange,"change",s),n(a.topSelectionChange,"selectionchange",s),n(a.topCompositionEnd,"compositionend",s),n(a.topCompositionStart,"compositionstart",s),n(a.topCompositionUpdate,"compositionupdate",s),d("drag")&&(n(a.topDrag,"drag",s),n(a.topDragEnd,"dragend",s),n(a.topDragEnter,"dragenter",s),n(a.topDragExit,"dragexit",s),n(a.topDragLeave,"dragleave",s),n(a.topDragOver,"dragover",s),n(a.topDragStart,"dragstart",s),n(a.topDrop,"drop",s)),d("wheel")?n(a.topWheel,"wheel",s):d("mousewheel")?n(a.topWheel,"mousewheel",s):n(a.topWheel,"DOMMouseScroll",s),d("scroll",!0)?o(a.topScroll,"scroll",s):n(a.topScroll,"scroll",window),d("focus",!0)?(o(a.topFocus,"focus",s),o(a.topBlur,"blur",s)):d("focusin")&&(n(a.topFocus,"focusin",s),n(a.topBlur,"focusout",s)),d("copy")&&(n(a.topCopy,"copy",s),n(a.topCut,"cut",s),n(a.topPaste,"paste",s))},registrationNames:s.registrationNames,putListener:s.putListener,getListener:s.getListener,deleteListener:s.deleteListener,deleteAllListeners:s.deleteAllListeners,trapBubbledEvent:n,trapCapturedEvent:o});e.exports=f},{"./EventConstants":15,"./EventListener":16,"./EventPluginHub":17,"./ExecutionEnvironment":21,"./ReactEventEmitterMixin":48,"./ViewportMetrics":84,"./invariant":109,"./isEventSupported":110,"./merge":118}],48:[function(t,e){"use strict";function n(t){o.enqueueEvents(t),o.processEventQueue()}var o=t("./EventPluginHub"),r=t("./ReactUpdates"),i={_isListening:!1,ensureListening:function(t){t.contentDocument._reactIsListening||(this.listenAtTopLevel(t.touchNotMouse,t.contentDocument),t.contentDocument._reactIsListening=!0)},handleTopLevel:function(t,e,i,a){var s=o.extractEvents(t,e,i,a);r.batchedUpdates(n,s)}};e.exports=i},{"./EventPluginHub":17,"./ReactUpdates":70}],49:[function(t,e){"use strict";var n=t("./ReactEventEmitter"),o=t("./ReactMount"),r=t("./getEventTarget"),i=!0,a={setEnabled:function(t){i=!!t},isEnabled:function(){return i},createTopLevelCallback:function(t){return function(e){if(i){e.srcElement&&e.srcElement!==e.target&&(e.target=e.srcElement);var a=o.getFirstReactDOM(r(e))||window,s=o.getID(a)||"";n.handleTopLevel(t,a,s,e)}}}};e.exports=a},{"./ReactEventEmitter":47,"./ReactMount":54,"./getEventTarget":102}],50:[function(t,e){"use strict";function n(t){return r(document.documentElement,t)}var o=t("./ReactDOMSelection"),r=t("./containsNode"),i=t("./getActiveElement"),a={hasSelectionCapabilities:function(t){return t&&("INPUT"===t.nodeName&&"text"===t.type||"TEXTAREA"===t.nodeName||"true"===t.contentEditable)},getSelectionInformation:function(){var t=i();return{focusedElem:t,selectionRange:a.hasSelectionCapabilities(t)?a.getSelection(t):null}},restoreSelection:function(t){var e=i(),o=t.focusedElem,r=t.selectionRange;e!==o&&n(o)&&(a.hasSelectionCapabilities(o)&&a.setSelection(o,r),o.focus())},getSelection:function(t){var e;if("selectionStart"in t)e={start:t.selectionStart,end:t.selectionEnd};else if(document.selection&&"INPUT"===t.nodeName){var n=document.selection.createRange();n.parentElement()===t&&(e={start:-n.moveStart("character",-t.value.length),end:-n.moveEnd("character",-t.value.length)})}else e=o.getOffsets(t);return e||{start:0,end:0}},setSelection:function(t,e){var n=e.start,r=e.end;if("undefined"==typeof r&&(r=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(r,t.value.length);else if(document.selection&&"INPUT"===t.nodeName){var i=t.createTextRange();i.collapse(!0),i.moveStart("character",n),i.moveEnd("character",r-n),i.select()}else o.setOffsets(t,e)}};e.exports=a},{"./ReactDOMSelection":41,"./containsNode":87,"./getActiveElement":101}],51:[function(t,e){"use strict";function n(t){return p+"r["+t.toString(36)+"]"}function o(t,e){return t.charAt(e)===p||e===t.length}function r(t){return""===t||t.charAt(0)===p&&t.charAt(t.length-1)!==p}function i(t,e){return 0===e.indexOf(t)&&o(e,t.length)}function a(t){return t?t.substr(0,t.lastIndexOf(p)):""}function s(t,e){if(l(r(t)&&r(e)),l(i(t,e)),t===e)return t;for(var n=t.length+d,a=n;a=a;a++)if(o(t,a)&&o(e,a))i=a;else if(t.charAt(a)!==e.charAt(a))break;var s=t.substr(0,i);return l(r(s)),s}function c(t,e,n,o,r,u){t=t||"",e=e||"",l(t!==e);var c=i(e,t);l(c||i(t,e));for(var p=0,d=c?a:s,f=t;r&&f===t||u&&f===e||n(f,c,o),f!==e;f=d(f,e))l(p++"," "+o.CHECKSUM_ATTR_NAME+'="'+e+'">')},canReuseMarkup:function(t,e){var r=e.getAttribute(o.CHECKSUM_ATTR_NAME);r=r&&parseInt(r,10);var i=n(t);return i===r}};e.exports=o},{"./adler32":86}],54:[function(t,e){"use strict";function n(t){var e=h(t);return e&&R.getID(e)}function o(t){var e=r(t);if(e)if(g.hasOwnProperty(e)){var n=g[e];n!==t&&(f(!s(n,e)),g[e]=t)}else g[e]=t;return e}function r(t){return t&&t.getAttribute&&t.getAttribute(v)||""}function i(t,e){var n=r(t);n!==e&&delete g[n],t.setAttribute(v,e),g[e]=t}function a(t){return g.hasOwnProperty(t)&&s(g[t],t)||(g[t]=R.findReactNodeByID(t)),g[t]}function s(t,e){if(t){f(r(t)===e);var n=R.findReactContainerForID(e);if(n&&d(n,t))return!0}return!1}function u(t){delete g[t]}var c=t("./ReactEventEmitter"),l=t("./ReactInstanceHandles"),p=t("./$"),d=t("./containsNode"),h=t("./getReactRootElementInContainer"),f=t("./invariant"),m=l.SEPARATOR,v="data-reactid",g={},C=1,y=9,E={},M={},R={allowFullPageRender:!1,totalInstantiationTime:0,totalInjectionTime:0,useTouchEvents:!1,_instancesByReactRootID:E,scrollMonitor:function(t,e){e()},prepareEnvironmentForDOM:function(t){f(t&&(t.nodeType===C||t.nodeType===y));var e=t.nodeType===C?t.ownerDocument:t;c.ensureListening(R.useTouchEvents,e)},_updateRootComponent:function(t,e,n,o){var r=e.props;return R.scrollMonitor(n,function(){t.replaceProps(r,o)}),t},_registerComponent:function(t,e){R.prepareEnvironmentForDOM(e);var n=R.registerContainer(e);return E[n]=t,n},_renderNewRootComponent:function(t,e,n){var o=R._registerComponent(t,e);return t.mountComponentIntoNode(o,e,n),t},renderComponent:function(t,e,o){var r=E[n(e)];if(r){if(r.constructor===t.constructor)return R._updateRootComponent(r,t,e,o);R.unmountComponentAtNode(e)}var i=h(e),a=i&&R.isRenderedByReact(i),s=a&&!r,u=R._renderNewRootComponent(t,e,s);return o&&o(),u},constructAndRenderComponent:function(t,e,n){return R.renderComponent(t(e),n)},constructAndRenderComponentByID:function(t,e,n){return R.constructAndRenderComponent(t,e,p(n))},registerContainer:function(t){var e=n(t);return e&&(e=l.getReactRootIDFromNodeID(e)),e||(e=l.createReactRootID()),M[e]=t,e},unmountComponentAtNode:function(t){var e=n(t),o=E[e];return o?(R.unmountComponentFromNode(o,t),delete E[e],delete M[e],!0):!1},unmountAndReleaseReactRootNode:function(){return R.unmountComponentAtNode.apply(this,arguments)},unmountComponentFromNode:function(t,e){for(t.unmountComponent(),e.nodeType===y&&(e=e.documentElement);e.lastChild;)e.removeChild(e.lastChild)},findReactContainerForID:function(t){var e=l.getReactRootIDFromNodeID(t),n=M[e];return n},findReactNodeByID:function(t){var e=R.findReactContainerForID(t);return R.findComponentRoot(e,t)},isRenderedByReact:function(t){if(1!==t.nodeType)return!1;var e=R.getID(t);return e?e.charAt(0)===m:!1},getFirstReactDOM:function(t){for(var e=t;e&&e.parentNode!==e;){if(R.isRenderedByReact(e))return e;e=e.parentNode}return null},findComponentRoot:function(t,e){for(var n=[t.firstChild],o=0;oe;e++){var o=t[e].component,r=t[e].callback;r.call(o,o.getDOMNode())}t.length=0}},reset:function(){this._queue=null},destructor:function(){this.reset()}}),o.addPoolingTo(n),e.exports=n},{"./PooledClass":25,"./mixInto":121}],56:[function(t,e){"use strict";function n(t,e){return t&&e&&t.constructor===e.constructor}function o(t,e,n){h.push({parentID:t,parentNode:null,type:l.INSERT_MARKUP,markupIndex:f.push(e)-1,textContent:null,fromIndex:null,toIndex:n})}function r(t,e,n){h.push({parentID:t,parentNode:null,type:l.MOVE_EXISTING,markupIndex:null,textContent:null,fromIndex:e,toIndex:n})}function i(t,e){h.push({parentID:t,parentNode:null,type:l.REMOVE_NODE,markupIndex:null,textContent:null,fromIndex:e,toIndex:null})}function a(t,e){h.push({parentID:t,parentNode:null,type:l.TEXT_CONTENT,markupIndex:null,textContent:e,fromIndex:null,toIndex:null})}function s(){h.length&&(c.DOMIDOperations.dangerouslyProcessChildrenUpdates(h,f),u())}function u(){h.length=0,f.length=0}var c=t("./ReactComponent"),l=t("./ReactMultiChildUpdateTypes"),p=t("./flattenChildren"),d=0,h=[],f=[],m={Mixin:{mountChildren:function(t,e){var n=p(t),o=[],r=0;this._renderedChildren=n;for(var i in n){var a=n[i];if(n.hasOwnProperty(i)&&a){var s=this._rootNodeID+"."+i,u=a.mountComponent(s,e,this._mountDepth+1); -a._mountImage=u,a._mountIndex=r,o.push(u),r++}}return o},updateTextContent:function(t){d++;try{var e=this._renderedChildren;for(var n in e)e.hasOwnProperty(n)&&e[n]&&this._unmountChildByName(e[n],n);this.setTextContent(t)}catch(o){throw d--,d||u(),o}d--,d||s()},updateChildren:function(t,e){d++;try{this._updateChildren(t,e)}catch(n){throw d--,d||u(),n}d--,d||s()},_updateChildren:function(t,e){var o=p(t),r=this._renderedChildren;if(o||r){var i,a=0,s=0;for(i in o)if(o.hasOwnProperty(i)){var u=r&&r[i],c=o[i];n(u,c)?(this.moveChild(u,s,a),a=Math.max(u._mountIndex,a),u.receiveComponent(c,e),u._mountIndex=s):(u&&(a=Math.max(u._mountIndex,a),this._unmountChildByName(u,i)),c&&this._mountChildByNameAtIndex(c,i,s,e)),c&&s++}for(i in r)!r.hasOwnProperty(i)||!r[i]||o&&o[i]||this._unmountChildByName(r[i],i)}},unmountChildren:function(){var t=this._renderedChildren;for(var e in t){var n=t[e];n&&n.unmountComponent&&n.unmountComponent()}this._renderedChildren=null},moveChild:function(t,e,n){t._mountIndex>";e.exports=u},{"./createObjectFrom":91,"./invariant":109}],62:[function(t,e){"use strict";function n(){this.reinitializeTransaction(),this.reactMountReady=s.getPooled(null)}var o=t("./ExecutionEnvironment"),r=t("./PooledClass"),i=t("./ReactEventEmitter"),a=t("./ReactInputSelection"),s=t("./ReactMountReady"),u=t("./Transaction"),c=t("./mixInto"),l={initialize:a.getSelectionInformation,close:a.restoreSelection},p={initialize:function(){var t=i.isEnabled();return i.setEnabled(!1),t},close:function(t){i.setEnabled(t)}},d={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},h=[l,p,d],f={getTransactionWrappers:function(){return o.canUseDOM?h:[]},getReactMountReady:function(){return this.reactMountReady},destructor:function(){s.release(this.reactMountReady),this.reactMountReady=null}};c(n,u.Mixin),c(n,f),r.addPoolingTo(n),e.exports=n},{"./ExecutionEnvironment":21,"./PooledClass":25,"./ReactEventEmitter":47,"./ReactInputSelection":50,"./ReactMountReady":55,"./Transaction":83,"./mixInto":121}],63:[function(t,e){"use strict";function n(t,e){s(o.isValidComponent(t)),s("function"==typeof e);var n=r.createReactRootID(),u=a.getPooled();u.reinitializeTransaction();try{u.perform(function(){var o=t.mountComponent(n,u,0);o=i.addChecksumToMarkup(o),e(o)},null)}finally{a.release(u)}}var o=t("./ReactComponent"),r=t("./ReactInstanceHandles"),i=t("./ReactMarkupChecksum"),a=t("./ReactReconcileTransaction"),s=t("./invariant");e.exports={renderComponentToString:n}},{"./ReactComponent":28,"./ReactInstanceHandles":51,"./ReactMarkupChecksum":53,"./ReactReconcileTransaction":62,"./invariant":109}],64:[function(t,e){"use strict";function n(t,e){var n={};return function(o){n[e]=o,t.setState(n)}}var o={createStateSetter:function(t,e){return function(n,o,r,i,a,s){var u=e.call(t,n,o,r,i,a,s);u&&t.setState(u)}},createStateKeySetter:function(t,e){var o=t.__keySetters||(t.__keySetters={});return o[e]||(o[e]=n(t,e))}};o.Mixin={createStateSetter:function(t){return o.createStateSetter(this,t)},createStateKeySetter:function(t){return o.createStateKeySetter(this,t)}},e.exports=o},{}],65:[function(t,e){"use strict";var n=t("./ReactComponent"),o=t("./ReactMount"),r=t("./escapeTextForBrowser"),i=t("./mixInto"),a=function(t){this.construct({text:t})};i(a,n.Mixin),i(a,{mountComponent:function(t,e,i){return n.Mixin.mountComponent.call(this,t,e,i),"'+r(this.props.text)+""},receiveComponent:function(t){var e=t.props;e.text!==this.props.text&&(this.props.text=e.text,n.DOMIDOperations.updateTextContentByID(this._rootNodeID,e.text))}}),e.exports=a},{"./ReactComponent":28,"./ReactMount":54,"./escapeTextForBrowser":95,"./mixInto":121}],66:[function(t,e){"use strict";function n(){var t=document.createElement("div"),e=t.style;for(var n in a){var o=a[n];for(var r in o)if(r in e){s.push(o[r]);break}}}function o(t,e,n){t.addEventListener(e,n,!1)}function r(t,e,n){t.removeEventListener(e,n,!1)}var i=t("./ExecutionEnvironment"),a={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},s=[];i.canUseDOM&&n();var u={addEndEventListener:function(t,e){return 0===s.length?(window.setTimeout(e,0),void 0):(s.forEach(function(n){o(t,n,e)}),void 0)},removeEndEventListener:function(t,e){0!==s.length&&s.forEach(function(n){r(t,n,e)})}};e.exports=u},{"./ExecutionEnvironment":21}],67:[function(t,e){"use strict";var n=t("./React"),o=t("./ReactTransitionableChild"),r=t("./ReactTransitionKeySet"),i=n.createClass({propTypes:{transitionName:n.PropTypes.string.isRequired,transitionEnter:n.PropTypes.bool,transitionLeave:n.PropTypes.bool,onTransition:n.PropTypes.func,component:n.PropTypes.func},getDefaultProps:function(){return{transitionEnter:!0,transitionLeave:!0,component:n.DOM.span}},componentWillMount:function(){this._transitionGroupCurrentKeys={}},componentDidUpdate:function(){this.props.onTransition&&this.props.onTransition()},renderTransitionableChildren:function(t){var e={},n=r.getChildMapping(t),i=r.mergeKeySets(this._transitionGroupCurrentKeys,r.getKeySet(t));for(var a in i)(n[a]||this.props.transitionLeave)&&(e[a]=o({name:this.props.transitionName,enter:this.props.transitionEnter,onDoneLeaving:this._handleDoneLeaving.bind(this,a)},n[a]));return this._transitionGroupCurrentKeys=i,e},_handleDoneLeaving:function(t){delete this._transitionGroupCurrentKeys[t],this.forceUpdate()},render:function(){return this.transferPropsTo(this.props.component({transitionName:null,transitionEnter:null,transitionLeave:null,component:null},this.renderTransitionableChildren(this.props.children)))}});e.exports=i},{"./React":26,"./ReactTransitionKeySet":68,"./ReactTransitionableChild":69}],68:[function(t,e){"use strict";var n=t("./ReactChildren"),o={},r={getChildMapping:function(t){return n.map(t,function(t){return t})},getKeySet:function(t){return n.map(t,function(){return!0})},mergeKeySets:function(t,e){t=t||{},e=e||{};var n,r={},i=Object.keys(t).concat([o]),a=Object.keys(e).concat([o]);for(n=0;n=0));c++);a.splice(u,0,s)}}for(n=0;n":">","<":"<",'"':""","'":"'","/":"/"},i=/[&><"'\/]/g;e.exports=o},{}],96:[function(t,e){var n=function(t){var e=Array.prototype.slice.call(arguments).map(function(t){return String(t)}),o=t.split("%s").length-1;return o!==e.length-1?n("ex args number mismatch: %s",JSON.stringify(e)):n._prefix+JSON.stringify(e)+n._suffix};n._prefix="",e.exports=n},{}],97:[function(t,e){"use strict";function n(t,e,n){for(var o=t.attributes,r=o.length,i=[],a=0;r>a;a++){var s=o.item(a);e.call(n,s)&&i.push(s)}return i}e.exports=n},{}],98:[function(t,e){"use strict";function n(t,e,n){var o=t;r(!o.hasOwnProperty(n)),o[n]=e}function o(t){if(null==t)return t;var e={};return i(t,n,e),e}var r=t("./invariant"),i=t("./traverseAllChildren");e.exports=o},{"./invariant":109,"./traverseAllChildren":127}],99:[function(t,e){"use strict";var n=function(t,e,n){Array.isArray(t)?t.forEach(e,n):t&&e.call(n,t)};e.exports=n},{}],100:[function(t,e){function n(t,e,n){return"string"!=typeof t?t:e?o(t,e,n):document.getElementById(t)}function o(t,e,n){var i,a,s;if(r(e)==t)return e;if(e.getElementsByTagName){for(a=e.getElementsByTagName(n||"*"),s=0;s":"<"+t+">",a[t]=!i.firstChild),a[t]?p[t]:null}var o=t("./ExecutionEnvironment"),r=t("./invariant"),i=o.canUseDOM?document.createElement("div"):null,a={circle:!0,g:!0,line:!0,path:!0,polyline:!0,rect:!0,text:!0},s=[1,'"],u=[1,"","
"],c=[3,"","
"],l=[1,"",""],p={"*":[1,"?
","
"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:s,option:s,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:c,th:c,circle:l,g:l,line:l,path:l,polyline:l,rect:l,text:l};e.exports=n},{"./ExecutionEnvironment":21,"./invariant":109}],104:[function(t,e){"use strict";function n(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function o(t){for(;t;){if(t.nextSibling)return t.nextSibling;t=t.parentNode}}function r(t,e){for(var r=n(t),i=0,a=0;r;){if(3==r.nodeType){if(a=i+r.textContent.length,e>=i&&a>=e)return{node:r,offset:e-i};i=a}r=n(o(r))}}e.exports=r},{}],105:[function(t,e){"use strict";function n(t){return t?t.nodeType===o?t.documentElement:t.firstChild:null}var o=9;e.exports=n},{}],106:[function(t,e){"use strict";function n(){return!r&&o.canUseDOM&&(r="innerText"in document.createElement("div")?"innerText":"textContent"),r}var o=t("./ExecutionEnvironment"),r=null;e.exports=n},{"./ExecutionEnvironment":21}],107:[function(t,e){"use strict";function n(t){return t===window?{x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}:{x:t.scrollLeft,y:t.scrollTop}}e.exports=n},{}],108:[function(t,e){function n(t){return t.replace(o,"-$1").toLowerCase()}var o=/([A-Z])/g;e.exports=n},{}],109:[function(t,e){function n(t){if(!t)throw new Error("Invariant Violation")}e.exports=n},{}],110:[function(t,e){"use strict";function n(t,e){if(!o||e&&!o.addEventListener)return!1;var n=document.createElement("div"),i="on"+t,a=i in n;return a||(n.setAttribute(i,"return;"),a="function"==typeof n[i],"undefined"!=typeof n[i]&&(n[i]=void 0),n.removeAttribute(i)),!a&&r&&"wheel"===t&&(a=document.implementation.hasFeature("Events.wheel","3.0")),n=null,a}var o,r,i=t("./ExecutionEnvironment");i.canUseDOM&&(o=document.createElement("div"),r=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),e.exports=n},{"./ExecutionEnvironment":21}],111:[function(t,e){function n(t){return!(!t||!("undefined"!=typeof Node?t instanceof Node:"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName))}e.exports=n -},{}],112:[function(t,e){"use strict";function n(t){return t&&("INPUT"===t.nodeName&&o[t.type]||"TEXTAREA"===t.nodeName)}var o={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};e.exports=n},{}],113:[function(t,e){function n(t){return o(t)&&3==t.nodeType}var o=t("./isNode");e.exports=n},{"./isNode":111}],114:[function(t,e){"use strict";function n(t){t||(t="");var e,n=arguments.length;if(n>1)for(var o=1;n>o;o++)e=arguments[o],e&&(t+=" "+e);return t}e.exports=n},{}],115:[function(t,e){"use strict";var n=t("./invariant"),o=function(t){var e,o={};n(t instanceof Object&&!Array.isArray(t));for(e in t)t.hasOwnProperty(e)&&(o[e]=e);return o};e.exports=o},{"./invariant":109}],116:[function(t,e){var n=function(t){var e;for(e in t)if(t.hasOwnProperty(e))return e;return null};e.exports=n},{}],117:[function(t,e){"use strict";function n(t){var e={};return function(n){return e.hasOwnProperty(n)?e[n]:e[n]=t.call(this,n)}}e.exports=n},{}],118:[function(t,e){"use strict";var n=t("./mergeInto"),o=function(t,e){var o={};return n(o,t),n(o,e),o};e.exports=o},{"./mergeInto":120}],119:[function(t,e){"use strict";var n=t("./invariant"),o=t("./keyMirror"),r=36,i=function(t){return"object"!=typeof t||null===t},a={MAX_MERGE_DEPTH:r,isTerminal:i,normalizeMergeArg:function(t){return void 0===t||null===t?{}:t},checkMergeArrayArgs:function(t,e){n(Array.isArray(t)&&Array.isArray(e))},checkMergeObjectArgs:function(t,e){a.checkMergeObjectArg(t),a.checkMergeObjectArg(e)},checkMergeObjectArg:function(t){n(!i(t)&&!Array.isArray(t))},checkMergeLevel:function(t){n(r>t)},checkArrayStrategy:function(t){n(void 0===t||t in a.ArrayStrategies)},ArrayStrategies:o({Clobber:!0,IndexByIndex:!0})};e.exports=a},{"./invariant":109,"./keyMirror":115}],120:[function(t,e){"use strict";function n(t,e){if(r(t),null!=e){r(e);for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}}var o=t("./mergeHelpers"),r=o.checkMergeObjectArg;e.exports=n},{"./mergeHelpers":119}],121:[function(t,e){"use strict";var n=function(t,e){var n;for(n in e)e.hasOwnProperty(n)&&(t.prototype[n]=e[n])};e.exports=n},{}],122:[function(t,e){"use strict";function n(t,e){i("html"===t.tagName.toLowerCase()),e=e.trim(),i(0===e.toLowerCase().indexOf("")+1,a=e.lastIndexOf("<"),s=e.substring(0,n),u=e.substring(n,a),c=s.indexOf(" ")>-1,l=null;if(c){l=o(s.replace("html ","span ")+"")[0];var p=r(l,function(e){return t.getAttributeNS(e.namespaceURI,e.name)!==e.value});p.forEach(function(e){t.setAttributeNS(e.namespaceURI,e.name,e.value)})}var d=r(t,function(t){return!(l&&l.hasAttributeNS(t.namespaceURI,t.name))});d.forEach(function(e){t.removeAttributeNS(e.namespaceURI,e.name)}),t.innerHTML=u}var o=t("./createNodesFromMarkup"),r=t("./filterAttributes"),i=t("./invariant");e.exports=n},{"./createNodesFromMarkup":90,"./filterAttributes":97,"./invariant":109}],123:[function(t,e){"use strict";function n(t,e,n){if(!t)return null;var o=0,r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]=e.call(n,t[i],i,o++));return r}e.exports=n},{}],124:[function(t,e){"use strict";function n(t,e,n){if(!t)return null;var o=0,r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]=e.call(n,i,t[i],o++));return r}e.exports=n},{}],125:[function(t,e){"use strict";var n=t("./ExecutionEnvironment"),o=null;n.canUseDOM&&(o=window.performance||window.webkitPerformance),o&&o.now||(o=Date);var r=o.now.bind(o);e.exports=r},{"./ExecutionEnvironment":21}],126:[function(t,e){"use strict";function n(t,e){if(t===e)return!0;var n;for(n in t)if(t.hasOwnProperty(n)&&(!e.hasOwnProperty(n)||t[n]!==e[n]))return!1;for(n in e)if(e.hasOwnProperty(n)&&!t.hasOwnProperty(n))return!1;return!0}e.exports=n},{}],127:[function(t,e){"use strict";function n(t,e,n){null!==t&&void 0!==t&&a(t,"",0,e,n)}var o=t("./ReactComponent"),r=t("./ReactTextComponent"),i=t("./invariant"),a=function(t,e,n,s,u){var c=0;if(Array.isArray(t))for(var l=0;l createMarkupForStyles({width: '200px', height: 0}) + * "width:200px;height:0;" + * + * Undefined values are ignored so that declarative programming is easier. + * + * @param {object} styles + * @return {?string} + */ + createMarkupForStyles: function(styles) { + var serialized = ''; + for (var styleName in styles) { + if (!styles.hasOwnProperty(styleName)) { + continue; + } + var styleValue = styles[styleName]; + if (styleValue != null) { + serialized += processStyleName(styleName) + ':'; + serialized += dangerousStyleValue(styleName, styleValue) + ';'; + } + } + return serialized || null; + }, + + /** + * Sets the value for multiple styles on a node. If a value is specified as + * '' (empty string), the corresponding style property will be unset. + * + * @param {DOMElement} node + * @param {object} styles + */ + setValueForStyles: function(node, styles) { + var style = node.style; + for (var styleName in styles) { + if (!styles.hasOwnProperty(styleName)) { + continue; + } + var styleValue = dangerousStyleValue(styleName, styles[styleName]); + if (styleValue) { + style[styleName] = styleValue; + } else { + var expansion = CSSProperty.shorthandPropertyExpansions[styleName]; + if (expansion) { + // Shorthand property that IE8 won't like unsetting, so unset each + // component to placate it + for (var individualStyleName in expansion) { + style[individualStyleName] = ''; + } + } else { + style[styleName] = ''; + } + } + } + } + +}; + +module.exports = CSSPropertyOperations; + +},{"./CSSProperty":2,"./dangerousStyleValue":82,"./escapeTextForBrowser":84,"./hyphenate":97,"./memoizeStringOnly":106}],4:[function(require,module,exports){ +/** + * Copyright 2013 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @providesModule CallbackRegistry + * @typechecks static-only + */ + +"use strict"; + +var listenerBank = {}; + +/** + * Stores "listeners" by `registrationName`/`id`. There should be at most one + * "listener" per `registrationName`/`id` in the `listenerBank`. + * + * Access listeners via `listenerBank[registrationName][id]`. + * + * @class CallbackRegistry + * @internal + */ +var CallbackRegistry = { + + /** + * Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent. + * + * @param {string} id ID of the DOM element. + * @param {string} registrationName Name of listener (e.g. `onClick`). + * @param {?function} listener The callback to store. + */ + putListener: function(id, registrationName, listener) { + var bankForRegistrationName = + listenerBank[registrationName] || (listenerBank[registrationName] = {}); + bankForRegistrationName[id] = listener; + }, + + /** + * @param {string} id ID of the DOM element. + * @param {string} registrationName Name of listener (e.g. `onClick`). + * @return {?function} The stored callback. + */ + getListener: function(id, registrationName) { + var bankForRegistrationName = listenerBank[registrationName]; + return bankForRegistrationName && bankForRegistrationName[id]; + }, + + /** + * Deletes a listener from the registration bank. + * + * @param {string} id ID of the DOM element. + * @param {string} registrationName Name of listener (e.g. `onClick`). + */ + deleteListener: function(id, registrationName) { + var bankForRegistrationName = listenerBank[registrationName]; + if (bankForRegistrationName) { + delete bankForRegistrationName[id]; + } + }, + + /** + * Deletes all listeners for the DOM element with the supplied ID. + * + * @param {string} id ID of the DOM element. + */ + deleteAllListeners: function(id) { + for (var registrationName in listenerBank) { + delete listenerBank[registrationName][id]; + } + }, + + /** + * This is needed for tests only. Do not use! + */ + __purge: function() { + listenerBank = {}; + } + +}; + +module.exports = CallbackRegistry; + +},{}],5:[function(require,module,exports){ +/** + * Copyright 2013 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @providesModule ChangeEventPlugin + */ + +"use strict"; + +var EventConstants = require("./EventConstants"); +var EventPluginHub = require("./EventPluginHub"); +var EventPropagators = require("./EventPropagators"); +var ExecutionEnvironment = require("./ExecutionEnvironment"); +var SyntheticEvent = require("./SyntheticEvent"); + +var isEventSupported = require("./isEventSupported"); +var isTextInputElement = require("./isTextInputElement"); +var keyOf = require("./keyOf"); + +var topLevelTypes = EventConstants.topLevelTypes; + +var eventTypes = { + change: { + phasedRegistrationNames: { + bubbled: keyOf({onChange: null}), + captured: keyOf({onChangeCapture: null}) + } + } +}; + +/** + * For IE shims + */ +var activeElement = null; +var activeElementID = null; +var activeElementValue = null; +var activeElementValueProp = null; + +/** + * SECTION: handle `change` event + */ +function shouldUseChangeEvent(elem) { + return ( + elem.nodeName === 'SELECT' || + (elem.nodeName === 'INPUT' && elem.type === 'file') + ); +} + +var doesChangeEventBubble = false; +if (ExecutionEnvironment.canUseDOM) { + // See `handleChange` comment below + doesChangeEventBubble = isEventSupported('change') && ( + !('documentMode' in document) || document.documentMode > 8 + ); +} + +function manualDispatchChangeEvent(nativeEvent) { + var event = SyntheticEvent.getPooled( + eventTypes.change, + activeElementID, + nativeEvent + ); + EventPropagators.accumulateTwoPhaseDispatches(event); + + // If change bubbled, we'd just bind to it like all the other events + // and have it go through ReactEventTopLevelCallback. Since it doesn't, we + // manually listen for the change event and so we have to enqueue and + // process the abstract event manually. + EventPluginHub.enqueueEvents(event); + EventPluginHub.processEventQueue(); +} + +function startWatchingForChangeEventIE8(target, targetID) { + activeElement = target; + activeElementID = targetID; + activeElement.attachEvent('onchange', manualDispatchChangeEvent); +} + +function stopWatchingForChangeEventIE8() { + if (!activeElement) { + return; + } + activeElement.detachEvent('onchange', manualDispatchChangeEvent); + activeElement = null; + activeElementID = null; +} + +function getTargetIDForChangeEvent( + topLevelType, + topLevelTarget, + topLevelTargetID) { + if (topLevelType === topLevelTypes.topChange) { + return topLevelTargetID; + } +} +function handleEventsForChangeEventIE8( + topLevelType, + topLevelTarget, + topLevelTargetID) { + if (topLevelType === topLevelTypes.topFocus) { + // stopWatching() should be a noop here but we call it just in case we + // missed a blur event somehow. + stopWatchingForChangeEventIE8(); + startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID); + } else if (topLevelType === topLevelTypes.topBlur) { + stopWatchingForChangeEventIE8(); + } +} + + +/** + * SECTION: handle `input` event + */ +var isInputEventSupported = false; +if (ExecutionEnvironment.canUseDOM) { + // IE9 claims to support the input event but fails to trigger it when + // deleting text, so we ignore its input events + isInputEventSupported = isEventSupported('input') && ( + !('documentMode' in document) || document.documentMode > 9 + ); +} + +/** + * (For old IE.) Replacement getter/setter for the `value` property that gets + * set on the active element. + */ +var newValueProp = { + get: function() { + return activeElementValueProp.get.call(this); + }, + set: function(val) { + // Cast to a string so we can do equality checks. + activeElementValue = '' + val; + activeElementValueProp.set.call(this, val); + } +}; + +/** + * (For old IE.) Starts tracking propertychange events on the passed-in element + * and override the value property so that we can distinguish user events from + * value changes in JS. + */ +function startWatchingForValueChange(target, targetID) { + activeElement = target; + activeElementID = targetID; + activeElementValue = target.value; + activeElementValueProp = Object.getOwnPropertyDescriptor( + target.constructor.prototype, + 'value' + ); + + Object.defineProperty(activeElement, 'value', newValueProp); + activeElement.attachEvent('onpropertychange', handlePropertyChange); +} + +/** + * (For old IE.) Removes the event listeners from the currently-tracked element, + * if any exists. + */ +function stopWatchingForValueChange() { + if (!activeElement) { + return; + } + + // delete restores the original property definition + delete activeElement.value; + activeElement.detachEvent('onpropertychange', handlePropertyChange); + + activeElement = null; + activeElementID = null; + activeElementValue = null; + activeElementValueProp = null; +} + +/** + * (For old IE.) Handles a propertychange event, sending a `change` event if + * the value of the active element has changed. + */ +function handlePropertyChange(nativeEvent) { + if (nativeEvent.propertyName !== 'value') { + return; + } + var value = nativeEvent.srcElement.value; + if (value === activeElementValue) { + return; + } + activeElementValue = value; + + manualDispatchChangeEvent(nativeEvent); +} + +/** + * If a `change` event should be fired, returns the target's ID. + */ +function getTargetIDForInputEvent( + topLevelType, + topLevelTarget, + topLevelTargetID) { + if (topLevelType === topLevelTypes.topInput) { + // In modern browsers (i.e., not IE8 or IE9), the input event is exactly + // what we want so fall through here and trigger an abstract event + return topLevelTargetID; + } +} + +// For IE8 and IE9. +function handleEventsForInputEventIE( + topLevelType, + topLevelTarget, + topLevelTargetID) { + if (topLevelType === topLevelTypes.topFocus) { + // In IE8, we can capture almost all .value changes by adding a + // propertychange handler and looking for events with propertyName + // equal to 'value' + // In IE9, propertychange fires for most input events but is buggy and + // doesn't fire when text is deleted, but conveniently, selectionchange + // appears to fire in all of the remaining cases so we catch those and + // forward the event if the value has changed + // In either case, we don't want to call the event handler if the value + // is changed from JS so we redefine a setter for `.value` that updates + // our activeElementValue variable, allowing us to ignore those changes + // + // stopWatching() should be a noop here but we call it just in case we + // missed a blur event somehow. + stopWatchingForValueChange(); + startWatchingForValueChange(topLevelTarget, topLevelTargetID); + } else if (topLevelType === topLevelTypes.topBlur) { + stopWatchingForValueChange(); + } +} + +// For IE8 and IE9. +function getTargetIDForInputEventIE( + topLevelType, + topLevelTarget, + topLevelTargetID) { + if (topLevelType === topLevelTypes.topSelectionChange || + topLevelType === topLevelTypes.topKeyUp || + topLevelType === topLevelTypes.topKeyDown) { + // On the selectionchange event, the target is just document which isn't + // helpful for us so just check activeElement instead. + // + // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire + // propertychange on the first input event after setting `value` from a + // script and fires only keydown, keypress, keyup. Catching keyup usually + // gets it and catching keydown lets us fire an event for the first + // keystroke if user does a key repeat (it'll be a little delayed: right + // before the second keystroke). Other input methods (e.g., paste) seem to + // fire selectionchange normally. + if (activeElement && activeElement.value !== activeElementValue) { + activeElementValue = activeElement.value; + return activeElementID; + } + } +} + + +/** + * SECTION: handle `click` event + */ +function shouldUseClickEvent(elem) { + // Use the `click` event to detect changes to checkbox and radio inputs. + // This approach works across all browsers, whereas `change` does not fire + // until `blur` in IE8. + return ( + elem.nodeName === 'INPUT' && + (elem.type === 'checkbox' || elem.type === 'radio') + ); +} + +function getTargetIDForClickEvent( + topLevelType, + topLevelTarget, + topLevelTargetID) { + if (topLevelType === topLevelTypes.topClick) { + return topLevelTargetID; + } +} + +/** + * This plugin creates an `onChange` event that normalizes change events + * across form elements. This event fires at a time when it's possible to + * change the element's value without seeing a flicker. + * + * Supported elements are: + * - input (see `isTextInputElement`) + * - textarea + * - select + */ +var ChangeEventPlugin = { + + eventTypes: eventTypes, + + /** + * @param {string} topLevelType Record from `EventConstants`. + * @param {DOMEventTarget} topLevelTarget The listening component root node. + * @param {string} topLevelTargetID ID of `topLevelTarget`. + * @param {object} nativeEvent Native browser event. + * @return {*} An accumulation of synthetic events. + * @see {EventPluginHub.extractEvents} + */ + extractEvents: function( + topLevelType, + topLevelTarget, + topLevelTargetID, + nativeEvent) { + + var getTargetIDFunc, handleEventFunc; + if (shouldUseChangeEvent(topLevelTarget)) { + if (doesChangeEventBubble) { + getTargetIDFunc = getTargetIDForChangeEvent; + } else { + handleEventFunc = handleEventsForChangeEventIE8; + } + } else if (isTextInputElement(topLevelTarget)) { + if (isInputEventSupported) { + getTargetIDFunc = getTargetIDForInputEvent; + } else { + getTargetIDFunc = getTargetIDForInputEventIE; + handleEventFunc = handleEventsForInputEventIE; + } + } else if (shouldUseClickEvent(topLevelTarget)) { + getTargetIDFunc = getTargetIDForClickEvent; + } + + if (getTargetIDFunc) { + var targetID = getTargetIDFunc( + topLevelType, + topLevelTarget, + topLevelTargetID + ); + if (targetID) { + var event = SyntheticEvent.getPooled( + eventTypes.change, + targetID, + nativeEvent + ); + EventPropagators.accumulateTwoPhaseDispatches(event); + return event; + } + } + + if (handleEventFunc) { + handleEventFunc( + topLevelType, + topLevelTarget, + topLevelTargetID + ); + } + } + +}; + +module.exports = ChangeEventPlugin; + +},{"./EventConstants":14,"./EventPluginHub":16,"./EventPropagators":19,"./ExecutionEnvironment":20,"./SyntheticEvent":66,"./isEventSupported":99,"./isTextInputElement":101,"./keyOf":105}],6:[function(require,module,exports){ +/** + * Copyright 2013 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @providesModule CompositionEventPlugin + * @typechecks static-only + */ + +"use strict"; + +var EventConstants = require("./EventConstants"); +var EventPropagators = require("./EventPropagators"); +var ExecutionEnvironment = require("./ExecutionEnvironment"); +var ReactInputSelection = require("./ReactInputSelection"); +var SyntheticCompositionEvent = require("./SyntheticCompositionEvent"); + +var getTextContentAccessor = require("./getTextContentAccessor"); +var keyOf = require("./keyOf"); + +var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space +var START_KEYCODE = 229; + +var useCompositionEvent = ExecutionEnvironment.canUseDOM && + 'CompositionEvent' in window; +var topLevelTypes = EventConstants.topLevelTypes; +var currentComposition = null; + +// Events and their corresponding property names. +var eventTypes = { + compositionEnd: { + phasedRegistrationNames: { + bubbled: keyOf({onCompositionEnd: null}), + captured: keyOf({onCompositionEndCapture: null}) + } + }, + compositionStart: { + phasedRegistrationNames: { + bubbled: keyOf({onCompositionStart: null}), + captured: keyOf({onCompositionStartCapture: null}) + } + }, + compositionUpdate: { + phasedRegistrationNames: { + bubbled: keyOf({onCompositionUpdate: null}), + captured: keyOf({onCompositionUpdateCapture: null}) + } + } +}; + +/** + * Translate native top level events into event types. + * + * @param {string} topLevelType + * @return {object} + */ +function getCompositionEventType(topLevelType) { + switch (topLevelType) { + case topLevelTypes.topCompositionStart: + return eventTypes.compositionStart; + case topLevelTypes.topCompositionEnd: + return eventTypes.compositionEnd; + case topLevelTypes.topCompositionUpdate: + return eventTypes.compositionUpdate; + } +} + +/** + * Does our fallback best-guess model think this event signifies that + * composition has begun? + * + * @param {string} topLevelType + * @param {object} nativeEvent + * @return {boolean} + */ +function isFallbackStart(topLevelType, nativeEvent) { + return ( + topLevelType === topLevelTypes.topKeyDown && + nativeEvent.keyCode === START_KEYCODE + ); +} + +/** + * Does our fallback mode think that this event is the end of composition? + * + * @param {string} topLevelType + * @param {object} nativeEvent + * @return {boolean} + */ +function isFallbackEnd(topLevelType, nativeEvent) { + switch (topLevelType) { + case topLevelTypes.topKeyUp: + // Command keys insert or clear IME input. + return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1); + case topLevelTypes.topKeyDown: + // Expect IME keyCode on each keydown. If we get any other + // code we must have exited earlier. + return (nativeEvent.keyCode !== START_KEYCODE); + case topLevelTypes.topKeyPress: + case topLevelTypes.topMouseDown: + case topLevelTypes.topBlur: + // Events are not possible without cancelling IME. + return true; + default: + return false; + } +} + +/** + * Helper class stores information about selection and document state + * so we can figure out what changed at a later date. + * + * @param {DOMEventTarget} root + */ +function FallbackCompositionState(root) { + this.root = root; + this.startSelection = ReactInputSelection.getSelection(root); + this.startValue = this.getText(); +} + +/** + * Get current text of input. + * + * @return {string} + */ +FallbackCompositionState.prototype.getText = function() { + return this.root.value || this.root[getTextContentAccessor()]; +}; + +/** + * Text that has changed since the start of composition. + * + * @return {string} + */ +FallbackCompositionState.prototype.getData = function() { + var endValue = this.getText(); + var prefixLength = this.startSelection.start; + var suffixLength = this.startValue.length - this.startSelection.end; + + return endValue.substr( + prefixLength, + endValue.length - suffixLength - prefixLength + ); +}; + +/** + * This plugin creates `onCompositionStart`, `onCompositionUpdate` and + * `onCompositionEnd` events on inputs, textareas and contentEditable + * nodes. + */ +var CompositionEventPlugin = { + + eventTypes: eventTypes, + + /** + * @param {string} topLevelType Record from `EventConstants`. + * @param {DOMEventTarget} topLevelTarget The listening component root node. + * @param {string} topLevelTargetID ID of `topLevelTarget`. + * @param {object} nativeEvent Native browser event. + * @return {*} An accumulation of synthetic events. + * @see {EventPluginHub.extractEvents} + */ + extractEvents: function( + topLevelType, + topLevelTarget, + topLevelTargetID, + nativeEvent) { + + var eventType; + var data; + + if (useCompositionEvent) { + eventType = getCompositionEventType(topLevelType); + } else if (!currentComposition) { + if (isFallbackStart(topLevelType, nativeEvent)) { + eventType = eventTypes.start; + currentComposition = new FallbackCompositionState(topLevelTarget); + } + } else if (isFallbackEnd(topLevelType, nativeEvent)) { + eventType = eventTypes.compositionEnd; + data = currentComposition.getData(); + currentComposition = null; + } + + if (eventType) { + var event = SyntheticCompositionEvent.getPooled( + eventType, + topLevelTargetID, + nativeEvent + ); + if (data) { + // Inject data generated from fallback path into the synthetic event. + // This matches the property of native CompositionEventInterface. + event.data = data; + } + EventPropagators.accumulateTwoPhaseDispatches(event); + return event; + } + } +}; + +module.exports = CompositionEventPlugin; + +},{"./EventConstants":14,"./EventPropagators":19,"./ExecutionEnvironment":20,"./ReactInputSelection":47,"./SyntheticCompositionEvent":65,"./getTextContentAccessor":95,"./keyOf":105}],7:[function(require,module,exports){ +/** + * Copyright 2013 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @providesModule DOMChildrenOperations + * @typechecks static-only + */ + +"use strict"; + +var Danger = require("./Danger"); +var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes"); + +var getTextContentAccessor = require("./getTextContentAccessor"); + +/** + * The DOM property to use when setting text content. + * + * @type {string} + * @private + */ +var textContentAccessor = getTextContentAccessor() || 'NA'; + +/** + * Inserts `childNode` as a child of `parentNode` at the `index`. + * + * @param {DOMElement} parentNode Parent node in which to insert. + * @param {DOMElement} childNode Child node to insert. + * @param {number} index Index at which to insert the child. + * @internal + */ +function insertChildAt(parentNode, childNode, index) { + var childNodes = parentNode.childNodes; + if (childNodes[index] === childNode) { + return; + } + // If `childNode` is already a child of `parentNode`, remove it so that + // computing `childNodes[index]` takes into account the removal. + if (childNode.parentNode === parentNode) { + parentNode.removeChild(childNode); + } + if (index >= childNodes.length) { + parentNode.appendChild(childNode); + } else { + parentNode.insertBefore(childNode, childNodes[index]); + } +} + +/** + * Operations for updating with DOM children. + */ +var DOMChildrenOperations = { + + dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup, + + /** + * Updates a component's children by processing a series of updates. The + * update configurations are each expected to have a `parentNode` property. + * + * @param {array} updates List of update configurations. + * @param {array} markupList List of markup strings. + * @internal + */ + processUpdates: function(updates, markupList) { + var update; + // Mapping from parent IDs to initial child orderings. + var initialChildren = null; + // List of children that will be moved or removed. + var updatedChildren = null; + + for (var i = 0; update = updates[i]; i++) { + if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || + update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) { + var updatedIndex = update.fromIndex; + var updatedChild = update.parentNode.childNodes[updatedIndex]; + var parentID = update.parentID; + + initialChildren = initialChildren || {}; + initialChildren[parentID] = initialChildren[parentID] || []; + initialChildren[parentID][updatedIndex] = updatedChild; + + updatedChildren = updatedChildren || []; + updatedChildren.push(updatedChild); + } + } + + var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList); + + // Remove updated children first so that `toIndex` is consistent. + if (updatedChildren) { + for (var j = 0; j < updatedChildren.length; j++) { + updatedChildren[j].parentNode.removeChild(updatedChildren[j]); + } + } + + for (var k = 0; update = updates[k]; k++) { + switch (update.type) { + case ReactMultiChildUpdateTypes.INSERT_MARKUP: + insertChildAt( + update.parentNode, + renderedMarkup[update.markupIndex], + update.toIndex + ); + break; + case ReactMultiChildUpdateTypes.MOVE_EXISTING: + insertChildAt( + update.parentNode, + initialChildren[update.parentID][update.fromIndex], + update.toIndex + ); + break; + case ReactMultiChildUpdateTypes.TEXT_CONTENT: + update.parentNode[textContentAccessor] = update.textContent; + break; + case ReactMultiChildUpdateTypes.REMOVE_NODE: + // Already removed by the for-loop above. + break; + } + } + } + +}; + +module.exports = DOMChildrenOperations; + +},{"./Danger":10,"./ReactMultiChildUpdateTypes":53,"./getTextContentAccessor":95}],8:[function(require,module,exports){ +/** + * Copyright 2013 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @providesModule DOMProperty + * @typechecks static-only + */ + +/*jslint bitwise: true */ + +"use strict"; + +var invariant = require("./invariant"); + +var DOMPropertyInjection = { + /** + * Mapping from normalized, camelcased property names to a configuration that + * specifies how the associated DOM property should be accessed or rendered. + */ + MUST_USE_ATTRIBUTE: 0x1, + MUST_USE_PROPERTY: 0x2, + HAS_SIDE_EFFECTS: 0x4, + HAS_BOOLEAN_VALUE: 0x8, + HAS_POSITIVE_NUMERIC_VALUE: 0x10, + + /** + * Inject some specialized knowledge about the DOM. This takes a config object + * with the following properties: + * + * isCustomAttribute: function that given an attribute name will return true + * if it can be inserted into the DOM verbatim. Useful for data-* or aria-* + * attributes where it's impossible to enumerate all of the possible + * attribute names, + * + * Properties: object mapping DOM property name to one of the + * DOMPropertyInjection constants or null. If your attribute isn't in here, + * it won't get written to the DOM. + * + * DOMAttributeNames: object mapping React attribute name to the DOM + * attribute name. Attribute names not specified use the **lowercase** + * normalized name. + * + * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. + * Property names not specified use the normalized name. + * + * DOMMutationMethods: Properties that require special mutation methods. If + * `value` is undefined, the mutation method should unset the property. + * + * @param {object} domPropertyConfig the config as described above. + */ + injectDOMPropertyConfig: function(domPropertyConfig) { + var Properties = domPropertyConfig.Properties || {}; + var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; + var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; + var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; + + if (domPropertyConfig.isCustomAttribute) { + DOMProperty._isCustomAttributeFunctions.push( + domPropertyConfig.isCustomAttribute + ); + } + + for (var propName in Properties) { + ("production" !== "development" ? invariant( + !DOMProperty.isStandardName[propName], + 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + + '\'%s\' which has already been injected. You may be accidentally ' + + 'injecting the same DOM property config twice, or you may be ' + + 'injecting two configs that have conflicting property names.', + propName + ) : invariant(!DOMProperty.isStandardName[propName])); + + DOMProperty.isStandardName[propName] = true; + + var lowerCased = propName.toLowerCase(); + DOMProperty.getPossibleStandardName[lowerCased] = propName; + + var attributeName = DOMAttributeNames[propName]; + if (attributeName) { + DOMProperty.getPossibleStandardName[attributeName] = propName; + } + + DOMProperty.getAttributeName[propName] = attributeName || lowerCased; + + DOMProperty.getPropertyName[propName] = + DOMPropertyNames[propName] || propName; + + var mutationMethod = DOMMutationMethods[propName]; + if (mutationMethod) { + DOMProperty.getMutationMethod[propName] = mutationMethod; + } + + var propConfig = Properties[propName]; + DOMProperty.mustUseAttribute[propName] = + propConfig & DOMPropertyInjection.MUST_USE_ATTRIBUTE; + DOMProperty.mustUseProperty[propName] = + propConfig & DOMPropertyInjection.MUST_USE_PROPERTY; + DOMProperty.hasSideEffects[propName] = + propConfig & DOMPropertyInjection.HAS_SIDE_EFFECTS; + DOMProperty.hasBooleanValue[propName] = + propConfig & DOMPropertyInjection.HAS_BOOLEAN_VALUE; + DOMProperty.hasPositiveNumericValue[propName] = + propConfig & DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE; + + ("production" !== "development" ? invariant( + !DOMProperty.mustUseAttribute[propName] || + !DOMProperty.mustUseProperty[propName], + 'DOMProperty: Cannot require using both attribute and property: %s', + propName + ) : invariant(!DOMProperty.mustUseAttribute[propName] || + !DOMProperty.mustUseProperty[propName])); + ("production" !== "development" ? invariant( + DOMProperty.mustUseProperty[propName] || + !DOMProperty.hasSideEffects[propName], + 'DOMProperty: Properties that have side effects must use property: %s', + propName + ) : invariant(DOMProperty.mustUseProperty[propName] || + !DOMProperty.hasSideEffects[propName])); + ("production" !== "development" ? invariant( + !DOMProperty.hasBooleanValue[propName] || + !DOMProperty.hasPositiveNumericValue[propName], + 'DOMProperty: Cannot have both boolean and positive numeric value: %s', + propName + ) : invariant(!DOMProperty.hasBooleanValue[propName] || + !DOMProperty.hasPositiveNumericValue[propName])); + } + } +}; +var defaultValueCache = {}; + +/** + * DOMProperty exports lookup objects that can be used like functions: + * + * > DOMProperty.isValid['id'] + * true + * > DOMProperty.isValid['foobar'] + * undefined + * + * Although this may be confusing, it performs better in general. + * + * @see http://jsperf.com/key-exists + * @see http://jsperf.com/key-missing + */ +var DOMProperty = { + + /** + * Checks whether a property name is a standard property. + * @type {Object} + */ + isStandardName: {}, + + /** + * Mapping from lowercase property names to the properly cased version, used + * to warn in the case of missing properties. + * @type {Object} + */ + getPossibleStandardName: {}, + + /** + * Mapping from normalized names to attribute names that differ. Attribute + * names are used when rendering markup or with `*Attribute()`. + * @type {Object} + */ + getAttributeName: {}, + + /** + * Mapping from normalized names to properties on DOM node instances. + * (This includes properties that mutate due to external factors.) + * @type {Object} + */ + getPropertyName: {}, + + /** + * Mapping from normalized names to mutation methods. This will only exist if + * mutation cannot be set simply by the property or `setAttribute()`. + * @type {Object} + */ + getMutationMethod: {}, + + /** + * Whether the property must be accessed and mutated as an object property. + * @type {Object} + */ + mustUseAttribute: {}, + + /** + * Whether the property must be accessed and mutated using `*Attribute()`. + * (This includes anything that fails ` in `.) + * @type {Object} + */ + mustUseProperty: {}, + + /** + * Whether or not setting a value causes side effects such as triggering + * resources to be loaded or text selection changes. We must ensure that + * the value is only set if it has changed. + * @type {Object} + */ + hasSideEffects: {}, + + /** + * Whether the property should be removed when set to a falsey value. + * @type {Object} + */ + hasBooleanValue: {}, + + /** + * Whether the property must be positive numeric or parse as a positive + * numeric and should be removed when set to a falsey value. + * @type {Object} + */ + hasPositiveNumericValue: {}, + + /** + * All of the isCustomAttribute() functions that have been injected. + */ + _isCustomAttributeFunctions: [], + + /** + * Checks whether a property name is a custom attribute. + * @method + */ + isCustomAttribute: function(attributeName) { + return DOMProperty._isCustomAttributeFunctions.some( + function(isCustomAttributeFn) { + return isCustomAttributeFn.call(null, attributeName); + } + ); + }, + + /** + * Returns the default property value for a DOM property (i.e., not an + * attribute). Most default values are '' or false, but not all. Worse yet, + * some (in particular, `type`) vary depending on the type of element. + * + * TODO: Is it better to grab all the possible properties when creating an + * element to avoid having to create the same element twice? + */ + getDefaultValueForProperty: function(nodeName, prop) { + var nodeDefaults = defaultValueCache[nodeName]; + var testElement; + if (!nodeDefaults) { + defaultValueCache[nodeName] = nodeDefaults = {}; + } + if (!(prop in nodeDefaults)) { + testElement = document.createElement(nodeName); + nodeDefaults[prop] = testElement[prop]; + } + return nodeDefaults[prop]; + }, + + injection: DOMPropertyInjection +}; + +module.exports = DOMProperty; + +},{"./invariant":98}],9:[function(require,module,exports){ +/** + * Copyright 2013 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @providesModule DOMPropertyOperations + * @typechecks static-only + */ + +"use strict"; + +var DOMProperty = require("./DOMProperty"); + +var escapeTextForBrowser = require("./escapeTextForBrowser"); +var memoizeStringOnly = require("./memoizeStringOnly"); + +function shouldIgnoreValue(name, value) { + return value == null || + DOMProperty.hasBooleanValue[name] && !value || + DOMProperty.hasPositiveNumericValue[name] && (isNaN(value) || value < 1); +} + +var processAttributeNameAndPrefix = memoizeStringOnly(function(name) { + return escapeTextForBrowser(name) + '="'; +}); + +if ("production" !== "development") { + var reactProps = { + __owner__: true, + children: true, + dangerouslySetInnerHTML: true, + key: true, + ref: true + }; + var warnedProperties = {}; + + var warnUnknownProperty = function(name) { + if (reactProps[name] || warnedProperties[name]) { + return; + } + + warnedProperties[name] = true; + var lowerCasedName = name.toLowerCase(); + + // data-* attributes should be lowercase; suggest the lowercase version + var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? + lowerCasedName : DOMProperty.getPossibleStandardName[lowerCasedName]; + + // For now, only warn when we have a suggested correction. This prevents + // logging too much when using transferPropsTo. + if (standardName != null) { + console.warn( + 'Unknown DOM property ' + name + '. Did you mean ' + standardName + '?' + ); + } + + }; +} + +/** + * Operations for dealing with DOM properties. + */ +var DOMPropertyOperations = { + + /** + * Creates markup for a property. + * + * @param {string} name + * @param {*} value + * @return {?string} Markup string, or null if the property was invalid. + */ + createMarkupForProperty: function(name, value) { + if (DOMProperty.isStandardName[name]) { + if (shouldIgnoreValue(name, value)) { + return ''; + } + var attributeName = DOMProperty.getAttributeName[name]; + return processAttributeNameAndPrefix(attributeName) + + escapeTextForBrowser(value) + '"'; + } else if (DOMProperty.isCustomAttribute(name)) { + if (value == null) { + return ''; + } + return processAttributeNameAndPrefix(name) + + escapeTextForBrowser(value) + '"'; + } else if ("production" !== "development") { + warnUnknownProperty(name); + } + return null; + }, + + /** + * Sets the value for a property on a node. + * + * @param {DOMElement} node + * @param {string} name + * @param {*} value + */ + setValueForProperty: function(node, name, value) { + if (DOMProperty.isStandardName[name]) { + var mutationMethod = DOMProperty.getMutationMethod[name]; + if (mutationMethod) { + mutationMethod(node, value); + } else if (shouldIgnoreValue(name, value)) { + this.deleteValueForProperty(node, name); + } else if (DOMProperty.mustUseAttribute[name]) { + node.setAttribute(DOMProperty.getAttributeName[name], '' + value); + } else { + var propName = DOMProperty.getPropertyName[name]; + if (!DOMProperty.hasSideEffects[name] || node[propName] !== value) { + node[propName] = value; + } + } + } else if (DOMProperty.isCustomAttribute(name)) { + if (value == null) { + node.removeAttribute(DOMProperty.getAttributeName[name]); + } else { + node.setAttribute(name, '' + value); + } + } else if ("production" !== "development") { + warnUnknownProperty(name); + } + }, + + /** + * Deletes the value for a property on a node. + * + * @param {DOMElement} node + * @param {string} name + */ + deleteValueForProperty: function(node, name) { + if (DOMProperty.isStandardName[name]) { + var mutationMethod = DOMProperty.getMutationMethod[name]; + if (mutationMethod) { + mutationMethod(node, undefined); + } else if (DOMProperty.mustUseAttribute[name]) { + node.removeAttribute(DOMProperty.getAttributeName[name]); + } else { + var propName = DOMProperty.getPropertyName[name]; + var defaultValue = DOMProperty.getDefaultValueForProperty( + node.nodeName, + name + ); + if (!DOMProperty.hasSideEffects[name] || + node[propName] !== defaultValue) { + node[propName] = defaultValue; + } + } + } else if (DOMProperty.isCustomAttribute(name)) { + node.removeAttribute(name); + } else if ("production" !== "development") { + warnUnknownProperty(name); + } + } + +}; + +module.exports = DOMPropertyOperations; + +},{"./DOMProperty":8,"./escapeTextForBrowser":84,"./memoizeStringOnly":106}],10:[function(require,module,exports){ +/** + * Copyright 2013 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @providesModule Danger + * @typechecks static-only + */ + +/*jslint evil: true, sub: true */ + +"use strict"; + +var ExecutionEnvironment = require("./ExecutionEnvironment"); + +var createNodesFromMarkup = require("./createNodesFromMarkup"); +var emptyFunction = require("./emptyFunction"); +var getMarkupWrap = require("./getMarkupWrap"); +var invariant = require("./invariant"); +var mutateHTMLNodeWithMarkup = require("./mutateHTMLNodeWithMarkup"); + +var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/; +var RESULT_INDEX_ATTR = 'data-danger-index'; + +/** + * Extracts the `nodeName` from a string of markup. + * + * NOTE: Extracting the `nodeName` does not require a regular expression match + * because we make assumptions about React-generated markup (i.e. there are no + * spaces surrounding the opening tag and there is at least one attribute). + * + * @param {string} markup String of markup. + * @return {string} Node name of the supplied markup. + * @see http://jsperf.com/extract-nodename + */ +function getNodeName(markup) { + return markup.substring(1, markup.indexOf(' ')); +} + +var Danger = { + + /** + * Renders markup into an array of nodes. The markup is expected to render + * into a list of root nodes. Also, the length of `resultList` and + * `markupList` should be the same. + * + * @param {array} markupList List of markup strings to render. + * @return {array} List of rendered nodes. + * @internal + */ + dangerouslyRenderMarkup: function(markupList) { + ("production" !== "development" ? invariant( + ExecutionEnvironment.canUseDOM, + 'dangerouslyRenderMarkup(...): Cannot render markup in a Worker ' + + 'thread. This is likely a bug in the framework. Please report ' + + 'immediately.' + ) : invariant(ExecutionEnvironment.canUseDOM)); + var nodeName; + var markupByNodeName = {}; + // Group markup by `nodeName` if a wrap is necessary, else by '*'. + for (var i = 0; i < markupList.length; i++) { + ("production" !== "development" ? invariant( + markupList[i], + 'dangerouslyRenderMarkup(...): Missing markup.' + ) : invariant(markupList[i])); + nodeName = getNodeName(markupList[i]); + nodeName = getMarkupWrap(nodeName) ? nodeName : '*'; + markupByNodeName[nodeName] = markupByNodeName[nodeName] || []; + markupByNodeName[nodeName][i] = markupList[i]; + } + var resultList = []; + var resultListAssignmentCount = 0; + for (nodeName in markupByNodeName) { + if (!markupByNodeName.hasOwnProperty(nodeName)) { + continue; + } + var markupListByNodeName = markupByNodeName[nodeName]; + + // This for-in loop skips the holes of the sparse array. The order of + // iteration should follow the order of assignment, which happens to match + // numerical index order, but we don't rely on that. + for (var resultIndex in markupListByNodeName) { + if (markupListByNodeName.hasOwnProperty(resultIndex)) { + var markup = markupListByNodeName[resultIndex]; + + // Push the requested markup with an additional RESULT_INDEX_ATTR + // attribute. If the markup does not start with a < character, it + // will be discarded below (with an appropriate console.error). + markupListByNodeName[resultIndex] = markup.replace( + OPEN_TAG_NAME_EXP, + // This index will be parsed back out below. + '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ' + ); + } + } + + // Render each group of markup with similar wrapping `nodeName`. + var renderNodes = createNodesFromMarkup( + markupListByNodeName.join(''), + emptyFunction // Do nothing special with