UNPKG

@ineentho/react-rangeslider

Version:

A lightweight react component that acts as a HTML5 input range slider polyfill

11 lines 27.5 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactRangeslider=t(require("react")):e.ReactRangeslider=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){n(5),e.exports=n(5)},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){v&&d&&(v=!1,d.length?h=d.concat(h):y=-1,h.length&&s())}function s(){if(!v){var e=o(a);v=!0;for(var t=h.length;t;){for(d=h,h=[];++y<t;)d&&d[y].run();y=-1,t=h.length}d=null,v=!1,i(e)}}function u(e,t){this.fun=e,this.array=t}function c(){}var l,f,p=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}();var d,h=[],v=!1,y=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new u(e,t)),1!==h.length||v||o(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t){"use strict";function n(e){return function(){return e}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){(function(t){"use strict";function n(e,t,n,o,i,a,s,u){if(r(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,o,i,a,s,u],f=0;c=new Error(t.replace(/%s/g,function(){return l[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var r=function(e){};"production"!==t.env.NODE_ENV&&(r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=n}).call(t,n(1))},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(7),i=r(o);t.default=i.default},function(e,t,n){(function(t){"use strict";var r=n(2),o=r;if("production"!==t.env.NODE_ENV){var i=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,function(){return n[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};o=function(e,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==t.indexOf("Failed Composite propType: ")&&!e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];i.apply(void 0,[t].concat(r))}}}e.exports=o}).call(t,n(1))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(9),l=r(c),f=n(16),p=r(f),d=n(14),h=r(d),v=n(15),y=r(v),m=n(8),b={orientation:{horizontal:{dimension:"width",direction:"left",reverseDirection:"right",coordinate:"x"},vertical:{dimension:"height",direction:"top",reverseDirection:"bottom",coordinate:"y"}}},g=function(e){function t(e,n){i(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.handleFormat=function(e){var t=r.props.format;return t?t(e):e},r.handleUpdate=function(){if(r.slider){var e=r.props.orientation,t=(0,m.capitalize)(b.orientation[e].dimension),n=r.slider["offset"+t],o=r.handle["offset"+t];r.setState({limit:n-o,grab:o/2})}},r.handleStart=function(e){var t=r.props.onChangeStart;document.addEventListener("mousemove",r.handleDrag),document.addEventListener("mouseup",r.handleEnd),r.setState({active:!0},function(){t&&t(e)})},r.handleDrag=function(e){e.stopPropagation();var t=r.props.onChange,n=e.target,o=n.className,i=n.classList,a=n.dataset;if(t&&"rangeslider__labels"!==o){var s=r.position(e);i&&i.contains("rangeslider__label-item")&&a.value&&(s=parseFloat(a.value)),t&&t(s,e)}},r.handleEnd=function(e){var t=r.props.onChangeComplete;r.setState({active:!1},function(){t&&t(e)}),document.removeEventListener("mousemove",r.handleDrag),document.removeEventListener("mouseup",r.handleEnd)},r.handleKeyDown=function(e){var t=e.keyCode,n=r.props,o=n.value,i=n.min,a=n.max,s=n.step,u=n.onChange,c=void 0;switch(t){case 38:case 39:e.preventDefault(),c=o+s>a?a:o+s,u&&u(c,e);break;case 37:case 40:e.preventDefault(),c=o-s<i?i:o-s,u&&u(c,e)}},r.getPositionFromValue=function(e){var t=r.state.limit,n=r.props,o=n.min,i=n.max,a=i-o,s=e-o,u=s/a,c=Math.round(u*t);return c},r.getValueFromPosition=function(e){var t=r.state.limit,n=r.props,o=n.orientation,i=n.min,a=n.max,s=n.step,u=(0,m.clamp)(e,0,t)/(t||1),c=s*Math.round(u*(a-i)/s),l="horizontal"===o?c+i:a-c;return(0,m.clamp)(l,i,a)},r.position=function(e){var t=r.state.grab,n=r.props,o=n.orientation,i=n.reverse,a=r.slider,s=b.orientation[o].coordinate,u=i?b.orientation[o].reverseDirection:b.orientation[o].direction,c="client"+(0,m.capitalize)(s),l=e.touches?e.touches[0][c]:e[c],f=a.getBoundingClientRect()[u],p=i?f-l-t:l-f-t,d=r.getValueFromPosition(p);return d},r.coordinates=function(e){var t=r.state,n=t.limit,o=t.grab,i=r.props.orientation,a=r.getValueFromPosition(e),s=r.getPositionFromValue(a),u="horizontal"===i?s+o:s,c="horizontal"===i?u:n-u;return{fill:c,handle:u,label:u}},r.renderLabels=function(e){return p.default.createElement("ul",{ref:function(e){r.labels=e},className:(0,l.default)("rangeslider__labels")},e)},r.state={active:!1,limit:0,grab:0},r}return s(t,e),u(t,[{key:"componentDidMount",value:function(){this.handleUpdate();var e=new y.default(this.handleUpdate);e.observe(this.slider)}},{key:"render",value:function(){var e=this,t=this.props,n=t.value,r=t.orientation,i=t.className,a=t.tooltip,s=t.reverse,u=t.labels,c=t.min,f=t.max,d=t.handleLabel,h=this.state.active,v=b.orientation[r].dimension,y=s?b.orientation[r].reverseDirection:b.orientation[r].direction,m=this.getPositionFromValue(n),g=this.coordinates(m),_=o({},v,g.fill+"px"),w=o({},y,g.handle+"px"),O=a&&h,E=[],x=Object.keys(u);if(x.length>0){x=x.sort(function(e,t){return s?e-t:t-e});var T=!0,j=!1,P=void 0;try{for(var R,D=x[Symbol.iterator]();!(T=(R=D.next()).done);T=!0){var M=R.value,N=this.getPositionFromValue(M),S=this.coordinates(N),k=o({},y,S.label+"px");E.push(p.default.createElement("li",{key:M,className:(0,l.default)("rangeslider__label-item"),"data-value":M,onMouseDown:this.handleDrag,onTouchStart:this.handleStart,onTouchEnd:this.handleEnd,style:k},this.props.labels[M]))}}catch(e){j=!0,P=e}finally{try{!T&&D.return&&D.return()}finally{if(j)throw P}}}return p.default.createElement("div",{ref:function(t){e.slider=t},className:(0,l.default)("rangeslider","rangeslider-"+r,{"rangeslider-reverse":s},i),onMouseDown:this.handleDrag,onMouseUp:this.handleEnd,onTouchStart:this.handleStart,onTouchEnd:this.handleEnd,"aria-valuemin":c,"aria-valuemax":f,"aria-valuenow":n,"aria-orientation":r},p.default.createElement("div",{className:"rangeslider__fill",style:_}),p.default.createElement("div",{ref:function(t){e.handle=t},className:"rangeslider__handle",onMouseDown:this.handleStart,onTouchMove:this.handleDrag,onTouchEnd:this.handleEnd,onKeyDown:this.handleKeyDown,style:w,tabIndex:0},O?p.default.createElement("div",{ref:function(t){e.tooltip=t},className:"rangeslider__handle-tooltip"},p.default.createElement("span",null,this.handleFormat(n))):null,p.default.createElement("div",{className:"rangeslider__handle-label"},d)),u?this.renderLabels(E):null)}}]),t}(f.Component);g.propTypes={min:h.default.number,max:h.default.number,step:h.default.number,value:h.default.number,orientation:h.default.string,tooltip:h.default.bool,reverse:h.default.bool,labels:h.default.object,handleLabel:h.default.string,format:h.default.func,onChangeStart:h.default.func,onChange:h.default.func,onChangeComplete:h.default.func},g.defaultProps={min:0,max:100,step:1,value:0,orientation:"horizontal",tooltip:!0,reverse:!1,labels:{},handleLabel:""},t.default=g},function(e,t){"use strict";function n(e){return e.charAt(0).toUpperCase()+e.substr(1)}function r(e,t,n){return Math.min(Math.max(e,t),n)}Object.defineProperty(t,"__esModule",{value:!0}),t.capitalize=n,t.clamp=r},function(e,t,n){var r,o;/*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===o)for(var a in r)i.call(r,a)&&r[a]&&e.push(a)}}return e.join(" ")}var i={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(r=[],o=function(){return n}.apply(t,r),!(void 0!==o&&(e.exports=o)))}()},function(e,t){/* object-assign (c) Sindre Sorhus @license MIT */ "use strict";function n(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function r(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=r()?Object.assign:function(e,t){for(var r,s,u=n(e),c=1;c<arguments.length;c++){r=Object(arguments[c]);for(var l in r)i.call(r,l)&&(u[l]=r[l]);if(o){s=o(r);for(var f=0;f<s.length;f++)a.call(r,s[f])&&(u[s[f]]=r[s[f]])}}return u}},function(e,t,n){(function(t){"use strict";function r(e,n,r,u,c){if("production"!==t.env.NODE_ENV)for(var l in e)if(e.hasOwnProperty(l)){var f;try{o("function"==typeof e[l],"%s: %s type `%s` is invalid; it must be a function, usually from the `prop-types` package, but received `%s`.",u||"React class",r,l,typeof e[l]),f=e[l](n,l,u,r,null,a)}catch(e){f=e}if(i(!f||f instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",u||"React class",r,l,typeof f),f instanceof Error&&!(f.message in s)){s[f.message]=!0;var p=c?c():"";i(!1,"Failed %s type: %s%s",r,f.message,null!=p?p:"")}}}if("production"!==t.env.NODE_ENV)var o=n(3),i=n(6),a=n(4),s={};e.exports=r}).call(t,n(1))},function(e,t,n){"use strict";var r=n(2),o=n(3),i=n(4);e.exports=function(){function e(e,t,n,r,a,s){s!==i&&o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){(function(t){"use strict";var r=n(2),o=n(3),i=n(6),a=n(10),s=n(4),u=n(11);e.exports=function(e,n){function c(e){var t=e&&(M&&e[M]||e[N]);if("function"==typeof t)return t}function l(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function f(e){this.message=e,this.stack=""}function p(e){function r(r,c,l,p,d,h,v){if(p=p||S,h=h||l,v!==s)if(n)o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var y=p+":"+l;!a[y]&&u<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",h,p),a[y]=!0,u++)}return null==c[l]?r?new f(null===c[l]?"The "+d+" `"+h+"` is marked as required "+("in `"+p+"`, but its value is `null`."):"The "+d+" `"+h+"` is marked as required in "+("`"+p+"`, but its value is `undefined`.")):null:e(c,l,p,d,h)}if("production"!==t.env.NODE_ENV)var a={},u=0;var c=r.bind(null,!1);return c.isRequired=r.bind(null,!0),c}function d(e){function t(t,n,r,o,i,a){var s=t[n],u=j(s);if(u!==e){var c=P(s);return new f("Invalid "+o+" `"+i+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return p(t)}function h(){return p(r.thatReturnsNull)}function v(e){function t(t,n,r,o,i){if("function"!=typeof e)return new f("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var a=t[n];if(!Array.isArray(a)){var u=j(a);return new f("Invalid "+o+" `"+i+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an array."))}for(var c=0;c<a.length;c++){var l=e(a,c,r,o,i+"["+c+"]",s);if(l instanceof Error)return l}return null}return p(t)}function y(){function t(t,n,r,o,i){var a=t[n];if(!e(a)){var s=j(a);return new f("Invalid "+o+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return p(t)}function m(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var a=e.name||S,s=D(t[n]);return new f("Invalid "+o+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+a+"`."))}return null}return p(t)}function b(e){function n(t,n,r,o,i){for(var a=t[n],s=0;s<e.length;s++)if(l(a,e[s]))return null;var u=JSON.stringify(e);return new f("Invalid "+o+" `"+i+"` of value `"+a+"` "+("supplied to `"+r+"`, expected one of "+u+"."))}return Array.isArray(e)?p(n):("production"!==t.env.NODE_ENV?i(!1,"Invalid argument supplied to oneOf, expected an instance of array."):void 0,r.thatReturnsNull)}function g(e){function t(t,n,r,o,i){if("function"!=typeof e)return new f("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var a=t[n],u=j(a);if("object"!==u)return new f("Invalid "+o+" `"+i+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an object."));for(var c in a)if(a.hasOwnProperty(c)){var l=e(a,c,r,o,i+"."+c,s);if(l instanceof Error)return l}return null}return p(t)}function _(e){function n(t,n,r,o,i){for(var a=0;a<e.length;a++){var u=e[a];if(null==u(t,n,r,o,i,s))return null}return new f("Invalid "+o+" `"+i+"` supplied to "+("`"+r+"`."))}if(!Array.isArray(e))return"production"!==t.env.NODE_ENV?i(!1,"Invalid argument supplied to oneOfType, expected an instance of array."):void 0,r.thatReturnsNull;for(var o=0;o<e.length;o++){var a=e[o];if("function"!=typeof a)return i(!1,"Invalid argument supplied to oneOfType. Expected an array of check functions, but received %s at index %s.",R(a),o),r.thatReturnsNull}return p(n)}function w(){function e(e,t,n,r,o){return x(e[t])?null:new f("Invalid "+r+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return p(e)}function O(e){function t(t,n,r,o,i){var a=t[n],u=j(a);if("object"!==u)return new f("Invalid "+o+" `"+i+"` of type `"+u+"` "+("supplied to `"+r+"`, expected `object`."));for(var c in e){var l=e[c];if(l){var p=l(a,c,r,o,i+"."+c,s);if(p)return p}}return null}return p(t)}function E(e){function t(t,n,r,o,i){var u=t[n],c=j(u);if("object"!==c)return new f("Invalid "+o+" `"+i+"` of type `"+c+"` "+("supplied to `"+r+"`, expected `object`."));var l=a({},t[n],e);for(var p in l){var d=e[p];if(!d)return new f("Invalid "+o+" `"+i+"` key `"+p+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var h=d(u,p,r,o,i+"."+p,s);if(h)return h}return null}return p(t)}function x(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(x);if(null===t||e(t))return!0;var n=c(t);if(!n)return!1;var r,o=n.call(t);if(n!==t.entries){for(;!(r=o.next()).done;)if(!x(r.value))return!1}else for(;!(r=o.next()).done;){var i=r.value;if(i&&!x(i[1]))return!1}return!0;default:return!1}}function T(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function j(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":T(t,e)?"symbol":t}function P(e){if("undefined"==typeof e||null===e)return""+e;var t=j(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function R(e){var t=P(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function D(e){return e.constructor&&e.constructor.name?e.constructor.name:S}var M="function"==typeof Symbol&&Symbol.iterator,N="@@iterator",S="<<anonymous>>",k={array:d("array"),bool:d("boolean"),func:d("function"),number:d("number"),object:d("object"),string:d("string"),symbol:d("symbol"),any:h(),arrayOf:v,element:y(),instanceOf:m,node:w(),objectOf:g,oneOf:b,oneOfType:_,shape:O,exact:E};return f.prototype=Error.prototype,k.checkPropTypes=u,k.PropTypes=k,k}}).call(t,n(1))},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},i=!0;e.exports=n(13)(o,i)}else e.exports=n(12)()}).call(t,n(1))},function(e,t,n){(function(t){!function(t,n){e.exports=n()}(this,function(){"use strict";function e(e){return parseFloat(e)||0}function n(t){for(var n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];return n.reduce(function(n,r){var o=t["border-"+r+"-width"];return n+e(o)},0)}function r(t){for(var n=["top","right","bottom","left"],r={},o=0,i=n;o<i.length;o+=1){var a=i[o],s=t["padding-"+a];r[a]=e(s)}return r}function o(e){var t=e.getBBox();return c(0,0,t.width,t.height)}function i(t){var o=t.clientWidth,i=t.clientHeight;if(!o&&!i)return O;var s=w(t).getComputedStyle(t),u=r(s),l=u.left+u.right,f=u.top+u.bottom,p=e(s.width),d=e(s.height);if("border-box"===s.boxSizing&&(Math.round(p+l)!==o&&(p-=n(s,"left","right")+l),Math.round(d+f)!==i&&(d-=n(s,"top","bottom")+f)),!a(t)){var h=Math.round(p+l)-o,v=Math.round(d+f)-i;1!==Math.abs(h)&&(p-=h),1!==Math.abs(v)&&(d-=v)}return c(u.left,u.top,p,d)}function a(e){return e===w(e).document.documentElement}function s(e){return f?E(e)?o(e):i(e):O}function u(e){var t=e.x,n=e.y,r=e.width,o=e.height,i="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,a=Object.create(i.prototype);return _(a,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),a}function c(e,t,n,r){return{x:e,y:t,width:n,height:r}}var l=function(){function e(e,t){var n=-1;return e.some(function(e,r){return e[0]===t&&(n=r,!0)}),n}return"undefined"!=typeof Map?Map:function(){function t(){this.__entries__=[]}var n={size:{configurable:!0}};return n.size.get=function(){return this.__entries__.length},t.prototype.get=function(t){var n=e(this.__entries__,t),r=this.__entries__[n];return r&&r[1]},t.prototype.set=function(t,n){var r=e(this.__entries__,t);~r?this.__entries__[r][1]=n:this.__entries__.push([t,n])},t.prototype.delete=function(t){var n=this.__entries__,r=e(n,t);~r&&n.splice(r,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){var n=this;void 0===t&&(t=null);for(var r=0,o=n.__entries__;r<o.length;r+=1){var i=o[r];e.call(t,i[1],i[0])}},Object.defineProperties(t.prototype,n),t}()}(),f="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,p=function(){return"undefined"!=typeof t&&t.Math===Math?t:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")()}(),d=function(){return"function"==typeof requestAnimationFrame?requestAnimationFrame.bind(p):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}}(),h=2,v=function(e,t){function n(){i&&(i=!1,e()),a&&o()}function r(){d(n)}function o(){var e=Date.now();if(i){if(e-s<h)return;a=!0}else i=!0,a=!1,setTimeout(r,t);s=e}var i=!1,a=!1,s=0;return o},y=20,m=["top","right","bottom","left","width","height","size","weight"],b="undefined"!=typeof MutationObserver,g=function(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=v(this.refresh.bind(this),y)};g.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},g.prototype.removeObserver=function(e){var t=this.observers_,n=t.indexOf(e);~n&&t.splice(n,1),!t.length&&this.connected_&&this.disconnect_()},g.prototype.refresh=function(){var e=this.updateObservers_();e&&this.refresh()},g.prototype.updateObservers_=function(){var e=this.observers_.filter(function(e){return e.gatherActive(),e.hasActive()});return e.forEach(function(e){return e.broadcastActive()}),e.length>0},g.prototype.connect_=function(){f&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),b?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},g.prototype.disconnect_=function(){f&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},g.prototype.onTransitionEnd_=function(e){var t=e.propertyName;void 0===t&&(t="");var n=m.some(function(e){return!!~t.indexOf(e)});n&&this.refresh()},g.getInstance=function(){return this.instance_||(this.instance_=new g),this.instance_},g.instance_=null;var _=function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n+=1){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e},w=function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||p},O=c(0,0,0,0),E=function(){return"undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof w(e).SVGGraphicsElement}:function(e){return e instanceof w(e).SVGElement&&"function"==typeof e.getBBox}}(),x=function(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=c(0,0,0,0),this.target=e};x.prototype.isActive=function(){var e=s(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},x.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e};var T=function(e,t){var n=u(t);_(this,{target:e,contentRect:n})},j=function(e,t,n){if(this.activeObservations_=[],this.observations_=new l,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=n};j.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof w(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new x(e)),this.controller_.addObserver(this),this.controller_.refresh())}},j.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof w(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},j.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},j.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},j.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(e){return new T(e.target,e.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},j.prototype.clearActive=function(){this.activeObservations_.splice(0)},j.prototype.hasActive=function(){return this.activeObservations_.length>0};var P="undefined"!=typeof WeakMap?new WeakMap:new l,R=function(e){if(!(this instanceof R))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var t=g.getInstance(),n=new j(e,t,this);P.set(this,n)};["observe","unobserve","disconnect"].forEach(function(e){R.prototype[e]=function(){return(t=P.get(this))[e].apply(t,arguments);var t}});var D=function(){return"undefined"!=typeof p.ResizeObserver?p.ResizeObserver:R}();return D})}).call(t,function(){return this}())},function(t,n){t.exports=e}])});