text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e=e||self).ReactRating=t(e.React)}(this,function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function r(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,o)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(n,!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&p(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?y(e):t}e=e&&e.hasOwnProperty("default")?e.default:e;var h={display:"inline-block",borderRadius:"50%",border:"5px double white",width:30,height:30},d={empty:s({},h,{backgroundColor:"#ccc"}),full:s({},h,{backgroundColor:"black"}),placeholder:s({},h,{backgroundColor:"red"})},v=function(n){return e.isValidElement(n)?n:"object"===t(n)&&null!==n?e.createElement("span",{style:n}):"[object String]"===Object.prototype.toString.call(n)?e.createElement("span",{className:n}):void 0},b=function(t){function o(){return n(this,o),f(this,c(o).apply(this,arguments))}return u(o,e.PureComponent),r(o,[{key:"render",value:function(){var t,n=this.props,o=n.index,r=n.inactiveIcon,a=n.activeIcon,l=n.percent,s=n.direction,u=n.readonly,c=n.onClick,p=n.onMouseMove,y=n.onTouchEnd,f=v(r),h=l<100?{}:{visibility:"hidden"},d=v(a),b=(i(t={display:"inline-block",position:"absolute",overflow:"hidden",top:0},"rtl"===s?"right":"left",0),i(t,"width","".concat(l,"%")),t),m={cursor:u?"inherit":"pointer",display:"inline-block",position:"relative"};function g(e){p&&p(o,e)}return e.createElement("span",{style:m,onClick:function(e){c&&(e.preventDefault(),c(o,e))},onMouseMove:g,onTouchMove:g,onTouchEnd:function(e){y&&y(o,e)}},e.createElement("span",{style:h},f),e.createElement("span",{style:b},d))}}]),o}(),m=function(t){function o(e){var t;return n(this,o),(t=f(this,c(o).call(this,e))).state={displayValue:t.props.value,interacting:!1},t.onMouseLeave=t.onMouseLeave.bind(y(t)),t.symbolMouseMove=t.symbolMouseMove.bind(y(t)),t.symbolClick=t.symbolClick.bind(y(t)),t.symbolEnd=t.symbolEnd.bind(y(t)),t}return u(o,e.PureComponent),r(o,[{key:"componentDidUpdate",value:function(e,t){if(t.interacting&&!this.state.interacting)return this.props.onHover();this.state.interacting&&e.value==this.props.value&&this.props.onHover(this.state.displayValue)}},{key:"symbolEnd",value:function(e,t){this.props.quiet||(this.symbolClick(e,t),t.preventDefault()),this.onMouseLeave()}},{key:"symbolClick",value:function(e,t){var n=this.calculateDisplayValue(e,t);this.props.onClick(n,t)}},{key:"symbolMouseMove",value:function(e,t){var n=this.calculateDisplayValue(e,t);this.setState({interacting:!this.props.readonly,displayValue:n})}},{key:"onMouseLeave",value:function(){this.setState({displayValue:this.props.value,interacting:!1})}},{key:"calculateDisplayValue",value:function(e,t){var n=this.calculateHoverPercentage(t),o=Math.ceil(n%1*this.props.fractions)/this.props.fractions,r=Math.pow(10,3),i=e+(Math.floor(n)+Math.floor(o*r)/r);return i>0?i>this.props.totalSymbols?this.props.totalSymbols:i:1/this.props.fractions}},{key:"calculateHoverPercentage",value:function(e){var t=e.nativeEvent.type.indexOf("touch")>-1?e.nativeEvent.type.indexOf("touchend")>-1?e.changedTouches[0].clientX:e.touches[0].clientX:e.clientX,n=e.target.getBoundingClientRect(),o="rtl"===this.props.direction?n.right-t:t-n.left;return o<0?0:o/n.width}},{key:"render",value:function(){var t,n=this.props,o=n.readonly,r=n.quiet,i=n.totalSymbols,l=n.value,u=n.placeholderValue,c=n.direction,p=n.emptySymbol,y=n.fullSymbol,f=n.placeholderSymbol,h=n.className,d=n.id,v=n.style,m=n.tabIndex,g=this.state,k=g.displayValue,O=g.interacting,S=[],M=[].concat(p),C=[].concat(y),V=[].concat(f),P=0!==u&&0===l&&!O;t=P?u:r?l:k;for(var j=Math.floor(t),w=0;w<i;w++){var E=void 0;E=w-j<0?100:w-j==0?100*(t-w):0,S.push(e.createElement(b,a({key:w,index:w,readonly:o,inactiveIcon:M[w%M.length],activeIcon:P?V[w%C.length]:C[w%C.length],percent:E,direction:c},!o&&{onClick:this.symbolClick,onMouseMove:this.symbolMouseMove,onTouchMove:this.symbolMouseMove,onTouchEnd:this.symbolEnd})))}return e.createElement("span",a({id:d,style:s({},v,{display:"inline-block",direction:c}),className:h,tabIndex:m,"aria-label":this.props["aria-label"]},!o&&{onMouseLeave:this.onMouseLeave}),S)}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.value!==e.value;t.setState(function(t){return{displayValue:n?e.value:t.displayValue}})}}]),o}();function g(){}g._name="react_rating_noop";var k=function(t){function o(e){var t;return n(this,o),(t=f(this,c(o).call(this,e))).state={value:e.initialRating},t.handleClick=t.handleClick.bind(y(t)),t.handleHover=t.handleHover.bind(y(t)),t}return u(o,e.PureComponent),r(o,[{key:"handleClick",value:function(e,t){var n=this,o=this.translateDisplayValueToValue(e);this.props.onClick(o),this.state.value!==o&&this.setState({value:o},function(){return n.props.onChange(n.state.value)})}},{key:"handleHover",value:function(e){var t=void 0===e?e:this.translateDisplayValueToValue(e);this.props.onHover(t)}},{key:"translateDisplayValueToValue",value:function(e){var t=e*this.props.step+this.props.start;return t===this.props.start?t+1/this.props.fractions:t}},{key:"tranlateValueToDisplayValue",value:function(e){return void 0===e?0:(e-this.props.start)/this.props.step}},{key:"render",value:function(){var t=this.props,n=t.step,o=t.emptySymbol,r=t.fullSymbol,i=t.placeholderSymbol,a=t.readonly,l=t.quiet,s=t.fractions,u=t.direction,c=t.start,p=t.stop,y=t.id,f=t.className,h=t.style,d=t.tabIndex;return e.createElement(m,{id:y,style:h,className:f,tabIndex:d,"aria-label":this.props["aria-label"],totalSymbols:function(e,t,n){return Math.floor((t-e)/n)}(c,p,n),value:this.tranlateValueToDisplayValue(this.state.value),placeholderValue:this.tranlateValueToDisplayValue(this.props.placeholderRating),readonly:a,quiet:l,fractions:s,direction:u,emptySymbol:o,fullSymbol:r,placeholderSymbol:i,onClick:this.handleClick,onHover:this.handleHover})}}],[{key:"getDerivedStateFromProps",value:function(e,t){t.setState({value:e.initialRating})}}]),o}();return k.defaultProps={start:0,stop:5,step:1,readonly:!1,quiet:!1,fractions:1,direction:"ltr",onHover:g,onClick:g,onChange:g,emptySymbol:d.empty,fullSymbol:d.full,placeholderSymbol:d.placeholder},k});
  //# sourceMappingURL=react-rating.umd.min.js.map
  