cool-globe 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,16 +19,21 @@
19
19
  ## Installation
20
20
 
21
21
  ```bash
22
- npm install cool-globe
22
+ npm install cool-globe react-globe.gl three
23
23
  ```
24
24
 
25
- ## Peer dependencies
25
+ > `react`, `react-dom`, `react-globe.gl` and `three` are **peer dependencies** — they must be installed by the consuming app. This guarantees a single shared `three.js` instance in the page (multiple `three` copies break WebGL state, materials and shaders).
26
26
 
27
- Install these in the consuming app:
27
+ ### Peer dependency versions
28
28
 
29
29
  - `react` (`^18 || ^19`)
30
30
  - `react-dom` (`^18 || ^19`)
31
- - `react-globe.gl` (`^2`)
31
+ - `react-globe.gl` (`^2.37.1`)
32
+ - `three` (`^0.180.0`)
33
+
34
+ ### Requirements
35
+
36
+ - Node.js `>= 18`
32
37
 
33
38
  ## Basic usage
34
39
 
@@ -63,7 +68,11 @@ export default function Example() {
63
68
  >
64
69
  Reset globe
65
70
  </button>
66
- <CoolGlobe statisticsData={statisticsData} resetSignal={resetSignal} />
71
+ <CoolGlobe
72
+ statisticsData={statisticsData}
73
+ resetSignal={resetSignal}
74
+ preselectedCountry="LT"
75
+ />
67
76
  </div>
68
77
  );
69
78
  }
@@ -72,7 +81,8 @@ export default function Example() {
72
81
  ## Props
73
82
 
74
83
  - `statisticsData` (required): country/region metric tree.
75
- - `resetSignal` (optional): when this value changes, globe view and selection state reset to default.
84
+ - `resetSignal` (optional): when this value changes, globe view and selection state reset. With `preselectedCountry`, reset returns to that country instead of the world view.
85
+ - `preselectedCountry` (optional): ISO 3166-1 alpha-2 code (e.g. `"LT"`). Auto-selects and zooms to this country once geo data and the globe are ready.
76
86
  - `primaryMetric` (optional, default: `"visits"`): metric key used for color scale.
77
87
  - `colorScale` (optional): `{ minColor, maxColor }`.
78
88
  - `countryNumericToIsoMap` (optional): fallback mapping from numeric country ids to ISO2.
@@ -1,4 +1,16 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ze=require("react/jsx-runtime"),C=require("react"),vt=require("react-globe.gl");function Et(t){return t}function Nt(t){if(t==null)return Et;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],s=t.translate[1];return function(a,c){c||(e=n=0);var u=2,f=a.length,l=new Array(f);for(l[0]=(e+=a[0])*r+o,l[1]=(n+=a[1])*i+s;u<f;)l[u]=a[u],++u;return l}}function At(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n}function St(t,e){return typeof e=="string"&&(e=t.objects[e]),e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(n){return Ue(t,n)})}:Ue(t,e)}function Ue(t,e){var n=e.id,r=e.bbox,i=e.properties==null?{}:e.properties,o=Rt(t,e);return n==null&&r==null?{type:"Feature",properties:i,geometry:o}:r==null?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}function Rt(t,e){var n=Nt(t.transform),r=t.arcs;function i(f,l){l.length&&l.pop();for(var g=r[f<0?~f:f],w=0,y=g.length;w<y;++w)l.push(n(g[w],w));f<0&&At(l,y)}function o(f){return n(f)}function s(f){for(var l=[],g=0,w=f.length;g<w;++g)i(f[g],l);return l.length<2&&l.push(l[0]),l}function a(f){for(var l=s(f);l.length<4;)l.push(l[0]);return l}function c(f){return f.map(a)}function u(f){var l=f.type,g;switch(l){case"GeometryCollection":return{type:l,geometries:f.geometries.map(u)};case"Point":g=o(f.coordinates);break;case"MultiPoint":g=f.coordinates.map(o);break;case"LineString":g=s(f.arcs);break;case"MultiLineString":g=f.arcs.map(s);break;case"Polygon":g=c(f.arcs);break;case"MultiPolygon":g=f.arcs.map(c);break;default:return null}return{type:l,coordinates:g}}return u(e)}const gt="180",_t="",$="srgb",Ve="srgb-linear",Ze="linear",Ee="srgb";function ne(t,e,n){return Math.max(e,Math.min(n,t))}function Lt(t,e){return(t%e+e)%e}function Ne(t,e,n){return(1-n)*t+n*e}class ae{constructor(e,n,r,i,o,s,a,c,u){ae.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,o,s,a,c,u)}set(e,n,r,i,o,s,a,c,u){const f=this.elements;return f[0]=e,f[1]=i,f[2]=a,f[3]=n,f[4]=o,f[5]=c,f[6]=r,f[7]=s,f[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,o=this.elements,s=r[0],a=r[3],c=r[6],u=r[1],f=r[4],l=r[7],g=r[2],w=r[5],y=r[8],F=i[0],_=i[3],R=i[6],O=i[1],T=i[4],E=i[7],G=i[2],k=i[5],I=i[8];return o[0]=s*F+a*O+c*G,o[3]=s*_+a*T+c*k,o[6]=s*R+a*E+c*I,o[1]=u*F+f*O+l*G,o[4]=u*_+f*T+l*k,o[7]=u*R+f*E+l*I,o[2]=g*F+w*O+y*G,o[5]=g*_+w*T+y*k,o[8]=g*R+w*E+y*I,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],f=e[8];return n*s*f-n*a*u-r*o*f+r*a*c+i*o*u-i*s*c}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],f=e[8],l=f*s-a*u,g=a*c-f*o,w=u*o-s*c,y=n*l+r*g+i*w;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const F=1/y;return e[0]=l*F,e[1]=(i*u-f*r)*F,e[2]=(a*r-i*s)*F,e[3]=g*F,e[4]=(f*n-i*c)*F,e[5]=(i*o-a*n)*F,e[6]=w*F,e[7]=(r*c-u*n)*F,e[8]=(s*n-r*o)*F,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,o,s,a){const c=Math.cos(o),u=Math.sin(o);return this.set(r*c,r*u,-r*(c*s+u*a)+s+e,-i*u,i*c,-i*(-u*s+c*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(Ae.makeScale(e,n)),this}rotate(e){return this.premultiply(Ae.makeRotation(-e)),this}translate(e,n){return this.premultiply(Ae.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Ae=new ae,Ye={};function Xe(t){t in Ye||(Ye[t]=!0,console.warn(t))}const We=new ae().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Je=new ae().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Bt(){const t={enabled:!0,workingColorSpace:Ve,spaces:{},convert:function(i,o,s){return this.enabled===!1||o===s||!o||!s||(this.spaces[o].transfer===Ee&&(i.r=W(i.r),i.g=W(i.g),i.b=W(i.b)),this.spaces[o].primaries!==this.spaces[s].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===Ee&&(i.r=J(i.r),i.g=J(i.g),i.b=J(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===_t?Ze:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,s){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return Xe("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return Xe("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(i,o)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return t.define({[Ve]:{primaries:e,whitePoint:r,transfer:Ze,toXYZ:We,fromXYZ:Je,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:$},outputColorSpaceConfig:{drawingBufferColorSpace:$}},[$]:{primaries:e,whitePoint:r,transfer:Ee,toXYZ:We,fromXYZ:Je,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:$}}}),t}const B=Bt();function W(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function J(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}const dt={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},q={h:0,s:0,l:0},ge={h:0,s:0,l:0};function Se(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}let re=class{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=$){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,B.colorSpaceToWorking(this,n),this}setRGB(e,n,r,i=B.workingColorSpace){return this.r=e,this.g=n,this.b=r,B.colorSpaceToWorking(this,i),this}setHSL(e,n,r,i=B.workingColorSpace){if(e=Lt(e,1),n=ne(n,0,1),r=ne(r,0,1),n===0)this.r=this.g=this.b=r;else{const o=r<=.5?r*(1+n):r+n-r*n,s=2*r-o;this.r=Se(s,o,e+1/3),this.g=Se(s,o,e),this.b=Se(s,o,e-1/3)}return B.colorSpaceToWorking(this,i),this}setStyle(e,n=$){function r(o){o!==void 0&&parseFloat(o)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,n);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,n);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=i[1],s=o.length;if(s===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,n);if(s===6)return this.setHex(parseInt(o,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=$){const r=dt[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=W(e.r),this.g=W(e.g),this.b=W(e.b),this}copyLinearToSRGB(e){return this.r=J(e.r),this.g=J(e.g),this.b=J(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=$){return B.workingToColorSpace(v.copy(this),e),Math.round(ne(v.r*255,0,255))*65536+Math.round(ne(v.g*255,0,255))*256+Math.round(ne(v.b*255,0,255))}getHexString(e=$){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=B.workingColorSpace){B.workingToColorSpace(v.copy(this),n);const r=v.r,i=v.g,o=v.b,s=Math.max(r,i,o),a=Math.min(r,i,o);let c,u;const f=(a+s)/2;if(a===s)c=0,u=0;else{const l=s-a;switch(u=f<=.5?l/(s+a):l/(2-s-a),s){case r:c=(i-o)/l+(i<o?6:0);break;case i:c=(o-r)/l+2;break;case o:c=(r-i)/l+4;break}c/=6}return e.h=c,e.s=u,e.l=f,e}getRGB(e,n=B.workingColorSpace){return B.workingToColorSpace(v.copy(this),n),e.r=v.r,e.g=v.g,e.b=v.b,e}getStyle(e=$){B.workingToColorSpace(v.copy(this),e);const n=v.r,r=v.g,i=v.b;return e!==$?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(q),this.setHSL(q.h+e,q.s+n,q.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(q),e.getHSL(ge);const r=Ne(q.h,ge.h,n),i=Ne(q.s,ge.s,n),o=Ne(q.l,ge.l,n);return this.setHSL(r,i,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,o=e.elements;return this.r=o[0]*n+o[3]*r+o[6]*i,this.g=o[1]*n+o[4]*r+o[7]*i,this.b=o[2]*n+o[5]*r+o[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}};const v=new re;re.NAMES=dt;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:gt}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=gt);const $t="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_110m_admin_0_countries.geojson",Dt="https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json",Tt="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_admin_1_states_provinces.geojson",It="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='4' height='4'><rect width='4' height='4' fill='%23f5f5f5'/></svg>",Ht={minColor:"#f8fafc",maxColor:"#e5e7eb"};function He(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function mt(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function ue(){}var ie=.7,be=1/ie,Q="\\s*([+-]?\\d+)\\s*",oe="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",j="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",jt=/^#([0-9a-f]{3,8})$/,Ot=new RegExp(`^rgb\\(${Q},${Q},${Q}\\)$`),Pt=new RegExp(`^rgb\\(${j},${j},${j}\\)$`),Gt=new RegExp(`^rgba\\(${Q},${Q},${Q},${oe}\\)$`),qt=new RegExp(`^rgba\\(${j},${j},${j},${oe}\\)$`),zt=new RegExp(`^hsl\\(${oe},${j},${j}\\)$`),Ut=new RegExp(`^hsla\\(${oe},${j},${j},${oe}\\)$`),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};He(ue,se,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ke,formatHex:Ke,formatHex8:Vt,formatHsl:Zt,formatRgb:et,toString:et});function Ke(){return this.rgb().formatHex()}function Vt(){return this.rgb().formatHex8()}function Zt(){return xt(this).formatHsl()}function et(){return this.rgb().formatRgb()}function se(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=jt.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?tt(e):n===3?new S(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?de(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?de(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Ot.exec(t))?new S(e[1],e[2],e[3],1):(e=Pt.exec(t))?new S(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Gt.exec(t))?de(e[1],e[2],e[3],e[4]):(e=qt.exec(t))?de(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=zt.exec(t))?it(e[1],e[2]/100,e[3]/100,1):(e=Ut.exec(t))?it(e[1],e[2]/100,e[3]/100,e[4]):Qe.hasOwnProperty(t)?tt(Qe[t]):t==="transparent"?new S(NaN,NaN,NaN,0):null}function tt(t){return new S(t>>16&255,t>>8&255,t&255,1)}function de(t,e,n,r){return r<=0&&(t=e=n=NaN),new S(t,e,n,r)}function Yt(t){return t instanceof ue||(t=se(t)),t?(t=t.rgb(),new S(t.r,t.g,t.b,t.opacity)):new S}function Be(t,e,n,r){return arguments.length===1?Yt(t):new S(t,e,n,r??1)}function S(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}He(S,Be,mt(ue,{brighter(t){return t=t==null?be:Math.pow(be,t),new S(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ie:Math.pow(ie,t),new S(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new S(Z(this.r),Z(this.g),Z(this.b),we(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:nt,formatHex:nt,formatHex8:Xt,formatRgb:rt,toString:rt}));function nt(){return`#${V(this.r)}${V(this.g)}${V(this.b)}`}function Xt(){return`#${V(this.r)}${V(this.g)}${V(this.b)}${V((isNaN(this.opacity)?1:this.opacity)*255)}`}function rt(){const t=we(this.opacity);return`${t===1?"rgb(":"rgba("}${Z(this.r)}, ${Z(this.g)}, ${Z(this.b)}${t===1?")":`, ${t})`}`}function we(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Z(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function V(t){return t=Z(t),(t<16?"0":"")+t.toString(16)}function it(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new D(t,e,n,r)}function xt(t){if(t instanceof D)return new D(t.h,t.s,t.l,t.opacity);if(t instanceof ue||(t=se(t)),!t)return new D;if(t instanceof D)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(e===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-e)/a+2:s=(e-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new D(s,a,c,t.opacity)}function Wt(t,e,n,r){return arguments.length===1?xt(t):new D(t,e,n,r??1)}function D(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}He(D,Wt,mt(ue,{brighter(t){return t=t==null?be:Math.pow(be,t),new D(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ie:Math.pow(ie,t),new D(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new S(Re(t>=240?t-240:t+120,i,r),Re(t,i,r),Re(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new D(ot(this.h),me(this.s),me(this.l),we(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 t=we(this.opacity);return`${t===1?"hsl(":"hsla("}${ot(this.h)}, ${me(this.s)*100}%, ${me(this.l)*100}%${t===1?")":`, ${t})`}`}}));function ot(t){return t=(t||0)%360,t<0?t+360:t}function me(t){return Math.max(0,Math.min(1,t||0))}function Re(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const je=t=>()=>t;function Jt(t,e){return function(n){return t+n*e}}function Qt(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Kt(t){return(t=+t)==1?pt:function(e,n){return n-e?Qt(e,n,t):je(isNaN(e)?n:e)}}function pt(t,e){var n=e-t;return n?Jt(t,n):je(isNaN(t)?e:t)}const $e=(function t(e){var n=Kt(e);function r(i,o){var s=n((i=Be(i)).r,(o=Be(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),u=pt(i.opacity,o.opacity);return function(f){return i.r=s(f),i.g=a(f),i.b=c(f),i.opacity=u(f),i+""}}return r.gamma=t,r})(1);function en(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=t[i]*(1-o)+e[i]*o;return r}}function tn(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function nn(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,i=new Array(r),o=new Array(n),s;for(s=0;s<r;++s)i[s]=Oe(t[s],e[s]);for(;s<n;++s)o[s]=e[s];return function(a){for(s=0;s<r;++s)o[s]=i[s](a);return o}}function rn(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function ye(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function on(t,e){var n={},r={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=Oe(t[i],e[i]):r[i]=e[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var De=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_e=new RegExp(De.source,"g");function sn(t){return function(){return t}}function an(t){return function(e){return t(e)+""}}function un(t,e){var n=De.lastIndex=_e.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(t=t+"",e=e+"";(r=De.exec(t))&&(i=_e.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:ye(r,i)})),n=_e.lastIndex;return n<e.length&&(o=e.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?an(c[0].x):sn(e):(e=c.length,function(u){for(var f=0,l;f<e;++f)a[(l=c[f]).i]=l.x(u);return a.join("")})}function Oe(t,e){var n=typeof e,r;return e==null||n==="boolean"?je(e):(n==="number"?ye:n==="string"?(r=se(e))?(e=r,$e):un:e instanceof se?$e:e instanceof Date?rn:tn(e)?en:Array.isArray(e)?nn:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?on:ye)(t,e)}function cn(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}function pe(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function fn(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function bt(t){let e,n,r;t.length!==2?(e=pe,n=(a,c)=>pe(t(a),c),r=(a,c)=>t(a)-c):(e=t===pe||t===fn?t:ln,n=t,r=t);function i(a,c,u=0,f=a.length){if(u<f){if(e(c,c)!==0)return f;do{const l=u+f>>>1;n(a[l],c)<0?u=l+1:f=l}while(u<f)}return u}function o(a,c,u=0,f=a.length){if(u<f){if(e(c,c)!==0)return f;do{const l=u+f>>>1;n(a[l],c)<=0?u=l+1:f=l}while(u<f)}return u}function s(a,c,u=0,f=a.length){const l=i(a,c,u,f-1);return l>u&&r(a[l-1],c)>-r(a[l],c)?l-1:l}return{left:i,center:s,right:o}}function ln(){return 0}function hn(t){return t===null?NaN:+t}const gn=bt(pe),dn=gn.right;bt(hn).center;const mn=Math.sqrt(50),xn=Math.sqrt(10),pn=Math.sqrt(2);function Fe(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=mn?10:o>=xn?5:o>=pn?2:1;let a,c,u;return i<0?(u=Math.pow(10,-i)/s,a=Math.round(t*u),c=Math.round(e*u),a/u<t&&++a,c/u>e&&--c,u=-u):(u=Math.pow(10,i)*s,a=Math.round(t/u),c=Math.round(e/u),a*u<t&&++a,c*u>e&&--c),c<a&&.5<=n&&n<2?Fe(t,e,n*2):[a,c,u]}function bn(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[i,o,s]=r?Fe(e,t,n):Fe(t,e,n);if(!(o>=i))return[];const a=o-i+1,c=new Array(a);if(r)if(s<0)for(let u=0;u<a;++u)c[u]=(o-u)/-s;else for(let u=0;u<a;++u)c[u]=(o-u)*s;else if(s<0)for(let u=0;u<a;++u)c[u]=(i+u)/-s;else for(let u=0;u<a;++u)c[u]=(i+u)*s;return c}function Te(t,e,n){return e=+e,t=+t,n=+n,Fe(t,e,n)[2]}function wn(t,e,n){e=+e,t=+t,n=+n;const r=e<t,i=r?Te(e,t,n):Te(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function yn(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function Fn(t){return function(){return t}}function Cn(t){return+t}var st=[0,1];function X(t){return t}function Ie(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:Fn(isNaN(e)?NaN:.5)}function Mn(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function kn(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1];return i<r?(r=Ie(i,r),o=n(s,o)):(r=Ie(r,i),o=n(o,s)),function(a){return o(r(a))}}function vn(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)i[s]=Ie(t[s],t[s+1]),o[s]=n(e[s],e[s+1]);return function(a){var c=dn(t,a,1,r)-1;return o[c](i[c](a))}}function En(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Nn(){var t=st,e=st,n=Oe,r,i,o,s=X,a,c,u;function f(){var g=Math.min(t.length,e.length);return s!==X&&(s=Mn(t[0],t[g-1])),a=g>2?vn:kn,c=u=null,l}function l(g){return g==null||isNaN(g=+g)?o:(c||(c=a(t.map(r),e,n)))(r(s(g)))}return l.invert=function(g){return s(i((u||(u=a(e,t.map(r),ye)))(g)))},l.domain=function(g){return arguments.length?(t=Array.from(g,Cn),f()):t.slice()},l.range=function(g){return arguments.length?(e=Array.from(g),f()):e.slice()},l.rangeRound=function(g){return e=Array.from(g),n=cn,f()},l.clamp=function(g){return arguments.length?(s=g?!0:X,f()):s!==X},l.interpolate=function(g){return arguments.length?(n=g,f()):n},l.unknown=function(g){return arguments.length?(o=g,l):o},function(g,w){return r=g,i=w,f()}}function An(){return Nn()(X,X)}function Sn(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Ce(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function K(t){return t=Ce(Math.abs(t)),t?t[1]:NaN}function Rn(t,e){return function(n,r){for(var i=n.length,o=[],s=0,a=t[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>r));)a=t[s=(s+1)%t.length];return o.reverse().join(e)}}function _n(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Ln=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Me(t){if(!(e=Ln.exec(t)))throw new Error("invalid format: "+t);var e;return new Pe({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Me.prototype=Pe.prototype;function Pe(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Pe.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Bn(t){e:for(var e=t.length,n=1,r=-1,i;n<e;++n)switch(t[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var ke;function $n(t,e){var n=Ce(t,e);if(!n)return ke=void 0,t.toPrecision(e);var r=n[0],i=n[1],o=i-(ke=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Ce(t,Math.max(0,e+o-1))[0]}function at(t,e){var n=Ce(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const ut={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Sn,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>at(t*100,e),r:at,s:$n,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function ct(t){return t}var ft=Array.prototype.map,lt=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Dn(t){var e=t.grouping===void 0||t.thousands===void 0?ct:Rn(ft.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?ct:_n(ft.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function u(l,g){l=Me(l);var w=l.fill,y=l.align,F=l.sign,_=l.symbol,R=l.zero,O=l.width,T=l.comma,E=l.precision,G=l.trim,k=l.type;k==="n"?(T=!0,k="g"):ut[k]||(E===void 0&&(E=12),G=!0,k="g"),(R||w==="0"&&y==="=")&&(R=!0,w="0",y="=");var I=(g&&g.prefix!==void 0?g.prefix:"")+(_==="$"?n:_==="#"&&/[boxX]/.test(k)?"0"+k.toLowerCase():""),ce=(_==="$"?r:/[%p]/.test(k)?s:"")+(g&&g.suffix!==void 0?g.suffix:""),fe=ut[k],le=/[defgprs%]/.test(k);E=E===void 0?6:/[gprs]/.test(k)?Math.max(1,Math.min(21,E)):Math.max(0,Math.min(20,E));function ee(p){var P=I,N=ce,H,te,Y;if(k==="c")N=fe(p)+N,p="";else{p=+p;var z=p<0||1/p<0;if(p=isNaN(p)?c:fe(Math.abs(p),E),G&&(p=Bn(p)),z&&+p==0&&F!=="+"&&(z=!1),P=(z?F==="("?F:a:F==="-"||F==="("?"":F)+P,N=(k==="s"&&!isNaN(p)&&ke!==void 0?lt[8+ke/3]:"")+N+(z&&F==="("?")":""),le){for(H=-1,te=p.length;++H<te;)if(Y=p.charCodeAt(H),48>Y||Y>57){N=(Y===46?i+p.slice(H+1):p.slice(H))+N,p=p.slice(0,H);break}}}T&&!R&&(p=e(p,1/0));var U=P.length+p.length+N.length,L=U<O?new Array(O-U+1).join(w):"";switch(T&&R&&(p=e(L+p,L.length?O-N.length:1/0),L=""),y){case"<":p=P+p+N+L;break;case"=":p=P+L+p+N;break;case"^":p=L.slice(0,U=L.length>>1)+P+p+N+L.slice(U);break;default:p=L+P+p+N;break}return o(p)}return ee.toString=function(){return l+""},ee}function f(l,g){var w=Math.max(-8,Math.min(8,Math.floor(K(g)/3)))*3,y=Math.pow(10,-w),F=u((l=Me(l),l.type="f",l),{suffix:lt[8+w/3]});return function(_){return F(y*_)}}return{format:u,formatPrefix:f}}var xe,wt,yt;Tn({thousands:",",grouping:[3],currency:["$",""]});function Tn(t){return xe=Dn(t),wt=xe.format,yt=xe.formatPrefix,xe}function In(t){return Math.max(0,-K(Math.abs(t)))}function Hn(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(K(e)/3)))*3-K(Math.abs(t)))}function jn(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,K(e)-K(t))+1}function On(t,e,n,r){var i=wn(t,e,n),o;switch(r=Me(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=Hn(i,s))&&(r.precision=o),yt(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=jn(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=In(i))&&(r.precision=o-(r.type==="%")*2);break}}return wt(r)}function Pn(t){var e=t.domain;return t.ticks=function(n){var r=e();return bn(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return On(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,s=r[i],a=r[o],c,u,f=10;for(a<s&&(u=s,s=a,a=u,u=i,i=o,o=u);f-- >0;){if(u=Te(s,a,n),u===c)return r[i]=s,r[o]=a,e(r);if(u>0)s=Math.floor(s/u)*u,a=Math.ceil(a/u)*u;else if(u<0)s=Math.ceil(s*u)/u,a=Math.floor(a*u)/u;else break;c=u}return t},t}function Ft(){var t=An();return t.copy=function(){return En(t,Ft())},yn.apply(t,arguments),Pn(t)}const Le=(t,e)=>{const n=t?.[e];return typeof n=="number"?n:0},ht=(t,e)=>{if(!t.length)return()=>e.minColor;const n=Math.min(...t),r=Math.max(...t);if(n===r)return()=>e.maxColor;const i=Ft().domain([n,r]).range([0,1]),o=$e(e.minColor,e.maxColor);return s=>o(i(s))},Gn=t=>t<=1.35?2:t<=2.1?1:0,qn=t=>new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(t),zn=({statisticsData:t,resetSignal:e,countryNumericToIsoMap:n={},countryNameToIsoMap:r={},primaryMetric:i="visits",colorScale:o=Ht})=>{const s=C.useRef(null),a=C.useRef(null),c=C.useRef(void 0),u=C.useRef({}),f=C.useRef(null),l=C.useRef(e),[g,w]=C.useState(0),[y,F]=C.useState(),[_,R]=C.useState(),[O,T]=C.useState(null),[E,G]=C.useState([]),[k,I]=C.useState([]),[ce,fe]=C.useState({width:900,height:760}),le=C.useMemo(()=>Object.values(t.countries).map(h=>Le(h,i)),[i,t.countries]),ee=C.useMemo(()=>y?Object.values(t.regions[y]??{}).map(h=>Le(h,i)):[],[y,i,t.regions]),p=C.useMemo(()=>ht(le,o),[le,o]),P=C.useMemo(()=>ht(ee,o),[ee,o]);C.useEffect(()=>{(async()=>{let d=[];try{d=(await(await fetch($t)).json()).features}catch{const m=await(await fetch(Dt)).json(),M=m.objects.countries,A=St(m,M);d=A.type==="FeatureCollection"?A.features:[A]}const b=d.map(x=>{const m=String(x.id??""),M=x.properties??{},A=String(M.name??M.NAME??M.name_en??M.ADMIN??"").trim()||`Country ${m}`,ve=A.toLowerCase(),he=String(M.iso_a2??M.ISO_A2??M.iso_a2_eh??"").trim().toUpperCase(),qe=n[m]??r[ve]??(he&&he!=="-99"?he:void 0)??(m.length===2?m.toUpperCase():m);return{...x,properties:{...M,__isoA2:qe,name:A||qe||`Country ${m}`}}});G(b)})()},[]),C.useEffect(()=>{if(!a.current)return;const h=new ResizeObserver(d=>{const b=d[0];b&&fe({width:Math.max(360,Math.floor(b.contentRect.width)),height:Math.max(520,Math.floor(b.contentRect.height))})});return h.observe(a.current),()=>h.disconnect()},[]),C.useEffect(()=>{if(!y){I([]);return}const h=u.current[y];if(h){I(h);return}(async()=>{if(!f.current){const M=await(await fetch(Tt)).json();f.current=M.features}const x=(f.current??[]).filter(m=>(m.properties??{}).iso_a2===y).map(m=>{const M=m.properties??{},A=String(M.name??"").trim();return{...m,properties:{...M,__countryCode:y,__regionName:A,name:A}}});u.current[y]=x,I(x)})()},[y]),C.useEffect(()=>{if(_&&g<2)return void w(2);y&&g<1&&w(1)},[y,_,g]),C.useEffect(()=>{const h=s.current?.controls?.();if(!h)return;h.autoRotate=!0,h.autoRotateSpeed=.45,h.enablePan=!1,h.enableZoom=!0;const d=s.current?.renderer?.();d&&d.setPixelRatio(Math.min(window.devicePixelRatio,1.5))},[]),C.useEffect(()=>{const h=s.current?.controls?.();h&&(h.autoRotate=!y&&g===0)},[y,g]),C.useEffect(()=>{if(e===l.current)return;l.current=e,w(0),F(void 0),R(void 0),T(null),I([]);const h=s.current?.controls?.();h&&(h.autoRotate=!0),s.current?.pointOfView({lat:20,lng:15,altitude:2.6},650)},[e]);const N=()=>{const h=s.current?.globeMaterial?.();h&&(h.map=null,h.color=new re("#f5f5f5"),h.emissive=new re("#ffffff"),h.emissiveIntensity=.35,h.specular=new re("#d4d4d8"),h.shininess=3,h.needsUpdate=!0)},H=(h,d,b)=>{s.current?.pointOfView({lat:h,lng:d,altitude:b},650)},te=()=>{const h=s.current?.controls?.();h&&(h.autoRotate=!1)},Y=h=>{if(typeof h!="object"||h===null||!("coordinates"in h))return[];const d=h.coordinates,b=[],x=m=>{if(Array.isArray(m)){if(m.length>=2&&typeof m[0]=="number"&&typeof m[1]=="number"){b.push([m[0],m[1]]);return}m.forEach(x)}};return x(d),b},z=h=>{const d=Y(h.geometry);if(!d.length)return;const b=d.reduce((x,[m,M])=>({minLat:Math.min(x.minLat,M),maxLat:Math.max(x.maxLat,M),minLng:Math.min(x.minLng,m),maxLng:Math.max(x.maxLng,m)}),{minLat:Number.POSITIVE_INFINITY,maxLat:Number.NEGATIVE_INFINITY,minLng:Number.POSITIVE_INFINITY,maxLng:Number.NEGATIVE_INFINITY});if(!(!Number.isFinite(b.minLat)||!Number.isFinite(b.minLng)))return b},U=h=>{const d=Math.max(.1,h.maxLat-h.minLat),b=Math.max(.1,h.maxLng-h.minLng),m=Math.max(d,b)/112;return Math.min(.9,Math.max(.14,m))},L=()=>{c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{const h=s.current?.pointOfView?.().altitude??2.4,d=Gn(h);w(d),d<=0&&R(void 0)},120)},Ct=h=>{const d=h.properties??{};if(g===0){const b=r[String(d.name??"").toLowerCase()],x=d.__isoA2??(typeof d.iso_a2=="string"?d.iso_a2.toUpperCase():void 0)??b;if(!x)return;te(),w(1),F(x),R(void 0);const m=z(h);if(m){H((m.minLat+m.maxLat)/2,(m.minLng+m.maxLng)/2,U(m));return}return}if(g>=1){const b=d.__regionName;if(!b)return;te(),w(2),R(b);const x=z(h);if(x){H((x.minLat+x.maxLat)/2,(x.minLng+x.maxLng)/2,Math.max(.2,U(x)*.52));return}}},Mt=g===0?E:k.length?[...E,...k]:E,Ge=(h,d)=>{if(d&&h)return t.regions[h]?.[d];if(h)return t.countries[h]},kt=h=>{if(!h)return"<div>No data</div>";const d=Object.entries(h).filter(([,b])=>typeof b=="number"&&Number.isFinite(b));return d.length?(d.sort(([b],[x])=>b===i?-1:x===i?1:b.localeCompare(x)),d.map(([b,x])=>`<div>${b}: ${qn(x)}</div>`).join("")):"<div>No data</div>"};return ze.jsx("div",{ref:a,style:{position:"relative",height:"100%",overflow:"hidden",background:"white"},children:ze.jsx(vt,{ref:s,globeImageUrl:It,backgroundColor:"#ffffff",polygonsData:Mt,polygonAltitude:.01,polygonsTransitionDuration:180,polygonCapColor:h=>{const d=h.properties??{},b=!!d.__regionName;if(g>0&&!b)return"rgba(148,163,184,0.027)";const x=g===0?d.__isoA2:d.__countryCode,m=d.__regionName,M=Ge(x,m),A=Le(M,i),ve=g===0?p(A):P(A);return O===h?"#60a5fa":ve},polygonSideColor:h=>{const d=h.properties??{};return g>0&&!d.__regionName?"rgba(148,163,184,0.027)":d.__regionName?"rgba(148,163,184,0.22)":"rgba(226,232,240,0.45)"},polygonStrokeColor:h=>{const d=h.properties??{};return g>0&&!d.__regionName?"rgba(100,116,139,0.067)":d.__regionName?"rgba(51,65,85,0.98)":"rgba(156,163,175,0.95)"},polygonLabel:h=>{const d=h.properties??{},b=g===0?d.__isoA2:d.__countryCode,x=d.__regionName,m=x??d.name??"Unknown",M=Ge(b,x),A=kt(M);return`<div style="padding:6px 8px; font-size:12px; background:#111827; color:#f9fafb; border-radius:6px;">
2
- <div style="font-weight:700;">${m}</div>
3
- ${A}
4
- </div>`},onPolygonHover:h=>{T(h??null)},onPolygonClick:h=>Ct(h),onZoom:L,onGlobeReady:()=>{N(),H(20,15,2.6)},onGlobeClick:()=>{const h=s.current?.controls?.();h&&(h.autoRotate=!1)},lineHoverPrecision:0,width:ce.width,height:ce.height,showAtmosphere:!1})})};exports.CoolGlobe=zn;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ie=require("react/jsx-runtime"),x=require("react"),hn=require("react-globe.gl"),be=require("three");function mn(e){return e}function gn(e){if(e==null)return mn;var n,t,r=e.scale[0],i=e.scale[1],o=e.translate[0],s=e.translate[1];return function(a,l){l||(n=t=0);var f=2,d=a.length,u=new Array(d);for(u[0]=(n+=a[0])*r+o,u[1]=(t+=a[1])*i+s;f<d;)u[f]=a[f],++f;return u}}function pn(e,n){for(var t,r=e.length,i=r-n;i<--r;)t=e[i],e[i++]=e[r],e[r]=t}function xn(e,n){return typeof n=="string"&&(n=e.objects[n]),n.type==="GeometryCollection"?{type:"FeatureCollection",features:n.geometries.map(function(t){return je(e,t)})}:je(e,n)}function je(e,n){var t=n.id,r=n.bbox,i=n.properties==null?{}:n.properties,o=bn(e,n);return t==null&&r==null?{type:"Feature",properties:i,geometry:o}:r==null?{type:"Feature",id:t,properties:i,geometry:o}:{type:"Feature",id:t,bbox:r,properties:i,geometry:o}}function bn(e,n){var t=gn(e.transform),r=e.arcs;function i(d,u){u.length&&u.pop();for(var m=r[d<0?~d:d],N=0,L=m.length;N<L;++N)u.push(t(m[N],N));d<0&&pn(u,L)}function o(d){return t(d)}function s(d){for(var u=[],m=0,N=d.length;m<N;++m)i(d[m],u);return u.length<2&&u.push(u[0]),u}function a(d){for(var u=s(d);u.length<4;)u.push(u[0]);return u}function l(d){return d.map(a)}function f(d){var u=d.type,m;switch(u){case"GeometryCollection":return{type:u,geometries:d.geometries.map(f)};case"Point":m=o(d.coordinates);break;case"MultiPoint":m=d.coordinates.map(o);break;case"LineString":m=s(d.arcs);break;case"MultiLineString":m=d.arcs.map(s);break;case"Polygon":m=l(d.arcs);break;case"MultiPolygon":m=d.arcs.map(l);break;default:return null}return{type:u,coordinates:m}}return f(n)}const yn="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_110m_admin_0_countries.geojson",wn="https://cdn.jsdelivr.net/npm/world-atlas@2/countries-110m.json",vn="https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_admin_1_states_provinces.geojson",Mn="data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='4' height='4'><rect width='4' height='4' fill='%23f5f5f5'/></svg>",Nn={minColor:"#f8fafc",maxColor:"#e5e7eb"};function ke(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function en(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function ee(){}var X=.7,ce=1/X,K="\\s*([+-]?\\d+)\\s*",W="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",P="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_n=/^#([0-9a-f]{3,8})$/,Rn=new RegExp(`^rgb\\(${K},${K},${K}\\)$`),$n=new RegExp(`^rgb\\(${P},${P},${P}\\)$`),Cn=new RegExp(`^rgba\\(${K},${K},${K},${W}\\)$`),kn=new RegExp(`^rgba\\(${P},${P},${P},${W}\\)$`),Ln=new RegExp(`^hsl\\(${W},${P},${P}\\)$`),An=new RegExp(`^hsla\\(${W},${P},${P},${W}\\)$`),Fe={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};ke(ee,Q,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Pe,formatHex:Pe,formatHex8:Sn,formatHsl:En,formatRgb:Oe,toString:Oe});function Pe(){return this.rgb().formatHex()}function Sn(){return this.rgb().formatHex8()}function En(){return nn(this).formatHsl()}function Oe(){return this.rgb().formatRgb()}function Q(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=_n.exec(e))?(t=n[1].length,n=parseInt(n[1],16),t===6?ze(n):t===3?new k(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):t===8?oe(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):t===4?oe(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=Rn.exec(e))?new k(n[1],n[2],n[3],1):(n=$n.exec(e))?new k(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=Cn.exec(e))?oe(n[1],n[2],n[3],n[4]):(n=kn.exec(e))?oe(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=Ln.exec(e))?Ge(n[1],n[2]/100,n[3]/100,1):(n=An.exec(e))?Ge(n[1],n[2]/100,n[3]/100,n[4]):Fe.hasOwnProperty(e)?ze(Fe[e]):e==="transparent"?new k(NaN,NaN,NaN,0):null}function ze(e){return new k(e>>16&255,e>>8&255,e&255,1)}function oe(e,n,t,r){return r<=0&&(e=n=t=NaN),new k(e,n,t,r)}function In(e){return e instanceof ee||(e=Q(e)),e?(e=e.rgb(),new k(e.r,e.g,e.b,e.opacity)):new k}function Ne(e,n,t,r){return arguments.length===1?In(e):new k(e,n,t,r??1)}function k(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}ke(k,Ne,en(ee,{brighter(e){return e=e==null?ce:Math.pow(ce,e),new k(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?X:Math.pow(X,e),new k(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new k(V(this.r),V(this.g),V(this.b),le(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:He,formatHex:He,formatHex8:jn,formatRgb:Te,toString:Te}));function He(){return`#${D(this.r)}${D(this.g)}${D(this.b)}`}function jn(){return`#${D(this.r)}${D(this.g)}${D(this.b)}${D((isNaN(this.opacity)?1:this.opacity)*255)}`}function Te(){const e=le(this.opacity);return`${e===1?"rgb(":"rgba("}${V(this.r)}, ${V(this.g)}, ${V(this.b)}${e===1?")":`, ${e})`}`}function le(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function V(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function D(e){return e=V(e),(e<16?"0":"")+e.toString(16)}function Ge(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new I(e,n,t,r)}function nn(e){if(e instanceof I)return new I(e.h,e.s,e.l,e.opacity);if(e instanceof ee||(e=Q(e)),!e)return new I;if(e instanceof I)return e;e=e.rgb();var n=e.r/255,t=e.g/255,r=e.b/255,i=Math.min(n,t,r),o=Math.max(n,t,r),s=NaN,a=o-i,l=(o+i)/2;return a?(n===o?s=(t-r)/a+(t<r)*6:t===o?s=(r-n)/a+2:s=(n-t)/a+4,a/=l<.5?o+i:2-o-i,s*=60):a=l>0&&l<1?0:s,new I(s,a,l,e.opacity)}function Fn(e,n,t,r){return arguments.length===1?nn(e):new I(e,n,t,r??1)}function I(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}ke(I,Fn,en(ee,{brighter(e){return e=e==null?ce:Math.pow(ce,e),new I(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?X:Math.pow(X,e),new I(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,i=2*t-r;return new k(ye(e>=240?e-240:e+120,i,r),ye(e,i,r),ye(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new I(Ue(this.h),ae(this.s),ae(this.l),le(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=le(this.opacity);return`${e===1?"hsl(":"hsla("}${Ue(this.h)}, ${ae(this.s)*100}%, ${ae(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Ue(e){return e=(e||0)%360,e<0?e+360:e}function ae(e){return Math.max(0,Math.min(1,e||0))}function ye(e,n,t){return(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)*255}const Le=e=>()=>e;function Pn(e,n){return function(t){return e+t*n}}function On(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}function zn(e){return(e=+e)==1?tn:function(n,t){return t-n?On(n,t,e):Le(isNaN(n)?t:n)}}function tn(e,n){var t=n-e;return t?Pn(e,t):Le(isNaN(e)?n:e)}const _e=(function e(n){var t=zn(n);function r(i,o){var s=t((i=Ne(i)).r,(o=Ne(o)).r),a=t(i.g,o.g),l=t(i.b,o.b),f=tn(i.opacity,o.opacity);return function(d){return i.r=s(d),i.g=a(d),i.b=l(d),i.opacity=f(d),i+""}}return r.gamma=e,r})(1);function Hn(e,n){n||(n=[]);var t=e?Math.min(n.length,e.length):0,r=n.slice(),i;return function(o){for(i=0;i<t;++i)r[i]=e[i]*(1-o)+n[i]*o;return r}}function Tn(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Gn(e,n){var t=n?n.length:0,r=e?Math.min(t,e.length):0,i=new Array(r),o=new Array(t),s;for(s=0;s<r;++s)i[s]=Ae(e[s],n[s]);for(;s<t;++s)o[s]=n[s];return function(a){for(s=0;s<r;++s)o[s]=i[s](a);return o}}function Un(e,n){var t=new Date;return e=+e,n=+n,function(r){return t.setTime(e*(1-r)+n*r),t}}function de(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}function qn(e,n){var t={},r={},i;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(i in n)i in e?t[i]=Ae(e[i],n[i]):r[i]=n[i];return function(o){for(i in t)r[i]=t[i](o);return r}}var Re=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,we=new RegExp(Re.source,"g");function Dn(e){return function(){return e}}function Vn(e){return function(n){return e(n)+""}}function Bn(e,n){var t=Re.lastIndex=we.lastIndex=0,r,i,o,s=-1,a=[],l=[];for(e=e+"",n=n+"";(r=Re.exec(e))&&(i=we.exec(n));)(o=i.index)>t&&(o=n.slice(t,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:de(r,i)})),t=we.lastIndex;return t<n.length&&(o=n.slice(t),a[s]?a[s]+=o:a[++s]=o),a.length<2?l[0]?Vn(l[0].x):Dn(n):(n=l.length,function(f){for(var d=0,u;d<n;++d)a[(u=l[d]).i]=u.x(f);return a.join("")})}function Ae(e,n){var t=typeof n,r;return n==null||t==="boolean"?Le(n):(t==="number"?de:t==="string"?(r=Q(n))?(n=r,_e):Bn:n instanceof Q?_e:n instanceof Date?Un:Tn(n)?Hn:Array.isArray(n)?Gn:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?qn:de)(e,n)}function Zn(e,n){return e=+e,n=+n,function(t){return Math.round(e*(1-t)+n*t)}}function fe(e,n){return e==null||n==null?NaN:e<n?-1:e>n?1:e>=n?0:NaN}function Jn(e,n){return e==null||n==null?NaN:n<e?-1:n>e?1:n>=e?0:NaN}function rn(e){let n,t,r;e.length!==2?(n=fe,t=(a,l)=>fe(e(a),l),r=(a,l)=>e(a)-l):(n=e===fe||e===Jn?e:Kn,t=e,r=e);function i(a,l,f=0,d=a.length){if(f<d){if(n(l,l)!==0)return d;do{const u=f+d>>>1;t(a[u],l)<0?f=u+1:d=u}while(f<d)}return f}function o(a,l,f=0,d=a.length){if(f<d){if(n(l,l)!==0)return d;do{const u=f+d>>>1;t(a[u],l)<=0?f=u+1:d=u}while(f<d)}return f}function s(a,l,f=0,d=a.length){const u=i(a,l,f,d-1);return u>f&&r(a[u-1],l)>-r(a[u],l)?u-1:u}return{left:i,center:s,right:o}}function Kn(){return 0}function Yn(e){return e===null?NaN:+e}const Xn=rn(fe),Wn=Xn.right;rn(Yn).center;const Qn=Math.sqrt(50),et=Math.sqrt(10),nt=Math.sqrt(2);function he(e,n,t){const r=(n-e)/Math.max(0,t),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=Qn?10:o>=et?5:o>=nt?2:1;let a,l,f;return i<0?(f=Math.pow(10,-i)/s,a=Math.round(e*f),l=Math.round(n*f),a/f<e&&++a,l/f>n&&--l,f=-f):(f=Math.pow(10,i)*s,a=Math.round(e/f),l=Math.round(n/f),a*f<e&&++a,l*f>n&&--l),l<a&&.5<=t&&t<2?he(e,n,t*2):[a,l,f]}function tt(e,n,t){if(n=+n,e=+e,t=+t,!(t>0))return[];if(e===n)return[e];const r=n<e,[i,o,s]=r?he(n,e,t):he(e,n,t);if(!(o>=i))return[];const a=o-i+1,l=new Array(a);if(r)if(s<0)for(let f=0;f<a;++f)l[f]=(o-f)/-s;else for(let f=0;f<a;++f)l[f]=(o-f)*s;else if(s<0)for(let f=0;f<a;++f)l[f]=(i+f)/-s;else for(let f=0;f<a;++f)l[f]=(i+f)*s;return l}function $e(e,n,t){return n=+n,e=+e,t=+t,he(e,n,t)[2]}function rt(e,n,t){n=+n,e=+e,t=+t;const r=n<e,i=r?$e(n,e,t):$e(e,n,t);return(r?-1:1)*(i<0?1/-i:i)}function it(e,n){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(n).domain(e);break}return this}function ot(e){return function(){return e}}function at(e){return+e}var qe=[0,1];function J(e){return e}function Ce(e,n){return(n-=e=+e)?function(t){return(t-e)/n}:ot(isNaN(n)?NaN:.5)}function st(e,n){var t;return e>n&&(t=e,e=n,n=t),function(r){return Math.max(e,Math.min(n,r))}}function ft(e,n,t){var r=e[0],i=e[1],o=n[0],s=n[1];return i<r?(r=Ce(i,r),o=t(s,o)):(r=Ce(r,i),o=t(o,s)),function(a){return o(r(a))}}function ut(e,n,t){var r=Math.min(e.length,n.length)-1,i=new Array(r),o=new Array(r),s=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),n=n.slice().reverse());++s<r;)i[s]=Ce(e[s],e[s+1]),o[s]=t(n[s],n[s+1]);return function(a){var l=Wn(e,a,1,r)-1;return o[l](i[l](a))}}function ct(e,n){return n.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function lt(){var e=qe,n=qe,t=Ae,r,i,o,s=J,a,l,f;function d(){var m=Math.min(e.length,n.length);return s!==J&&(s=st(e[0],e[m-1])),a=m>2?ut:ft,l=f=null,u}function u(m){return m==null||isNaN(m=+m)?o:(l||(l=a(e.map(r),n,t)))(r(s(m)))}return u.invert=function(m){return s(i((f||(f=a(n,e.map(r),de)))(m)))},u.domain=function(m){return arguments.length?(e=Array.from(m,at),d()):e.slice()},u.range=function(m){return arguments.length?(n=Array.from(m),d()):n.slice()},u.rangeRound=function(m){return n=Array.from(m),t=Zn,d()},u.clamp=function(m){return arguments.length?(s=m?!0:J,d()):s!==J},u.interpolate=function(m){return arguments.length?(t=m,d()):t},u.unknown=function(m){return arguments.length?(o=m,u):o},function(m,N){return r=m,i=N,d()}}function dt(){return lt()(J,J)}function ht(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function me(e,n){if(!isFinite(e)||e===0)return null;var t=(e=n?e.toExponential(n-1):e.toExponential()).indexOf("e"),r=e.slice(0,t);return[r.length>1?r[0]+r.slice(2):r,+e.slice(t+1)]}function Y(e){return e=me(Math.abs(e)),e?e[1]:NaN}function mt(e,n){return function(t,r){for(var i=t.length,o=[],s=0,a=e[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),o.push(t.substring(i-=a,i+a)),!((l+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(n)}}function gt(e){return function(n){return n.replace(/[0-9]/g,function(t){return e[+t]})}}var pt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ge(e){if(!(n=pt.exec(e)))throw new Error("invalid format: "+e);var n;return new Se({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}ge.prototype=Se.prototype;function Se(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Se.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function xt(e){e:for(var n=e.length,t=1,r=-1,i;t<n;++t)switch(e[t]){case".":r=i=t;break;case"0":r===0&&(r=t),i=t;break;default:if(!+e[t])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var pe;function bt(e,n){var t=me(e,n);if(!t)return pe=void 0,e.toPrecision(n);var r=t[0],i=t[1],o=i-(pe=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+me(e,Math.max(0,n+o-1))[0]}function De(e,n){var t=me(e,n);if(!t)return e+"";var r=t[0],i=t[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const Ve={"%":(e,n)=>(e*100).toFixed(n),b:e=>Math.round(e).toString(2),c:e=>e+"",d:ht,e:(e,n)=>e.toExponential(n),f:(e,n)=>e.toFixed(n),g:(e,n)=>e.toPrecision(n),o:e=>Math.round(e).toString(8),p:(e,n)=>De(e*100,n),r:De,s:bt,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Be(e){return e}var Ze=Array.prototype.map,Je=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function yt(e){var n=e.grouping===void 0||e.thousands===void 0?Be:mt(Ze.call(e.grouping,Number),e.thousands+""),t=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?Be:gt(Ze.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"−":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function f(u,m){u=ge(u);var N=u.fill,L=u.align,A=u.sign,v=u.symbol,S=u.zero,_=u.width,B=u.comma,j=u.precision,G=u.trim,C=u.type;C==="n"?(B=!0,C="g"):Ve[C]||(j===void 0&&(j=12),G=!0,C="g"),(S||N==="0"&&L==="=")&&(S=!0,N="0",L="=");var ne=(m&&m.prefix!==void 0?m.prefix:"")+(v==="$"?t:v==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():""),F=(v==="$"?r:/[%p]/.test(C)?s:"")+(m&&m.suffix!==void 0?m.suffix:""),te=Ve[C],re=/[defgprs%]/.test(C);j=j===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function U(g){var O=ne,R=F,z,ie,Z;if(C==="c")R=te(g)+R,g="";else{g=+g;var E=g<0||1/g<0;if(g=isNaN(g)?l:te(Math.abs(g),j),G&&(g=xt(g)),E&&+g==0&&A!=="+"&&(E=!1),O=(E?A==="("?A:a:A==="-"||A==="("?"":A)+O,R=(C==="s"&&!isNaN(g)&&pe!==void 0?Je[8+pe/3]:"")+R+(E&&A==="("?")":""),re){for(z=-1,ie=g.length;++z<ie;)if(Z=g.charCodeAt(z),48>Z||Z>57){R=(Z===46?i+g.slice(z+1):g.slice(z))+R,g=g.slice(0,z);break}}}B&&!S&&(g=n(g,1/0));var H=O.length+g.length+R.length,$=H<_?new Array(_-H+1).join(N):"";switch(B&&S&&(g=n($+g,$.length?_-R.length:1/0),$=""),L){case"<":g=O+g+R+$;break;case"=":g=O+$+g+R;break;case"^":g=$.slice(0,H=$.length>>1)+O+g+R+$.slice(H);break;default:g=$+O+g+R;break}return o(g)}return U.toString=function(){return u+""},U}function d(u,m){var N=Math.max(-8,Math.min(8,Math.floor(Y(m)/3)))*3,L=Math.pow(10,-N),A=f((u=ge(u),u.type="f",u),{suffix:Je[8+N/3]});return function(v){return A(L*v)}}return{format:f,formatPrefix:d}}var se,on,an;wt({thousands:",",grouping:[3],currency:["$",""]});function wt(e){return se=yt(e),on=se.format,an=se.formatPrefix,se}function vt(e){return Math.max(0,-Y(Math.abs(e)))}function Mt(e,n){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Y(n)/3)))*3-Y(Math.abs(e)))}function Nt(e,n){return e=Math.abs(e),n=Math.abs(n)-e,Math.max(0,Y(n)-Y(e))+1}function _t(e,n,t,r){var i=rt(e,n,t),o;switch(r=ge(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(n));return r.precision==null&&!isNaN(o=Mt(i,s))&&(r.precision=o),an(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=Nt(i,Math.max(Math.abs(e),Math.abs(n))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=vt(i))&&(r.precision=o-(r.type==="%")*2);break}}return on(r)}function Rt(e){var n=e.domain;return e.ticks=function(t){var r=n();return tt(r[0],r[r.length-1],t??10)},e.tickFormat=function(t,r){var i=n();return _t(i[0],i[i.length-1],t??10,r)},e.nice=function(t){t==null&&(t=10);var r=n(),i=0,o=r.length-1,s=r[i],a=r[o],l,f,d=10;for(a<s&&(f=s,s=a,a=f,f=i,i=o,o=f);d-- >0;){if(f=$e(s,a,t),f===l)return r[i]=s,r[o]=a,n(r);if(f>0)s=Math.floor(s/f)*f,a=Math.ceil(a/f)*f;else if(f<0)s=Math.ceil(s*f)/f,a=Math.floor(a*f)/f;else break;l=f}return e},e}function sn(){var e=dt();return e.copy=function(){return ct(e,sn())},it.apply(e,arguments),Rt(e)}const ue=e=>e.trim().toUpperCase(),Ke=(e,n,t={})=>{const r=ue(n);return e.find(i=>{const o=i.properties??{};if((o.__isoA2??(typeof o.iso_a2=="string"?o.iso_a2.toUpperCase():void 0))===r)return!0;const a=String(o.name??"").toLowerCase();return t[a]===r})},$t=e=>{if(typeof e!="object"||e===null||!("coordinates"in e))return[];const n=e.coordinates,t=[],r=i=>{if(Array.isArray(i)){if(i.length>=2&&typeof i[0]=="number"&&typeof i[1]=="number"){t.push([i[0],i[1]]);return}i.forEach(r)}};return r(n),t},Ye=e=>{const n=$t(e.geometry);if(!n.length)return;const t=n.reduce((r,[i,o])=>({minLat:Math.min(r.minLat,o),maxLat:Math.max(r.maxLat,o),minLng:Math.min(r.minLng,i),maxLng:Math.max(r.maxLng,i)}),{minLat:Number.POSITIVE_INFINITY,maxLat:Number.NEGATIVE_INFINITY,minLng:Number.POSITIVE_INFINITY,maxLng:Number.NEGATIVE_INFINITY});if(!(!Number.isFinite(t.minLat)||!Number.isFinite(t.minLng)))return t},Xe=e=>{const n=Math.max(.1,e.maxLat-e.minLat),t=Math.max(.1,e.maxLng-e.minLng),i=Math.max(n,t)/112;return Math.min(.9,Math.max(.14,i))},ve=(e,n)=>{const t=e?.[n];return typeof t=="number"?t:0},We=(e,n)=>{if(!e.length)return()=>n.minColor;const t=Math.min(...e),r=Math.max(...e);if(t===r)return()=>n.maxColor;const i=sn().domain([t,r]).range([0,1]),o=_e(n.minColor,n.maxColor);return s=>o(i(s))},Ct=e=>e<=1.35?2:e<=2.1?1:0,kt=e=>new Intl.NumberFormat("en-US",{maximumFractionDigits:0}).format(e),Me=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),Lt=(e,n)=>{let t=e.trim();if(!t)return t;const r=n?.trim().toUpperCase();return r&&/^[A-Z]{2}$/.test(r)&&(t=t.replace(new RegExp(`\\s*\\(${r}\\)`,"gi"),"").replace(new RegExp(`\\s*\\[${r}\\]`,"gi"),"").replace(new RegExp(`\\s*[-–—]\\s*${r}\\s*$`,"i"),"").replace(new RegExp(`\\s+${r}\\s*$`,"i"),"")),t.trim()||e.trim()},At=e=>e.replace(/_/g," ").replace(/\b\w/g,t=>t.toUpperCase()),St=new Set(["countrycode","country_code","iso_a2","iso","adm0_a3","iso_3166_1"]),Et=e=>St.has(e.toLowerCase()),It=(e,n)=>e.toLowerCase()==="revenue"?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:"compact",maximumFractionDigits:1}).format(n):kt(n),Qe="cool-globe-float-tooltip-override",jt=()=>{if(typeof document>"u"||document.getElementById(Qe))return;const e=document.createElement("style");e.id=Qe,e.textContent=`
2
+ .cool-globe-host .float-tooltip-kap {
3
+ background: transparent !important;
4
+ background-color: transparent !important;
5
+ padding: 0 !important;
6
+ border-radius: 0 !important;
7
+ box-shadow: none !important;
8
+ max-width: none !important;
9
+ font-size: inherit !important;
10
+ font-family: inherit !important;
11
+ color: transparent !important;
12
+ }
13
+ `,document.head.appendChild(e)},Ft=({statisticsData:e,resetSignal:n,preselectedCountry:t,countryNumericToIsoMap:r={},countryNameToIsoMap:i={},primaryMetric:o="visits",colorScale:s=Nn})=>{const a=x.useRef(null),l=x.useRef(null),f=x.useRef(void 0),d=x.useRef({}),u=x.useRef(null),m=x.useRef(n),N=x.useRef(void 0),[L,A]=x.useState(!1),[v,S]=x.useState(0),[_,B]=x.useState(),[j,G]=x.useState(),[C,ne]=x.useState(null),[F,te]=x.useState([]),[re,U]=x.useState([]),[g,O]=x.useState({width:900,height:760});x.useEffect(()=>{jt()},[]);const R=x.useMemo(()=>Object.values(e.countries).map(c=>ve(c,o)),[o,e.countries]),z=x.useMemo(()=>_?Object.values(e.regions[_]??{}).map(c=>ve(c,o)):[],[_,o,e.regions]),ie=x.useMemo(()=>We(R,s),[R,s]),Z=x.useMemo(()=>We(z,s),[z,s]);x.useEffect(()=>{(async()=>{let h=[];try{h=(await(await fetch(yn)).json()).features}catch{const y=await(await fetch(wn)).json(),p=y.objects.countries,M=xn(y,p);h=M.type==="FeatureCollection"?M.features:[M]}const w=h.map(b=>{const y=String(b.id??""),p=b.properties??{},M=String(p.name??p.NAME??p.name_en??p.ADMIN??"").trim()||`Country ${y}`,q=M.toLowerCase(),T=String(p.iso_a2??p.ISO_A2??p.iso_a2_eh??"").trim().toUpperCase(),xe=r[y]??i[q]??(T&&T!=="-99"?T:void 0)??(y.length===2?y.toUpperCase():y);return{...b,properties:{...p,__isoA2:xe,name:M||xe||`Country ${y}`}}});te(w)})()},[]),x.useEffect(()=>{if(!l.current)return;const c=new ResizeObserver(h=>{const w=h[0];w&&O({width:Math.max(360,Math.floor(w.contentRect.width)),height:Math.max(520,Math.floor(w.contentRect.height))})});return c.observe(l.current),()=>c.disconnect()},[]),x.useEffect(()=>{if(!_){U([]);return}const c=d.current[_];if(c){U(c);return}(async()=>{if(!u.current){const p=await(await fetch(vn)).json();u.current=p.features}const b=(u.current??[]).filter(y=>(y.properties??{}).iso_a2===_).map(y=>{const p=y.properties??{},M=String(p.name??"").trim();return{...y,properties:{...p,__countryCode:_,__regionName:M,name:M}}});d.current[_]=b,U(b)})()},[_]),x.useEffect(()=>{if(j&&v<2)return void S(2);_&&v<1&&S(1)},[_,j,v]),x.useEffect(()=>{const c=a.current?.controls?.();if(!c)return;c.autoRotate=!0,c.autoRotateSpeed=.45,c.enablePan=!1,c.enableZoom=!0;const h=a.current?.renderer?.();h&&h.setPixelRatio(Math.min(window.devicePixelRatio,1.5))},[]),x.useEffect(()=>{const c=a.current?.controls?.();c&&(c.autoRotate=!_&&v===0)},[_,v]);const E=x.useCallback((c,h,w)=>{a.current?.pointOfView({lat:c,lng:h,altitude:w},650)},[]),H=x.useCallback(()=>{const c=a.current?.controls?.();c&&(c.autoRotate=!1)},[]),$=x.useCallback((c,h,w)=>{const b=ue(c);if(!b||(H(),S(1),B(b),G(void 0),w?.focusCamera===!1))return;const y=h??Ke(F,b,i),p=y?Ye(y):void 0;p&&E((p.minLat+p.maxLat)/2,(p.minLng+p.maxLng)/2,Xe(p))},[F,i,E,H]);x.useEffect(()=>{if(n===m.current)return;m.current=n,G(void 0),ne(null),N.current=void 0;const c=t?.trim()?ue(t):void 0;if(c){$(c);return}S(0),B(void 0),U([]);const h=a.current?.controls?.();h&&(h.autoRotate=!0),E(20,15,2.6)},[E,t,n,$]),x.useEffect(()=>{const c=t?.trim()?ue(t):void 0;if(!c||!L||!F.length)return;const h=`${c}:${String(n??"")}`;if(N.current===h)return;const w=Ke(F,c,i);$(c,w),N.current=h},[F,i,L,t,n,$]);const fn=()=>{const c=a.current?.globeMaterial?.();c&&(c.map=null,c.color=new be.Color("#f5f5f5"),c.emissive=new be.Color("#ffffff"),c.emissiveIntensity=.35,c.specular=new be.Color("#d4d4d8"),c.shininess=3,c.needsUpdate=!0)},un=()=>{f.current&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>{const c=a.current?.pointOfView?.().altitude??2.4,h=Ct(c);S(h),h<=0&&G(void 0)},120)},cn=c=>{const h=c.properties??{};if(v===0){const w=i[String(h.name??"").toLowerCase()],b=h.__isoA2??(typeof h.iso_a2=="string"?h.iso_a2.toUpperCase():void 0)??w;if(!b)return;$(b,c);return}if(v>=1){const w=h.__regionName;if(!w)return;H(),S(2),G(w);const b=Ye(c);if(b){E((b.minLat+b.maxLat)/2,(b.minLng+b.maxLng)/2,Math.max(.2,Xe(b)*.52));return}}},ln=v===0?F:re.length?[...F,...re]:F,Ee=(c,h)=>{if(h&&c)return e.regions[c]?.[h];if(c)return e.countries[c]},dn=c=>{if(!c)return'<div style="color:#697386;font-weight:500;font-size:15px;">No data available</div>';const h=Object.entries(c).filter(([p,M])=>!Et(p)&&typeof M=="number"&&Number.isFinite(M));if(!h.length)return'<div style="color:#697386;font-weight:500;font-size:15px;">No data available</div>';h.sort(([p],[M])=>p===o?-1:M===o?1:p.localeCompare(M));const w="display:flex;justify-content:space-between;align-items:center;gap:24px;padding:6px 0;",b="font-weight:500;color:#697386;font-size:15px;",y="font-weight:600;color:#1A1F36;font-size:15px;font-variant-numeric:tabular-nums;white-space:nowrap;";return h.map(([p,M])=>{const q=Me(At(p)),T=Me(It(p,M));return`<div style="${w}"><span style="${b}">${q}</span><span style="${y}">${T}</span></div>`}).join("")};return Ie.jsx("div",{ref:l,className:"cool-globe-host",style:{position:"relative",height:"100%",overflow:"hidden",background:"white"},children:Ie.jsx(hn,{ref:a,globeImageUrl:Mn,backgroundColor:"#ffffff",polygonsData:ln,polygonAltitude:.01,polygonsTransitionDuration:180,polygonCapColor:c=>{const h=c.properties??{},w=!!h.__regionName;if(v>0&&!w)return"rgba(148,163,184,0.027)";const b=v===0?h.__isoA2:h.__countryCode,y=h.__regionName,p=Ee(b,y),M=ve(p,o),q=v===0?ie(M):Z(M);return C===c?"#60a5fa":q},polygonSideColor:c=>{const h=c.properties??{};return v>0&&!h.__regionName?"rgba(148,163,184,0.027)":h.__regionName?"rgba(148,163,184,0.22)":"rgba(226,232,240,0.45)"},polygonStrokeColor:c=>{const h=c.properties??{};return v>0&&!h.__regionName?"rgba(100,116,139,0.067)":h.__regionName?"rgba(51,65,85,0.98)":"rgba(156,163,175,0.95)"},polygonLabel:c=>{const h=c.properties??{};if(v>0&&!h.__regionName)return"";const w=v===0?h.__isoA2:h.__countryCode,b=h.__regionName,y=b??h.name??"Unknown",p=v===0?h.__isoA2:h.__countryCode??h.__isoA2,M=Lt(String(y),p),q=Ee(w,b),T=dn(q);return`<div style="font-family:system-ui,-apple-system,'Segoe UI',Roboto,Inter,sans-serif;min-width:272px;max-width:320px;padding:20px;background:#ffffff;color:#1A1F36;border-radius:14px;box-shadow:0 8px 24px rgba(15,23,42,0.12);">
14
+ <div style="font-size:17px;font-weight:600;color:#1A1F36;line-height:1.25;margin-bottom:4px;">${Me(M)}</div>
15
+ <div style="margin-top:8px;">${T}</div>
16
+ </div>`},onPolygonHover:c=>{ne(c??null)},onPolygonClick:c=>cn(c),onZoom:un,onGlobeReady:()=>{fn(),A(!0),t?.trim()||E(20,15,2.6)},onGlobeClick:()=>{const c=a.current?.controls?.();c&&(c.autoRotate=!1)},lineHoverPrecision:0,width:g.width,height:g.height,showAtmosphere:!1})})};exports.CoolGlobe=Ft;