UNPKG

aframe-globe-component

Version:
2 lines 1.16 MB
// Version 1.17.4 aframe-globe-component - https://github.com/vasturiano/aframe-globe-component#readme !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("three")):"function"==typeof define&&define.amd?define(["three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).THREE)}(this,(function(e){"use strict";function t(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var r="object"==typeof global&&global&&global.Object===Object&&global,i="object"==typeof self&&self&&self.Object===Object&&self,n=r||i||Function("return this")(),s=function(){return n.Date.now()},a=/\s/;var o=/^\s+/;function A(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&a.test(e.charAt(t)););return t}(e)+1).replace(o,""):e}var l=n.Symbol,u=Object.prototype,h=u.hasOwnProperty,c=u.toString,d=l?l.toStringTag:void 0;var p=Object.prototype.toString;var f=l?l.toStringTag:void 0;function m(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":f&&f in Object(e)?function(e){var t=h.call(e,d),r=e[d];try{e[d]=void 0;var i=!0}catch(e){}var n=c.call(e);return i&&(t?e[d]=r:delete e[d]),n}(e):function(e){return p.call(e)}(e)}var g=/^[-+]0x[0-9a-f]+$/i,y=/^0b[01]+$/i,b=/^0o[0-7]+$/i,x=parseInt;function v(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]"==m(e)}(e))return NaN;if(t(e)){var r="function"==typeof e.valueOf?e.valueOf():e;e=t(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=A(e);var i=y.test(e);return i||b.test(e)?x(e.slice(2),i?2:8):g.test(e)?NaN:+e}var _=Math.max,w=Math.min;function T(e,r,i){var n,a,o,A,l,u,h=0,c=!1,d=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var r=n,i=a;return n=a=void 0,h=t,A=e.apply(i,r)}function m(e){var t=e-u;return void 0===u||t>=r||t<0||d&&e-h>=o}function g(){var e=s();if(m(e))return y(e);l=setTimeout(g,function(e){var t=r-(e-u);return d?w(t,o-(e-h)):t}(e))}function y(e){return l=void 0,p&&n?f(e):(n=a=void 0,A)}function b(){var e=s(),t=m(e);if(n=arguments,a=this,u=e,t){if(void 0===l)return function(e){return h=e,l=setTimeout(g,r),c?f(e):A}(u);if(d)return clearTimeout(l),l=setTimeout(g,r),f(u)}return void 0===l&&(l=setTimeout(g,r)),A}return r=v(r)||0,t(i)&&(c=!!i.leading,o=(d="maxWait"in i)?_(v(i.maxWait)||0,r):o,p="trailing"in i?!!i.trailing:p),b.cancel=function(){void 0!==l&&clearTimeout(l),h=0,n=u=a=l=void 0},b.flush=function(){return void 0===l?A:y(s())},b}function M(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 S(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}function E(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 M(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)?M(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 N=S((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 C(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 N(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=T((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=E(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 R=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-R.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*R.Bounce.In(2*e):.5*R.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}}}}),B=function(){return performance.now()},q=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=B()),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}(),P={Linear:function(e,t){var r=e.length-1,i=r*t,n=Math.floor(i),s=P.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}}},D=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),I=new q,F=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=R.Linear.None,this._interpolationFunction=P.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=D.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=I,I.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=B()),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=B()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e),this},e.prototype.resume=function(e){return void 0===e&&(e=B()),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=R.Linear.None),this._easingFunction=e,this},e.prototype.interpolation=function(e){return void 0===e&&(e=P.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=B()),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}();D.nextId;var O=I;function L(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 k(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}O.getAll.bind(O),O.removeAll.bind(O),O.add.bind(O),O.remove.bind(O),O.update.bind(O);const U=(e,t,r,i,n,s)=>Math.sqrt((e-i)**2+(t-n)**2+(r-s)**2);function V(e){return e[0]}function z(e){return e[1]}function G(e){return e[2]}function j(e,t,r,i){var n=new H(null==t?V:t,null==r?z:r,null==i?G:i,NaN,NaN,NaN,NaN,NaN,NaN);return null==e?n:n.addAll(e)}function H(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 W(e){for(var t={data:e.data},r=t;e=e.next;)r=r.next={data:e.data};return t}var Q=j.prototype=H.prototype;function $(e,t){return null==e||null==t?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function X(e,t){return null==e||null==t?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Y(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=$,r=(t,r)=>$(e(t),r),i=(t,r)=>e(t)-r):(t=e===$||e===X?e:Z,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 Z(){return 0}Q.copy=function(){var e,t,r=new H(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=W(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]=W(t));return r},Q.add=function(e){const t=+this._x.call(null,e),r=+this._y.call(null,e),i=+this._z.call(null,e);return L(this.cover(t,r,i),t,r,i,e)},Q.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)L(this,r[s],i[s],n[s],e[s]);return this},Q.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},Q.data=function(){var e=[];return this.visit((function(t){if(!t.length)do{e.push(t.data)}while(t=t.next)})),e},Q.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]]},Q.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 k(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 k(x[7],v,_,w,A,l,u),new k(x[6],s,_,w,v,l,u),new k(x[5],v,a,w,A,_,u),new k(x[4],s,a,w,v,_,u),new k(x[3],v,_,o,A,l,w),new k(x[2],s,_,o,v,l,w),new k(x[1],v,a,o,A,_,w),new k(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),M=t-+this._y.call(null,x.data),S=r-+this._z.call(null,x.data),E=T*T+M*M+S*S;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},Q.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;U(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},Q.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)},Q.removeAll=function(e){for(var t=0,r=e.length;t<r;++t)this.remove(e[t]);return this},Q.root=function(){return this._root},Q.size=function(){var e=0;return this.visit((function(t){if(!t.length)do{++e}while(t=t.next)})),e},Q.visit=function(e){var t,r,i,n,s,a,o,A,l=[],u=this._root;for(u&&l.push(new k(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 k(r,h,c,d,a,o,A)),(r=u[6])&&l.push(new k(r,i,c,d,h,o,A)),(r=u[5])&&l.push(new k(r,h,n,d,a,c,A)),(r=u[4])&&l.push(new k(r,i,n,d,h,c,A)),(r=u[3])&&l.push(new k(r,h,c,s,a,o,d)),(r=u[2])&&l.push(new k(r,i,c,s,h,o,d)),(r=u[1])&&l.push(new k(r,h,n,s,a,c,d)),(r=u[0])&&l.push(new k(r,i,n,s,h,c,d))}return this},Q.visitAfter=function(e){var t,r=[],i=[];for(this._root&&r.push(new k(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 k(s,a,o,A,c,d,p)),(s=n[1])&&r.push(new k(s,c,o,A,l,d,p)),(s=n[2])&&r.push(new k(s,a,d,A,c,u,p)),(s=n[3])&&r.push(new k(s,c,d,A,l,u,p)),(s=n[4])&&r.push(new k(s,a,o,p,c,d,h)),(s=n[5])&&r.push(new k(s,c,o,p,l,d,h)),(s=n[6])&&r.push(new k(s,a,d,p,c,u,h)),(s=n[7])&&r.push(new k(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},Q.x=function(e){return arguments.length?(this._x=e,this):this._x},Q.y=function(e){return arguments.length?(this._y=e,this):this._y},Q.z=function(e){return arguments.length?(this._z=e,this):this._z};const K=Y($).right;function J(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]}Y((function(e){return null===e?NaN:+e})).center;class ee{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 te=Math.sqrt(50),re=Math.sqrt(10),ie=Math.sqrt(2);function ne(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>=te?10:s>=re?5:s>=ie?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?ne(e,t,2*r):[o,A,l]}function se(e,t,r){return ne(e=+e,t=+t,r=+r)[2]}function ae(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}function oe(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 Ae(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function le(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function ue(e,t){var r=Object.create(e.prototype);for(var i in t)r[i]=t[i];return r}function he(){}var ce=.7,de=1/ce,pe="\\s*([+-]?\\d+)\\s*",fe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",me="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ge=/^#([0-9a-f]{3,8})$/,ye=new RegExp(`^rgb\\(${pe},${pe},${pe}\\)$`),be=new RegExp(`^rgb\\(${me},${me},${me}\\)$`),xe=new RegExp(`^rgba\\(${pe},${pe},${pe},${fe}\\)$`),ve=new RegExp(`^rgba\\(${me},${me},${me},${fe}\\)$`),_e=new RegExp(`^hsl\\(${fe},${me},${me}\\)$`),we=new RegExp(`^hsla\\(${fe},${me},${me},${fe}\\)$`),Te={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 Me(){return this.rgb().formatHex()}function Se(){return this.rgb().formatRgb()}function Ee(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=ge.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?Ne(t):3===r?new Be(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?Ce(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?Ce(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=ye.exec(e))?new Be(t[1],t[2],t[3],1):(t=be.exec(e))?new Be(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=xe.exec(e))?Ce(t[1],t[2],t[3],t[4]):(t=ve.exec(e))?Ce(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=_e.exec(e))?Oe(t[1],t[2]/100,t[3]/100,1):(t=we.exec(e))?Oe(t[1],t[2]/100,t[3]/100,t[4]):Te.hasOwnProperty(e)?Ne(Te[e]):"transparent"===e?new Be(NaN,NaN,NaN,0):null}function Ne(e){return new Be(e>>16&255,e>>8&255,255&e,1)}function Ce(e,t,r,i){return i<=0&&(e=t=r=NaN),new Be(e,t,r,i)}function Re(e,t,r,i){return 1===arguments.length?((n=e)instanceof he||(n=Ee(n)),n?new Be((n=n.rgb()).r,n.g,n.b,n.opacity):new Be):new Be(e,t,r,null==i?1:i);var n}function Be(e,t,r,i){this.r=+e,this.g=+t,this.b=+r,this.opacity=+i}function qe(){return`#${Fe(this.r)}${Fe(this.g)}${Fe(this.b)}`}function Pe(){const e=De(this.opacity);return`${1===e?"rgb(":"rgba("}${Ie(this.r)}, ${Ie(this.g)}, ${Ie(this.b)}${1===e?")":`, ${e})`}`}function De(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ie(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Fe(e){return((e=Ie(e))<16?"0":"")+e.toString(16)}function Oe(e,t,r,i){return i<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new ke(e,t,r,i)}function Le(e){if(e instanceof ke)return new ke(e.h,e.s,e.l,e.opacity);if(e instanceof he||(e=Ee(e)),!e)return new ke;if(e instanceof ke)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 ke(a,o,A,e.opacity)}function ke(e,t,r,i){this.h=+e,this.s=+t,this.l=+r,this.opacity=+i}function Ue(e){return(e=(e||0)%360)<0?e+360:e}function Ve(e){return Math.max(0,Math.min(1,e||0))}function ze(e,t,r){return 255*(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)}le(he,Ee,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Me,formatHex:Me,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Le(this).formatHsl()},formatRgb:Se,toString:Se}),le(Be,Re,ue(he,{brighter(e){return e=null==e?de:Math.pow(de,e),new Be(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?ce:Math.pow(ce,e),new Be(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Be(Ie(this.r),Ie(this.g),Ie(this.b),De(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:qe,formatHex:qe,formatHex8:function(){return`#${Fe(this.r)}${Fe(this.g)}${Fe(this.b)}${Fe(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Pe,toString:Pe})),le(ke,(function(e,t,r,i){return 1===arguments.length?Le(e):new ke(e,t,r,null==i?1:i)}),ue(he,{brighter(e){return e=null==e?de:Math.pow(de,e),new ke(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?ce:Math.pow(ce,e),new ke(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 Be(ze(e>=240?e-240:e+120,n,i),ze(e,n,i),ze(e<120?e+240:e-120,n,i),this.opacity)},clamp(){return new ke(Ue(this.h),Ve(this.s),Ve(this.l),De(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=De(this.opacity);return`${1===e?"hsl(":"hsla("}${Ue(this.h)}, ${100*Ve(this.s)}%, ${100*Ve(this.l)}%${1===e?")":`, ${e})`}`}}));var Ge=e=>()=>e;function je(e){return 1==(e=+e)?He: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):Ge(isNaN(t)?r:t)}}function He(e,t){var r=t-e;return r?function(e,t){return function(r){return e+r*t}}(e,r):Ge(isNaN(e)?t:e)}var We=function e(t){var r=je(t);function i(e,t){var i=r((e=Re(e)).r,(t=Re(t)).r),n=r(e.g,t.g),s=r(e.b,t.b),a=He(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 Qe(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 $e(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Xe(e,t){return($e(t)?Qe:Ye)(e,t)}function Ye(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]=it(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 Ze(e,t){var r=new Date;return e=+e,t=+t,function(i){return r.setTime(e*(1-i)+t*i),r}}function Ke(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function Je(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]=it(e[r],t[r]):n[r]=t[r];return function(e){for(r in i)n[r]=i[r](e);return n}}var et=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tt=new RegExp(et.source,"g");function rt(e,t){var r,i,n,s=et.lastIndex=tt.lastIndex=0,a=-1,o=[],A=[];for(e+="",t+="";(r=et.exec(e))&&(i=tt.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:Ke(r,i)})),s=tt.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 it(e,t){var r,i=typeof t;return null==t||"boolean"===i?Ge(t):("number"===i?Ke:"string"===i?(r=Ee(t))?(t=r,We):rt:t instanceof Ee?We:t instanceof Date?Ze:$e(t)?Qe:Array.isArray(t)?Ye:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?Je:Ke)(e,t)}function nt(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function st(e){return+e}var at=[0,1];function ot(e){return e}function At(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:(r=isNaN(t)?NaN:.5,function(){return r});var r}function lt(e,t,r){var i=e[0],n=e[1],s=t[0],a=t[1];return n<i?(i=At(n,i),s=r(a,s)):(i=At(i,n),s=r(s,a)),function(e){return s(i(e))}}function ut(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]=At(e[a],e[a+1]),s[a]=r(t[a],t[a+1]);return function(t){var r=K(e,t,1,i)-1;return s[r](n[r](t))}}function ht(){var e,t,r,i,n,s,a=at,o=at,A=it,l=ot;function u(){var e,t,r,A=Math.min(a.length,o.length);return l!==ot&&(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?ut:lt,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),Ke)))(r)))},h.domain=function(e){return arguments.length?(a=Array.from(e,st),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=nt,u()},h.clamp=function(e){return arguments.length?(l=!!e||ot,u()):l!==ot},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 ct(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 dt(e){return(e=ct(Math.abs(e)))?e[1]:NaN}var pt,ft=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function mt(e){if(!(t=ft.exec(e)))throw new Error("invalid format: "+e);var t;return new gt({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 gt(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 yt(e,t){var r=ct(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")}mt.prototype=gt.prototype,gt.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 bt={"%":(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)=>yt(100*e,t),r:yt,s:function(e,t){var r=ct(e,t);if(!r)return e+"";var i=r[0],n=r[1],s=n-(pt=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")+ct(e,Math.max(0,t+s-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function xt(e){return e}var vt,_t,wt,Tt=Array.prototype.map,Mt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function St(e){var t,r,i=void 0===e.grouping||void 0===e.thousands?xt:(t=Tt.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?xt:function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(Tt.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=mt(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"):bt[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=bt[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?Mt[8+pt/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 M=c.length+e.length+w.length,S=M<p?new Array(p-M+1).join(t):"";switch(f&&d&&(e=i(S+e,S.length?p-w.length:1/0),S=""),r){case"<":e=c+e+w+S;break;case"=":e=c+S+e+w;break;case"^":e=S.slice(0,M=S.length>>1)+c+e+w+S.slice(M);break;default:e=S+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=mt(e)).type="f",e)),i=3*Math.max(-8,Math.min(8,Math.floor(dt(t)/3))),n=Math.pow(10,-i),s=Mt[8+i/3];return function(e){return r(n*e)+s}}}}function Et(e,t,r,i){var n,s=function(e,t,r){r=+r;const i=(t=+t)<(e=+e),n=i?se(t,e,r):se(e,t,r);return(i?-1:1)*(n<0?1/-n:n)}(e,t,r);switch((i=mt(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(dt(t)/3)))-dt(Math.abs(e)))}(s,a))||(i.precision=n),wt(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,dt(t)-dt(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,-dt(Math.abs(e)))}(s))||(i.precision=n-2*("%"===i.type))}return _t(i)}function Nt(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?ne(t,e,r):ne(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 Et(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=se(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 Ct(){var e=ht()(ot,ot);return e.copy=function(){return t=e,Ct().domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());var t},Ae.apply(e,arguments),Nt(e)}function Rt(){var e,t=0,r=1,i=1,n=[.5],s=[0,1];function a(t){return null!=t&&t<=t?s[K(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 Rt().domain([t,r]).range(s).unknown(e)},Ae.apply(Nt(a),arguments)}vt=St({thousands:",",grouping:[3],currency:["$",""]}),_t=vt.format,wt=vt.formatPrefix;var Bt=1e-6,qt=1e-12,Pt=Math.PI,Dt=Pt/2,It=Pt/4,Ft=2*Pt,Ot=180/Pt,Lt=Pt/180,kt=Math.abs,Ut=Math.atan,Vt=Math.atan2,zt=Math.cos,Gt=Math.ceil,jt=Math.exp,Ht=Math.hypot,Wt=Math.log,Qt=Math.sin,$t=Math.sign||function(e){return e>0?1:e<0?-1:0},Xt=Math.sqrt,Yt=Math.tan;function Zt(e){return e>1?Dt:e<-1?-Dt:Math.asin(e)}function Kt(e){return(e=Qt(e/2))*e}function Jt(){}function er(e,t){e&&rr.hasOwnProperty(e.type)&&rr[e.type](e,t)}var tr={Feature:function(e,t){er(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,i=-1,n=r.length;++i<n;)er(r[i].geometry,t)}},rr={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){ir(e.coordinates,t,0)},MultiLineString:function(e,t){for(var r=e.coordinates,i=-1,n=r.length;++i<n;)ir(r[i],t,0)},Polygon:function(e,t){nr(e.coordinates,t)},MultiPolygon:function(e,t){for(var r=e.coordinates,i=-1,n=r.length;++i<n;)nr(r[i],t)},GeometryCollection:function(e,t){for(var r=e.geometries,i=-1,n=r.length;++i<n;)er(r[i],t)}};function ir(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 nr(e,t){var r=-1,i=e.length;for(t.polygonStart();++r<i;)ir(e[r],t,1);t.polygonEnd()}function sr(e,t){e&&tr.hasOwnProperty(e.type)?tr[e.type](e,t):er(e,t)}var ar,or,Ar,lr,ur,hr,cr,dr,pr,fr,mr,gr,yr,br,xr,vr,_r=new ee,wr=new ee,Tr={point:Jt,lineStart:Jt,lineEnd:Jt,polygonStart:function(){_r=new ee,Tr.lineStart=Mr,Tr.lineEnd=Sr},polygonEnd:function(){var e=+_r;wr.add(e<0?Ft+e:e),this.lineStart=this.lineEnd=this.point=Jt},sphere:function(){wr.add(Ft)}};function Mr(){Tr.point=Er}function Sr(){Nr(ar,or)}function Er(e,t){Tr.point=Nr,ar=e,or=t,Ar=e*=Lt,lr=zt(t=(t*=Lt)/2+It),ur=Qt(t)}function Nr(e,t){var r=(e*=Lt)-Ar,i=r>=0?1:-1,n=i*r,s=zt(t=(t*=Lt)/2+It),a=Qt(t),o=ur*a,A=lr*s+o*zt(n),l=o*i*Qt(n);_r.add(Vt(l,A)),Ar=e,lr=s,ur=a}function Cr(e){return[Vt(e[1],e[0]),Zt(e[2])]}function Rr(e){var t=e[0],r=e[1],i=zt(r);return[i*zt(t),i*Qt(t),Qt(r)]}function Br(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function qr(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 Pr(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Dr(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ir(e){var t=Xt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Fr,Or,Lr,kr,Ur,Vr,zr,Gr,jr,Hr,Wr,Qr,$r,Xr,Yr,Zr,Kr={point:Jr,lineStart:ti,lineEnd:ri,polygonStart:function(){Kr.point=ii,Kr.lineStart=ni,Kr.lineEnd=si,br=new ee,Tr.polygonStart()},polygonEnd:function(){Tr.polygonEnd(),Kr.point=Jr,Kr.lineStart=ti,Kr.lineEnd=ri,_r<0?(hr=-(dr=180),cr=-(pr=90)):br>Bt?pr=90:br<-1e-6&&(cr=-90),vr[0]=hr,vr[1]=dr},sphere:function(){hr=-(dr=180),cr=-(pr=90)}};function Jr(e,t){xr.push(vr=[hr=e,dr=e]),t<cr&&(cr=t),t>pr&&(pr=t)}function ei(e,t){var r=Rr([e*Lt,t*Lt]);if(yr){var i=qr(yr,r),n=qr([i[1],-i[0],0],i);Ir(n),n=Cr(n);var s,a=e-fr,o=a>0?1:-1,A=n[0]*Ot*o,l=kt(a)>180;l^(o*fr<A&&A<o*e)?(s=n[1]*Ot)>pr&&(pr=s):l^(o*fr<(A=(A+360)%360-180)&&A<o*e)?(s=-n[1]*Ot)<cr&&(cr=s):(t<cr&&(cr=t),t>pr&&(pr=t)),l?e<fr?ai(hr,e)>ai(hr,dr)&&(dr=e):ai(e,dr)>ai(hr,dr)&&(hr=e):dr>=hr?(e<hr&&(hr=e),e>dr&&(dr=e)):e>fr?ai(hr,e)>ai(hr,dr)&&(dr=e):ai(e,dr)>ai(hr,dr)&&(hr=e)}else xr.push(vr=[hr=e,dr=e]);t<cr&&(cr=t),t>pr&&(pr=t),yr=r,fr=e}function ti(){Kr.point=ei}function ri(){vr[0]=hr,vr[1]=dr,Kr.point=Jr,yr=null}function ii(e,t){if(yr){var r=e-fr;br.add(kt(r)>180?r+(r>0?360:-360):r)}else mr=e,gr=t;Tr.point(e,t),ei(e,t)}function ni(){Tr.lineStart()}function si(){ii(mr,gr),Tr.lineEnd(),kt(br)>Bt&&(hr=-(dr=180)),vr[0]=hr,vr[1]=dr,yr=null}function ai(e,t){return(t-=e)<0?t+360:t}function oi(e,t){return e[0]-t[0]}function Ai(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}function li(e){var t,r,i,n,s,a,o;if(pr=dr=-(hr=cr=1/0),xr=[],sr(e,Kr),r=xr.length){for(xr.sort(oi),t=1,s=[i=xr[0]];t<r;++t)Ai(i,(n=xr[t])[0])||Ai(i,n[1])?(ai(i[0],n[1])>ai(i[0],i[1])&&(i[1]=n[1]),ai(n[0],i[1])>ai(i[0],i[1])&&(i[0]=n[0])):s.push(i=n);for(a=-1/0,t=0,i=s[r=s.length-1];t<=r;i=n,++t)n=s[t],(o=ai(i[1],n[0]))>a&&(a=o,hr=n[0],dr=i[1])}return xr=vr=null,hr===1/0||cr===1/0?[[NaN,NaN],[NaN,NaN]]:[[hr,cr],[dr,pr]]}var ui={sphere:Jt,point:hi,lineStart:di,lineEnd:mi,polygonStart:function(){ui.lineStart=gi,ui.lineEnd=yi},polygonEnd:function(){ui.lineStart=di,ui.lineEnd=mi}};function hi(e,t){e*=Lt;var r=zt(t*=Lt);ci(r*zt(e),r*Qt(e),Qt(t))}function ci(e,t,r){++Fr,Lr+=(e-Lr)/Fr,kr+=(t-kr)/Fr,Ur+=(r-Ur)/Fr}function di(){ui.point=pi}function pi(e,t){e*=Lt;var r=zt(t*=Lt);Xr=r*zt(e),Yr=r*Qt(e),Zr=Qt(t),ui.point=fi,ci(Xr,Yr,Zr)}function fi(e,t){e*=Lt;var r=zt(t*=Lt),i=r*zt(e),n=r*Qt(e),s=Qt(t),a=Vt(Xt((a=Yr*s-Zr*n)*a+(a=Zr*i-Xr*s)*a+(a=Xr*n-Yr*i)*a),Xr*i+Yr*n+Zr*s);Or+=a,Vr+=a*(Xr+(Xr=i)),zr+=a*(Yr+(Yr=n)),Gr+=a*(Zr+(Zr=s)),ci(Xr,Yr,Zr)}function mi(){ui.point=hi}function gi(){ui.point=bi}function yi(){xi(Qr,$r),ui.point=hi}function bi(e,t){Qr=e,$r=t,e*=Lt,t*=Lt,ui.point=xi;var r=zt(t);Xr=r*zt(e),Yr=r*Qt(e),Zr=Qt(t),ci(Xr,Yr,Zr)}function xi(e,t){e*=Lt;var r=zt(t*=Lt),i=r*zt(e),n=r*Qt(e),s=Qt(t),a=Yr*s-Zr*n,o=Zr*i-Xr*s,A=Xr*n-Yr*i,l=Ht(a,o,A),u=Zt(l),h=l&&-u/l;jr.add(h*a),Hr.add(h*o),Wr.add(h*A),Or+=u,Vr+=u*(Xr+(Xr=i)),zr+=u*(Yr+(Yr=n)),Gr+=u*(Zr+(Zr=s)),ci(Xr,Yr,Zr)}function vi(e){Fr=Or=Lr=kr=Ur=Vr=zr=Gr=0,jr=new ee,Hr=new ee,Wr=new ee,sr(e,ui);var t=+jr,r=+Hr,i=+Wr,n=Ht(t,r,i);return n<qt&&(t=Vr,r=zr,i=Gr,Or<Bt&&(t=Lr,r=kr,i=Ur),(n=Ht(t,r,i))<qt)?[NaN,NaN]:[Vt(r,t)*Ot,Zt(i/n)*Ot]}function _i(e,t){function r(r,i){return r=e(r,i),t(r[0],r[1])}return e.invert&&t.invert&&(r.invert=function(r,i){return(r=t.invert(r,i))&&e.invert(r[0],r[1])}),r}function wi(e,t){return kt(e)>Pt&&(e-=Math.round(e/Ft)*Ft),[e,t]}function Ti(e,t,r){return(e%=Ft)?t||r?_i(Si(e),Ei(t,r)):Si(e):t||r?Ei(t,r):wi}function Mi(e){return function(t,r){return kt(t+=e)>Pt&&(t-=Math.round(t/Ft)*Ft),[t,r]}}function Si(e){var t=Mi(e);return t.invert=Mi(-e),t}function Ei(e,t){var r=zt(e),i=Qt(e),n=zt(t),s=Qt(t);function a(e,t){var a=zt(t),o=zt(e)*a,A=Qt(e)*a,l=Qt(t),u=l*r+o*i;return