UNPKG

react-d3-speedometer

Version:

React library for showing speedometer like gauge using d3.

41 lines (40 loc) 42.9 kB
var e=Object.defineProperty,t=(t,r,n)=>((t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n)(t,'symbol'!=typeof r?r+'':r,n);import r,{PureComponent as n}from'react';import{format as o}from'd3-format';import{select as a}from'd3-selection';import{scaleLinear as i,scaleQuantize as s}from'd3-scale';import{interpolateHsl as u}from'd3-interpolate';import{rgb as c}from'd3-color';import{arc as l,line as f,curveMonotoneX as p}from'd3-shape';import{transition as d}from'd3-transition';import{easeQuadInOut as y,easeElastic as m,easeElasticInOut as g,easeElasticOut as b,easeElasticIn as v,easeBackInOut as h,easeBackOut as O,easeBackIn as S,easeBounceInOut as x,easeBounceOut as j,easeBounceIn as w,easeCircleInOut as I,easeCircleOut as C,easeCircleIn as E,easeExpInOut as $,easeExpOut as T,easeExpIn as k,easeSinInOut as R,easeSinOut as _,easeSinIn as P,easePolyInOut as A,easePolyOut as F,easePolyIn as V,easeCubicInOut as N,easeCubicOut as D,easeCubicIn as L,easeQuadOut as z,easeQuadIn as W,easeLinear as q}from'd3-ease';import{range as M}from'd3-array';function B(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,'default')?e.default:e}var U,H={exports:{}},Q={}; /** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function Y(){if(U)return Q;U=1;var e=Symbol.for('react.transitional.element'),t=Symbol.for('react.fragment');function r(t,r,n){var o=null;if(void 0!==n&&(o=''+n),void 0!==r.key&&(o=''+r.key),'key'in r)for(var a in n={},r)'key'!==a&&(n[a]=r[a]);else n=r;return r=n.ref,{$$typeof:e,type:t,key:o,ref:void 0!==r?r:null,props:n}}return Q.Fragment=t,Q.jsx=r,Q.jsxs=r,Q}var G,J,K={}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function X(){return G||(G=1,'production'!==process.env.NODE_ENV&&function(){function e(t){if(null==t)return null;if('function'==typeof t)return t.$$typeof===V?null:t.displayName||t.name||null;if('string'==typeof t)return t;switch(t){case w:return'Fragment';case j:return'Portal';case C:return'Profiler';case I:return'StrictMode';case k:return'Suspense';case R:return'SuspenseList'}if('object'==typeof t)switch(t.tag,t.$$typeof){case $:return(t.displayName||'Context')+'.Provider';case E:return(t._context.displayName||'Context')+'.Consumer';case T:var r=t.render;return(t=t.displayName)||(t=''!==(t=r.displayName||r.name||'')?'ForwardRef('+t+')':'ForwardRef'),t;case _:return null!==(r=t.displayName||null)?r:e(t.type)||'Memo';case P:r=t._payload,t=t._init;try{return e(t(r))}catch{}}return null}function t(e){return''+e}function n(e){try{t(e);var r=!1}catch{r=!0}if(r){var n=(r=console).error,o='function'==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||'Object';return n.call(r,'The provided key is an unsupported type %s. This value must be coerced to a string before using it here.',o),t(e)}}function o(){}function a(e){if(void 0===M)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);M=t&&t[1]||'',B=-1<e.stack.indexOf('\n at')?' (<anonymous>)':-1<e.stack.indexOf('@')?'@unknown:0:0':''}return'\n'+M+e+B}function i(e,t){if(!e||H)return'';var r=Q.get(e);if(void 0!==r)return r;H=!0,r=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var n;n=N.H,N.H=null,function(){if(0===q){y=console.log,m=console.info,g=console.warn,b=console.error,v=console.group,h=console.groupCollapsed,O=console.groupEnd;var e={configurable:!0,enumerable:!0,value:o,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}q++}();try{var i={DetermineComponentFrameRoot:()=>{try{if(t){var r=()=>{throw Error()};if(Object.defineProperty(r.prototype,'props',{set:()=>{throw Error()}}),'object'==typeof Reflect&&Reflect.construct){try{Reflect.construct(r,[])}catch(e){var n=e}Reflect.construct(e,[],r)}else{try{r.call()}catch(e){n=e}e.call(r.prototype)}}else{try{throw Error()}catch(e){n=e}(r=e())&&'function'==typeof r.catch&&r.catch((()=>{}))}}catch(e){if(e&&n&&'string'==typeof e.stack)return[e.stack,n.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName='DetermineComponentFrameRoot';var s=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,'name');s&&s.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,'name',{value:'DetermineComponentFrameRoot'});var u=i.DetermineComponentFrameRoot(),c=u[0],l=u[1];if(c&&l){var f=c.split('\n'),p=l.split('\n');for(u=s=0;s<f.length&&!f[s].includes('DetermineComponentFrameRoot');)s++;for(;u<p.length&&!p[u].includes('DetermineComponentFrameRoot');)u++;if(s===f.length||u===p.length)for(s=f.length-1,u=p.length-1;1<=s&&0<=u&&f[s]!==p[u];)u--;for(;1<=s&&0<=u;s--,u--)if(f[s]!==p[u]){if(1!==s||1!==u)do{if(s--,0>--u||f[s]!==p[u]){var d='\n'+f[s].replace(' at new ',' at ');return e.displayName&&d.includes('<anonymous>')&&(d=d.replace('<anonymous>',e.displayName)),'function'==typeof e&&Q.set(e,d),d}}while(1<=s&&0<=u);break}}}finally{H=!1,N.H=n,function(){if(0==--q){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},e,{value:y}),info:L({},e,{value:m}),warn:L({},e,{value:g}),error:L({},e,{value:b}),group:L({},e,{value:v}),groupCollapsed:L({},e,{value:h}),groupEnd:L({},e,{value:O})})}}(),Error.prepareStackTrace=r}return f=(f=e?e.displayName||e.name:'')?a(f):'','function'==typeof e&&Q.set(e,f),f}function s(e){if(null==e)return'';if('function'==typeof e){var t=e.prototype;return i(e,!(!t||!t.isReactComponent))}if('string'==typeof e)return a(e);switch(e){case k:return a('Suspense');case R:return a('SuspenseList')}if('object'==typeof e)switch(e.$$typeof){case T:return e=i(e.render,!1);case _:return s(e.type);case P:t=e._payload,e=e._init;try{return s(e(t))}catch{}}return''}function u(){var e=N.A;return null===e?null:e.getOwner()}function c(){var t=e(this.type);return G[t]||(G[t]=!0),void 0!==(t=this.props.ref)?t:null}function l(t,r,o,a,i,s){if('string'==typeof t||'function'==typeof t||t===w||t===C||t===I||t===k||t===R||t===A||'object'==typeof t&&null!==t&&(t.$$typeof===P||t.$$typeof===_||t.$$typeof===$||t.$$typeof===E||t.$$typeof===T||t.$$typeof===z||void 0!==t.getModuleId)){var l=r.children;if(void 0!==l)if(a){if(W(l)){for(a=0;a<l.length;a++)f(l[a],t);Object.freeze&&Object.freeze(l)}}else f(l,t)}else l='',(void 0===t||'object'==typeof t&&null!==t&&0===Object.keys(t).length)&&(l+=' You likely forgot to export your component from the file it\'s defined in, or you might have mixed up default and named imports.'),null===t?a='null':W(t)?a='array':void 0!==t&&t.$$typeof===x?(a='<'+(e(t.type)||'Unknown')+' />',l=' Did you accidentally export a JSX literal instead of a component?'):a=typeof t;if(D.call(r,'key')){l=e(t);var p=Object.keys(r).filter((e=>'key'!==e));a=0<p.length?'{key: someKey, '+p.join(': ..., ')+': ...}':'{key: someKey}',J[l+a]||(p=0<p.length?'{'+p.join(': ..., ')+': ...}':'{}',J[l+a]=!0)}if(l=null,void 0!==o&&(n(o),l=''+o),function(e){if(D.call(e,'key')){var t=Object.getOwnPropertyDescriptor(e,'key').get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(r)&&(n(r.key),l=''+r.key),'key'in r)for(var d in o={},r)'key'!==d&&(o[d]=r[d]);else o=r;return l&&function(e){function t(){U||(U=!0)}t.isReactWarning=!0,Object.defineProperty(e,'key',{get:t,configurable:!0})}(o,'function'==typeof t&&(t.displayName||t.name)),function(e,t,r,n,o,a){return r=a.ref,e={$$typeof:x,type:e,key:t,props:a,_owner:o},null!==(void 0!==r?r:null)?Object.defineProperty(e,'ref',{enumerable:!1,get:c}):Object.defineProperty(e,'ref',{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,'validated',{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,'_debugInfo',{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(t,l,s,0,u(),o)}function f(e,t){if('object'==typeof e&&e&&e.$$typeof!==Y)if(W(e))for(var r=0;r<e.length;r++){var n=e[r];p(n)&&d(n,t)}else if(p(e))e._store&&(e._store.validated=1);else if(null===e||'object'!=typeof e?r=null:r='function'==typeof(r=F&&e[F]||e['@@iterator'])?r:null,'function'==typeof r&&r!==e.entries&&(r=r.call(e))!==e)for(;!(e=r.next()).done;)p(e.value)&&d(e.value,t)}function p(e){return'object'==typeof e&&null!==e&&e.$$typeof===x}function d(t,r){if(t._store&&!t._store.validated&&null==t.key&&(t._store.validated=1,r=function(t){var r='',n=u();return n&&(n=e(n.type))&&(r='\n\nCheck the render method of `'+n+'`.'),r||(t=e(t))&&(r='\n\nCheck the top-level render call using <'+t+'>.'),r}(r),!X[r])){X[r]=!0;var n='';t&&null!=t._owner&&t._owner!==u()&&(n=null,'number'==typeof t._owner.tag?n=e(t._owner.type):'string'==typeof t._owner.name&&(n=t._owner.name),n=' It was passed a child from '+n+'.');var o=N.getCurrentStack;N.getCurrentStack=()=>{var e=s(t.type);return o&&(e+=o()||''),e},N.getCurrentStack=o}}var y,m,g,b,v,h,O,S=r,x=Symbol.for('react.transitional.element'),j=Symbol.for('react.portal'),w=Symbol.for('react.fragment'),I=Symbol.for('react.strict_mode'),C=Symbol.for('react.profiler'),E=Symbol.for('react.consumer'),$=Symbol.for('react.context'),T=Symbol.for('react.forward_ref'),k=Symbol.for('react.suspense'),R=Symbol.for('react.suspense_list'),_=Symbol.for('react.memo'),P=Symbol.for('react.lazy'),A=Symbol.for('react.offscreen'),F=Symbol.iterator,V=Symbol.for('react.client.reference'),N=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,D=Object.prototype.hasOwnProperty,L=Object.assign,z=Symbol.for('react.client.reference'),W=Array.isArray,q=0;o.__reactDisabledLog=!0;var M,B,U,H=!1,Q=new('function'==typeof WeakMap?WeakMap:Map),Y=Symbol.for('react.client.reference'),G={},J={},X={};K.Fragment=w,K.jsx=(e,t,r,n,o)=>l(e,t,r,!1,0,o),K.jsxs=(e,t,r,n,o)=>l(e,t,r,!0,0,o)}()),K}function Z(){return J||(J=1,'production'===process.env.NODE_ENV?H.exports=Y():H.exports=X()),H.exports}var ee,te=Z(),re={exports:{}},ne={exports:{}},oe={}; /** @license React v16.13.1 * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function ae(){if(ee)return oe;ee=1;var e='function'==typeof Symbol&&Symbol.for,t=e?Symbol.for('react.element'):60103,r=e?Symbol.for('react.portal'):60106,n=e?Symbol.for('react.fragment'):60107,o=e?Symbol.for('react.strict_mode'):60108,a=e?Symbol.for('react.profiler'):60114,i=e?Symbol.for('react.provider'):60109,s=e?Symbol.for('react.context'):60110,u=e?Symbol.for('react.async_mode'):60111,c=e?Symbol.for('react.concurrent_mode'):60111,l=e?Symbol.for('react.forward_ref'):60112,f=e?Symbol.for('react.suspense'):60113,p=e?Symbol.for('react.suspense_list'):60120,d=e?Symbol.for('react.memo'):60115,y=e?Symbol.for('react.lazy'):60116,m=e?Symbol.for('react.block'):60121,g=e?Symbol.for('react.fundamental'):60117,b=e?Symbol.for('react.responder'):60118,v=e?Symbol.for('react.scope'):60119;function h(e){if('object'==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:switch(e=e.type){case u:case c:case n:case a:case o:case f:return e;default:switch(e=e&&e.$$typeof){case s:case l:case y:case d:case i:return e;default:return p}}case r:return p}}}function O(e){return h(e)===c}return oe.AsyncMode=u,oe.ConcurrentMode=c,oe.ContextConsumer=s,oe.ContextProvider=i,oe.Element=t,oe.ForwardRef=l,oe.Fragment=n,oe.Lazy=y,oe.Memo=d,oe.Portal=r,oe.Profiler=a,oe.StrictMode=o,oe.Suspense=f,oe.isAsyncMode=e=>O(e)||h(e)===u,oe.isConcurrentMode=O,oe.isContextConsumer=e=>h(e)===s,oe.isContextProvider=e=>h(e)===i,oe.isElement=e=>'object'==typeof e&&null!==e&&e.$$typeof===t,oe.isForwardRef=e=>h(e)===l,oe.isFragment=e=>h(e)===n,oe.isLazy=e=>h(e)===y,oe.isMemo=e=>h(e)===d,oe.isPortal=e=>h(e)===r,oe.isProfiler=e=>h(e)===a,oe.isStrictMode=e=>h(e)===o,oe.isSuspense=e=>h(e)===f,oe.isValidElementType=e=>'string'==typeof e||'function'==typeof e||e===n||e===c||e===a||e===o||e===f||e===p||'object'==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===i||e.$$typeof===s||e.$$typeof===l||e.$$typeof===g||e.$$typeof===b||e.$$typeof===v||e.$$typeof===m),oe.typeOf=h,oe}var ie,se,ue,ce,le,fe,pe,de,ye,me,ge,be,ve,he,Oe,Se={}; /** @license React v16.13.1 * react-is.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */function xe(){return ie||(ie=1,'production'!==process.env.NODE_ENV&&(()=>{var e='function'==typeof Symbol&&Symbol.for,t=e?Symbol.for('react.element'):60103,r=e?Symbol.for('react.portal'):60106,n=e?Symbol.for('react.fragment'):60107,o=e?Symbol.for('react.strict_mode'):60108,a=e?Symbol.for('react.profiler'):60114,i=e?Symbol.for('react.provider'):60109,s=e?Symbol.for('react.context'):60110,u=e?Symbol.for('react.async_mode'):60111,c=e?Symbol.for('react.concurrent_mode'):60111,l=e?Symbol.for('react.forward_ref'):60112,f=e?Symbol.for('react.suspense'):60113,p=e?Symbol.for('react.suspense_list'):60120,d=e?Symbol.for('react.memo'):60115,y=e?Symbol.for('react.lazy'):60116,m=e?Symbol.for('react.block'):60121,g=e?Symbol.for('react.fundamental'):60117,b=e?Symbol.for('react.responder'):60118,v=e?Symbol.for('react.scope'):60119;function h(e){if('object'==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:var m=e.type;switch(m){case u:case c:case n:case a:case o:case f:return m;default:var g=m&&m.$$typeof;switch(g){case s:case l:case y:case d:case i:return g;default:return p}}case r:return p}}}var O=u,S=c,x=s,j=i,w=t,I=l,C=n,E=y,$=d,T=r,k=a,R=o,_=f,P=!1;function A(e){return h(e)===c}Se.AsyncMode=O,Se.ConcurrentMode=S,Se.ContextConsumer=x,Se.ContextProvider=j,Se.Element=w,Se.ForwardRef=I,Se.Fragment=C,Se.Lazy=E,Se.Memo=$,Se.Portal=T,Se.Profiler=k,Se.StrictMode=R,Se.Suspense=_,Se.isAsyncMode=function(e){return P||(P=!0),A(e)||h(e)===u},Se.isConcurrentMode=A,Se.isContextConsumer=function(e){return h(e)===s},Se.isContextProvider=function(e){return h(e)===i},Se.isElement=function(e){return'object'==typeof e&&null!==e&&e.$$typeof===t},Se.isForwardRef=function(e){return h(e)===l},Se.isFragment=function(e){return h(e)===n},Se.isLazy=function(e){return h(e)===y},Se.isMemo=function(e){return h(e)===d},Se.isPortal=function(e){return h(e)===r},Se.isProfiler=function(e){return h(e)===a},Se.isStrictMode=function(e){return h(e)===o},Se.isSuspense=function(e){return h(e)===f},Se.isValidElementType=function(e){return'string'==typeof e||'function'==typeof e||e===n||e===c||e===a||e===o||e===f||e===p||'object'==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===i||e.$$typeof===s||e.$$typeof===l||e.$$typeof===g||e.$$typeof===b||e.$$typeof===v||e.$$typeof===m)},Se.typeOf=h})()),Se}function je(){return se||(se=1,'production'===process.env.NODE_ENV?ne.exports=ae():ne.exports=xe()),ne.exports /* object-assign (c) Sindre Sorhus @license MIT */}function we(){if(ce)return ue;ce=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return ue=function(){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={},r=0;r<10;r++)t['_'+String.fromCharCode(r)]=r;if('0123456789'!==Object.getOwnPropertyNames(t).map((e=>t[e])).join(''))return!1;var n={};return'abcdefghijklmnopqrst'.split('').forEach((e=>{n[e]=e})),'abcdefghijklmnopqrst'===Object.keys(Object.assign({},n)).join('')}catch{return!1}}()?Object.assign:function(n,o){for(var a,i,s=function(e){if(null==e)throw new TypeError('Object.assign cannot be called with null or undefined');return Object(e)}(n),u=1;u<arguments.length;u++){for(var c in a=Object(arguments[u]))t.call(a,c)&&(s[c]=a[c]);if(e){i=e(a);for(var l=0;l<i.length;l++)r.call(a,i[l])&&(s[i[l]]=a[i[l]])}}return s},ue}function Ie(){if(fe)return le;fe=1;return le='SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'}function Ce(){return de||(de=1,pe=Function.call.bind(Object.prototype.hasOwnProperty)),pe}function Ee(){if(me)return ye;me=1;var e=()=>{};if('production'!==process.env.NODE_ENV){var t=Ie(),r={},n=Ce();e=e=>{var t='Warning: '+e;try{throw new Error(t)}catch{}}}function o(o,a,i,s,u){if('production'!==process.env.NODE_ENV)for(var c in o)if(n(o,c)){var l;try{if('function'!=typeof o[c]){var f=Error((s||'React class')+': '+i+' type `'+c+'` is invalid; it must be a function, usually from the `prop-types` package, but received `'+typeof o[c]+'`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');throw f.name='Invariant Violation',f}l=o[c](a,c,s,i,null,t)}catch(e){l=e}if(l&&!(l instanceof Error)&&e((s||'React class')+': type specification of '+i+' `'+c+'` is invalid; the type checker function must return `null` or an `Error` but returned a '+typeof l+'. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).'),l instanceof Error&&!(l.message in r)){r[l.message]=!0;var p=u?u():'';e('Failed '+i+' type: '+l.message+(p??''))}}}return o.resetWarningCache=()=>{'production'!==process.env.NODE_ENV&&(r={})},ye=o}function $e(){if(be)return ge;be=1;var e=je(),t=we(),r=Ie(),n=Ce(),o=Ee(),a=()=>{};function i(){return null}return'production'!==process.env.NODE_ENV&&(a=e=>{var t='Warning: '+e;try{throw new Error(t)}catch{}}),ge=function(s,u){var c='function'==typeof Symbol&&Symbol.iterator;var l='<<anonymous>>',f={array:m('array'),bigint:m('bigint'),bool:m('boolean'),func:m('function'),number:m('number'),object:m('object'),string:m('string'),symbol:m('symbol'),any:y(i),arrayOf:function(e){return y((function(t,n,o,a,i){if('function'!=typeof e)return new d('Property `'+i+'` of component `'+o+'` has invalid PropType notation inside arrayOf.');var s=t[n];if(!Array.isArray(s))return new d('Invalid '+a+' `'+i+'` of type `'+v(s)+'` supplied to `'+o+'`, expected an array.');for(var u=0;u<s.length;u++){var c=e(s,u,o,a,i+'['+u+']',r);if(c instanceof Error)return c}return null}))},element:y(((e,t,r,n,o)=>{var a=e[t];return s(a)?null:new d('Invalid '+n+' `'+o+'` of type `'+v(a)+'` supplied to `'+r+'`, expected a single ReactElement.')})),elementType:y(((t,r,n,o,a)=>{var i=t[r];return e.isValidElementType(i)?null:new d('Invalid '+o+' `'+a+'` of type `'+v(i)+'` supplied to `'+n+'`, expected a single ReactElement type.')})),instanceOf:function(e){return y((function(t,r,n,o,a){if(!(t[r]instanceof e)){var i=e.name||l,s=(e=>e.constructor&&e.constructor.name?e.constructor.name:l)(t[r]);return new d('Invalid '+o+' `'+a+'` of type `'+s+'` supplied to `'+n+'`, expected instance of `'+i+'`.')}return null}))},node:y(((e,t,r,n,o)=>b(e[t])?null:new d('Invalid '+n+' `'+o+'` supplied to `'+r+'`, expected a ReactNode.'))),objectOf:function(e){return y((function(t,o,a,i,s){if('function'!=typeof e)return new d('Property `'+s+'` of component `'+a+'` has invalid PropType notation inside objectOf.');var u=t[o],c=v(u);if('object'!==c)return new d('Invalid '+i+' `'+s+'` of type `'+c+'` supplied to `'+a+'`, expected an object.');for(var l in u)if(n(u,l)){var f=e(u,l,a,i,s+'.'+l,r);if(f instanceof Error)return f}return null}))},oneOf:function(e){if(!Array.isArray(e))return'production'!==process.env.NODE_ENV&&a(arguments.length>1?'Invalid arguments supplied to oneOf, expected an array, got '+arguments.length+' arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).':'Invalid argument supplied to oneOf, expected an array.'),i;return y((function(t,r,n,o,a){for(var i=t[r],s=0;s<e.length;s++)if(p(i,e[s]))return null;var u=JSON.stringify(e,((e,t)=>'symbol'===h(t)?String(t):t));return new d('Invalid '+o+' `'+a+'` of value `'+String(i)+'` supplied to `'+n+'`, expected one of '+u+'.')}))},oneOfType:function(e){if(!Array.isArray(e))return'production'!==process.env.NODE_ENV&&a('Invalid argument supplied to oneOfType, expected an instance of array.'),i;for(var t=0;t<e.length;t++){var o=e[t];if('function'!=typeof o)return a('Invalid argument supplied to oneOfType. Expected an array of check functions, but received '+O(o)+' at index '+t+'.'),i}return y((function(t,o,a,i,s){for(var u=[],c=0;c<e.length;c++){var l=(0,e[c])(t,o,a,i,s,r);if(null==l)return null;l.data&&n(l.data,'expectedType')&&u.push(l.data.expectedType)}return new d('Invalid '+i+' `'+s+'` supplied to `'+a+'`'+(u.length>0?', expected one of type ['+u.join(', ')+']':'')+'.')}))},shape:function(e){return y((function(t,n,o,a,i){var s=t[n],u=v(s);if('object'!==u)return new d('Invalid '+a+' `'+i+'` of type `'+u+'` supplied to `'+o+'`, expected `object`.');for(var c in e){var l=e[c];if('function'!=typeof l)return g(o,a,i,c,h(l));var f=l(s,c,o,a,i+'.'+c,r);if(f)return f}return null}))},exact:function(e){return y((function(o,a,i,s,u){var c=o[a],l=v(c);if('object'!==l)return new d('Invalid '+s+' `'+u+'` of type `'+l+'` supplied to `'+i+'`, expected `object`.');var f=t({},o[a],e);for(var p in f){var y=e[p];if(n(e,p)&&'function'!=typeof y)return g(i,s,u,p,h(y));if(!y)return new d('Invalid '+s+' `'+u+'` key `'+p+'` supplied to `'+i+'`.\nBad object: '+JSON.stringify(o[a],null,' ')+'\nValid keys: '+JSON.stringify(Object.keys(e),null,' '));var m=y(c,p,i,s,u+'.'+p,r);if(m)return m}return null}))}};function p(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function d(e,t){this.message=e,this.data=t&&'object'==typeof t?t:{},this.stack=''}function y(e){if('production'!==process.env.NODE_ENV)var t={},n=0;function o(o,i,s,c,f,p,y){if(c=c||l,p=p||s,y!==r){if(u){var m=new Error('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');throw m.name='Invariant Violation',m}if('production'!==process.env.NODE_ENV&&typeof console<'u'){var g=c+':'+s;!t[g]&&n<3&&(a('You are manually calling a React.PropTypes validation function for the `'+p+'` prop on `'+c+'`. 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.'),t[g]=!0,n++)}}return null==i[s]?o?null===i[s]?new d('The '+f+' `'+p+'` is marked as required in `'+c+'`, but its value is `null`.'):new d('The '+f+' `'+p+'` is marked as required in `'+c+'`, but its value is `undefined`.'):null:e(i,s,c,f,p)}var i=o.bind(null,!1);return i.isRequired=o.bind(null,!0),i}function m(e){return y((function(t,r,n,o,a,i){var s=t[r];return v(s)!==e?new d('Invalid '+o+' `'+a+'` of type `'+h(s)+'` supplied to `'+n+'`, expected `'+e+'`.',{expectedType:e}):null}))}function g(e,t,r,n,o){return new d((e||'React class')+': '+t+' type `'+r+'.'+n+'` is invalid; it must be a function, usually from the `prop-types` package, but received `'+o+'`.')}function b(e){switch(typeof e){case'number':case'string':case'undefined':return!0;case'boolean':return!e;case'object':if(Array.isArray(e))return e.every(b);if(null===e||s(e))return!0;var t=function(e){var t=e&&(c&&e[c]||e['@@iterator']);if('function'==typeof t)return t}(e);if(!t)return!1;var r,n=t.call(e);if(t!==e.entries){for(;!(r=n.next()).done;)if(!b(r.value))return!1}else for(;!(r=n.next()).done;){var o=r.value;if(o&&!b(o[1]))return!1}return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?'array':e instanceof RegExp?'object':function(e,t){return'symbol'===e||!!t&&('Symbol'===t['@@toStringTag']||'function'==typeof Symbol&&t instanceof Symbol)}(t,e)?'symbol':t}function h(e){if(typeof e>'u'||null===e)return''+e;var t=v(e);if('object'===t){if(e instanceof Date)return'date';if(e instanceof RegExp)return'regexp'}return t}function O(e){var t=h(e);switch(t){case'array':case'object':return'an '+t;case'boolean':case'date':case'regexp':return'a '+t;default:return t}}return d.prototype=Error.prototype,f.checkPropTypes=o,f.resetWarningCache=o.resetWarningCache,f.PropTypes=f,f},ge}function Te(){if(he)return ve;he=1;var e=Ie();function t(){}function r(){}return r.resetWarningCache=t,ve=()=>{function n(t,r,n,o,a,i){if(i!==e){var s=new Error('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');throw s.name='Invariant Violation',s}}function o(){return n}n.isRequired=n;var a={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:o,element:n,elementType:n,instanceOf:o,node:n,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:t};return a.PropTypes=a,a}}function ke(){if(Oe)return re.exports;if(Oe=1,'production'!==process.env.NODE_ENV){var e=je();re.exports=$e()(e.isElement,true)}else re.exports=Te()();return re.exports}const Re=B(ke());var _e='object'==typeof global&&global&&global.Object===Object&&global,Pe='object'==typeof self&&self&&self.Object===Object&&self,Ae=_e||Pe||Function('return this')(),Fe=Ae.Symbol,Ve=Object.prototype,Ne=Ve.hasOwnProperty,De=Ve.toString,Le=Fe?Fe.toStringTag:void 0;var ze=Object.prototype.toString;var We=Fe?Fe.toStringTag:void 0;function qe(e){return null==e?void 0===e?'[object Undefined]':'[object Null]':We&&We in Object(e)?function(e){var t=Ne.call(e,Le),r=e[Le];try{e[Le]=void 0;var n=!0}catch{}var o=De.call(e);return n&&(t?e[Le]=r:delete e[Le]),o}(e):function(e){return ze.call(e)}(e)}function Me(e){return null!=e&&'object'==typeof e}function Be(e){return e}var Ue=Object.prototype;function He(e){var t=e&&e.constructor;return e===('function'==typeof t&&t.prototype||Ue)}var Qe,Ye,Ge=(Qe=Object.keys,Ye=Object,e=>Qe(Ye(e))),Je=Object.prototype.hasOwnProperty;function Ke(e){var t=typeof e;return null!=e&&('object'==t||'function'==t)}function Xe(e){if(!Ke(e))return!1;var t=qe(e);return'[object Function]'==t||'[object GeneratorFunction]'==t||'[object AsyncFunction]'==t||'[object Proxy]'==t}var Ze=Ae['__core-js_shared__'],et=(()=>{var e=/[^.]+$/.exec(Ze&&Ze.keys&&Ze.keys.IE_PROTO||'');return e?'Symbol(src)_1.'+e:''})();var tt=Function.prototype.toString;function rt(e){if(null!=e){try{return tt.call(e)}catch{}try{return e+''}catch{}}return''}var nt=/^\[object .+?Constructor\]$/,ot=Function.prototype,at=Object.prototype,it=ot.toString,st=at.hasOwnProperty,ut=RegExp('^'+it.call(st).replace(/[\\^$.*+?()[\]{}|]/g,'\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,'$1.*?')+'$');function ct(e){return!(!Ke(e)||function(e){return!!et&&et in e}(e))&&(Xe(e)?ut:nt).test(rt(e))}function lt(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return ct(r)?r:void 0}var ft=lt(Ae,'DataView'),pt=lt(Ae,'Map'),dt=lt(Ae,'Promise'),yt=lt(Ae,'Set'),mt=lt(Ae,'WeakMap'),gt='[object Map]',bt='[object Promise]',vt='[object Set]',ht='[object WeakMap]',Ot='[object DataView]',St=rt(ft),xt=rt(pt),jt=rt(dt),wt=rt(yt),It=rt(mt),Ct=qe;(ft&&Ct(new ft(new ArrayBuffer(1)))!=Ot||pt&&Ct(new pt)!=gt||dt&&Ct(dt.resolve())!=bt||yt&&Ct(new yt)!=vt||mt&&Ct(new mt)!=ht)&&(Ct=e=>{var t=qe(e),r='[object Object]'==t?e.constructor:void 0,n=r?rt(r):'';if(n)switch(n){case St:return Ot;case xt:return gt;case jt:return bt;case wt:return vt;case It:return ht}return t});function Et(e){return Me(e)&&'[object Arguments]'==qe(e)}var $t=Object.prototype,Tt=$t.hasOwnProperty,kt=$t.propertyIsEnumerable,Rt=Et(function(){return arguments}())?Et:e=>Me(e)&&Tt.call(e,'callee')&&!kt.call(e,'callee'),_t=Array.isArray;function Pt(e){return'number'==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}var At='object'==typeof exports&&exports&&!exports.nodeType&&exports,Ft=At&&'object'==typeof module&&module&&!module.nodeType&&module,Vt=Ft&&Ft.exports===At?Ae.Buffer:void 0,Nt=(Vt?Vt.isBuffer:void 0)||function(){return!1},Dt={};Dt['[object Float32Array]']=Dt['[object Float64Array]']=Dt['[object Int8Array]']=Dt['[object Int16Array]']=Dt['[object Int32Array]']=Dt['[object Uint8Array]']=Dt['[object Uint8ClampedArray]']=Dt['[object Uint16Array]']=Dt['[object Uint32Array]']=!0,Dt['[object Arguments]']=Dt['[object Array]']=Dt['[object ArrayBuffer]']=Dt['[object Boolean]']=Dt['[object DataView]']=Dt['[object Date]']=Dt['[object Error]']=Dt['[object Function]']=Dt['[object Map]']=Dt['[object Number]']=Dt['[object Object]']=Dt['[object RegExp]']=Dt['[object Set]']=Dt['[object String]']=Dt['[object WeakMap]']=!1;var Lt='object'==typeof exports&&exports&&!exports.nodeType&&exports,zt=Lt&&'object'==typeof module&&module&&!module.nodeType&&module,Wt=zt&&zt.exports===Lt&&_e.process,qt=(()=>{try{return zt&&zt.require&&zt.require('util').types||Wt&&Wt.binding&&Wt.binding('util')}catch{}})(),Mt=qt&&qt.isTypedArray,Bt=Mt?function(e){return t=>e(t)}(Mt):function(e){return Me(e)&&Pt(e.length)&&!!Dt[qe(e)]},Ut=Object.prototype.hasOwnProperty;function Ht(e){if(null==e)return!0;if(function(e){return null!=e&&Pt(e.length)&&!Xe(e)}(e)&&(_t(e)||'string'==typeof e||'function'==typeof e.splice||Nt(e)||Bt(e)||Rt(e)))return!e.length;var t=Ct(e);if('[object Map]'==t||'[object Set]'==t)return!e.size;if(He(e))return!function(e){if(!He(e))return Ge(e);var t=[];for(var r in Object(e))Je.call(e,r)&&'constructor'!=r&&t.push(r);return t}(e).length;for(var r in e)if(Ut.call(e,r))return!1;return!0}function Qt(e){var t=null==e?0:e.length;return t?e[t-1]:void 0}function Yt(e,t,r){var n=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(o);++n<o;)a[n]=e[n+t];return a}var Gt=/\s/;var Jt=/^\s+/;function Kt(e){return e&&e.slice(0,function(e){for(var t=e.length;t--&&Gt.test(e.charAt(t)););return t}(e)+1).replace(Jt,'')}var Xt=/^[-+]0x[0-9a-f]+$/i,Zt=/^0b[01]+$/i,er=/^0o[0-7]+$/i,tr=parseInt;function rr(e){if('number'==typeof e)return e;if(function(e){return'symbol'==typeof e||Me(e)&&'[object Symbol]'==qe(e)}(e))return NaN;if(Ke(e)){var t='function'==typeof e.valueOf?e.valueOf():e;e=Ke(t)?t+'':t}if('string'!=typeof e)return 0===e?e:+e;e=Kt(e);var r=Zt.test(e);return r||er.test(e)?tr(e.slice(2),r?2:8):Xt.test(e)?NaN:+e}var nr=1/0;function or(e){var t=function(e){return e?(e=rr(e))===nr||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}(e),r=t%1;return t==t?r?t-r:t:0}var ar=4294967295,ir=Math.min;function sr(e,t){if((e=or(e))<1||e>9007199254740991)return[];var r=ar,n=ir(e,ar);t=function(e){return'function'==typeof e?e:Be}(t),e-=ar;for(var o=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(n,t);++r<e;)t(r);return o}function ur(e,t){return function(e){return e&&e.length?((e,t)=>{for(var r,n=-1,o=e.length;++n<o;){var a=t(e[n]);void 0!==a&&(r=void 0===r?a:r+a)}return r})(e,Be):0}(function(e,t){return e&&e.length?Yt(e,0,(t=void 0===t?1:or(t))<0?0:t):[]}(e,t))}function cr({tickData:e,customSegmentStops:t,min:r,max:n}){if(!_t(t)||Ht(t))return e;if(function(e){return e&&e.length?e[0]:void 0}(t)!==r)throw new Error(`First value should be equivalent to min value given. Current min value - ${r}`);if(Qt(t)!==n)throw new Error(`Last value should be equivalent to max value given. Current min value - ${n}`);return function(e,t){var r=null==e?0:e.length;return r?Yt(e,(t=void 0===t?1:or(t))<0?0:t,r):[]}(t.map(((e,o)=>{if(0!==o)return(e-t[o-1])/(n-r)})))}function lr({maxSegmentLabelCount:e,segmentCount:t}){const r=parseInt(e,10),n=parseInt(t,10);return function(e){return'number'==typeof e||Me(e)&&'[object Number]'==qe(e)}(r)&&r>=0&&r<=n?r:n}function fr(e){return e*Math.PI/180}const pr={Inside:'INSIDE',Outside:'OUTSIDE'},dr={easeLinear:'easeLinear',easeQuadIn:'easeQuadIn',easeQuadOut:'easeQuadOut',easeQuadInOut:'easeQuadInOut',easeCubicIn:'easeCubicIn',easeCubicOut:'easeCubicOut',easeCubicInOut:'easeCubicInOut',easePolyIn:'easePolyIn',easePolyOut:'easePolyOut',easePolyInOut:'easePolyInOut',easeSinIn:'easeSinIn',easeSinOut:'easeSinOut',easeSinInOut:'easeSinInOut',easeExpIn:'easeExpIn',easeExpOut:'easeExpOut',easeExpInOut:'easeExpInOut',easeCircleIn:'easeCircleIn',easeCircleOut:'easeCircleOut',easeCircleInOut:'easeCircleInOut',easeBounceIn:'easeBounceIn',easeBounceOut:'easeBounceOut',easeBounceInOut:'easeBounceInOut',easeBackIn:'easeBackIn',easeBackOut:'easeBackOut',easeBackInOut:'easeBackInOut',easeElasticIn:'easeElasticIn',easeElasticOut:'easeElasticOut',easeElasticInOut:'easeElasticInOut',easeElastic:'easeElastic'},yr=e=>e,mr={value:0,minValue:0,maxValue:1e3,forceRender:!1,width:300,height:300,paddingHorizontal:0,paddingVertical:0,fluidWidth:!1,dimensionUnit:'px',segments:5,maxSegmentLabels:-1,customSegmentStops:[],customSegmentLabels:[],needleColor:'steelblue',startColor:'#FF471A',endColor:'#33CC33',segmentColors:[],needleTransition:dr.easeQuadInOut,needleTransitionDuration:500,needleHeightRatio:.9,ringWidth:60,textColor:'#666',valueFormat:'',segmentValueFormatter:yr,currentValueText:'${value}',currentValuePlaceholderStyle:'${value}',labelFontSize:'14px',valueTextFontSize:'16px',valueTextFontWeight:'bold',svgAriaLabel:'React d3 speedometer'},gr={ringInset:20,pointerWidth:10,pointerTailLength:5,minAngle:-90,maxAngle:90,labelInset:10};function br(e){switch(e){case dr.easeLinear:return q;case dr.easeQuadIn:return W;case dr.easeQuadOut:return z;case dr.easeQuadInOut:return y;case dr.easeCubicIn:return L;case dr.easeCubicOut:return D;case dr.easeCubicInOut:return N;case dr.easePolyIn:return V;case dr.easePolyOut:return F;case dr.easePolyInOut:return A;case dr.easeSinIn:return P;case dr.easeSinOut:return _;case dr.easeSinInOut:return R;case dr.easeExpIn:return k;case dr.easeExpOut:return T;case dr.easeExpInOut:return $;case dr.easeCircleIn:return E;case dr.easeCircleOut:return C;case dr.easeCircleInOut:return I;case dr.easeBounceIn:return w;case dr.easeBounceOut:return j;case dr.easeBounceInOut:return x;case dr.easeBackIn:return S;case dr.easeBackOut:return O;case dr.easeBackInOut:return h;case dr.easeElasticIn:return v;case dr.easeElasticOut:return b;case dr.easeElasticInOut:return g;case dr.easeElastic:return m;default:return y}}var vr=Number.isNaN||(e=>'number'==typeof e&&e!=e);function hr(e,t){return!!(e===t||vr(e)&&vr(t))}function Or(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!hr(e[r],t[r]))return!1;return!0}function Sr(e,t){void 0===t&&(t=Or);var r=null;function n(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];if(r&&r.lastThis===this&&t(n,r.lastArgs))return r.lastResult;var a=e.apply(this,n);return r={lastResult:a,lastArgs:n,lastThis:this},a}return n.clear=()=>{r=null},n}const xr=Sr((function(e){return function({min:e,max:t,segments:r}){return i().range([0,1]).domain([e,t])}({min:e.minValue,max:e.maxValue,segments:e.maxSegmentLabels})})),jr=Sr((function(e){const t=xr(e);let r=function(e,{min:t,max:r,segments:n}){let o=[];if(o=e.ticks(n),(Qt(o)!==r||n<o.length)&&o.length>1){const e=(r-t)/n;o=[t],sr(n,(r=>{o.push(t+(r+1)*e)}))}return 1===o.length&&(o=[t,r]),o}(t,{min:e.minValue,max:e.maxValue,segments:e.maxSegmentLabels});return e.customSegmentStops.length>0&&0!==e.maxSegmentLabels&&(r=e.customSegmentStops),r})),wr=Sr((function(e){const t=M(e.majorTicks).map((t=>1/e.majorTicks));return cr({tickData:t,customSegmentStops:e.customSegmentStops,min:e.minValue,max:e.maxValue})})),Ir=Sr((function(e){const t=wr(e),r=e.maxAngle-e.minAngle,n=e.width/2;return l().innerRadius(n-e.ringWidth-e.ringInset).outerRadius(n-e.ringInset).startAngle(((n,o)=>{const a=ur(t,o);return fr(e.minAngle+a*r)})).endAngle(((n,o)=>{const a=ur(t,o+1);return fr(e.minAngle+a*r)}))}));const Cr=({d3_refs:e,newValue:t,config:r})=>{const n=xr(r)(t),o=r.maxAngle-r.minAngle,a=r.minAngle+n*o;e.pointer.transition(function({duration:e,ease:t}){return d().duration(e).ease(t)}({duration:r.needleTransitionDuration,ease:br(r.needleTransition)})).attr('transform',`rotate(${a})`),e.current_value_text.text(function(e,t){const r=t.labelFormat(e),n=t.currentValuePlaceholderStyle;return t.currentValueText.replace(n,r)}(t,r))},Er=({container:e,config:t})=>{const r=function(e){return e.width/2}(t),n=function(e,t,r){return`translate(${e+t}, ${e+r})`}(r,t.paddingHorizontal,t.paddingVertical),o=function({container:e,config:t}){const r=t.width+2*t.paddingHorizontal,n=t.height+2*t.paddingVertical;return a(e).append('svg:svg').attr('class','speedometer').attr('width',`${r}${t.dimensionUnit}`).attr('height',`${n}${t.dimensionUnit}`).attr('role','img').attr('focusable','false').attr('aria-label',t.svgAriaLabel).style('width',`${r}${t.dimensionUnit}`).style('height',`${n}${t.dimensionUnit}`)}({container:e,config:t});return function({config:e,svg:t,centerTx:r}){const n=wr(e),o=Ir(e);t.append('g').attr('class','arc').attr('transform',r).selectAll('path').data(n).enter().append('path').attr('class','speedo-segment').attr('fill',((t,r)=>!Ht(e.segmentColors)&&e.segmentColors[r]?e.segmentColors[r]:e.arcColorFn(t*r))).attr('d',o)}({config:t,svg:o,centerTx:n}),function({config:e,svg:t,centerTx:r,r:n}){const o=jr(e),a=wr(e),i=xr(e),s=e.maxAngle-e.minAngle,{customSegmentLabels:u}=e,c=_t(u)&&!Ht(u),l=c&&u.length===a.length;if(c&&!l)throw new Error(`Custom Segment Labels should be an array with length of ${a.length}`);if(c&&l)return void function({config:e,svg:t,centerTx:r,r:n,ticks:o,tickData:a,scale:i,range:s}){const{customSegmentStops:u,customSegmentLabels:c}=e;function l(t,r){const n=0===u.length?i(t):ur(a,r);return e.minAngle+n*s}const f=c.map(((e,t)=>{const r=t,n=t+1,a=l(o[r],r);return(l(o[n],n)+a)/2})),p=n-e.ringWidth-e.ringInset,d=n-e.ringInset,y=d-(d-p)/2;t.append('g').attr('class','label').attr('transform',r).selectAll('text').data(c).enter().append('text').attr('transform',((t,r)=>{const o=f[r],a=`rotate(${o}) translate(0, ${e.labelInset-n})`,i=`rotate(${o}) translate(0, ${e.labelInset/2-y})`;return'OUTSIDE'===t.position?a:i})).text((e=>e.text||'')).attr('class','segment-value').style('text-anchor','middle').style('font-size',(t=>t.fontSize||e.labelFontSize)).style('font-weight','bold').style('fill',(t=>t.color||e.textColor))}({config:e,svg:t,centerTx:r,r:n,ticks:o,tickData:a,scale:i,range:s});t.append('g').attr('class','label').attr('transform',r).selectAll('text').data(o).enter().append('text').attr('transform',((t,r)=>{const o=0===e.customSegmentStops.length?i(t):ur(a,r);return`rotate(${e.minAngle+o*s}) translate(0, ${e.labelInset-n})`})).text((t=>e.segmentValueFormatter(e.labelFormat(t)))).attr('class','segment-value').style('text-anchor','middle').style('font-size',e.labelFontSize).style('font-weight','bold').style('fill',e.textColor)}({config:t,svg:o,centerTx:n,r}),{current_value_text:$r({config:t,svg:o}),pointer:Tr({config:t,svg:o,r,centerTx:n})}};function $r({config:e,svg:t}){const r=(e.width+2*e.paddingHorizontal)/2,n=(e.width+4*e.paddingVertical)/2;return t.append('g').attr('transform',`translate(${r}, ${n})`).append('text').attr('class','current-value').attr('text-anchor','middle').attr('y',23).text(e.currentValue).style('font-size',e.valueTextFontSize).style('font-weight',e.valueTextFontWeight).style('fill',e.textColor)}function Tr({config:e,svg:t,r,centerTx:n}){const o=function({heightRatio:e,radius:t}){if(e<0||e>1)throw new Error(`Invalid needleHeightRatio given - ${e}`);return Math.round(t*e)}({heightRatio:e.needleHeightRatio,radius:r}),a=[[e.pointerWidth/2,0],[0,-o],[-e.pointerWidth/2,0],[0,e.pointerTailLength],[e.pointerWidth/2,0]],i=f().curve(p);return t.append('g').data([a]).attr('class','pointer').attr('transform',n).style('fill',e.needleColor).append('path').attr('d',i).attr('transform',`rotate(${e.minAngle})`)}class kr extends n{constructor(e){super(e),t(this,'render',(()=>te.jsx('div',{ref:e=>this.gaugeDiv=e}))),this.d3_refs={pointer:!1,current_value_text:!1}}componentDidMount(){this.renderGauge()}componentDidUpdate(){this.props.forceRender?this.renderGauge():this.updateReadings()}renderGauge(){this.config=(({PROPS:e,parentWidth:t,parentHeight:r})=>{const n={width:e.fluidWidth?t:e.width,height:e.fluidWidth?r:e.height,paddingHorizontal:e.paddingHorizontal,paddingVertical:e.paddingVertical,dimensionUnit:e.dimensionUnit,ringWidth:e.ringWidth,minValue:e.minValue,maxValue:e.maxValue,needleColor:e.needleColor,majorTicks:e.segments,customSegmentStops:e.customSegmentStops,customSegmentLabels:e.customSegmentLabels,maxSegmentLabels:lr({maxSegmentLabelCount:e.maxSegmentLabels,segmentCount:e.segments}),segmentColors:e.segmentColors,arcColorFn:e.segmentColors.length>0?s(e.segmentColors):u(c(e.startColor),c(e.endColor)),needleTransition:e.needleTransition,needleTransitionDuration:e.needleTransitionDuration,needleHeightRatio:e.needleHeightRatio,textColor:e.textColor,labelFormat:o(e.valueFormat),segmentValueFormatter:e.segmentValueFormatter,currentValueText:e.currentValueText,currentValuePlaceholderStyle:e.currentValuePlaceholderStyle,labelFontSize:e.labelFontSize,valueTextFontSize:e.valueTextFontSize,valueTextFontWeight:e.valueTextFontWeight,svgAriaLabel:e.svgAriaLabel};return Object.assign({},gr,n)})({PROPS:this.props,parentWidth:this.gaugeDiv.parentNode.clientWidth,parentHeight:this.gaugeDiv.parentNode.clientHeight}),a(this.gaugeDiv).select('svg').remove(),this.d3_refs=Er({container:this.gaugeDiv,config:this.config}),Cr({d3_refs:this.d3_refs,newValue:this.props.value,config:this.config})}updateReadings(){this.config=((e,t)=>({...e,...t}))(this.config,{labelFormat:o(this.props.valueFormat||''),segmentValueFormatter:this.props.segmentValueFormatter||yr,currentValueText:this.props.currentValueText||'${value}'}),Cr({d3_refs:this.d3_refs,newValue:this.props.value||0,config:this.config})}}t(kr,'displayName','ReactSpeedometer'),kr.propTypes={value:Re.number.isRequired,minValue:Re.number.isRequired,maxValue:Re.number.isRequired,forceRender:Re.bool.isRequired,width:Re.number.isRequired,height:Re.number.isRequired,paddingHorizontal:Re.number.isRequired,paddingVertical:Re.number.isRequired,dimensionUnit:Re.string.isRequired,fluidWidth:Re.bool.isRequired,segments:Re.number.isRequired,maxSegmentLabels:Re.number,customSegmentStops:Re.array,customSegmentLabels:Re.arrayOf(Re.shape({text:Re.string,position:Re.oneOf(['OUTSIDE','INSIDE']),fontSize:Re.string,color:Re.string})),needleColor:Re.string.isRequired,startColor:Re.string.isRequired,endColor:Re.string.isRequired,segmentColors:Re.array.isRequired,needleTransition:Re.string.isRequired,needleTransitionDuration:Re.number.isRequired,needleHeightRatio:Re.number.isRequired,ringWidth:Re.number.isRequired,textColor:Re.string.isRequired,valueFormat:Re.string.isRequired,segmentValueFormatter:Re.func,currentValueText:Re.string.isRequired,currentValuePlaceholderStyle:Re.string.isRequired,labelFontSize:Re.string.isRequired,valueTextFontSize:Re.string.isRequired,valueTextFontWeight:Re.string.isRequired,svgAriaLabel:Re.string},kr.defaultProps=mr;export{pr as CustomSegmentLabelPosition,dr as Transition,kr as default};