UNPKG

r3f-globe

Version:

React Three Fiber component for Globe Data Visualization

2 lines 1.16 MB
// Version 1.3.7 r3f-globe - https://github.com/vasturiano/r3f-globe !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react"),require("three")):"function"==typeof define&&define.amd?define(["react","three"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).R3fGlobe=t(e.React,e.THREE)}(this,(function(e,t){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,s,a,o=[],A=!0,l=!1;try{if(s=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;A=!1}else for(;!(A=(i=s.call(r)).done)&&(o.push(i.value),o.length!==t);A=!0);}catch(e){l=!0,n=e}finally{try{if(!A&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw n}}return o}}(e,t)||A(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||A(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}function l(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var u="object"==typeof global&&global&&global.Object===Object&&global,h="object"==typeof self&&self&&self.Object===Object&&self,c=u||h||Function("return this")(),d=function(){return c.Date.now()},p=/\s/;var f=/^\s+/;function m(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&p.test(e.charAt(t)););return t}(e)+1).replace(f,""):e}var g=c.Symbol,y=Object.prototype,b=y.hasOwnProperty,x=y.toString,v=g?g.toStringTag:void 0;var _=Object.prototype.toString;var w=g?g.toStringTag:void 0;function T(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":w&&w in Object(e)?function(e){var t=b.call(e,v),r=e[v];try{e[v]=void 0;var i=!0}catch(e){}var n=x.call(e);return i&&(t?e[v]=r:delete e[v]),n}(e):function(e){return _.call(e)}(e)}var S=/^[-+]0x[0-9a-f]+$/i,M=/^0b[01]+$/i,E=/^0o[0-7]+$/i,N=parseInt;function C(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==T(e)}(e))return NaN;if(l(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=l(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=m(e);var r=M.test(e);return r||E.test(e)?N(e.slice(2),r?2:8):S.test(e)?NaN:+e}var R=Math.max,B=Math.min;function q(e,t,r){var i,n,s,a,o,A,u=0,h=!1,c=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var r=i,s=n;return i=n=void 0,u=t,a=e.apply(s,r)}function m(e){var r=e-A;return void 0===A||r>=t||r<0||c&&e-u>=s}function g(){var e=d();if(m(e))return y(e);o=setTimeout(g,function(e){var r=t-(e-A);return c?B(r,s-(e-u)):r}(e))}function y(e){return o=void 0,p&&i?f(e):(i=n=void 0,a)}function b(){var e=d(),r=m(e);if(i=arguments,n=this,A=e,r){if(void 0===o)return function(e){return u=e,o=setTimeout(g,t),h?f(e):a}(A);if(c)return clearTimeout(o),o=setTimeout(g,t),f(A)}return void 0===o&&(o=setTimeout(g,t)),a}return t=C(t)||0,l(r)&&(h=!!r.leading,s=(c="maxWait"in r)?R(C(r.maxWait)||0,t):s,p="trailing"in r?!!r.trailing:p),b.cancel=function(){void 0!==o&&clearTimeout(o),u=0,i=A=n=o=void 0},b.flush=function(){return void 0===o?a:y(d())},b}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function D(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,s,a,o=[],A=!0,l=!1;try{if(s=(r=r.call(e)).next,0===t);else for(;!(A=(i=s.call(r)).done)&&(o.push(i.value),o.length!==t);A=!0);}catch(e){l=!0,n=e}finally{try{if(!A&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw n}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?P(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var F=D((function e(t,r){var i=r.default,n=void 0===i?null:i,s=r.triggerUpdate,a=void 0===s||s,o=r.onChange,A=void 0===o?function(e,t){}:o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=t,this.defaultVal=n,this.triggerUpdate=a,this.onChange=A}));function O(e){var t=e.stateInit,r=void 0===t?function(){return{}}:t,i=e.props,n=void 0===i?{}:i,s=e.methods,a=void 0===s?{}:s,o=e.aliases,A=void 0===o?{}:o,l=e.init,u=void 0===l?function(){}:l,h=e.update,c=void 0===h?function(){}:h,d=Object.keys(n).map((function(e){return new F(e,n[e])}));return function e(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var s=!!(this instanceof e?this.constructor:void 0),o=s?i.shift():void 0,l=i[0],h=void 0===l?{}:l,p=Object.assign({},r instanceof Function?r(h):r,{initialised:!1}),f={};function m(e){return g(e,h),y(),m}var g=function(e,t){u.call(m,e,p,t),p.initialised=!0},y=q((function(){p.initialised&&(c.call(m,p,f),f={})}),1);return d.forEach((function(e){m[e.name]=function(e){var t=e.name,r=e.triggerUpdate,i=void 0!==r&&r,n=e.onChange,s=void 0===n?function(e,t){}:n,a=e.defaultVal,o=void 0===a?null:a;return function(e){var r=p[t];if(!arguments.length)return r;var n=void 0===e?o:e;return p[t]=n,s.call(m,n,p,r),!f.hasOwnProperty(t)&&(f[t]=r),i&&y(),m}}(e)})),Object.keys(a).forEach((function(e){m[e]=function(){for(var t,r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];return(t=a[e]).call.apply(t,[m,p].concat(i))}})),Object.entries(A).forEach((function(e){var t=I(e,2),r=t[0],i=t[1];return m[r]=m[i]})),m.resetProps=function(){return d.forEach((function(e){m[e.name](e.defaultVal)})),m},m.resetProps(),p._rerender=y,s&&o&&m(o),m}}var k=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}}),Back:Object.freeze({In:function(e){var t=1.70158;return 1===e?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return 0===e?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-k.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*k.Bounce.In(2*e):.5*k.Bounce.Out(2*e-1)+.5}}),generatePow:function(e){return void 0===e&&(e=4),e=(e=e<Number.EPSILON?Number.EPSILON:e)>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(2*t,e)/2:(1-Math.pow(2-2*t,e))/2+.5}}}}),L=function(){return performance.now()},U=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];for(var i=0,n=t;i<n.length;i++){var s=n[i];null===(e=s._group)||void 0===e||e.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},e.prototype.remove=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=0,i=e;r<i.length;r++){var n=i[r];n._group=void 0,delete this._tweens[n.getId()],delete this._tweensAddedDuringUpdate[n.getId()]}},e.prototype.allStopped=function(){return this.getAll().every((function(e){return!e.isPlaying()}))},e.prototype.update=function(e,t){void 0===e&&(e=L()),void 0===t&&(t=!0);var r=Object.keys(this._tweens);if(0!==r.length)for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<r.length;i++){var n=this._tweens[r[i]],s=!t;n&&!1===n.update(e,s)&&!t&&this.remove(n)}r=Object.keys(this._tweensAddedDuringUpdate)}},e}(),V={Linear:function(e,t){var r=e.length-1,i=r*t,n=Math.floor(i),s=V.Utils.Linear;return t<0?s(e[0],e[1],i):t>1?s(e[r],e[r-1],r-i):s(e[n],e[n+1>r?r:n+1],i-n)},Utils:{Linear:function(e,t,r){return(t-e)*r+e}}},z=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),G=new U,j=function(){function e(e,t){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=k.Linear.None,this._interpolationFunction=V.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=z.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,"object"==typeof t?(this._group=t,t.add(this)):!0===t&&(this._group=G,G.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(e,t){if(void 0===t&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},e.prototype.duration=function(e){return void 0===e&&(e=1e3),this._duration=e<0?0:e,this},e.prototype.dynamic=function(e){return void 0===e&&(e=!1),this._isDynamic=e,this},e.prototype.start=function(e,t){if(void 0===e&&(e=L()),void 0===t&&(t=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed)for(var r in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r];if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var n in this._valuesEnd)i[n]=this._valuesEnd[n];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},e.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},e.prototype._setupProperties=function(e,t,r,i,n){for(var s in r){var a=e[s],o=Array.isArray(a),A=o?"array":typeof a,l=!o&&Array.isArray(r[s]);if("undefined"!==A&&"function"!==A){if(l){if(0===(m=r[s]).length)continue;for(var u=[a],h=0,c=m.length;h<c;h+=1){var d=this._handleRelativeValue(a,m[h]);if(isNaN(d)){l=!1,console.warn("Found invalid interpolation list. Skipping.");break}u.push(d)}l&&(r[s]=u)}if("object"!==A&&!o||!a||l)(void 0===t[s]||n)&&(t[s]=a),o||(t[s]*=1),i[s]=l?r[s].slice().reverse():t[s]||0;else{t[s]=o?[]:{};var p=a;for(var f in p)t[s][f]=p[f];i[s]=o?[]:{};var m=r[s];if(!this._isDynamic){var g={};for(var f in m)g[f]=m[f];r[s]=m=g}this._setupProperties(p,t[s],m,i[s],n)}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(e){return void 0===e&&(e=L()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e),this},e.prototype.resume=function(e){return void 0===e&&(e=L()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var e;return null===(e=this._group)||void 0===e||e.remove(this),this},e.prototype.delay=function(e){return void 0===e&&(e=0),this._delayTime=e,this},e.prototype.repeat=function(e){return void 0===e&&(e=0),this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return void 0===e&&(e=!1),this._yoyo=e,this},e.prototype.easing=function(e){return void 0===e&&(e=k.Linear.None),this._easingFunction=e,this},e.prototype.interpolation=function(e){return void 0===e&&(e=V.Linear),this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(t,r){var i,n,s=this;if(void 0===t&&(t=L()),void 0===r&&(r=e.autoStartOnUpdate),this._isPaused)return!0;if(!this._goToEnd&&!this._isPlaying){if(!r)return!1;this.start(t,!0)}if(this._goToEnd=!1,t<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),!1===this._onEveryStartCallbackFired&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=t-this._startTime,o=this._duration+(null!==(i=this._repeatDelayTime)&&void 0!==i?i:this._delayTime),A=this._duration+this._repeat*o,l=function(){if(0===s._duration)return 1;if(a>A)return 1;var e=Math.trunc(a/o),t=a-e*o,r=Math.min(t/s._duration,1);return 0===r&&a===s._duration?1:r}(),u=this._easingFunction(l);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,u),this._onUpdateCallback&&this._onUpdateCallback(this._object,l),0===this._duration||a>=this._duration){if(this._repeat>0){var h=Math.min(Math.trunc((a-this._duration)/o)+1,this._repeat);for(n in isFinite(this._repeat)&&(this._repeat-=h),this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=o*h,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var c=0,d=this._chainedTweens.length;c<d;c++)this._chainedTweens[c].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,r,i){for(var n in r)if(void 0!==t[n]){var s=t[n]||0,a=r[n],o=Array.isArray(e[n]),A=Array.isArray(a);!o&&A?e[n]=this._interpolationFunction(a,i):"object"==typeof a&&a?this._updateProperties(e[n],s,a,i):"number"==typeof(a=this._handleRelativeValue(s,a))&&(e[n]=s+(a-s)*i)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],r=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof r?this._valuesStartRepeat[e]+parseFloat(r):this._valuesEnd[e],this._valuesEnd[e]=t},e.autoStartOnUpdate=!1,e}();z.nextId;var H=G;function W(e,t,r,i,n){if(isNaN(t)||isNaN(r)||isNaN(i))return e;var s,a,o,A,l,u,h,c,d,p,f,m,g=e._root,y={data:n},b=e._x0,x=e._y0,v=e._z0,_=e._x1,w=e._y1,T=e._z1;if(!g)return e._root=y,e;for(;g.length;)if((c=t>=(a=(b+_)/2))?b=a:_=a,(d=r>=(o=(x+w)/2))?x=o:w=o,(p=i>=(A=(v+T)/2))?v=A:T=A,s=g,!(g=g[f=p<<2|d<<1|c]))return s[f]=y,e;if(l=+e._x.call(null,g.data),u=+e._y.call(null,g.data),h=+e._z.call(null,g.data),t===l&&r===u&&i===h)return y.next=g,s?s[f]=y:e._root=y,e;do{s=s?s[f]=new Array(8):e._root=new Array(8),(c=t>=(a=(b+_)/2))?b=a:_=a,(d=r>=(o=(x+w)/2))?x=o:w=o,(p=i>=(A=(v+T)/2))?v=A:T=A}while((f=p<<2|d<<1|c)==(m=(h>=A)<<2|(u>=o)<<1|l>=a));return s[m]=g,s[f]=y,e}function Q(e,t,r,i,n,s,a){this.node=e,this.x0=t,this.y0=r,this.z0=i,this.x1=n,this.y1=s,this.z1=a}H.getAll.bind(H),H.removeAll.bind(H),H.add.bind(H),H.remove.bind(H),H.update.bind(H);const $=(e,t,r,i,n,s)=>Math.sqrt((e-i)**2+(t-n)**2+(r-s)**2);function X(e){return e[0]}function Y(e){return e[1]}function Z(e){return e[2]}function K(e,t,r,i){var n=new J(null==t?X:t,null==r?Y:r,null==i?Z:i,NaN,NaN,NaN,NaN,NaN,NaN);return null==e?n:n.addAll(e)}function J(e,t,r,i,n,s,a,o,A){this._x=e,this._y=t,this._z=r,this._x0=i,this._y0=n,this._z0=s,this._x1=a,this._y1=o,this._z1=A,this._root=void 0}function ee(e){for(var t={data:e.data},r=t;e=e.next;)r=r.next={data:e.data};return t}var te=K.prototype=J.prototype;function re(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function ie(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ne(e){let t,r,i;function n(e,i,n=0,s=e.length){if(n<s){if(0!==t(i,i))return s;do{const t=n+s>>>1;r(e[t],i)<0?n=t+1:s=t}while(n<s)}return n}return 2!==e.length?(t=re,r=(t,r)=>re(e(t),r),i=(t,r)=>e(t)-r):(t=e===re||e===ie?e:se,r=e,i=e),{left:n,center:function(e,t,r=0,s=e.length){const a=n(e,t,r,s-1);return a>r&&i(e[a-1],t)>-i(e[a],t)?a-1:a},right:function(e,i,n=0,s=e.length){if(n<s){if(0!==t(i,i))return s;do{const t=n+s>>>1;r(e[t],i)<=0?n=t+1:s=t}while(n<s)}return n}}}function se(){return 0}te.copy=function(){var e,t,r=new J(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),i=this._root;if(!i)return r;if(!i.length)return r._root=ee(i),r;for(e=[{source:i,target:r._root=new Array(8)}];i=e.pop();)for(var n=0;n<8;++n)(t=i.source[n])&&(t.length?e.push({source:t,target:i.target[n]=new Array(8)}):i.target[n]=ee(t));return r},te.add=function(e){const t=+this._x.call(null,e),r=+this._y.call(null,e),i=+this._z.call(null,e);return W(this.cover(t,r,i),t,r,i,e)},te.addAll=function(e){Array.isArray(e)||(e=Array.from(e));const t=e.length,r=new Float64Array(t),i=new Float64Array(t),n=new Float64Array(t);let s=1/0,a=1/0,o=1/0,A=-1/0,l=-1/0,u=-1/0;for(let h,c,d,p,f=0;f<t;++f)isNaN(c=+this._x.call(null,h=e[f]))||isNaN(d=+this._y.call(null,h))||isNaN(p=+this._z.call(null,h))||(r[f]=c,i[f]=d,n[f]=p,c<s&&(s=c),c>A&&(A=c),d<a&&(a=d),d>l&&(l=d),p<o&&(o=p),p>u&&(u=p));if(s>A||a>l||o>u)return this;this.cover(s,a,o).cover(A,l,u);for(let s=0;s<t;++s)W(this,r[s],i[s],n[s],e[s]);return this},te.cover=function(e,t,r){if(isNaN(e=+e)||isNaN(t=+t)||isNaN(r=+r))return this;var i=this._x0,n=this._y0,s=this._z0,a=this._x1,o=this._y1,A=this._z1;if(isNaN(i))a=(i=Math.floor(e))+1,o=(n=Math.floor(t))+1,A=(s=Math.floor(r))+1;else{for(var l,u,h=a-i||1,c=this._root;i>e||e>=a||n>t||t>=o||s>r||r>=A;)switch(u=(r<s)<<2|(t<n)<<1|e<i,(l=new Array(8))[u]=c,c=l,h*=2,u){case 0:a=i+h,o=n+h,A=s+h;break;case 1:i=a-h,o=n+h,A=s+h;break;case 2:a=i+h,n=o-h,A=s+h;break;case 3:i=a-h,n=o-h,A=s+h;break;case 4:a=i+h,o=n+h,s=A-h;break;case 5:i=a-h,o=n+h,s=A-h;break;case 6:a=i+h,n=o-h,s=A-h;break;case 7:i=a-h,n=o-h,s=A-h}this._root&&this._root.length&&(this._root=c)}return this._x0=i,this._y0=n,this._z0=s,this._x1=a,this._y1=o,this._z1=A,this},te.data=function(){var e=[];return this.visit((function(t){if(!t.length)do{e.push(t.data)}while(t=t.next)})),e},te.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},te.find=function(e,t,r,i){var n,s,a,o,A,l,u,h,c,d=this._x0,p=this._y0,f=this._z0,m=this._x1,g=this._y1,y=this._z1,b=[],x=this._root;for(x&&b.push(new Q(x,d,p,f,m,g,y)),null==i?i=1/0:(d=e-i,p=t-i,f=r-i,m=e+i,g=t+i,y=r+i,i*=i);h=b.pop();)if(!(!(x=h.node)||(s=h.x0)>m||(a=h.y0)>g||(o=h.z0)>y||(A=h.x1)<d||(l=h.y1)<p||(u=h.z1)<f))if(x.length){var v=(s+A)/2,_=(a+l)/2,w=(o+u)/2;b.push(new Q(x[7],v,_,w,A,l,u),new Q(x[6],s,_,w,v,l,u),new Q(x[5],v,a,w,A,_,u),new Q(x[4],s,a,w,v,_,u),new Q(x[3],v,_,o,A,l,w),new Q(x[2],s,_,o,v,l,w),new Q(x[1],v,a,o,A,_,w),new Q(x[0],s,a,o,v,_,w)),(c=(r>=w)<<2|(t>=_)<<1|e>=v)&&(h=b[b.length-1],b[b.length-1]=b[b.length-1-c],b[b.length-1-c]=h)}else{var T=e-+this._x.call(null,x.data),S=t-+this._y.call(null,x.data),M=r-+this._z.call(null,x.data),E=T*T+S*S+M*M;if(E<i){var N=Math.sqrt(i=E);d=e-N,p=t-N,f=r-N,m=e+N,g=t+N,y=r+N,n=x.data}}return n},te.findAllWithinRadius=function(e,t,r,i){const n=[],s=e-i,a=t-i,o=r-i,A=e+i,l=t+i,u=r+i;return this.visit(((h,c,d,p,f,m,g)=>{if(!h.length)do{const s=h.data;$(e,t,r,this._x(s),this._y(s),this._z(s))<=i&&n.push(s)}while(h=h.next);return c>A||d>l||p>u||f<s||m<a||g<o})),n},te.remove=function(e){if(isNaN(s=+this._x.call(null,e))||isNaN(a=+this._y.call(null,e))||isNaN(o=+this._z.call(null,e)))return this;var t,r,i,n,s,a,o,A,l,u,h,c,d,p,f,m=this._root,g=this._x0,y=this._y0,b=this._z0,x=this._x1,v=this._y1,_=this._z1;if(!m)return this;if(m.length)for(;;){if((h=s>=(A=(g+x)/2))?g=A:x=A,(c=a>=(l=(y+v)/2))?y=l:v=l,(d=o>=(u=(b+_)/2))?b=u:_=u,t=m,!(m=m[p=d<<2|c<<1|h]))return this;if(!m.length)break;(t[p+1&7]||t[p+2&7]||t[p+3&7]||t[p+4&7]||t[p+5&7]||t[p+6&7]||t[p+7&7])&&(r=t,f=p)}for(;m.data!==e;)if(i=m,!(m=m.next))return this;return(n=m.next)&&delete m.next,i?(n?i.next=n:delete i.next,this):t?(n?t[p]=n:delete t[p],(m=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&m===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!m.length&&(r?r[f]=m:this._root=m),this):(this._root=n,this)},te.removeAll=function(e){for(var t=0,r=e.length;t<r;++t)this.remove(e[t]);return this},te.root=function(){return this._root},te.size=function(){var e=0;return this.visit((function(t){if(!t.length)do{++e}while(t=t.next)})),e},te.visit=function(e){var t,r,i,n,s,a,o,A,l=[],u=this._root;for(u&&l.push(new Q(u,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=l.pop();)if(!e(u=t.node,i=t.x0,n=t.y0,s=t.z0,a=t.x1,o=t.y1,A=t.z1)&&u.length){var h=(i+a)/2,c=(n+o)/2,d=(s+A)/2;(r=u[7])&&l.push(new Q(r,h,c,d,a,o,A)),(r=u[6])&&l.push(new Q(r,i,c,d,h,o,A)),(r=u[5])&&l.push(new Q(r,h,n,d,a,c,A)),(r=u[4])&&l.push(new Q(r,i,n,d,h,c,A)),(r=u[3])&&l.push(new Q(r,h,c,s,a,o,d)),(r=u[2])&&l.push(new Q(r,i,c,s,h,o,d)),(r=u[1])&&l.push(new Q(r,h,n,s,a,c,d)),(r=u[0])&&l.push(new Q(r,i,n,s,h,c,d))}return this},te.visitAfter=function(e){var t,r=[],i=[];for(this._root&&r.push(new Q(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));t=r.pop();){var n=t.node;if(n.length){var s,a=t.x0,o=t.y0,A=t.z0,l=t.x1,u=t.y1,h=t.z1,c=(a+l)/2,d=(o+u)/2,p=(A+h)/2;(s=n[0])&&r.push(new Q(s,a,o,A,c,d,p)),(s=n[1])&&r.push(new Q(s,c,o,A,l,d,p)),(s=n[2])&&r.push(new Q(s,a,d,A,c,u,p)),(s=n[3])&&r.push(new Q(s,c,d,A,l,u,p)),(s=n[4])&&r.push(new Q(s,a,o,p,c,d,h)),(s=n[5])&&r.push(new Q(s,c,o,p,l,d,h)),(s=n[6])&&r.push(new Q(s,a,d,p,c,u,h)),(s=n[7])&&r.push(new Q(s,c,d,p,l,u,h))}i.push(t)}for(;t=i.pop();)e(t.node,t.x0,t.y0,t.z0,t.x1,t.y1,t.z1);return this},te.x=function(e){return arguments.length?(this._x=e,this):this._x},te.y=function(e){return arguments.length?(this._y=e,this):this._y},te.z=function(e){return arguments.length?(this._z=e,this):this._z};const ae=ne(re).right;function oe(e,t){let r,i;if(void 0===t)for(const t of e)null!=t&&(void 0===r?t>=t&&(r=i=t):(r>t&&(r=t),i<t&&(i=t)));else{let n=-1;for(let s of e)null!=(s=t(s,++n,e))&&(void 0===r?s>=s&&(r=i=s):(r>s&&(r=s),i<s&&(i=s)))}return[r,i]}ne((function(e){return null===e?NaN:+e})).center;class Ae{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let r=0;for(let i=0;i<this._n&&i<32;i++){const n=t[i],s=e+n,a=Math.abs(e)<Math.abs(n)?e-(s-n):n-(s-e);a&&(t[r++]=a),e=s}return t[r]=e,this._n=r+1,this}valueOf(){const e=this._partials;let t,r,i,n=this._n,s=0;if(n>0){for(s=e[--n];n>0&&(t=s,r=e[--n],s=t+r,i=r-(s-t),!i););n>0&&(i<0&&e[n-1]<0||i>0&&e[n-1]>0)&&(r=2*i,t=s+r,r==t-s&&(s=t))}return s}}const le=Math.sqrt(50),ue=Math.sqrt(10),he=Math.sqrt(2);function ce(e,t,r){const i=(t-e)/Math.max(0,r),n=Math.floor(Math.log10(i)),s=i/Math.pow(10,n),a=s>=le?10:s>=ue?5:s>=he?2:1;let o,A,l;return n<0?(l=Math.pow(10,-n)/a,o=Math.round(e*l),A=Math.round(t*l),o/l<e&&++o,A/l>t&&--A,l=-l):(l=Math.pow(10,n)*a,o=Math.round(e/l),A=Math.round(t/l),o*l<e&&++o,A*l>t&&--A),A<o&&.5<=r&&r<2?ce(e,t,2*r):[o,A,l]}function de(e,t,r){return ce(e=+e,t=+t,r=+r)[2]}function pe(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}function fe(e,t,r){e=+e,t=+t,r=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+r;for(var i=-1,n=0|Math.max(0,Math.ceil((t-e)/r)),s=new Array(n);++i<n;)s[i]=e+i*r;return s}function me(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function ge(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function ye(e,t){var r=Object.create(e.prototype);for(var i in t)r[i]=t[i];return r}function be(){}var xe=.7,ve=1/xe,_e="\\s*([+-]?\\d+)\\s*",we="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Te="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Se=/^#([0-9a-f]{3,8})$/,Me=new RegExp(`^rgb\\(${_e},${_e},${_e}\\)$`),Ee=new RegExp(`^rgb\\(${Te},${Te},${Te}\\)$`),Ne=new RegExp(`^rgba\\(${_e},${_e},${_e},${we}\\)$`),Ce=new RegExp(`^rgba\\(${Te},${Te},${Te},${we}\\)$`),Re=new RegExp(`^hsl\\(${we},${Te},${Te}\\)$`),Be=new RegExp(`^hsla\\(${we},${Te},${Te},${we}\\)$`),qe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Pe(){return this.rgb().formatHex()}function De(){return this.rgb().formatRgb()}function Ie(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Se.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?Fe(t):3===r?new Le(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?Oe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?Oe(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Me.exec(e))?new Le(t[1],t[2],t[3],1):(t=Ee.exec(e))?new Le(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Ne.exec(e))?Oe(t[1],t[2],t[3],t[4]):(t=Ce.exec(e))?Oe(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Re.exec(e))?He(t[1],t[2]/100,t[3]/100,1):(t=Be.exec(e))?He(t[1],t[2]/100,t[3]/100,t[4]):qe.hasOwnProperty(e)?Fe(qe[e]):"transparent"===e?new Le(NaN,NaN,NaN,0):null}function Fe(e){return new Le(e>>16&255,e>>8&255,255&e,1)}function Oe(e,t,r,i){return i<=0&&(e=t=r=NaN),new Le(e,t,r,i)}function ke(e,t,r,i){return 1===arguments.length?((n=e)instanceof be||(n=Ie(n)),n?new Le((n=n.rgb()).r,n.g,n.b,n.opacity):new Le):new Le(e,t,r,null==i?1:i);var n}function Le(e,t,r,i){this.r=+e,this.g=+t,this.b=+r,this.opacity=+i}function Ue(){return`#${je(this.r)}${je(this.g)}${je(this.b)}`}function Ve(){const e=ze(this.opacity);return`${1===e?"rgb(":"rgba("}${Ge(this.r)}, ${Ge(this.g)}, ${Ge(this.b)}${1===e?")":`, ${e})`}`}function ze(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ge(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function je(e){return((e=Ge(e))<16?"0":"")+e.toString(16)}function He(e,t,r,i){return i<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Qe(e,t,r,i)}function We(e){if(e instanceof Qe)return new Qe(e.h,e.s,e.l,e.opacity);if(e instanceof be||(e=Ie(e)),!e)return new Qe;if(e instanceof Qe)return e;var t=(e=e.rgb()).r/255,r=e.g/255,i=e.b/255,n=Math.min(t,r,i),s=Math.max(t,r,i),a=NaN,o=s-n,A=(s+n)/2;return o?(a=t===s?(r-i)/o+6*(r<i):r===s?(i-t)/o+2:(t-r)/o+4,o/=A<.5?s+n:2-s-n,a*=60):o=A>0&&A<1?0:a,new Qe(a,o,A,e.opacity)}function Qe(e,t,r,i){this.h=+e,this.s=+t,this.l=+r,this.opacity=+i}function $e(e){return(e=(e||0)%360)<0?e+360:e}function Xe(e){return Math.max(0,Math.min(1,e||0))}function Ye(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}ge(be,Ie,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Pe,formatHex:Pe,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return We(this).formatHsl()},formatRgb:De,toString:De}),ge(Le,ke,ye(be,{brighter(e){return e=null==e?ve:Math.pow(ve,e),new Le(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?xe:Math.pow(xe,e),new Le(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Le(Ge(this.r),Ge(this.g),Ge(this.b),ze(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ue,formatHex:Ue,formatHex8:function(){return`#${je(this.r)}${je(this.g)}${je(this.b)}${je(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ve,toString:Ve})),ge(Qe,(function(e,t,r,i){return 1===arguments.length?We(e):new Qe(e,t,r,null==i?1:i)}),ye(be,{brighter(e){return e=null==e?ve:Math.pow(ve,e),new Qe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?xe:Math.pow(xe,e),new Qe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*t,n=2*r-i;return new Le(Ye(e>=240?e-240:e+120,n,i),Ye(e,n,i),Ye(e<120?e+240:e-120,n,i),this.opacity)},clamp(){return new Qe($e(this.h),Xe(this.s),Xe(this.l),ze(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=ze(this.opacity);return`${1===e?"hsl(":"hsla("}${$e(this.h)}, ${100*Xe(this.s)}%, ${100*Xe(this.l)}%${1===e?")":`, ${e})`}`}}));var Ze=e=>()=>e;function Ke(e){return 1==(e=+e)?Je:function(t,r){return r-t?function(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(i){return Math.pow(e+i*t,r)}}(t,r,e):Ze(isNaN(t)?r:t)}}function Je(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):Ze(isNaN(e)?t:e)}var et=function e(t){var r=Ke(t);function i(e,t){var i=r((e=ke(e)).r,(t=ke(t)).r),n=r(e.g,t.g),s=r(e.b,t.b),a=Je(e.opacity,t.opacity);return function(t){return e.r=i(t),e.g=n(t),e.b=s(t),e.opacity=a(t),e+""}}return i.gamma=e,i}(1);function tt(e,t){t||(t=[]);var r,i=e?Math.min(t.length,e.length):0,n=t.slice();return function(s){for(r=0;r<i;++r)n[r]=e[r]*(1-s)+t[r]*s;return n}}function rt(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function it(e,t){return(rt(t)?tt:nt)(e,t)}function nt(e,t){var r,i=t?t.length:0,n=e?Math.min(i,e.length):0,s=new Array(n),a=new Array(i);for(r=0;r<n;++r)s[r]=ht(e[r],t[r]);for(;r<i;++r)a[r]=t[r];return function(e){for(r=0;r<n;++r)a[r]=s[r](e);return a}}function st(e,t){var r=new Date;return e=+e,t=+t,function(i){return r.setTime(e*(1-i)+t*i),r}}function at(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function ot(e,t){var r,i={},n={};for(r in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)r in e?i[r]=ht(e[r],t[r]):n[r]=t[r];return function(e){for(r in i)n[r]=i[r](e);return n}}var At=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,lt=new RegExp(At.source,"g");function ut(e,t){var r,i,n,s=At.lastIndex=lt.lastIndex=0,a=-1,o=[],A=[];for(e+="",t+="";(r=At.exec(e))&&(i=lt.exec(t));)(n=i.index)>s&&(n=t.slice(s,n),o[a]?o[a]+=n:o[++a]=n),(r=r[0])===(i=i[0])?o[a]?o[a]+=i:o[++a]=i:(o[++a]=null,A.push({i:a,x:at(r,i)})),s=lt.lastIndex;return s<t.length&&(n=t.slice(s),o[a]?o[a]+=n:o[++a]=n),o.length<2?A[0]?function(e){return function(t){return e(t)+""}}(A[0].x):function(e){return function(){return e}}(t):(t=A.length,function(e){for(var r,i=0;i<t;++i)o[(r=A[i]).i]=r.x(e);return o.join("")})}function ht(e,t){var r,i=typeof t;return null==t||"boolean"===i?Ze(t):("number"===i?at:"string"===i?(r=Ie(t))?(t=r,et):ut:t instanceof Ie?et:t instanceof Date?st:rt(t)?tt:Array.isArray(t)?nt:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?ot:at)(e,t)}function ct(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function dt(e){return+e}var pt=[0,1];function ft(e){return e}function mt(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:(r=isNaN(t)?NaN:.5,function(){return r});var r}function gt(e,t,r){var i=e[0],n=e[1],s=t[0],a=t[1];return n<i?(i=mt(n,i),s=r(a,s)):(i=mt(i,n),s=r(s,a)),function(e){return s(i(e))}}function yt(e,t,r){var i=Math.min(e.length,t.length)-1,n=new Array(i),s=new Array(i),a=-1;for(e[i]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++a<i;)n[a]=mt(e[a],e[a+1]),s[a]=r(t[a],t[a+1]);return function(t){var r=ae(e,t,1,i)-1;return s[r](n[r](t))}}function bt(){var e,t,r,i,n,s,a=pt,o=pt,A=ht,l=ft;function u(){var e,t,r,A=Math.min(a.length,o.length);return l!==ft&&(e=a[0],t=a[A-1],e>t&&(r=e,e=t,t=r),l=function(r){return Math.max(e,Math.min(t,r))}),i=A>2?yt:gt,n=s=null,h}function h(t){return null==t||isNaN(t=+t)?r:(n||(n=i(a.map(e),o,A)))(e(l(t)))}return h.invert=function(r){return l(t((s||(s=i(o,a.map(e),at)))(r)))},h.domain=function(e){return arguments.length?(a=Array.from(e,dt),u()):a.slice()},h.range=function(e){return arguments.length?(o=Array.from(e),u()):o.slice()},h.rangeRound=function(e){return o=Array.from(e),A=ct,u()},h.clamp=function(e){return arguments.length?(l=!!e||ft,u()):l!==ft},h.interpolate=function(e){return arguments.length?(A=e,u()):A},h.unknown=function(e){return arguments.length?(r=e,h):r},function(r,i){return e=r,t=i,u()}}function xt(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,i=e.slice(0,r);return[i.length>1?i[0]+i.slice(2):i,+e.slice(r+1)]}function vt(e){return(e=xt(Math.abs(e)))?e[1]:NaN}var _t,wt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Tt(e){if(!(t=wt.exec(e)))throw new Error("invalid format: "+e);var t;return new St({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function St(e){this.fill=void 0===e.fill?" ":e.fill+"",this.align=void 0===e.align?">":e.align+"",this.sign=void 0===e.sign?"-":e.sign+"",this.symbol=void 0===e.symbol?"":e.symbol+"",this.zero=!!e.zero,this.width=void 0===e.width?void 0:+e.width,this.comma=!!e.comma,this.precision=void 0===e.precision?void 0:+e.precision,this.trim=!!e.trim,this.type=void 0===e.type?"":e.type+""}function Mt(e,t){var r=xt(e,t);if(!r)return e+"";var i=r[0],n=r[1];return n<0?"0."+new Array(-n).join("0")+i:i.length>n+1?i.slice(0,n+1)+"."+i.slice(n+1):i+new Array(n-i.length+2).join("0")}Tt.prototype=St.prototype,St.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Et={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Mt(100*e,t),r:Mt,s:function(e,t){var r=xt(e,t);if(!r)return e+"";var i=r[0],n=r[1],s=n-(_t=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=i.length;return s===a?i:s>a?i+new Array(s-a+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+xt(e,Math.max(0,t+s-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Nt(e){return e}var Ct,Rt,Bt,qt=Array.prototype.map,Pt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Dt(e){var t,r,i=void 0===e.grouping||void 0===e.thousands?Nt:(t=qt.call(e.grouping,Number),r=e.thousands+"",function(e,i){for(var n=e.length,s=[],a=0,o=t[0],A=0;n>0&&o>0&&(A+o+1>i&&(o=Math.max(1,i-A)),s.push(e.substring(n-=o,n+o)),!((A+=o+1)>i));)o=t[a=(a+1)%t.length];return s.reverse().join(r)}),n=void 0===e.currency?"":e.currency[0]+"",s=void 0===e.currency?"":e.currency[1]+"",a=void 0===e.decimal?".":e.decimal+"",o=void 0===e.numerals?Nt:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(qt.call(e.numerals,String)),A=void 0===e.percent?"%":e.percent+"",l=void 0===e.minus?"−":e.minus+"",u=void 0===e.nan?"NaN":e.nan+"";function h(e){var t=(e=Tt(e)).fill,r=e.align,h=e.sign,c=e.symbol,d=e.zero,p=e.width,f=e.comma,m=e.precision,g=e.trim,y=e.type;"n"===y?(f=!0,y="g"):Et[y]||(void 0===m&&(m=12),g=!0,y="g"),(d||"0"===t&&"="===r)&&(d=!0,t="0",r="=");var b="$"===c?n:"#"===c&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===c?s:/[%p]/.test(y)?A:"",v=Et[y],_=/[defgprs%]/.test(y);function w(e){var n,s,A,c=b,w=x;if("c"===y)w=v(e)+w,e="";else{var T=(e=+e)<0||1/e<0;if(e=isNaN(e)?u:v(Math.abs(e),m),g&&(e=function(e){e:for(var t,r=e.length,i=1,n=-1;i<r;++i)switch(e[i]){case".":n=t=i;break;case"0":0===n&&(n=i),t=i;break;default:if(!+e[i])break e;n>0&&(n=0)}return n>0?e.slice(0,n)+e.slice(t+1):e}(e)),T&&0==+e&&"+"!==h&&(T=!1),c=(T?"("===h?h:l:"-"===h||"("===h?"":h)+c,w=("s"===y?Pt[8+_t/3]:"")+w+(T&&"("===h?")":""),_)for(n=-1,s=e.length;++n<s;)if(48>(A=e.charCodeAt(n))||A>57){w=(46===A?a+e.slice(n+1):e.slice(n))+w,e=e.slice(0,n);break}}f&&!d&&(e=i(e,1/0));var S=c.length+e.length+w.length,M=S<p?new Array(p-S+1).join(t):"";switch(f&&d&&(e=i(M+e,M.length?p-w.length:1/0),M=""),r){case"<":e=c+e+w+M;break;case"=":e=c+M+e+w;break;case"^":e=M.slice(0,S=M.length>>1)+c+e+w+M.slice(S);break;default:e=M+c+e+w}return o(e)}return m=void 0===m?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),w.toString=function(){return e+""},w}return{format:h,formatPrefix:function(e,t){var r=h(((e=Tt(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(vt(t)/3))),n=Math.pow(10,-i),s=Pt[8+i/3];return function(e){return r(n*e)+s}}}}function It(e,t,r,i){var n,s=function(e,t,r){r=+r;const i=(t=+t)<(e=+e),n=i?de(t,e,r):de(e,t,r);return(i?-1:1)*(n<0?1/-n:n)}(e,t,r);switch((i=Tt(null==i?",f":i)).type){case"s":var a=Math.max(Math.abs(e),Math.abs(t));return null!=i.precision||isNaN(n=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(vt(t)/3)))-vt(Math.abs(e)))}(s,a))||(i.precision=n),Bt(i,a);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(n=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,vt(t)-vt(e))+1}(s,Math.max(Math.abs(e),Math.abs(t))))||(i.precision=n-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(n=function(e){return Math.max(0,-vt(Math.abs(e)))}(s))||(i.precision=n-2*("%"===i.type))}return Rt(i)}function Ft(e){var t=e.domain;return e.ticks=function(e){var r=t();return function(e,t,r){if(!((r=+r)>0))return[];if((e=+e)==(t=+t))return[e];const i=t<e,[n,s,a]=i?ce(t,e,r):ce(e,t,r);if(!(s>=n))return[];const o=s-n+1,A=new Array(o);if(i)if(a<0)for(let e=0;e<o;++e)A[e]=(s-e)/-a;else for(let e=0;e<o;++e)A[e]=(s-e)*a;else if(a<0)for(let e=0;e<o;++e)A[e]=(n+e)/-a;else for(let e=0;e<o;++e)A[e]=(n+e)*a;return A}(r[0],r[r.length-1],null==e?10:e)},e.tickFormat=function(e,r){var i=t();return It(i[0],i[i.length-1],null==e?10:e,r)},e.nice=function(r){null==r&&(r=10);var i,n,s=t(),a=0,o=s.length-1,A=s[a],l=s[o],u=10;for(l<A&&(n=A,A=l,l=n,n=a,a=o,o=n);u-- >0;){if((n=de(A,l,r))===i)return s[a]=A,s[o]=l,t(s);if(n>0)A=Math.floor(A/n)*n,l=Math.ceil(l/n)*n;else{if(!(n<0))break;A=Math.ceil(A*n)/n,l=Math.floor(l*n)/n}i=n}return e},e}function Ot(){var e=bt()(ft,ft);return e.copy=function(){return t=e,Ot().domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());var t},me.apply(e,arguments),Ft(e)}function kt(){var e,t=0,r=1,i=1,n=[.5],s=[0,1];function a(t){return null!=t&&t<=t?s[ae(n,t,0,i)]:e}function o(){var e=-1;for(n=new Array(i);++e<i;)n[e]=((e+1)*r-(e-i)*t)/(i+1);return a}return a.domain=function(e){return arguments.length?([t,r]=e,t=+t,r=+r,o()):[t,r]},a.range=function(e){return arguments.length?(i=(s=Array.from(e)).length-1,o()):s.slice()},a.invertExtent=function(e){var a=s.indexOf(e);return a<0?[NaN,NaN]:a<1?[t,n[0]]:a>=i?[n[i-1],r]:[n[a-1],n[a]]},a.unknown=function(t){return arguments.length?(e=t,a):a},a.thresholds=function(){return n.slice()},a.copy=function(){return kt().domain([t,r]).range(s).unknown(e)},me.apply(Ft(a),arguments)}Ct=Dt({thousands:",",grouping:[3],currency:["$",""]}),Rt=Ct.format,Bt=Ct.formatPrefix;var Lt=1e-6,Ut=1e-12,Vt=Math.PI,zt=Vt/2,Gt=Vt/4,jt=2*Vt,Ht=180/Vt,Wt=Vt/180,Qt=Math.abs,$t=Math.atan,Xt=Math.atan2,Yt=Math.cos,Zt=Math.ceil,Kt=Math.exp,Jt=Math.hypot,er=Math.log,tr=Math.sin,rr=Math.sign||function(e){return e>0?1:e<0?-1:0},ir=Math.sqrt,nr=Math.tan;function sr(e){return e>1?zt:e<-1?-zt:Math.asin(e)}function ar(e){return(e=tr(e/2))*e}function or(){}function Ar(e,t){e&&ur.hasOwnProperty(e.type)&&ur[e.type](e,t)}var lr={Feature:function(e,t){Ar(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,i=-1,n=r.length;++i<n;)Ar(r[i].geometry,t)}},ur={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var r=e.coordinates,i=-1,n=r.length;++i<n;)e=r[i],t.point(e[0],e[1],e[2])},LineString:function(e,t){hr(e.coordinates,t,0)},MultiLineString:function(e,t){for(var r=e.coordinates,i=-1,n=r.length;++i<n;)hr(r[i],t,0)},Polygon:function(e,t){cr(e.coordinates,t)},MultiPolygon:function(e,t){for(var r=e.coordinates,i=-1,n=r.length;++i<n;)cr(r[i],t)},GeometryCollection:function(e,t){for(var r=e.geometries,i=-1,n=r.length;++i<n;)Ar(r[i],t)}};function hr(e,t,r){var i,n=-1,s=e.length-r;for(t.lineStart();++n<s;)i=e[n],t.point(i[0],i[1],i[2]);t.lineEnd()}function cr(e,t){var r=-1,i=e.length;for(t.polygonStart();++r<i;)hr(e[r],t,1);t.polygonEnd()}function dr(e,t){e&&lr.hasOwnProperty(e.type)?lr[e.type](e,t):Ar(e,t)}var pr,fr,mr,gr,yr,br,xr,vr,_r,wr,Tr,Sr,Mr,Er,Nr,Cr,Rr=new Ae,Br=new Ae,qr={point:or,lineStart:or,lineEnd:or,polygonStart:function(){Rr=new Ae,qr.lineStart=Pr,qr.lineEnd=Dr},polygonEnd:function(){var e=+Rr;Br.add(e<0?jt+e:e),this.lineStart=this.lineEnd=this.point=or},sphere:function(){Br.add(jt)}};function Pr(){qr.point=Ir}function Dr(){Fr(pr,fr)}function Ir(e,t){qr.point=Fr,pr=e,fr=t,mr=e*=Wt,gr=Yt(t=(t*=Wt)/2+Gt),yr=tr(t)}function Fr(e,t){var r=(e*=Wt)-mr,i=r>=0?1:-1,n=i*r,s=Yt(t=(t*=Wt)/2+Gt),a=tr(t),o=yr*a,A=gr*s+o*Yt(n),l=o*i*tr(n);Rr.add(Xt(l,A)),mr=e,gr=s,yr=a}function Or(e){return[Xt(e[1],e[0]),sr(e[2])]}function kr(e){var t=e[0],r=e[1],i=Yt(r);return[i*Yt(t),i*tr(t),tr(r)]}function Lr(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ur(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Vr(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function zr(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Gr(e){var t=ir(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var jr,Hr,Wr,Qr,$r,Xr,Yr,Zr,Kr,Jr,ei,ti,ri,ii,ni,si,ai={point:oi,lineStart:li,lineEnd:ui,polygonStart:function(){ai.point=hi,ai.lineStart=ci,ai.lineEnd=di,Er=new Ae,qr.polygonStart()},polygonEnd:function(){qr.polygonEnd(),ai.point=oi,ai.lineStart=li,ai.lineEnd=ui,Rr<0?(br=-(vr=180),xr=-(_r=90)):Er>Lt?_r=90:Er<-1e-6&&(xr=-90),Cr[0]=br,Cr[1]=vr},sphere:function(){br=-(vr=180),xr=-(_r=90)}};function oi(e,t){Nr.push(Cr=[br=e,vr=e]),t<xr&&(xr=t),t>_r&&(_r=t)}function Ai(e,t){var r=kr([e*Wt,t*Wt]);if(Mr){var i=Ur(Mr,r),n=Ur([i[1],-i[0],0],i);Gr(n),n=Or(n);var s,a=e-wr,o=a>0?1:-1,A=n[0]*Ht*o,l=Qt(a)>180;l^(o*wr<A&&A<o*e)?(s=n[1]*Ht)>_r&&(_r=s):l^(o*wr<(A=(A+360)%360-180)&&A<o*e)?(s=-n[1]*Ht)<xr&&(xr=s):(t<xr&&(xr=t),t>_r&&(_r=t)),l?e<wr?pi(br,e)>pi(br,vr)&&(vr=e):pi(e,vr)>pi(br,vr)&&(br=e):vr>=br?(e<br&&(br=e),e>vr&&(vr=e)):e>wr?pi(br,e)>pi(br,vr)&&(vr=e):pi(e,vr)>pi(br,vr)&&(br=e)}else Nr.push(Cr=[br=e,vr=e]);t<xr&&(xr=t),t>_r&&(_r=t),Mr=r,wr=e}function li(){ai.point=Ai}function ui(){Cr[0]=br,Cr[1]=vr,ai.point=oi,Mr=null}function hi(e,t){if(Mr){var r=e-wr;Er.add(Qt(r)>180?r+(r>0?360:-360):r)}else Tr=e,Sr=t;qr.point(e,t),Ai(e,t)}function ci(){qr.lineStart()}function di(){hi(Tr,Sr),qr.lineEnd(),Qt(E